SAP Function Modules

QC01_BATCH_SPECS_WITH_OBJECT SAP Function module - Read batch specification with object key







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

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


Pattern for FM QC01_BATCH_SPECS_WITH_OBJECT - QC01 BATCH SPECS WITH OBJECT





CALL FUNCTION 'QC01_BATCH_SPECS_WITH_OBJECT' "Read batch specification with object key
  EXPORTING
    i_batch =                   " vbdpl-charg   Batch
*   i_plant =                   " vbdpl-werks   Plant
    i_material =                " mara-matnr    Material number
*   i_cuobj_ch =                " inob-cuobj    Batch object number
*   i_object =                  " kssk-objek    Classified Object
*   i_obtab =                   " tclt-obtab    Classified object (table)
*   i_language = SY-LANGU       " sy-langu      Language for short text
*   i_date = SY-DATUM           " sy-datum      Selection date
*   i_assigned_values =         " qm00-qkz      Indicator: Read assigned values
*   i_allowed_values = 'X'      " qm00-qkz      Indicator: Read permitted values
  IMPORTING
    e_class =                   " klah-class    Name of batch class
    e_class_type =              " klah-klart    Class type of batch class
* TABLES
*   t_sp_val_tab =              " api_vali      Table of batch values
*   t_sp_char_tab =             " api_char      Table of all characteristics of batch
*   t_sp_att_tab =              " api_ch_att    Table of characteristic attributes
  EXCEPTIONS
    NO_CLASS = 1                "               No batch class assigned
    INTERNAL_ERROR = 2          "               Internal error during batch classification
    NO_SPECIFICATIONS = 3       "               No specifications found
    NO_CHARACTERISTICS = 4      "               No characteristics found
    .  "  QC01_BATCH_SPECS_WITH_OBJECT

ABAP code example for Function Module QC01_BATCH_SPECS_WITH_OBJECT





The ABAP code below is a full code listing to execute function module QC01_BATCH_SPECS_WITH_OBJECT 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:
ld_e_class  TYPE KLAH-CLASS ,
ld_e_class_type  TYPE KLAH-KLART ,
it_t_sp_val_tab  TYPE STANDARD TABLE OF API_VALI,"TABLES PARAM
wa_t_sp_val_tab  LIKE LINE OF it_t_sp_val_tab ,
it_t_sp_char_tab  TYPE STANDARD TABLE OF API_CHAR,"TABLES PARAM
wa_t_sp_char_tab  LIKE LINE OF it_t_sp_char_tab ,
it_t_sp_att_tab  TYPE STANDARD TABLE OF API_CH_ATT,"TABLES PARAM
wa_t_sp_att_tab  LIKE LINE OF it_t_sp_att_tab .


DATA(ld_i_batch) = some text here

DATA(ld_i_plant) = some text here

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


SELECT single CUOBJ
FROM INOB
INTO @DATA(ld_i_cuobj_ch).


SELECT single OBJEK
FROM KSSK
INTO @DATA(ld_i_object).


SELECT single OBTAB
FROM TCLT
INTO @DATA(ld_i_obtab).

DATA(ld_i_language) = 'Check type of data required'.
DATA(ld_i_date) = '20210129'.

DATA(ld_i_assigned_values) = some text here

DATA(ld_i_allowed_values) = some text here

"populate fields of struture and append to itab
append wa_t_sp_val_tab to it_t_sp_val_tab.

"populate fields of struture and append to itab
append wa_t_sp_char_tab to it_t_sp_char_tab.

"populate fields of struture and append to itab
append wa_t_sp_att_tab to it_t_sp_att_tab. . CALL FUNCTION 'QC01_BATCH_SPECS_WITH_OBJECT' EXPORTING i_batch = ld_i_batch * i_plant = ld_i_plant i_material = ld_i_material * i_cuobj_ch = ld_i_cuobj_ch * i_object = ld_i_object * i_obtab = ld_i_obtab * i_language = ld_i_language * i_date = ld_i_date * i_assigned_values = ld_i_assigned_values * i_allowed_values = ld_i_allowed_values IMPORTING e_class = ld_e_class e_class_type = ld_e_class_type * TABLES * t_sp_val_tab = it_t_sp_val_tab * t_sp_char_tab = it_t_sp_char_tab * t_sp_att_tab = it_t_sp_att_tab EXCEPTIONS NO_CLASS = 1 INTERNAL_ERROR = 2 NO_SPECIFICATIONS = 3 NO_CHARACTERISTICS = 4 . " QC01_BATCH_SPECS_WITH_OBJECT
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_e_class  TYPE KLAH-CLASS ,
ld_i_batch  TYPE VBDPL-CHARG ,
it_t_sp_val_tab  TYPE STANDARD TABLE OF API_VALI ,
wa_t_sp_val_tab  LIKE LINE OF it_t_sp_val_tab,
ld_e_class_type  TYPE KLAH-KLART ,
ld_i_plant  TYPE VBDPL-WERKS ,
it_t_sp_char_tab  TYPE STANDARD TABLE OF API_CHAR ,
wa_t_sp_char_tab  LIKE LINE OF it_t_sp_char_tab,
ld_i_material  TYPE MARA-MATNR ,
it_t_sp_att_tab  TYPE STANDARD TABLE OF API_CH_ATT ,
wa_t_sp_att_tab  LIKE LINE OF it_t_sp_att_tab,
ld_i_cuobj_ch  TYPE INOB-CUOBJ ,
ld_i_object  TYPE KSSK-OBJEK ,
ld_i_obtab  TYPE TCLT-OBTAB ,
ld_i_language  TYPE SY-LANGU ,
ld_i_date  TYPE SY-DATUM ,
ld_i_assigned_values  TYPE QM00-QKZ ,
ld_i_allowed_values  TYPE QM00-QKZ .


ld_i_batch = some text here

"populate fields of struture and append to itab
append wa_t_sp_val_tab to it_t_sp_val_tab.

ld_i_plant = some text here

"populate fields of struture and append to itab
append wa_t_sp_char_tab to it_t_sp_char_tab.

SELECT single MATNR
FROM MARA
INTO ld_i_material.


"populate fields of struture and append to itab
append wa_t_sp_att_tab to it_t_sp_att_tab.

SELECT single CUOBJ
FROM INOB
INTO ld_i_cuobj_ch.


SELECT single OBJEK
FROM KSSK
INTO ld_i_object.


SELECT single OBTAB
FROM TCLT
INTO ld_i_obtab.

ld_i_language = 'Check type of data required'.
ld_i_date = '20210129'.

ld_i_assigned_values = some text here

ld_i_allowed_values = 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 QC01_BATCH_SPECS_WITH_OBJECT or its description.