REPORT ZCALLTRANSACTION11 NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE BDCRECX1.
DATA :IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ITAB OCCURS 0,
MBRSH(1) TYPE C ,
MTART(4) TYPE C ,
MAKTX(40) TYPE C ,
MEINS(3) TYPE C ,
MATKL(9) TYPE C ,
BRGEW(13) TYPE C ,
GEWEI(3) TYPE C ,
END OF ITAB .
*DATA : BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN : BEGIN OF BLOCK GR WITH FRAME TITLE TEXT-001.
PARAMETERS: P_FILE TYPE RLGRAP-FILENAME .
PARAMETERS : MD LIKE CTU_PARAMS-DISMODE . "DEFAULT 'A'.
SELECTION-SCREEN : END OF BLOCK GR.
*----------------------------------------------------------------------*
* At Selection-screen *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM F4_HELP_P_FILE.
START-OF-SELECTION.
PERFORM GUI_UPLOAD.
PERFORM CALL.
*&---------------------------------------------------------------------*
*& Form F4_HELP_P_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM F4_HELP_P_FILE . DATA : V_FILE(128) TYPE C . "LIKE P_FILE. * Display popup with files list to select CALL FUNCTION 'F4_FILENAME' IMPORTING FILE_NAME = V_FILE. CHECK SY-SUBRC EQ 0. P_FILE = V_FILE. ENDFORM. " F4_HELP_P_FILE *&---------------------------------------------------------------------* *& Form GUI_UPLOAD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM GUI_UPLOAD . CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = 'C:\UPLOAD.TXT' FILETYPE = 'ASC' HAS_FIELD_SEPARATOR = 'X' * HEADER_LENGTH = 0 * READ_BY_LINE = 'X' * DAT_MODE = ' ' * IMPORTING * FILELENGTH = * HEADER = TABLES DATA_TAB = ITAB * EXCEPTIONS * FILE_OPEN_ERROR = 1 * FILE_READ_ERROR = 2 * NO_BATCH = 3 * GUI_REFUSE_FILETRANSFER = 4 * INVALID_TYPE = 5 * NO_AUTHORITY = 6 * UNKNOWN_ERROR = 7 * BAD_DATA_FORMAT = 8 * HEADER_NOT_ALLOWED = 9 * SEPARATOR_NOT_ALLOWED = 10 * HEADER_TOO_LONG = 11 * UNKNOWN_DP_ERROR = 12 * ACCESS_DENIED = 13 * DP_OUT_OF_MEMORY = 14 * DISK_FULL = 15 * DP_TIMEOUT = 16 * OTHERS = 17 . IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GUI_UPLOAD
*&---------------------------------------------------------------------*
*& Form CALL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CALL .
PERFORM OPEN_GROUP.
LOOP AT ITAB .
REFRESH BDCDATA.
CLEAR BDCDATA.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=AUSW'.
PERFORM BDC_FIELD USING 'RMMG1-MBRSH' ITAB-MBRSH.
* 'M'.
PERFORM BDC_FIELD USING 'RMMG1-MTART' ITAB-MTART.
* 'ROH'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(02)'
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'BU'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX' ITAB-MAKTX.
* 'HARD-DISK'.
PERFORM BDC_FIELD USING 'MARA-MEINS' ITAB-MEINS.
* 'PC'.
PERFORM BDC_FIELD USING 'MARA-MATKL' ITAB-MATKL.
* '00101'.
PERFORM BDC_FIELD USING 'MARA-BRGEW' ITAB-BRGEW.
* '500'.
PERFORM BDC_FIELD USING 'MARA-GEWEI' ITAB-GEWEI.
* 'G'.
* PERFORM BDC_TRANSACTION USING 'MM01' USING BDCDATA MESSAGES INTO IT_MESSTAB .
CALL TRANSACTION 'MM01' USING BDCDATA MESSAGES INTO IT_MESSTAB .
CLEAR : BDCDATA .
CLEAR :ITAB.
READ TABLE ITAB .
ENDLOOP.
PERFORM CLOSE_GROUP.
ENDFORM. " CALL
No comments:
Post a Comment