REPORT z_barry_select_options_bdc .
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF messtab OCCURS 0.
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF messtab.
DATA: BEGIN OF itab OCCURS 0 ,
lifnr LIKE lfa1-lifnr ,
END OF itab.
START-OF-SELECTION.
APPEND '1' TO itab.
APPEND '2' TO itab.
APPEND '3' TO itab.
APPEND '4' TO itab.
APPEND '5' TO itab.
APPEND '6' TO itab.
APPEND '7' TO itab.
APPEND '8' TO itab.
APPEND '9' TO itab.
APPEND '10' TO itab.
APPEND '11' TO itab.
APPEND '12' TO itab.
REFRESH bdcdata .
CLEAR bdcdata .
PERFORM bdc_dynpro USING 'RFITEMAP' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=%004'.
PERFORM bdc_field USING 'BDC_CURSOR' 'KD_LIFNR-LOW'.
LOOP AT itab.
PERFORM bdc_dynpro USING 'SAPLALDB' '3000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RSCSEL-SLOW_I(02)'.
PERFORM bdc_field USING 'RSCSEL-SLOW_I(02)' itab-lifnr .
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLALDB' '3000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ACPT'.
CALL TRANSACTION 'FBL1N' USING bdcdata MODE 'A' UPDATE 'S'
MESSAGES INTO messtab.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
CONDENSE bdcdata-fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
阅读(4993) | 评论(3) | 转发(2) |