0% found this document useful (0 votes)
33 views6 pages

SAP Application Server Report Handling

The document describes writing data from an internal table to an external file. It defines variables to hold the file name, file line structure, and file table. It loops through error data, moves fields to internal variables, concatenates the variables into file lines, and appends them to the file table. After the loop, it calls a method to write the file table contents to the external file.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views6 pages

SAP Application Server Report Handling

The document describes writing data from an internal table to an external file. It defines variables to hold the file name, file line structure, and file table. It loops through error data, moves fields to internal variables, concatenates the variables into file lines, and appends them to the file table. After the loop, it calls a method to write the file table contents to the external file.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

DATA : lwa_svr_file TYPE rsanm_file_line, * Internal table for RSNAM file struct li_svr_file TYPE rsanm_file_table, lv_file_name TYPE

string. * File pc_svrfn may change once we get App path If not gt_error_val is initial. * OPEN DATASET pc_svrfn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. "UTF-8 loop at gt_error_val into gwa_error_val. * Conversion in concatenate all fields should be C,N,D,T clear : lc_umren, lc_umrez, lc_losgr, lc_stprs, lc_zplp1, lc_zplp2, lc_zplp3, lc_zplpr, lc_ausss, lc_bstfe, lc_bstma, lc_bstmi, lc_bstrf, lc_mabst, lc_minbe, lc_eisbe, lc_eislo, lc_plifz, lc_wzeit, lc_maxlz, lc_mhdhb, lc_mhdlp, lc_mhdrz, lc_wesch, lc_aumng, lc_scmng, lc_recno. MOVE : gwa_error_val-umren to lc_umren, gwa_error_val-umrez to lc_umrez, gwa_error_val-losgr to lc_losgr, gwa_error_val-stprs to lc_stprs, gwa_error_val-zplp1 to lc_zplp1, gwa_error_val-zplp2 to lc_zplp2,

gwa_error_val-zplp3 to lc_zplp3, gwa_error_val-zplpr to lc_zplpr, gwa_error_val-ausss to lc_ausss, gwa_error_val-bstfe to lc_bstfe, gwa_error_val-bstma to lc_bstma, gwa_error_val-bstmi to lc_bstmi, gwa_error_val-bstrf to lc_bstrf, gwa_error_val-mabst to lc_mabst, gwa_error_val-minbe to lc_minbe, gwa_error_val-eisbe to lc_eisbe, gwa_error_val-eislo to lc_eislo, gwa_error_val-plifz to lc_plifz, gwa_error_val-wzeit to lc_wzeit, gwa_error_val-maxlz to lc_maxlz, gwa_error_val-mhdhb to lc_mhdhb, gwa_error_val-mhdlp to lc_mhdlp, gwa_error_val-mhdrz to lc_mhdrz, gwa_error_val-wesch to lc_wesch, gwa_error_val-aumng to lc_aumng, gwa_error_val-scmng to lc_scmng, gwa_error_val-recno to lc_recno.

concatenate gwa_error_val-matnr * Accounting 1 gwa_error_val-bklas gwa_matupload-bwtty * Accounting 2 gwa_error_val-mtorg gwa_error_val-mtuse gwa_error_val-xlifo gwa_error_val-meinh lc_umren "gwa_error_val-umren dec 5 lc_umrez "gwa_error_val-umrez dec 5 * Basic Data 1 gwa_error_val-maktx gwa_error_val-meins * Costing 1 gwa_error_val-ekalr gwa_error_val-hkmat gwa_error_val-hrkft lc_losgr "gwa_error_val-losgr quan 13 * Costing 2

lc_stprs "gwa_error_val-stprs curr 11 gwa_error_val-zpld1 gwa_error_val-zpld2 gwa_error_val-zpld3 lc_zplp1 "gwa_error_val-zplp1 curr 11 lc_zplp2 "gwa_error_val-zplp2 curr 11 lc_zplp3 "gwa_error_val-zplp3 curr 11 lc_zplpr "gwa_error_val-zplpr curr 11 * Forecasting gwa_error_val-prmod * Foreign Trade Export gwa_error_val-herkl * Initial Screen gwa_error_val-bukrs gwa_error_val-mbrsh gwa_error_val-mtart gwa_error_val-vkorg gwa_error_val-vtweg * MRP1 lc_ausss "gwa_error_val-ausss Dec 5 lc_bstfe "gwa_error_val-bstfe Quan 13 lc_bstma "gwa_error_val-bstma Quan 13 lc_bstmi "gwa_error_val-bstmi Quan 13 lc_bstrf "gwa_error_val-bstrf Quan 13 gwa_error_val-disgr gwa_error_val-disls gwa_error_val-dismm gwa_error_val-dispo gwa_error_val-fxhor gwa_error_val-lagpr gwa_error_val-maabc lc_mabst "gwa_error_val-mabst Quan 13 lc_minbe "gwa_error_val-minbe Quan 13 gwa_error_val-zzcrank * MRP2 gwa_error_val-beskz lc_eisbe "gwa_error_val-eisbe Quan 13 lc_eislo "gwa_error_val-eislo Quan 13 gwa_error_val-fhori gwa_error_val-kzech gwa_error_val-lgfsb gwa_error_val-mrppp lc_plifz "gwa_error_val-plifz Dec 3 gwa_error_val-rgekz gwa_error_val-rwpro

gwa_error_val-schgt gwa_error_val-shflg gwa_error_val-shpro gwa_error_val-shzet gwa_error_val-sobsl gwa_error_val-vspvb * MRP3 gwa_error_val-perkz gwa_error_val-strgr gwa_error_val-vint1 gwa_error_val-vint2 gwa_error_val-vrmod lc_wzeit "gwa_error_val-wzeit Dec 3 * MRP4 gwa_error_val-altsl gwa_error_val-kzbed gwa_error_val-sbdkz * Plant Data/ Storage1 gwa_error_val-abcin gwa_error_val-behvo gwa_error_val-ccfix gwa_error_val-eprio gwa_error_val-etiar gwa_error_val-etifo gwa_error_val-iprkz gwa_error_val-lgpbe gwa_error_val-lwmkb gwa_error_val-lzeih lc_maxlz "gwa_error_val-maxlz Dec 5 lc_mhdhb "gwa_error_val-mhdhb Dec 4 lc_mhdlp "gwa_error_val-mhdlp Dec 3 lc_mhdrz "gwa_error_val-mhdrz Dec 4 gwa_error_val-raube gwa_error_val-rdmhd gwa_error_val-stoff gwa_error_val-tempb lc_wesch "gwa_error_val-wesch Quan 13 gwa_error_val-fprfm gwa_error_val-loggr gwa_error_val-sernp * Purchasing gwa_error_val-bstme

gwa_error_val-ekgrp gwa_error_val-ekwsl gwa_error_val-kautb gwa_error_val-mfrnr gwa_error_val-uchkz gwa_error_val-ucmat gwa_error_val-werks * Sales General/Plant gwa_error_val-ladgr gwa_error_val-mfrgr gwa_error_val-mtvfp gwa_error_val-prctr gwa_error_val-xchpf * SalesOrg 1 lc_aumng "gwa_error_val-aumng Quan 13 gwa_error_val-matkl gwa_error_val-schme lc_scmng "gwa_error_val-scmng Quan 13 * gwa_error_val-taty1 gwa_error_val-tatyp gwa_error_val-taxim * SalesOrg 2 gwa_error_val-mtpos gwa_error_val-mvgr4 gwa_error_val-prodh lc_recno "gwa_error_val-recno gwa_error_val-message into lwa_svr_file SEPARATED BY cl_abap_char_utilities=>horizontal_tab. *l_str SEPARATED by cc_tab. * TRANSFER l_str TO pc_svrfn. * clear : l_str. APPEND lwa_svr_file TO li_svr_file. CLEAR: gwa_error_val, lwa_svr_file. endloop. * CLOSE DATASET pc_svrfn. lv_file_name = pc_svrfn.

CALL METHOD CL_RSAN_UT_APPSERV_FILE_WRITER=>APPSERVER_FILE_WRITE EXPORTING I_FILENAME = lv_file_name * I_LINES_FROM = 1 * I_LINES_TO = -1 * I_OVERWRITE = SPACE I_DATA_TAB = li_svr_file[] * IMPORTING * E_LINES_WRITTEN = EXCEPTIONS OPEN_FAILED = 1 WRITE_FAILED = 2 CLOSE_FAILED = 3 others =4 . IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. Reply Forward

You might also like