SAP Function Modules

CUSL_BATCHES_SELECTION_EXECUTE SAP Function module







CUSL_BATCHES_SELECTION_EXECUTE 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 CUSL_BATCHES_SELECTION_EXECUTE into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM CUSL_BATCHES_SELECTION_EXECUTE - CUSL BATCHES SELECTION EXECUTE





CALL FUNCTION 'CUSL_BATCHES_SELECTION_EXECUTE' "
  EXPORTING
    material =                  " mara-matnr
*   plant =                     " marc-werks
    date =                      " sy-datum
*   no_initial_values = 'X'     " xfeld
  TABLES
    match =                     " cusl_03
*   it_selection =              " comw
  EXCEPTIONS
    NO_ENTRY_FOUND = 1          "
    .  "  CUSL_BATCHES_SELECTION_EXECUTE

ABAP code example for Function Module CUSL_BATCHES_SELECTION_EXECUTE





The ABAP code below is a full code listing to execute function module CUSL_BATCHES_SELECTION_EXECUTE 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_match  TYPE STANDARD TABLE OF CUSL_03,"TABLES PARAM
wa_match  LIKE LINE OF it_match ,
it_it_selection  TYPE STANDARD TABLE OF COMW,"TABLES PARAM
wa_it_selection  LIKE LINE OF it_it_selection .


SELECT single MATNR
FROM MARA
INTO @DATA(ld_material).


SELECT single WERKS
FROM MARC
INTO @DATA(ld_plant).

DATA(ld_date) = '20210129'.
DATA(ld_no_initial_values) = '20210129'.

"populate fields of struture and append to itab
append wa_match to it_match.

"populate fields of struture and append to itab
append wa_it_selection to it_it_selection. . CALL FUNCTION 'CUSL_BATCHES_SELECTION_EXECUTE' EXPORTING material = ld_material * plant = ld_plant date = ld_date * no_initial_values = ld_no_initial_values TABLES match = it_match * it_selection = it_it_selection EXCEPTIONS NO_ENTRY_FOUND = 1 . " CUSL_BATCHES_SELECTION_EXECUTE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "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_material  TYPE MARA-MATNR ,
it_match  TYPE STANDARD TABLE OF CUSL_03 ,
wa_match  LIKE LINE OF it_match,
ld_plant  TYPE MARC-WERKS ,
it_it_selection  TYPE STANDARD TABLE OF COMW ,
wa_it_selection  LIKE LINE OF it_it_selection,
ld_date  TYPE SY-DATUM ,
ld_no_initial_values  TYPE XFELD .


SELECT single MATNR
FROM MARA
INTO ld_material.


"populate fields of struture and append to itab
append wa_match to it_match.

SELECT single WERKS
FROM MARC
INTO ld_plant.


"populate fields of struture and append to itab
append wa_it_selection to it_it_selection.
ld_date = '20210129'.
ld_no_initial_values = '20210129'.

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 CUSL_BATCHES_SELECTION_EXECUTE or its description.