SAP Function Modules

CS_ALT_SELECT_DOC SAP Function module







CS_ALT_SELECT_DOC is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name CS_ALT_SELECT_DOC into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: CSS3
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM CS_ALT_SELECT_DOC - CS ALT SELECT DOC





CALL FUNCTION 'CS_ALT_SELECT_DOC' "
  EXPORTING
*   datuv = 00000000            " stkob-datuv   Valid On
    docar =                     " dostb-dokar   Document type
    docnr =                     " dostb-doknr   Document number
    doctl =                     " dostb-doktl   Document part
    docvr =                     " dostb-dokvr   Document version
  TABLES
    dostb_wa =                  " cs01_dostb_tab  Work area (int. table) for DOSTB
    stkob_wa =                  " cs01_stkob_tab  Work area (int. table) for STKOB
    stzub_wa =                  " cs01_stzub_tab  Work area (int. table) for STZUB
  EXCEPTIONS
    BOM_NOT_ACTIVE = 1          "               BOM not active (status)
    BOM_NOT_FOUND = 2           "               (Specific) BOM not found
    NO_ALT_FOUND = 3            "               No (valid) alternative found
    NO_BOM_FOUND = 4            "               No BOMs found
    .  "  CS_ALT_SELECT_DOC

ABAP code example for Function Module CS_ALT_SELECT_DOC





The ABAP code below is a full code listing to execute function module CS_ALT_SELECT_DOC including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
it_dostb_wa  TYPE STANDARD TABLE OF CS01_DOSTB_TAB,"TABLES PARAM
wa_dostb_wa  LIKE LINE OF it_dostb_wa ,
it_stkob_wa  TYPE STANDARD TABLE OF CS01_STKOB_TAB,"TABLES PARAM
wa_stkob_wa  LIKE LINE OF it_stkob_wa ,
it_stzub_wa  TYPE STANDARD TABLE OF CS01_STZUB_TAB,"TABLES PARAM
wa_stzub_wa  LIKE LINE OF it_stzub_wa .


DATA(ld_datuv) = 20210129

DATA(ld_docar) = some text here

DATA(ld_docnr) = some text here

DATA(ld_doctl) = some text here

DATA(ld_docvr) = some text here

"populate fields of struture and append to itab
append wa_dostb_wa to it_dostb_wa.

"populate fields of struture and append to itab
append wa_stkob_wa to it_stkob_wa.

"populate fields of struture and append to itab
append wa_stzub_wa to it_stzub_wa. . CALL FUNCTION 'CS_ALT_SELECT_DOC' EXPORTING * datuv = ld_datuv docar = ld_docar docnr = ld_docnr doctl = ld_doctl docvr = ld_docvr TABLES dostb_wa = it_dostb_wa stkob_wa = it_stkob_wa stzub_wa = it_stzub_wa EXCEPTIONS BOM_NOT_ACTIVE = 1 BOM_NOT_FOUND = 2 NO_ALT_FOUND = 3 NO_BOM_FOUND = 4 . " CS_ALT_SELECT_DOC
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_datuv  TYPE STKOB-DATUV ,
it_dostb_wa  TYPE STANDARD TABLE OF CS01_DOSTB_TAB ,
wa_dostb_wa  LIKE LINE OF it_dostb_wa,
ld_docar  TYPE DOSTB-DOKAR ,
it_stkob_wa  TYPE STANDARD TABLE OF CS01_STKOB_TAB ,
wa_stkob_wa  LIKE LINE OF it_stkob_wa,
ld_docnr  TYPE DOSTB-DOKNR ,
it_stzub_wa  TYPE STANDARD TABLE OF CS01_STZUB_TAB ,
wa_stzub_wa  LIKE LINE OF it_stzub_wa,
ld_doctl  TYPE DOSTB-DOKTL ,
ld_docvr  TYPE DOSTB-DOKVR .


ld_datuv = 20210129

"populate fields of struture and append to itab
append wa_dostb_wa to it_dostb_wa.

ld_docar = some text here

"populate fields of struture and append to itab
append wa_stkob_wa to it_stkob_wa.

ld_docnr = some text here

"populate fields of struture and append to itab
append wa_stzub_wa to it_stzub_wa.

ld_doctl = some text here

ld_docvr = some text here

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name CS_ALT_SELECT_DOC or its description.