调用CALL TRANSACTION的三种方法

时间:2022-09-01 15:41:58

1.使用屏幕传入
              REFRESH BDCDATA.
              CLEAR   BDCDATA.
              BDCDATA-PROGRAM = 'SAPLCSDI'.      "Programm St 點kliste
              BDCDATA-DYNPRO   = '0100'.          "Dynpro
              BDCDATA-DYNBEGIN = 'X'.             "Sofort starten
              APPEND BDCDATA.
              CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'   "HW 81070
                   EXPORTING
                        INPUT   = H_MATNR
                   IMPORTING
                        OUTPUT = H_MATNR
                   EXCEPTIONS
                        OTHERS = 0.
              CLEAR   BDCDATA.
              BDCDATA-FNAM     = 'RC29N-MATNR'.     "Material
              BDCDATA-FVAL     = H_MATNR.
              APPEND BDCDATA.
              CLEAR   BDCDATA.
              BDCDATA-FNAM     = 'RC29N-WERKS'.     "Werks
              BDCDATA-FVAL     = H_WERKS.
              APPEND BDCDATA.
              CLEAR   BDCDATA.
              BDCDATA-FNAM     = 'RC29N-STLAN'.     "Verwendung
              BDCDATA-FVAL     = H_STLAN.
              APPEND BDCDATA.
*
**            IF NOT H_STLAL IS INITIAL.
**              CLEAR   BDCDATA.
**              BDCDATA-FNAM     = 'RC29N-STLAL'.   "Stl.Alternative
**              BDCDATA-FVAL     = H_STLAL.
**              APPEND BDCDATA.
**            ENDIF.
*
              CLEAR   BDCDATA.
              BDCDATA-PROGRAM = 'SAPLCSDI'.      "Programm St 點kliste
              BDCDATA-DYNPRO   = '0150'.          "Dynpro
              BDCDATA-DYNBEGIN = 'X'.             "Sofort starten
              APPEND BDCDATA.
*             Umwandeln in Anzeigemodus  黚er BDC_OKCODE
              CLEAR   BDCDATA.
              BDCDATA-FNAM     = 'BDC_OKCODE'.
              BDCDATA-FVAL     = '/BDA'.
              APPEND BDCDATA.
 
*             Verzweig in St 點klistenanzeige 黚er Batchinput-Tabelle
              CALL TRANSACTION 'CS03' USING BDCDATA MODE 'E'.
2.使用parameter
      SET PARAMETER ID 'MAT' FIELD P_MATNR.
      SET PARAMETER ID 'WRK' FIELD P_WERKS.
      SET PARAMETER ID 'CSV' FIELD P_STLAN.
 
      CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
3. 使用memory
data:
 wfbomcom       type rc29n.
move-corresponding bom_key to wfbomcom. "#EC ENHOK        "note0526541
 wfbomcom-aennr = display_aennr.
 wfbomcom-datuv = display_datuv.
 wfbomcom-datub = display_datub.
 export wfbomcom to memory id 'WFBOMCOM'.
* display bom
call transaction 'CS03' and skip first screen.