ABAP 调用标准程序并获取ALV结果表示例

1. 标准代码执行结果

  • SE38->RFIDCN_BSAIS:选择界面
    ABAP 调用标准程序并获取ALV结果表示例_第1张图片
  • 标准程序正常执行结果
    ABAP 调用标准程序并获取ALV结果表示例_第2张图片

代码

  • 用代码调用RFIDCN_BSAIS,并取得输出结果存入
    DATA: LR_DATA TYPE REF TO DATA.
    FIELD-SYMBOLS : <LT_RECEIVE> TYPE ANY TABLE .
    
    CLEAR LR_DATA.
    UNASSIGN <LT_RECEIVE>.
    
    CL_SALV_BS_RUNTIME_INFO=>SET( EXPORTING DISPLAY  = ABAP_FALSE     "是否显示选择界面
                                            METADATA = ABAP_FALSE     "
                                            DATA     = ABAP_TRUE ).   "
        "调用程序并传值
    SUBMIT RFIDCN_BSAIS
        WITH SD_BUKRS = 'XXXX'	"公司代码
        WITH FSCKEY = 'LXCN'
        WITH VERSN = 'LXCN'
        WITH LANGU = '1'
        WITH BILBJAHR = '2020'
        WITH R-MONATE = '01'
        WITH CILVJAHR = '2020'
        WITH C-MONATE = '02'
        AND RETURN.
    
    TRY.
        "获取返回数据
        CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF( IMPORTING R_DATA = LR_DATA ).
        "赋值数据
        ASSIGN LR_DATA->* TO .
        "捕获异常
      CATCH CX_SALV_BS_SC_RUNTIME_INFO.
        MESSAGE 'Unable to retrieve ALV data! Please try other conditions.' TYPE 'E'.
    ENDTRY.
    

结果

  • 返回的数据
    ABAP 调用标准程序并获取ALV结果表示例_第3张图片

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

你可能感兴趣的:(ABAP开发,ABAP,实用程序记录,SAP,ABAP)