Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LOOP AT gt_routing INTO gs_longtext.
- clear ls_mapl.
- CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
- EXPORTING
- input = gs_longtext-matnr
- IMPORTING
- output = gs_longtext-matnr.
- IF testrun <> 'X'.
- " -----> Long text migration
- e_header-tdobject = 'ROUTING'.
- e_header-tdid = 'PLPO'.
- e_header-tdspras = sy-langu.
- CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
- EXPORTING
- input = gs_longtext-matnr
- IMPORTING
- output = gs_longtext-matnr.
- SELECT SINGLE * FROM mapl INTO ls_mapl WHERE matnr = gs_longtext-matnr and werks = werks and LOEKZ <> 'X'.
- SELECT single * FROM mapl INNER JOIN plpo on ( mapl~plnnr = plpo~plnnr ) INNER JOIN plas on ( mapl~PLNNR = plas~PLNNR
- and mapl~PLNAL = plas~PLNAL and plpo~PLNKN = plas~PLNKN ) into CORRESPONDING FIELDS OF GS_OPERATION
- WHERE mapl~matnr = gs_longtext-matnr AND mapl~plnnr = ls_mapl-plnnr AND mapl~plnal = ls_mapl-plnal and plpo~vornr = gs_longtext-vornr AND plpo~LTXA1 = gs_longtext-LTXA1.
- IF sy-subrc <> 0.
- WRITE:/ gs_longtext-matnr COLOR COL_NEGATIVE, 'Nie znalazł marszruty' COLOR COL_NEGATIVE.
- else.
- concatenate: sy-mandt gs_operation-plnty gs_operation-plnnr gs_operation-plnkn gs_operation-zaehl into e_header-tdname.
- " ----> Create file on application server
- OPEN DATASET longtext_file_server FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
- IF sy-subrc = 0.
- TRANSFER gs_longtext-LONGTEXT TO longtext_file_server.
- CLOSE DATASET longtext_file_server.
- refresh gt_lines.
- longtext_file_conv = longtext_file.
- longtext_file_server_conv = longtext_file_server.
- CALL FUNCTION 'ARCHIVFILE_SERVER_TO_CLIENT'
- EXPORTING
- PATH = longtext_file_server_conv
- TARGETPATH = longtext_file_conv.
- IF SY-SUBRC = 0.
- CALL FUNCTION 'IMPORT_TEXT'
- EXPORTING
- FILE = longtext_file
- FORMAT_TYPE = 'RTF'
- TABLES
- ITF_LINES = gt_lines.
- " ---> Insert operation short text into first row
- IF lines( gt_lines ) > 0.
- clear gs_lines.
- gs_lines-TDFORMAT = '*'.
- gs_lines-TDLINE = gs_longtext-LTXA1.
- INSERT gs_lines INTO gt_lines INDEX 1.
- ENDIF.
- CALL FUNCTION 'SAVE_TEXT'
- EXPORTING
- header = e_header
- savemode_direct = 'X'
- TABLES
- lines = gt_lines.
- IF sy-subrc <> 0.
- WRITE:/ gs_longtext-MATNR COLOR COL_NEGATIVE, gs_longtext-VORNR, gs_longtext-LTXA1, 'NIE utworzona' COLOR COL_NEGATIVE.
- ELSE.
- UPDATE PLPO set LTXA2 = '1' TXTSP = sy-langu WHERE plnty = gs_operation-plnty and plnnr = gs_operation-plnnr and plnkn = gs_operation-plnkn and zaehl = gs_operation-zaehl.
- COMMIT WORK AND WAIT.
- WRITE:/ gs_longtext-MATNR COLOR COL_POSITIVE, gs_longtext-VORNR, gs_longtext-LTXA1, 'UTWORZONA POPRAWNIE' COLOR COL_POSITIVE.
- ENDIF.
- else.
- WRITE:/ gs_longtext-matnr COLOR COL_NEGATIVE, 'Błąd podczas otwierania pliku' COLOR COL_NEGATIVE.
- ENDIF.
- DELETE DATASET longtext_file.
- IF sy-subrc = 0.
- CLOSE DATASET longtext_file.
- ENDIF.
- ENDIF.
- ENDIF.
- * LOOP AT t_error.
- * WRITE:/ t_error-material,t_error-message.
- * ENDLOOP.
- endif.
- PERFORM display_percentage USING lv_counter lv_lines.
- ENDLOOP.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement