The goal is to call Transaction with parameters and skip first screen.
Simple way
Example to call the Prod Order display transaction :
SET PARAMETER ID 'ANR' FIELD w_of_number.
CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.
Advanced way
The example below show how to call a transaction and skip first screen when it in not possible to SET parameters ID.
In case of CS03, the last field (BoM alternative) has no Parameter ID. In that case we use bdcdata to call transaction and provide parameters.
*&---------------------------------------------------------------------*
*& Form call_transaction_cs03
*&---------------------------------------------------------------------*
FORM call_transaction_cs03 USING pw_bom_header TYPE matnr
pw_werks TYPE werks_d
pw_stlan TYPE stlan
pw_stlal TYPE stalt.
DATA: li_bdcdata TYPE STANDARD TABLE OF bdcdata,
ls_options TYPE ctu_params,
li_messages TYPE STANDARD TABLE OF bdcmsgcoll.
CLEAR : li_bdcdata.
ls_options-dismode = 'E'.
ls_options-updmode = 'S'.
ls_options-defsize = ''.
ls_options-nobinpt = 'X'.
ls_options-racommit = 'X'.
PERFORM bdc_dynpro USING 'SAPLCSDI' '0100'
CHANGING li_bdcdata.
PERFORM bdc_fields USING 'RC29N-MATNR' pw_bom_header
CHANGING li_bdcdata.
PERFORM bdc_fields USING 'RC29N-WERKS' pw_werks
CHANGING li_bdcdata.
PERFORM bdc_fields USING 'RC29N-STLAN' pw_stlan
CHANGING li_bdcdata.
PERFORM bdc_fields USING 'RC29N-STLAL' pw_stlal
CHANGING li_bdcdata.
PERFORM bdc_fields USING 'BDC_OKCODE' '/00'
CHANGING li_bdcdata.
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
EXPORTING
tcode = 'CS03'
EXCEPTIONS
ok = 1
not_ok = 2
OTHERS = 3.
IF sy-subrc = 1.
CALL TRANSACTION 'CS03' USING li_bdcdata
OPTIONS FROM ls_options
MESSAGES INTO li_messages.
ELSEIF sy-subrc = 2.
MESSAGE s062(zpp) WITH 'CS03' DISPLAY LIKE 'E'.
" Vous n'êtes pas autorisé à lancer la transaction &.
ENDIF.
ENDFORM. " CALL_TRANSACTION_CS03
*&---------------------------------------------------------------------*
*& Form bdc_dynpro
*&---------------------------------------------------------------------*
FORM bdc_dynpro USING pw_program TYPE bdcdata-program
pw_dynpro TYPE bdcdata-dynpro
CHANGING pi_bdcdata TYPE tab_bdcdata.
* Local data declaration
DATA: ls_bdcdata TYPE bdcdata.
* Process
CLEAR ls_bdcdata.
ls_bdcdata-program = pw_program.
ls_bdcdata-dynpro = pw_dynpro.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO pi_bdcdata.
ENDFORM. "bdc_dynpro
*&---------------------------------------------------------------------*
*& Form bdc_fields
*&---------------------------------------------------------------------*
FORM bdc_fields USING pw_fnam TYPE bdcdata-fnam
pw_fval "TYPE bdcdata-fval
CHANGING pi_bdcdata TYPE tab_bdcdata.
* Local data declaration
DATA: ls_bdcdata TYPE bdcdata.
* Process
CLEAR ls_bdcdata.
ls_bdcdata-fnam = pw_fnam.
ls_bdcdata-fval = pw_fval.
APPEND ls_bdcdata TO pi_bdcdata.
ENDFORM. "bdc_fields
About the author