<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic gui_upload in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759472#M642311</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  i have  one zprogram, it is written for to get the data from application server ,&lt;/P&gt;&lt;P&gt;now i need to change the code to take the file from local drive.&lt;/P&gt;&lt;P&gt; here iam giving the code ,could any one help me in this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCLUDE zppiforecasttop.&lt;/P&gt;&lt;P&gt;INCLUDE zppiforecastf01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;SELECTION SCREEN EVENTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the splitting rules against source file format&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON RADIOBUTTON GROUP r4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF rb_spmon = 'X' AND rb_week = 'X'.&lt;/P&gt;&lt;P&gt;MESSAGE e005(z1) WITH text-t13.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF rb_spday &amp;lt;&amp;gt; 'X' AND rb_daily = 'X'.&lt;/P&gt;&lt;P&gt;MESSAGE e005(z1) WITH text-t14.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;F4 value help on filename field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: w_choice, t_filelist.&lt;/P&gt;&lt;P&gt;REFRESH: t_filelist.&lt;/P&gt;&lt;P&gt;w_proc = 'proc'.&lt;/P&gt;&lt;P&gt;w_txt = 'txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get and open logical filename&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'FILE_GET_NAME'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;logical_filename = p_lognam&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;parameter_1 = i_para_1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;parameter_2 = i_para_2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;parameter_3 = i_para_3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;file_name = w_dir&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;file_not_found = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE e005(z1) WITH text-t18.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;dir_name = w_dir&lt;/P&gt;&lt;P&gt;file_mask = '&lt;STRONG&gt;.&lt;/STRONG&gt;'&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;dir_list = t_files&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;invalid_eps_subdir = 1&lt;/P&gt;&lt;P&gt;sapgparam_failed = 2&lt;/P&gt;&lt;P&gt;build_directory_failed = 3&lt;/P&gt;&lt;P&gt;no_authorization = 4&lt;/P&gt;&lt;P&gt;read_directory_failed = 5&lt;/P&gt;&lt;P&gt;too_many_read_errors = 6&lt;/P&gt;&lt;P&gt;empty_directory_list = 7&lt;/P&gt;&lt;P&gt;OTHERS = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the return code is not 0 exit from event&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;*Loop at list of files and convert to display format&lt;/P&gt;&lt;P&gt;LOOP AT t_files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;only show processed files with filename '&lt;STRONG&gt;proc&lt;/STRONG&gt;'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SEARCH t_files-name FOR w_proc.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_filelist-name = t_files-name.&lt;/P&gt;&lt;P&gt;t_filelist-size = t_files-size.&lt;/P&gt;&lt;P&gt;APPEND t_filelist.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;only show processed files with filename '&lt;STRONG&gt;txt&lt;/STRONG&gt;'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SEARCH t_files-name FOR w_txt.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_filelist-name = t_files-name.&lt;/P&gt;&lt;P&gt;t_filelist-size = t_files-size.&lt;/P&gt;&lt;P&gt;APPEND t_filelist.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF t_filelist[] IS INITIAL.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Display list of available files in a popup screen&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;endpos_col = '100'&lt;/P&gt;&lt;P&gt;endpos_row = '23'&lt;/P&gt;&lt;P&gt;startpos_col = '10'&lt;/P&gt;&lt;P&gt;startpos_row = '5'&lt;/P&gt;&lt;P&gt;titletext = 'Select File'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;choise = w_choice&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;valuetab = t_filelist&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;break_off = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;READ TABLE t_filelist INDEX w_choice.&lt;/P&gt;&lt;P&gt;CONCATENATE w_dir t_filelist-name INTO p_file.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start of Selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the filetype corresponds to the selection&lt;/P&gt;&lt;P&gt;PERFORM check_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Upload the file by resolving logical filename.&lt;/P&gt;&lt;P&gt;PERFORM upload_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Depending on the selection criteria, alter the input data into the&lt;/P&gt;&lt;P&gt;*desired format and store.&lt;/P&gt;&lt;P&gt;PERFORM populate_post_split_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the idoc of type SOPGEN01&lt;/P&gt;&lt;P&gt;PERFORM post_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rename the file extension from '&lt;/STRONG&gt;.txt' to '*.proc_yyyymmdd', if&lt;/P&gt;&lt;P&gt;*reprocessing a file do nothing&lt;/P&gt;&lt;P&gt;SEARCH p_file FOR '*txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM rename_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;End of Selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Output error report&lt;/P&gt;&lt;P&gt;PERFORM error_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Top of Page&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOP-OF-PAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM top_of_page.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;.........this is the first include........................ &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INCLUDE ZPPIFORECASTTOP *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: marc, "Plant Data for Material&lt;/P&gt;&lt;P&gt;marm, "Units of Measure for Material&lt;/P&gt;&lt;P&gt;edidd, "Data record (IDoc)&lt;/P&gt;&lt;P&gt;edidc, "Control Segment&lt;/P&gt;&lt;P&gt;e1lipm0, "General characteristic segment&lt;/P&gt;&lt;P&gt;e1lipv0, "General version segment&lt;/P&gt;&lt;P&gt;e1lipp0. "Performance measure segment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;SELECTION SCREEN&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t01.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_1000 RADIOBUTTON GROUP r1 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_1005 RADIOBUTTON GROUP r1.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t02.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_mgx RADIOBUTTON GROUP r2 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_other RADIOBUTTON GROUP r2.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-t03.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_month RADIOBUTTON GROUP r3 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_week RADIOBUTTON GROUP r3,&lt;/P&gt;&lt;P&gt;rb_daily RADIOBUTTON GROUP r3.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-t04.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_spmon RADIOBUTTON GROUP r4 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_spwk RADIOBUTTON GROUP r4,&lt;/P&gt;&lt;P&gt;rb_spday RADIOBUTTON GROUP r4.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: so_datum FOR sy-datum, " (Planning time horizon)&lt;/P&gt;&lt;P&gt;so_matnr FOR marc-matnr. " (Material Master)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_lognam LIKE filenameci-fileintern&lt;/P&gt;&lt;P&gt;DEFAULT 'ZPPIFORECAST_FILENAME' NO-DISPLAY,&lt;/P&gt;&lt;P&gt;p_file LIKE rlgrap-filename OBLIGATORY. "(Input file)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TYPES&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF workdate,&lt;/P&gt;&lt;P&gt;datum LIKE sy-datum,&lt;/P&gt;&lt;P&gt;day TYPE p,&lt;/P&gt;&lt;P&gt;workday(1) TYPE c,&lt;/P&gt;&lt;P&gt;END OF workdate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF postsplit.&lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE zppiforecast.&lt;/P&gt;&lt;P&gt;TYPES: fromdat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;todat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;split_date LIKE sy-datum,&lt;/P&gt;&lt;P&gt;split_value(10) TYPE c,&lt;/P&gt;&lt;P&gt;flg_noscp(1) TYPE c,&lt;/P&gt;&lt;P&gt;END OF postsplit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF exception.&lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE zppiforecast.&lt;/P&gt;&lt;P&gt;TYPES: docnum TYPE docnum,&lt;/P&gt;&lt;P&gt;message TYPE edi_statx_,&lt;/P&gt;&lt;P&gt;END OF exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF filelist,&lt;/P&gt;&lt;P&gt;name TYPE epsfilnam,&lt;/P&gt;&lt;P&gt;size(10) TYPE c,&lt;/P&gt;&lt;P&gt;END OF filelist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;DATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_files TYPE TABLE OF epsfili INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_file TYPE TABLE OF zppiforecast INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_exception TYPE TABLE OF exception INITIAL SIZE 0&lt;/P&gt;&lt;P&gt;WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_post_split TYPE TABLE OF postsplit INITIAL SIZE 0&lt;/P&gt;&lt;P&gt;WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_workdates TYPE TABLE OF workdate INITIAL SIZE 0&lt;/P&gt;&lt;P&gt;WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_filelist TYPE TABLE OF filelist INITIAL SIZE 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_edidc TYPE TABLE OF edidc INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_edidd TYPE TABLE OF edidd INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_edids TYPE TABLE OF edids INITIAL SIZE 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: w_choice TYPE sy-tabix, "Index of chosen file&lt;/P&gt;&lt;P&gt;w_line(100), "100 character string&lt;/P&gt;&lt;P&gt;w_dir LIKE epsf-epsdirnam, "Directory path&lt;/P&gt;&lt;P&gt;w_hiper LIKE t445p-hiper, "Forecast lower limit&lt;/P&gt;&lt;P&gt;w_fuper LIKE t445p-fuper, "Forecast upper limit&lt;/P&gt;&lt;P&gt;w_count TYPE i, "Counter&lt;/P&gt;&lt;P&gt;w_total TYPE i, "Total&lt;/P&gt;&lt;P&gt;w_start LIKE sy-datum, "Start date in the range&lt;/P&gt;&lt;P&gt;w_end LIKE sy-datum, "End date in the range&lt;/P&gt;&lt;P&gt;w_date LIKE sy-datum, "Curent Date&lt;/P&gt;&lt;P&gt;w_first LIKE sy-datum, "First working date in range&lt;/P&gt;&lt;P&gt;w_flg_noscp(1) TYPE c, "No SCP UoM flag&lt;/P&gt;&lt;P&gt;w_days TYPE butag, "No of days&lt;/P&gt;&lt;P&gt;w_day TYPE p, "Day of the week indicator&lt;/P&gt;&lt;P&gt;w_value LIKE zppiforecast-value, "Record Value&lt;/P&gt;&lt;P&gt;w_post_split TYPE postsplit, "Work area for post split table line&lt;/P&gt;&lt;P&gt;w_docnum LIKE edidc-docnum, "IDOC number&lt;/P&gt;&lt;P&gt;w_docnum_no_zero LIKE w_docnum, " IDOC number wthout zeros&lt;/P&gt;&lt;P&gt;w_statva LIKE stacust-statva,&lt;/P&gt;&lt;P&gt;w_error(1) TYPE c,&lt;/P&gt;&lt;P&gt;w_matnr TYPE matnr,&lt;/P&gt;&lt;P&gt;w_tabix TYPE sytabix,&lt;/P&gt;&lt;P&gt;w_messg TYPE message,&lt;/P&gt;&lt;P&gt;w_msgln TYPE i,&lt;/P&gt;&lt;P&gt;w_todat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;w_fromdat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;w_lines TYPE i,&lt;/P&gt;&lt;P&gt;w_count_idoc_errors TYPE i,&lt;/P&gt;&lt;P&gt;w_count_recs_uploaded TYPE i,&lt;/P&gt;&lt;P&gt;w_count_idoc_posted TYPE i.&lt;/P&gt;&lt;P&gt;DATA: w_proc(4) TYPE c.&lt;/P&gt;&lt;P&gt;DATA: w_txt(4) TYPE c.&lt;/P&gt;&lt;P&gt;DATA: logsys LIKE tbdls-logsys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CONSTANTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS: c_uom LIKE marm-meinh VALUE 'SCP', "Unit of measure&lt;/P&gt;&lt;P&gt;c_delim TYPE x VALUE '09',&lt;/P&gt;&lt;P&gt;c_type LIKE rlgrap-filetype VALUE 'DAT',&lt;/P&gt;&lt;P&gt;c_werks_1000 LIKE marc-werks VALUE '1000',&lt;/P&gt;&lt;P&gt;c_werks_1005 LIKE marc-werks VALUE '1005',&lt;/P&gt;&lt;P&gt;c_pltyp_805 LIKE t445p-sctyp VALUE 'Z_805',&lt;/P&gt;&lt;P&gt;c_pltyp_810 LIKE t445p-sctyp VALUE 'Z_810',&lt;/P&gt;&lt;P&gt;c_mestyp_805 TYPE edi_mestyp VALUE 'LIP805',&lt;/P&gt;&lt;P&gt;c_mestyp_810 TYPE edi_mestyp VALUE 'LIP810',&lt;/P&gt;&lt;P&gt;c_rcvprt TYPE edi_rcvprt VALUE 'LS',&lt;/P&gt;&lt;P&gt;c_sndprn TYPE edi_sndprn VALUE 'WEBM_LS',&lt;/P&gt;&lt;P&gt;c_sndprt TYPE edi_sndprt VALUE 'LS'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;..............this is the second include................. &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INCLUDE ZPPIFORECASTF01 *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form upload_file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form upload_file.&lt;/P&gt;&lt;P&gt;data: w_matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;w_datum like sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Open file in read mode&lt;/P&gt;&lt;P&gt;open dataset p_file for input in text mode.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Read line of data into text string variable&lt;/P&gt;&lt;P&gt;read dataset p_file into w_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If successful. append the internal file table&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add 1 to w_count_recs_uploaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Split the string at delimiter into internal file table&lt;/P&gt;&lt;P&gt;split w_line at c_delim into i_file-matnr&lt;/P&gt;&lt;P&gt;i_file-datum&lt;/P&gt;&lt;P&gt;i_file-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERSION_EXIT_MATN1_INPUT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;input = i_file-matnr&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;output = w_matnr&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;length_error = 1&lt;/P&gt;&lt;P&gt;others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_file-index = sy-index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the date is in the correct format.&lt;/P&gt;&lt;P&gt;call function 'CONVERT_DATE_TO_INTERN_FORMAT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;datum = i_file-datum&lt;/P&gt;&lt;P&gt;dtype = 'DATS'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;error = w_error&lt;/P&gt;&lt;P&gt;idate = i_file-datum&lt;/P&gt;&lt;P&gt;messg = w_messg&lt;/P&gt;&lt;P&gt;msgln = w_msgln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If an error has occurred write entry to error table, otherwise append&lt;/P&gt;&lt;P&gt;*record list&lt;/P&gt;&lt;P&gt;if not w_error is initial.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-006.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;check i_file-datum in so_datum.&lt;/P&gt;&lt;P&gt;append i_file.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;message w005(z1) with 'File ' p_file ' cannot be opened'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;*Close the file&lt;/P&gt;&lt;P&gt;close dataset p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " upload_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form process_monthly&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form process_monthly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_mm type bumon,&lt;/P&gt;&lt;P&gt;w_yyyy type bdatj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_mm = i_file-datum+4(2).&lt;/P&gt;&lt;P&gt;w_yyyy = i_file-datum(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the number of days in the month&lt;/P&gt;&lt;P&gt;call function 'NUMBER_OF_DAYS_PER_MONTH_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;par_month = w_mm&lt;/P&gt;&lt;P&gt;par_year = w_yyyy&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;par_days = w_days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to first day&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the first working day in the month&lt;/P&gt;&lt;P&gt;perform get_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to last day in the month&lt;/P&gt;&lt;P&gt;w_date = i_file-datum + w_days - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last working day in the month&lt;/P&gt;&lt;P&gt;perform get_last_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate the post split table with monthly value&lt;/P&gt;&lt;P&gt;i_post_split-split_value = w_value.&lt;/P&gt;&lt;P&gt;i_post_split-matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = w_fromdat.&lt;/P&gt;&lt;P&gt;i_post_split-todat = w_todat.&lt;/P&gt;&lt;P&gt;i_post_split-datum = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-value = i_file-value.&lt;/P&gt;&lt;P&gt;i_post_split-index = i_file-index.&lt;/P&gt;&lt;P&gt;i_post_split-split_date = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-flg_noscp = w_flg_noscp.&lt;/P&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " process_monthly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_material&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_material using value(plant) value(pltyp).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the material plant combination exists&lt;/P&gt;&lt;P&gt;select single matnr from marc into w_matnr&lt;/P&gt;&lt;P&gt;where matnr = i_file-matnr&lt;/P&gt;&lt;P&gt;and werks = plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check return code, if no record found, write to error table and delete&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-001.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start DEVK931385&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if plant = c_werks_1000. "DEVK931385&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the material exists in the infotype hierarchy&lt;/P&gt;&lt;P&gt;select single matnr from s805e into w_matnr where ssour = space&lt;/P&gt;&lt;P&gt;and werks = plant&lt;/P&gt;&lt;P&gt;and matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;else. "DEVK931385&lt;/P&gt;&lt;P&gt;*Check that the material exists in the infotype hierarchy S810e&lt;/P&gt;&lt;P&gt;select single matnr from s810e into w_matnr where ssour = space&lt;/P&gt;&lt;P&gt;and werks = plant&lt;/P&gt;&lt;P&gt;and matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif. "DEVK931385&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;End DEVK931385&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-006.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the forcast limits from info structure&lt;/P&gt;&lt;P&gt;select single hiper fuper from t445p into (w_hiper, w_fuper)&lt;/P&gt;&lt;P&gt;where sctyp = pltyp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Determine start and end limits for forecasting based on current date&lt;/P&gt;&lt;P&gt;w_start = sy-datum - w_hiper.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start DEVK931340&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_end = sy-datum + w_fuper. "DEL&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;w_end = sy-datum + ( ( w_fuper * 7 ) / 5 ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END DEVK931340&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_material&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:33:06 PM&amp;amp;#9668;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Form process_weekly&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form process_weekly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_mm type bumon,&lt;/P&gt;&lt;P&gt;w_yyyy type bdatj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;w_mm = i_file-datum+4(2).&lt;/P&gt;&lt;P&gt;w_yyyy = i_file-datum(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the souce file is in monthly format&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the number of days in the current month&lt;/P&gt;&lt;P&gt;call function 'NUMBER_OF_DAYS_PER_MONTH_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;par_month = w_mm&lt;/P&gt;&lt;P&gt;par_year = w_yyyy&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;par_days = w_days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to last day in the month&lt;/P&gt;&lt;P&gt;w_date = i_file-datum + w_days - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last working day in the month&lt;/P&gt;&lt;P&gt;perform get_last_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to first day&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the first working day in the month&lt;/P&gt;&lt;P&gt;perform get_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;*Otherwise set for days in week&lt;/P&gt;&lt;P&gt;w_days = 7.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Clear the table of workdates&lt;/P&gt;&lt;P&gt;clear: t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check if the day is a working day&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If successful, set the workday flag to (Y)es&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_workdates-datum = w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;*Increment the counter for total number of workdays&lt;/P&gt;&lt;P&gt;add 1 to w_total.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;*Otherwise (N)o&lt;/P&gt;&lt;P&gt;t_workdates-datum = w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'N'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the day in the week of the current date, (1 = Monday, 7 = Sunday)&lt;/P&gt;&lt;P&gt;call function 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;datum = w_date&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;wotnr = t_workdates-day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append t_workdates.&lt;/P&gt;&lt;P&gt;add 1 to w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the day is a workday&lt;/P&gt;&lt;P&gt;if t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the fromdate is blank, set to current date in loop (first working&lt;/P&gt;&lt;P&gt;*day)&lt;/P&gt;&lt;P&gt;if i_post_split-fromdat is initial.&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;i_post_split-split_date = t_workdates-datum.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set variable to pick up last working date&lt;/P&gt;&lt;P&gt;i_post_split-todat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Increment loop counter&lt;/P&gt;&lt;P&gt;add 1 to w_count.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the day is a Sunday&lt;/P&gt;&lt;P&gt;if ( ( t_workdates-day = 7 or t_workdates-datum+6(2) = w_days )&lt;/P&gt;&lt;P&gt;and w_count &amp;lt;&amp;gt; 0 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Poplulate the post split table&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = w_fromdat.&lt;/P&gt;&lt;P&gt;i_post_split-todat = w_todat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_post_split-matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;i_post_split-datum = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-value = i_file-value.&lt;/P&gt;&lt;P&gt;i_post_split-index = i_file-index.&lt;/P&gt;&lt;P&gt;i_post_split-split_value = ( ( w_value / w_total ) * w_count ).&lt;/P&gt;&lt;P&gt;i_post_split-flg_noscp = w_flg_noscp.&lt;/P&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_count,&lt;/P&gt;&lt;P&gt;i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " process_weekly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_first_day&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_fromdat = w_date.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add 1 to w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_first_day&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_last_day&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_last_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_todat = w_date.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;subtract 1 from w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_last_day&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:33:30 PM&amp;amp;#9668;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form process_daily&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form process_daily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_mm type bumon,&lt;/P&gt;&lt;P&gt;w_yyyy type bdatj,&lt;/P&gt;&lt;P&gt;new_w_date like w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_mm = i_file-datum+4(2).&lt;/P&gt;&lt;P&gt;w_yyyy = i_file-datum(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;*Get the number of days in the current month&lt;/P&gt;&lt;P&gt;call function 'NUMBER_OF_DAYS_PER_MONTH_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;par_month = w_mm&lt;/P&gt;&lt;P&gt;par_year = w_yyyy&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;par_days = w_days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the source file is in weekly format set to days in week&lt;/P&gt;&lt;P&gt;elseif rb_week = 'X'.&lt;/P&gt;&lt;P&gt;w_days = 7.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;*If source file is daily, set to day&lt;/P&gt;&lt;P&gt;w_days = 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the current day is a workday&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If successful, set workday flag to (Y)es and append workday table&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_workdates-datum = w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;append t_workdates.&lt;/P&gt;&lt;P&gt;*Increment total&lt;/P&gt;&lt;P&gt;add 1 to w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add 1 to w_date and w_days to make it loop again until a the next work&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;day is found!!!!!&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if rb_daily = 'X'.&lt;/P&gt;&lt;P&gt;new_w_date = w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while new_w_date ne ''.&lt;/P&gt;&lt;P&gt;add 1 to new_w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the current day is a workday&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = new_w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_workdates-datum = new_w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;append t_workdates.&lt;/P&gt;&lt;P&gt;add 1 to w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Increment date&lt;/P&gt;&lt;P&gt;add 1 to w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the number of workdays in the period&lt;/P&gt;&lt;P&gt;describe table t_workdates lines w_lines.&lt;/P&gt;&lt;P&gt;*Get the first entry in the table&lt;/P&gt;&lt;P&gt;read table t_workdates index 1.&lt;/P&gt;&lt;P&gt;w_fromdat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last entry in the table&lt;/P&gt;&lt;P&gt;read table t_workdates index w_lines.&lt;/P&gt;&lt;P&gt;w_todat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate the post split table&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = w_fromdat.&lt;/P&gt;&lt;P&gt;i_post_split-todat = w_todat.&lt;/P&gt;&lt;P&gt;i_post_split-split_date = t_workdates-datum.&lt;/P&gt;&lt;P&gt;i_post_split-matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;i_post_split-datum = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-value = i_file-value.&lt;/P&gt;&lt;P&gt;i_post_split-index = i_file-index.&lt;/P&gt;&lt;P&gt;i_post_split-split_value = w_value / w_total.&lt;/P&gt;&lt;P&gt;i_post_split-flg_noscp = w_flg_noscp.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For daily sorce data which is split daily check that an entry doesnt&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;already exist in the post split table for this date - only the fromdat&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is checked because for daily split fromdat = todat&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_post_split into w_post_split&lt;/P&gt;&lt;P&gt;with key matnr = i_file-matnr&lt;/P&gt;&lt;P&gt;fromdat = i_file-datum&lt;/P&gt;&lt;P&gt;split_date = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;...an entry exist so add the new value to the existing one and update&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the table record&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;i_post_split-split_value = i_post_split-split_value +&lt;/P&gt;&lt;P&gt;w_post_split-split_value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MODIFY i_post_split from w_post_split index sy-tabix.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " process_daily&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_range&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If file date is not in forcast range discard&lt;/P&gt;&lt;P&gt;if i_file-datum &amp;lt; w_start or i_file-datum &amp;gt; w_end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-002.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_range&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_uom&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_uom.&lt;/P&gt;&lt;P&gt;*Get the alternative UoM for Material&lt;/P&gt;&lt;P&gt;select single * from marm where matnr = i_file-matnr&lt;/P&gt;&lt;P&gt;and meinh = c_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;w_value = ( i_file-value * ( marm-umren / marm-umrez ) ).&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;w_value = i_file-value.&lt;/P&gt;&lt;P&gt;w_flg_noscp = 'X'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_flg_noscp = 'X'. "jsa01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_uom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_first_day&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the date is not the first of the month, copy to error table, delete&lt;/P&gt;&lt;P&gt;*and end current loop process&lt;/P&gt;&lt;P&gt;if i_file-datum+6(2) &amp;lt;&amp;gt; '01'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-003.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_first_day&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:34:00 PM&amp;amp;#9668;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_monday&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_monday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;datum = i_file-datum&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;wotnr = w_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the day is not a monday, copy to error table, delete&lt;/P&gt;&lt;P&gt;*and end current loop process&lt;/P&gt;&lt;P&gt;if w_day &amp;lt;&amp;gt; 1.&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-004.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_monday&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form populate_post_split_table&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form populate_post_split_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Sort the uploaded table by material and date&lt;/P&gt;&lt;P&gt;sort i_file by matnr datum.&lt;/P&gt;&lt;P&gt;loop at i_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform material_internal_format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*clear loop variables&lt;/P&gt;&lt;P&gt;clear: w_hiper,&lt;/P&gt;&lt;P&gt;w_fuper,&lt;/P&gt;&lt;P&gt;w_count,&lt;/P&gt;&lt;P&gt;w_error,&lt;/P&gt;&lt;P&gt;w_fromdat,&lt;/P&gt;&lt;P&gt;w_todat,&lt;/P&gt;&lt;P&gt;w_flg_noscp,&lt;/P&gt;&lt;P&gt;t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Clear the contents of the internal table which holds work days&lt;/P&gt;&lt;P&gt;refresh: t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If plant radiobutton is set&lt;/P&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the material/plant combination&lt;/P&gt;&lt;P&gt;perform check_material using c_werks_1000 c_pltyp_805.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the material/plant combination&lt;/P&gt;&lt;P&gt;perform check_material using c_werks_1005 c_pltyp_810.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the uploaded file is in monthly format&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the record is for the first day of the month&lt;/P&gt;&lt;P&gt;perform check_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the value is within the range for the infotype&lt;/P&gt;&lt;P&gt;perform check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that an 'SCP' unit of measure exists and convert value&lt;/P&gt;&lt;P&gt;perform check_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Otherwise if the file is in weekly format&lt;/P&gt;&lt;P&gt;elseif rb_week = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the record corresponds to a monday&lt;/P&gt;&lt;P&gt;perform check_monday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the value is within the range for the infotype&lt;/P&gt;&lt;P&gt;perform check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that an 'SCP' unit of measure exists and convert value&lt;/P&gt;&lt;P&gt;perform check_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the value is within the range for the infotype&lt;/P&gt;&lt;P&gt;perform check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that an 'SCP' unit of measure exists and convert value&lt;/P&gt;&lt;P&gt;perform check_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If split monthly flag has been chosen&lt;/P&gt;&lt;P&gt;if rb_spmon = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Process value using split monthly process&lt;/P&gt;&lt;P&gt;perform process_monthly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Otherwise, if weekly split&lt;/P&gt;&lt;P&gt;elseif rb_spwk = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Process value using split weekly process&lt;/P&gt;&lt;P&gt;perform process_weekly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Otherwise daily split&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Process value using split daily process&lt;/P&gt;&lt;P&gt;perform process_daily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " populate_post_split_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_idoc&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build and submit the idoc for processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form post_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the logical system for ALE processing&lt;/P&gt;&lt;P&gt;perform get_ale_data.&lt;/P&gt;&lt;P&gt;check not logsys is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate the IDOC control record&lt;/P&gt;&lt;P&gt;perform build_control_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Sort the data by material, date and value&lt;/P&gt;&lt;P&gt;sort i_post_split by matnr datum value fromdat todat split_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build idocs and post them&lt;/P&gt;&lt;P&gt;loop at i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: e1lipp0,&lt;/P&gt;&lt;P&gt;t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Move i_post_split header to a work area&lt;/P&gt;&lt;P&gt;w_post_split = i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at new datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: e1lipm0, e1lipv0, t_edidd.&lt;/P&gt;&lt;P&gt;refresh t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the general characteristic segment&lt;/P&gt;&lt;P&gt;perform build_e1lipm0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the general version segment&lt;/P&gt;&lt;P&gt;perform build_e1lipv0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the performance measure segment&lt;/P&gt;&lt;P&gt;perform build_e1lipp0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Submit IDOC for inbound processing&lt;/P&gt;&lt;P&gt;perform submit_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_idoc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:34:22 PM&amp;amp;#9668;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form submit_idoc&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start inbound processing of IDOC&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form submit_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'IDOC_WRITE_AND_START_INBOUND'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_edidc = edidc&lt;/P&gt;&lt;P&gt;do_commit = 'X'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;docnum = w_docnum&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;i_edidd = t_edidd&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;idoc_not_saved = 1&lt;/P&gt;&lt;P&gt;others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERSION_EXIT_ALPHA_OUTPUT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;input = w_docnum&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;output = w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform check_idoc_status_records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;t_exception-index = w_post_split-index.&lt;/P&gt;&lt;P&gt;t_exception-matnr = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;t_exception-datum = w_post_split-datum.&lt;/P&gt;&lt;P&gt;t_exception-message = t_edids-statxt.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the no SCP UoM flag is set, write an entry to exception table&lt;/P&gt;&lt;P&gt;if w_post_split-flg_noscp = 'X'.&lt;/P&gt;&lt;P&gt;t_exception-index = w_post_split-index.&lt;/P&gt;&lt;P&gt;t_exception-matnr = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;t_exception-datum = w_post_split-datum.&lt;/P&gt;&lt;P&gt;t_exception-value = w_post_split-value.&lt;/P&gt;&lt;P&gt;t_exception-docnum = w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_exception-message = text-005.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " write_idoc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_control_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Build the IDOC control record&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_control_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear edidc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-idoctp = 'SOPGEN01'. " Basic type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;edidc-mestyp = c_mestyp_805. " Message type&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;edidc-mestyp = c_mestyp_810. " Message type&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-rcvprt = c_rcvprt. " Partner type of receiver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate 'SAP' sy-sysid(3) into edidc-rcvpor. " Receiver port&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate sy-sysid(3) 'CLNT' sy-mandt into edidc-rcvprn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-direct = '2'. " Inbound&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate 'SAP' sy-sysid(3) into edidc-sndpor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-sndprt = c_sndprt. " Partner type of sender&lt;/P&gt;&lt;P&gt;edidc-sndprn = c_sndprn. " Partner number of sender&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_control_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_ale_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get logical system for ALE processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_ale_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'OWN_LOGICAL_SYSTEM_GET'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;own_logical_system = logsys&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;own_logical_system_not_defined = 1&lt;/P&gt;&lt;P&gt;others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;clear logsys.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_ale_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_e1lipv0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create the general version segment&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_e1lipv0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipv0-vrsio = 'A00'.&lt;/P&gt;&lt;P&gt;e1lipv0-avrsi = 'X'.&lt;/P&gt;&lt;P&gt;e1lipv0-vetxt = 'Active Version'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move e1lipv0 to t_edidd-sdata.&lt;/P&gt;&lt;P&gt;move 'E1LIPV0' to t_edidd-segnam.&lt;/P&gt;&lt;P&gt;t_edidd-hlevel = '02'.&lt;/P&gt;&lt;P&gt;append t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " send_idoc&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_e1lipm0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_e1lipm0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipm0-vontg = w_post_split-fromdat.&lt;/P&gt;&lt;P&gt;e1lipm0-bistg = w_post_split-todat.&lt;/P&gt;&lt;P&gt;e1lipm0-perio = '0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;e1lipm0-m01 = c_werks_1000.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;e1lipm0-m01 = c_werks_1005.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipm0-m02 = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;e1lipm0-m03 = 'SCP'.&lt;/P&gt;&lt;P&gt;e1lipm0-m06 = 'T'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move e1lipm0 to t_edidd-sdata.&lt;/P&gt;&lt;P&gt;move 'E1LIPM0' to t_edidd-segnam.&lt;/P&gt;&lt;P&gt;t_edidd-hlevel = '01'.&lt;/P&gt;&lt;P&gt;append t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_e1lipm0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_e1lipp0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_e1lipp0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipp0-sptag = w_post_split-split_date.&lt;/P&gt;&lt;P&gt;if rb_mgx = 'X'.&lt;/P&gt;&lt;P&gt;e1lipp0-kz02 = w_post_split-split_value.&lt;/P&gt;&lt;P&gt;e1lipp0-kz03 = '/'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;e1lipp0-kz02 = '/'.&lt;/P&gt;&lt;P&gt;e1lipp0-kz03 = w_post_split-split_value.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move e1lipp0 to t_edidd-sdata.&lt;/P&gt;&lt;P&gt;move 'E1LIPP0' to t_edidd-segnam.&lt;/P&gt;&lt;P&gt;t_edidd-hlevel = '03'.&lt;/P&gt;&lt;P&gt;append t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_e1lipp0_segment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_idoc_status_records&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_idoc_status_records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: t_edids.&lt;/P&gt;&lt;P&gt;refresh: t_edids.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from edids into table t_edids where docnum = w_docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_edids.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_statva.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single statva from stacust into w_statva&lt;/P&gt;&lt;P&gt;where status = t_edids-status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case w_statva.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*When the status group is of type 'E' or 'F'.&lt;/P&gt;&lt;P&gt;when 'E' or 'F'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_exception-value = w_post_split-value.&lt;/P&gt;&lt;P&gt;t_exception-index = w_post_split-index.&lt;/P&gt;&lt;P&gt;t_exception-matnr = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;t_exception-datum = w_post_split-datum.&lt;/P&gt;&lt;P&gt;t_exception-docnum = w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;t_exception-message = t_edids-statxt.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when others.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error is initial.&lt;/P&gt;&lt;P&gt;add 1 to w_count_idoc_posted.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;add 1 to w_count_idoc_errors.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_idoc_status_records&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:34:35 PM&amp;amp;#9668;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form rename_file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Form to rename file&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form rename_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_filename_new(120), " New filename&lt;/P&gt;&lt;P&gt;l_filename_temp(120), " Temporary filename&lt;/P&gt;&lt;P&gt;l_command(250), " Unix command line&lt;/P&gt;&lt;P&gt;w_extension(14).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move p_file to l_filename_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Replace the file extension of the file to indicate that it has been&lt;/P&gt;&lt;P&gt;*processed&lt;/P&gt;&lt;P&gt;concatenate '.proc_' sy-datum into w_extension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace '.txt' with w_extension into l_filename_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create UNIX rename command&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;concatenate 'mv' p_file l_filename_new&lt;/P&gt;&lt;P&gt;into l_command separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create temporary unique file name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;concatenate p_file 'TEMP'&lt;/P&gt;&lt;P&gt;into l_filename_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move l_filename_new to p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Open temporary dataset but use the filter command to execute the UNIX&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;rename command 'mv'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This method has been used instead of SAP external commands because&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of file length limitations. The external command only allows a line of&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;128 chars which means filenames can only be about 62chars when doing&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;a move i.e. mv &amp;lt;file1&amp;gt; &amp;lt;file2&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;open dataset l_filename_temp for output filter l_command.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-007.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Close the temporary dataset&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;close dataset l_filename_temp.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-007.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delete the temporary dataset&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;delete dataset l_filename_temp.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-007.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " rename_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form material_internal_format&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form material_internal_format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERSION_EXIT_ALPHA_INPUT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;input = i_file-matnr&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;output = i_file-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " material_internal_format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form error_report&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form error_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format color col_normal.&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;*Loop at exception table and output contents&lt;/P&gt;&lt;P&gt;loop at t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / t_exception-index,&lt;/P&gt;&lt;P&gt;t_exception-matnr,&lt;/P&gt;&lt;P&gt;24 t_exception-datum,&lt;/P&gt;&lt;P&gt;t_exception-value right-justified,&lt;/P&gt;&lt;P&gt;t_exception-docnum,&lt;/P&gt;&lt;P&gt;t_exception-message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if t_exception[] is initial.&lt;/P&gt;&lt;P&gt;message s005(z1) with text-s01.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;message s005(z1) with text-s02.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format reset.&lt;/P&gt;&lt;P&gt;write : /40 text-eor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " error_report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*The source format in the report selection should match the upload file&lt;/P&gt;&lt;P&gt;*naming conventions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*start of insert - mpc01&lt;/P&gt;&lt;P&gt;if not t_filelist is initial.&lt;/P&gt;&lt;P&gt;refresh: t_filelist.&lt;/P&gt;&lt;P&gt;clear: t_filelist.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;split p_file at '/' into table t_filelist.&lt;/P&gt;&lt;P&gt;describe table t_filelist lines sy-tabix.&lt;/P&gt;&lt;P&gt;sy-tabix = sy-tabix - 1.&lt;/P&gt;&lt;P&gt;delete t_filelist from 1 to sy-tabix.&lt;/P&gt;&lt;P&gt;read table t_filelist index 1.&lt;/P&gt;&lt;P&gt;*end of insert - mpc01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case t_filelist-name(1).&lt;/P&gt;&lt;P&gt;when 'M'.&lt;/P&gt;&lt;P&gt;if rb_month &amp;lt;&amp;gt; 'X'.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-t15.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when 'W'.&lt;/P&gt;&lt;P&gt;if rb_week &amp;lt;&amp;gt; 'X'.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-t16.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when 'D'.&lt;/P&gt;&lt;P&gt;if rb_daily &amp;lt;&amp;gt; 'X'.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-t17.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form top_of_page&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FORMAT COLOR COL_HEADING INTENSIFIED OFF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;format reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;write: / 'Plant: ', 25 c_werks_1000.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / 'Plant: ', 25 c_werks_1005.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_mgx = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t02, 25 'MGX'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / text-t02, 25 'Other'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t03, 25 'Monthly'.&lt;/P&gt;&lt;P&gt;elseif rb_week = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t03, 25 'Weekly'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / text-t03, 25 'Daily'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_spmon = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t04, 25 'Month'.&lt;/P&gt;&lt;P&gt;elseif rb_spwk = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t04, 25 'Weekly'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / text-t04, 25 'Daily'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Number of records uploaded: ', w_count_recs_uploaded.&lt;/P&gt;&lt;P&gt;write: / 'Number of IDOCs posted : ', w_count_idoc_posted.&lt;/P&gt;&lt;P&gt;write: / 'Number of IDOC errors : ', w_count_idoc_errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'File: ', p_file.&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format color col_heading intensified on.&lt;/P&gt;&lt;P&gt;uline.&lt;/P&gt;&lt;P&gt;write: /6 'File',&lt;/P&gt;&lt;P&gt;13 'Material',&lt;/P&gt;&lt;P&gt;24 'Forecast',&lt;/P&gt;&lt;P&gt;40 'Value',&lt;/P&gt;&lt;P&gt;46 'IDOC',&lt;/P&gt;&lt;P&gt;67(70) 'Error '.&lt;/P&gt;&lt;P&gt;write: /6 'Index',&lt;/P&gt;&lt;P&gt;13 'Number',&lt;/P&gt;&lt;P&gt;24 'Date',&lt;/P&gt;&lt;P&gt;67(70) 'Message'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format color col_heading intensified off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " top_of_page&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Sep 2007 10:07:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-14T10:07:42Z</dc:date>
    <item>
      <title>gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759472#M642311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  i have  one zprogram, it is written for to get the data from application server ,&lt;/P&gt;&lt;P&gt;now i need to change the code to take the file from local drive.&lt;/P&gt;&lt;P&gt; here iam giving the code ,could any one help me in this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCLUDE zppiforecasttop.&lt;/P&gt;&lt;P&gt;INCLUDE zppiforecastf01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;SELECTION SCREEN EVENTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the splitting rules against source file format&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON RADIOBUTTON GROUP r4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF rb_spmon = 'X' AND rb_week = 'X'.&lt;/P&gt;&lt;P&gt;MESSAGE e005(z1) WITH text-t13.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF rb_spday &amp;lt;&amp;gt; 'X' AND rb_daily = 'X'.&lt;/P&gt;&lt;P&gt;MESSAGE e005(z1) WITH text-t14.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;F4 value help on filename field&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: w_choice, t_filelist.&lt;/P&gt;&lt;P&gt;REFRESH: t_filelist.&lt;/P&gt;&lt;P&gt;w_proc = 'proc'.&lt;/P&gt;&lt;P&gt;w_txt = 'txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get and open logical filename&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'FILE_GET_NAME'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;logical_filename = p_lognam&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;parameter_1 = i_para_1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;parameter_2 = i_para_2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;parameter_3 = i_para_3&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;file_name = w_dir&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;file_not_found = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE e005(z1) WITH text-t18.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;dir_name = w_dir&lt;/P&gt;&lt;P&gt;file_mask = '&lt;STRONG&gt;.&lt;/STRONG&gt;'&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;dir_list = t_files&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;invalid_eps_subdir = 1&lt;/P&gt;&lt;P&gt;sapgparam_failed = 2&lt;/P&gt;&lt;P&gt;build_directory_failed = 3&lt;/P&gt;&lt;P&gt;no_authorization = 4&lt;/P&gt;&lt;P&gt;read_directory_failed = 5&lt;/P&gt;&lt;P&gt;too_many_read_errors = 6&lt;/P&gt;&lt;P&gt;empty_directory_list = 7&lt;/P&gt;&lt;P&gt;OTHERS = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the return code is not 0 exit from event&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;*Loop at list of files and convert to display format&lt;/P&gt;&lt;P&gt;LOOP AT t_files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;only show processed files with filename '&lt;STRONG&gt;proc&lt;/STRONG&gt;'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SEARCH t_files-name FOR w_proc.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_filelist-name = t_files-name.&lt;/P&gt;&lt;P&gt;t_filelist-size = t_files-size.&lt;/P&gt;&lt;P&gt;APPEND t_filelist.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;only show processed files with filename '&lt;STRONG&gt;txt&lt;/STRONG&gt;'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SEARCH t_files-name FOR w_txt.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_filelist-name = t_files-name.&lt;/P&gt;&lt;P&gt;t_filelist-size = t_files-size.&lt;/P&gt;&lt;P&gt;APPEND t_filelist.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF t_filelist[] IS INITIAL.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Display list of available files in a popup screen&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;endpos_col = '100'&lt;/P&gt;&lt;P&gt;endpos_row = '23'&lt;/P&gt;&lt;P&gt;startpos_col = '10'&lt;/P&gt;&lt;P&gt;startpos_row = '5'&lt;/P&gt;&lt;P&gt;titletext = 'Select File'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;choise = w_choice&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;valuetab = t_filelist&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;break_off = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;READ TABLE t_filelist INDEX w_choice.&lt;/P&gt;&lt;P&gt;CONCATENATE w_dir t_filelist-name INTO p_file.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start of Selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the filetype corresponds to the selection&lt;/P&gt;&lt;P&gt;PERFORM check_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Upload the file by resolving logical filename.&lt;/P&gt;&lt;P&gt;PERFORM upload_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Depending on the selection criteria, alter the input data into the&lt;/P&gt;&lt;P&gt;*desired format and store.&lt;/P&gt;&lt;P&gt;PERFORM populate_post_split_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the idoc of type SOPGEN01&lt;/P&gt;&lt;P&gt;PERFORM post_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rename the file extension from '&lt;/STRONG&gt;.txt' to '*.proc_yyyymmdd', if&lt;/P&gt;&lt;P&gt;*reprocessing a file do nothing&lt;/P&gt;&lt;P&gt;SEARCH p_file FOR '*txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM rename_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;End of Selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Output error report&lt;/P&gt;&lt;P&gt;PERFORM error_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Top of Page&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOP-OF-PAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM top_of_page.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;.........this is the first include........................ &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INCLUDE ZPPIFORECASTTOP *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: marc, "Plant Data for Material&lt;/P&gt;&lt;P&gt;marm, "Units of Measure for Material&lt;/P&gt;&lt;P&gt;edidd, "Data record (IDoc)&lt;/P&gt;&lt;P&gt;edidc, "Control Segment&lt;/P&gt;&lt;P&gt;e1lipm0, "General characteristic segment&lt;/P&gt;&lt;P&gt;e1lipv0, "General version segment&lt;/P&gt;&lt;P&gt;e1lipp0. "Performance measure segment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;SELECTION SCREEN&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t01.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_1000 RADIOBUTTON GROUP r1 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_1005 RADIOBUTTON GROUP r1.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t02.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_mgx RADIOBUTTON GROUP r2 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_other RADIOBUTTON GROUP r2.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-t03.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_month RADIOBUTTON GROUP r3 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_week RADIOBUTTON GROUP r3,&lt;/P&gt;&lt;P&gt;rb_daily RADIOBUTTON GROUP r3.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-t04.&lt;/P&gt;&lt;P&gt;PARAMETERS: rb_spmon RADIOBUTTON GROUP r4 DEFAULT 'X',&lt;/P&gt;&lt;P&gt;rb_spwk RADIOBUTTON GROUP r4,&lt;/P&gt;&lt;P&gt;rb_spday RADIOBUTTON GROUP r4.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: so_datum FOR sy-datum, " (Planning time horizon)&lt;/P&gt;&lt;P&gt;so_matnr FOR marc-matnr. " (Material Master)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_lognam LIKE filenameci-fileintern&lt;/P&gt;&lt;P&gt;DEFAULT 'ZPPIFORECAST_FILENAME' NO-DISPLAY,&lt;/P&gt;&lt;P&gt;p_file LIKE rlgrap-filename OBLIGATORY. "(Input file)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;TYPES&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF workdate,&lt;/P&gt;&lt;P&gt;datum LIKE sy-datum,&lt;/P&gt;&lt;P&gt;day TYPE p,&lt;/P&gt;&lt;P&gt;workday(1) TYPE c,&lt;/P&gt;&lt;P&gt;END OF workdate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF postsplit.&lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE zppiforecast.&lt;/P&gt;&lt;P&gt;TYPES: fromdat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;todat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;split_date LIKE sy-datum,&lt;/P&gt;&lt;P&gt;split_value(10) TYPE c,&lt;/P&gt;&lt;P&gt;flg_noscp(1) TYPE c,&lt;/P&gt;&lt;P&gt;END OF postsplit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF exception.&lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE zppiforecast.&lt;/P&gt;&lt;P&gt;TYPES: docnum TYPE docnum,&lt;/P&gt;&lt;P&gt;message TYPE edi_statx_,&lt;/P&gt;&lt;P&gt;END OF exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF filelist,&lt;/P&gt;&lt;P&gt;name TYPE epsfilnam,&lt;/P&gt;&lt;P&gt;size(10) TYPE c,&lt;/P&gt;&lt;P&gt;END OF filelist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;DATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_files TYPE TABLE OF epsfili INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_file TYPE TABLE OF zppiforecast INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_exception TYPE TABLE OF exception INITIAL SIZE 0&lt;/P&gt;&lt;P&gt;WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_post_split TYPE TABLE OF postsplit INITIAL SIZE 0&lt;/P&gt;&lt;P&gt;WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_workdates TYPE TABLE OF workdate INITIAL SIZE 0&lt;/P&gt;&lt;P&gt;WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_filelist TYPE TABLE OF filelist INITIAL SIZE 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_edidc TYPE TABLE OF edidc INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_edidd TYPE TABLE OF edidd INITIAL SIZE 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;t_edids TYPE TABLE OF edids INITIAL SIZE 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: w_choice TYPE sy-tabix, "Index of chosen file&lt;/P&gt;&lt;P&gt;w_line(100), "100 character string&lt;/P&gt;&lt;P&gt;w_dir LIKE epsf-epsdirnam, "Directory path&lt;/P&gt;&lt;P&gt;w_hiper LIKE t445p-hiper, "Forecast lower limit&lt;/P&gt;&lt;P&gt;w_fuper LIKE t445p-fuper, "Forecast upper limit&lt;/P&gt;&lt;P&gt;w_count TYPE i, "Counter&lt;/P&gt;&lt;P&gt;w_total TYPE i, "Total&lt;/P&gt;&lt;P&gt;w_start LIKE sy-datum, "Start date in the range&lt;/P&gt;&lt;P&gt;w_end LIKE sy-datum, "End date in the range&lt;/P&gt;&lt;P&gt;w_date LIKE sy-datum, "Curent Date&lt;/P&gt;&lt;P&gt;w_first LIKE sy-datum, "First working date in range&lt;/P&gt;&lt;P&gt;w_flg_noscp(1) TYPE c, "No SCP UoM flag&lt;/P&gt;&lt;P&gt;w_days TYPE butag, "No of days&lt;/P&gt;&lt;P&gt;w_day TYPE p, "Day of the week indicator&lt;/P&gt;&lt;P&gt;w_value LIKE zppiforecast-value, "Record Value&lt;/P&gt;&lt;P&gt;w_post_split TYPE postsplit, "Work area for post split table line&lt;/P&gt;&lt;P&gt;w_docnum LIKE edidc-docnum, "IDOC number&lt;/P&gt;&lt;P&gt;w_docnum_no_zero LIKE w_docnum, " IDOC number wthout zeros&lt;/P&gt;&lt;P&gt;w_statva LIKE stacust-statva,&lt;/P&gt;&lt;P&gt;w_error(1) TYPE c,&lt;/P&gt;&lt;P&gt;w_matnr TYPE matnr,&lt;/P&gt;&lt;P&gt;w_tabix TYPE sytabix,&lt;/P&gt;&lt;P&gt;w_messg TYPE message,&lt;/P&gt;&lt;P&gt;w_msgln TYPE i,&lt;/P&gt;&lt;P&gt;w_todat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;w_fromdat LIKE sy-datum,&lt;/P&gt;&lt;P&gt;w_lines TYPE i,&lt;/P&gt;&lt;P&gt;w_count_idoc_errors TYPE i,&lt;/P&gt;&lt;P&gt;w_count_recs_uploaded TYPE i,&lt;/P&gt;&lt;P&gt;w_count_idoc_posted TYPE i.&lt;/P&gt;&lt;P&gt;DATA: w_proc(4) TYPE c.&lt;/P&gt;&lt;P&gt;DATA: w_txt(4) TYPE c.&lt;/P&gt;&lt;P&gt;DATA: logsys LIKE tbdls-logsys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CONSTANTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS: c_uom LIKE marm-meinh VALUE 'SCP', "Unit of measure&lt;/P&gt;&lt;P&gt;c_delim TYPE x VALUE '09',&lt;/P&gt;&lt;P&gt;c_type LIKE rlgrap-filetype VALUE 'DAT',&lt;/P&gt;&lt;P&gt;c_werks_1000 LIKE marc-werks VALUE '1000',&lt;/P&gt;&lt;P&gt;c_werks_1005 LIKE marc-werks VALUE '1005',&lt;/P&gt;&lt;P&gt;c_pltyp_805 LIKE t445p-sctyp VALUE 'Z_805',&lt;/P&gt;&lt;P&gt;c_pltyp_810 LIKE t445p-sctyp VALUE 'Z_810',&lt;/P&gt;&lt;P&gt;c_mestyp_805 TYPE edi_mestyp VALUE 'LIP805',&lt;/P&gt;&lt;P&gt;c_mestyp_810 TYPE edi_mestyp VALUE 'LIP810',&lt;/P&gt;&lt;P&gt;c_rcvprt TYPE edi_rcvprt VALUE 'LS',&lt;/P&gt;&lt;P&gt;c_sndprn TYPE edi_sndprn VALUE 'WEBM_LS',&lt;/P&gt;&lt;P&gt;c_sndprt TYPE edi_sndprt VALUE 'LS'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;..............this is the second include................. &lt;/P&gt;&lt;P&gt;&amp;amp;#9668;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INCLUDE ZPPIFORECASTF01 *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form upload_file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form upload_file.&lt;/P&gt;&lt;P&gt;data: w_matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;w_datum like sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Open file in read mode&lt;/P&gt;&lt;P&gt;open dataset p_file for input in text mode.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Read line of data into text string variable&lt;/P&gt;&lt;P&gt;read dataset p_file into w_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If successful. append the internal file table&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add 1 to w_count_recs_uploaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Split the string at delimiter into internal file table&lt;/P&gt;&lt;P&gt;split w_line at c_delim into i_file-matnr&lt;/P&gt;&lt;P&gt;i_file-datum&lt;/P&gt;&lt;P&gt;i_file-value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERSION_EXIT_MATN1_INPUT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;input = i_file-matnr&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;output = w_matnr&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;length_error = 1&lt;/P&gt;&lt;P&gt;others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_file-index = sy-index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the date is in the correct format.&lt;/P&gt;&lt;P&gt;call function 'CONVERT_DATE_TO_INTERN_FORMAT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;datum = i_file-datum&lt;/P&gt;&lt;P&gt;dtype = 'DATS'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;error = w_error&lt;/P&gt;&lt;P&gt;idate = i_file-datum&lt;/P&gt;&lt;P&gt;messg = w_messg&lt;/P&gt;&lt;P&gt;msgln = w_msgln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If an error has occurred write entry to error table, otherwise append&lt;/P&gt;&lt;P&gt;*record list&lt;/P&gt;&lt;P&gt;if not w_error is initial.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-006.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;check i_file-datum in so_datum.&lt;/P&gt;&lt;P&gt;append i_file.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;message w005(z1) with 'File ' p_file ' cannot be opened'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;*Close the file&lt;/P&gt;&lt;P&gt;close dataset p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " upload_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form process_monthly&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form process_monthly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_mm type bumon,&lt;/P&gt;&lt;P&gt;w_yyyy type bdatj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_mm = i_file-datum+4(2).&lt;/P&gt;&lt;P&gt;w_yyyy = i_file-datum(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the number of days in the month&lt;/P&gt;&lt;P&gt;call function 'NUMBER_OF_DAYS_PER_MONTH_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;par_month = w_mm&lt;/P&gt;&lt;P&gt;par_year = w_yyyy&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;par_days = w_days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to first day&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the first working day in the month&lt;/P&gt;&lt;P&gt;perform get_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to last day in the month&lt;/P&gt;&lt;P&gt;w_date = i_file-datum + w_days - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last working day in the month&lt;/P&gt;&lt;P&gt;perform get_last_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate the post split table with monthly value&lt;/P&gt;&lt;P&gt;i_post_split-split_value = w_value.&lt;/P&gt;&lt;P&gt;i_post_split-matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = w_fromdat.&lt;/P&gt;&lt;P&gt;i_post_split-todat = w_todat.&lt;/P&gt;&lt;P&gt;i_post_split-datum = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-value = i_file-value.&lt;/P&gt;&lt;P&gt;i_post_split-index = i_file-index.&lt;/P&gt;&lt;P&gt;i_post_split-split_date = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-flg_noscp = w_flg_noscp.&lt;/P&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " process_monthly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_material&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_material using value(plant) value(pltyp).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the material plant combination exists&lt;/P&gt;&lt;P&gt;select single matnr from marc into w_matnr&lt;/P&gt;&lt;P&gt;where matnr = i_file-matnr&lt;/P&gt;&lt;P&gt;and werks = plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check return code, if no record found, write to error table and delete&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-001.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start DEVK931385&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if plant = c_werks_1000. "DEVK931385&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the material exists in the infotype hierarchy&lt;/P&gt;&lt;P&gt;select single matnr from s805e into w_matnr where ssour = space&lt;/P&gt;&lt;P&gt;and werks = plant&lt;/P&gt;&lt;P&gt;and matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;else. "DEVK931385&lt;/P&gt;&lt;P&gt;*Check that the material exists in the infotype hierarchy S810e&lt;/P&gt;&lt;P&gt;select single matnr from s810e into w_matnr where ssour = space&lt;/P&gt;&lt;P&gt;and werks = plant&lt;/P&gt;&lt;P&gt;and matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif. "DEVK931385&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;End DEVK931385&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-006.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the forcast limits from info structure&lt;/P&gt;&lt;P&gt;select single hiper fuper from t445p into (w_hiper, w_fuper)&lt;/P&gt;&lt;P&gt;where sctyp = pltyp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Determine start and end limits for forecasting based on current date&lt;/P&gt;&lt;P&gt;w_start = sy-datum - w_hiper.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start DEVK931340&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_end = sy-datum + w_fuper. "DEL&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;w_end = sy-datum + ( ( w_fuper * 7 ) / 5 ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END DEVK931340&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_material&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:33:06 PM&amp;amp;#9668;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Form process_weekly&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form process_weekly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_mm type bumon,&lt;/P&gt;&lt;P&gt;w_yyyy type bdatj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;w_mm = i_file-datum+4(2).&lt;/P&gt;&lt;P&gt;w_yyyy = i_file-datum(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the souce file is in monthly format&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the number of days in the current month&lt;/P&gt;&lt;P&gt;call function 'NUMBER_OF_DAYS_PER_MONTH_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;par_month = w_mm&lt;/P&gt;&lt;P&gt;par_year = w_yyyy&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;par_days = w_days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to last day in the month&lt;/P&gt;&lt;P&gt;w_date = i_file-datum + w_days - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last working day in the month&lt;/P&gt;&lt;P&gt;perform get_last_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set date variable to first day&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the first working day in the month&lt;/P&gt;&lt;P&gt;perform get_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;*Otherwise set for days in week&lt;/P&gt;&lt;P&gt;w_days = 7.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Clear the table of workdates&lt;/P&gt;&lt;P&gt;clear: t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check if the day is a working day&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If successful, set the workday flag to (Y)es&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_workdates-datum = w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;*Increment the counter for total number of workdays&lt;/P&gt;&lt;P&gt;add 1 to w_total.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;*Otherwise (N)o&lt;/P&gt;&lt;P&gt;t_workdates-datum = w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'N'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the day in the week of the current date, (1 = Monday, 7 = Sunday)&lt;/P&gt;&lt;P&gt;call function 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;datum = w_date&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;wotnr = t_workdates-day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append t_workdates.&lt;/P&gt;&lt;P&gt;add 1 to w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the day is a workday&lt;/P&gt;&lt;P&gt;if t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the fromdate is blank, set to current date in loop (first working&lt;/P&gt;&lt;P&gt;*day)&lt;/P&gt;&lt;P&gt;if i_post_split-fromdat is initial.&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;i_post_split-split_date = t_workdates-datum.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Set variable to pick up last working date&lt;/P&gt;&lt;P&gt;i_post_split-todat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Increment loop counter&lt;/P&gt;&lt;P&gt;add 1 to w_count.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the day is a Sunday&lt;/P&gt;&lt;P&gt;if ( ( t_workdates-day = 7 or t_workdates-datum+6(2) = w_days )&lt;/P&gt;&lt;P&gt;and w_count &amp;lt;&amp;gt; 0 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Poplulate the post split table&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = w_fromdat.&lt;/P&gt;&lt;P&gt;i_post_split-todat = w_todat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_post_split-matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;i_post_split-datum = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-value = i_file-value.&lt;/P&gt;&lt;P&gt;i_post_split-index = i_file-index.&lt;/P&gt;&lt;P&gt;i_post_split-split_value = ( ( w_value / w_total ) * w_count ).&lt;/P&gt;&lt;P&gt;i_post_split-flg_noscp = w_flg_noscp.&lt;/P&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_count,&lt;/P&gt;&lt;P&gt;i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " process_weekly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_first_day&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_fromdat = w_date.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add 1 to w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_first_day&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_last_day&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_last_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_todat = w_date.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;subtract 1 from w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_last_day&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:33:30 PM&amp;amp;#9668;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form process_daily&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form process_daily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_mm type bumon,&lt;/P&gt;&lt;P&gt;w_yyyy type bdatj,&lt;/P&gt;&lt;P&gt;new_w_date like w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_mm = i_file-datum+4(2).&lt;/P&gt;&lt;P&gt;w_yyyy = i_file-datum(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_date = i_file-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;*Get the number of days in the current month&lt;/P&gt;&lt;P&gt;call function 'NUMBER_OF_DAYS_PER_MONTH_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;par_month = w_mm&lt;/P&gt;&lt;P&gt;par_year = w_yyyy&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;par_days = w_days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the source file is in weekly format set to days in week&lt;/P&gt;&lt;P&gt;elseif rb_week = 'X'.&lt;/P&gt;&lt;P&gt;w_days = 7.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;*If source file is daily, set to day&lt;/P&gt;&lt;P&gt;w_days = 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do w_days times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the current day is a workday&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If successful, set workday flag to (Y)es and append workday table&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_workdates-datum = w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;append t_workdates.&lt;/P&gt;&lt;P&gt;*Increment total&lt;/P&gt;&lt;P&gt;add 1 to w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add 1 to w_date and w_days to make it loop again until a the next work&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;day is found!!!!!&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if rb_daily = 'X'.&lt;/P&gt;&lt;P&gt;new_w_date = w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while new_w_date ne ''.&lt;/P&gt;&lt;P&gt;add 1 to new_w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the current day is a workday&lt;/P&gt;&lt;P&gt;call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;date = new_w_date&lt;/P&gt;&lt;P&gt;factory_calendar_id = 'GB'&lt;/P&gt;&lt;P&gt;message_type = 'I'&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;date_after_range = 1&lt;/P&gt;&lt;P&gt;date_before_range = 2&lt;/P&gt;&lt;P&gt;date_invalid = 3&lt;/P&gt;&lt;P&gt;date_no_workingday = 4&lt;/P&gt;&lt;P&gt;others = 5.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;t_workdates-datum = new_w_date.&lt;/P&gt;&lt;P&gt;t_workdates-workday = 'Y'.&lt;/P&gt;&lt;P&gt;append t_workdates.&lt;/P&gt;&lt;P&gt;add 1 to w_total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Increment date&lt;/P&gt;&lt;P&gt;add 1 to w_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the number of workdays in the period&lt;/P&gt;&lt;P&gt;describe table t_workdates lines w_lines.&lt;/P&gt;&lt;P&gt;*Get the first entry in the table&lt;/P&gt;&lt;P&gt;read table t_workdates index 1.&lt;/P&gt;&lt;P&gt;w_fromdat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last entry in the table&lt;/P&gt;&lt;P&gt;read table t_workdates index w_lines.&lt;/P&gt;&lt;P&gt;w_todat = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate the post split table&lt;/P&gt;&lt;P&gt;i_post_split-fromdat = w_fromdat.&lt;/P&gt;&lt;P&gt;i_post_split-todat = w_todat.&lt;/P&gt;&lt;P&gt;i_post_split-split_date = t_workdates-datum.&lt;/P&gt;&lt;P&gt;i_post_split-matnr = i_file-matnr.&lt;/P&gt;&lt;P&gt;i_post_split-datum = i_file-datum.&lt;/P&gt;&lt;P&gt;i_post_split-value = i_file-value.&lt;/P&gt;&lt;P&gt;i_post_split-index = i_file-index.&lt;/P&gt;&lt;P&gt;i_post_split-split_value = w_value / w_total.&lt;/P&gt;&lt;P&gt;i_post_split-flg_noscp = w_flg_noscp.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For daily sorce data which is split daily check that an entry doesnt&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;already exist in the post split table for this date - only the fromdat&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;is checked because for daily split fromdat = todat&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_post_split into w_post_split&lt;/P&gt;&lt;P&gt;with key matnr = i_file-matnr&lt;/P&gt;&lt;P&gt;fromdat = i_file-datum&lt;/P&gt;&lt;P&gt;split_date = t_workdates-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;...an entry exist so add the new value to the existing one and update&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the table record&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;i_post_split-split_value = i_post_split-split_value +&lt;/P&gt;&lt;P&gt;w_post_split-split_value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MODIFY i_post_split from w_post_split index sy-tabix.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;append i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " process_daily&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_range&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If file date is not in forcast range discard&lt;/P&gt;&lt;P&gt;if i_file-datum &amp;lt; w_start or i_file-datum &amp;gt; w_end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-002.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_range&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_uom&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_uom.&lt;/P&gt;&lt;P&gt;*Get the alternative UoM for Material&lt;/P&gt;&lt;P&gt;select single * from marm where matnr = i_file-matnr&lt;/P&gt;&lt;P&gt;and meinh = c_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;w_value = ( i_file-value * ( marm-umren / marm-umrez ) ).&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;w_value = i_file-value.&lt;/P&gt;&lt;P&gt;w_flg_noscp = 'X'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_flg_noscp = 'X'. "jsa01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_uom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_first_day&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the date is not the first of the month, copy to error table, delete&lt;/P&gt;&lt;P&gt;*and end current loop process&lt;/P&gt;&lt;P&gt;if i_file-datum+6(2) &amp;lt;&amp;gt; '01'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-003.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_first_day&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:34:00 PM&amp;amp;#9668;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_monday&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_monday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;datum = i_file-datum&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;wotnr = w_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the day is not a monday, copy to error table, delete&lt;/P&gt;&lt;P&gt;*and end current loop process&lt;/P&gt;&lt;P&gt;if w_day &amp;lt;&amp;gt; 1.&lt;/P&gt;&lt;P&gt;w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;t_exception = i_file.&lt;/P&gt;&lt;P&gt;t_exception-message = text-004.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;delete i_file index w_tabix.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_monday&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form populate_post_split_table&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form populate_post_split_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Sort the uploaded table by material and date&lt;/P&gt;&lt;P&gt;sort i_file by matnr datum.&lt;/P&gt;&lt;P&gt;loop at i_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform material_internal_format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*clear loop variables&lt;/P&gt;&lt;P&gt;clear: w_hiper,&lt;/P&gt;&lt;P&gt;w_fuper,&lt;/P&gt;&lt;P&gt;w_count,&lt;/P&gt;&lt;P&gt;w_error,&lt;/P&gt;&lt;P&gt;w_fromdat,&lt;/P&gt;&lt;P&gt;w_todat,&lt;/P&gt;&lt;P&gt;w_flg_noscp,&lt;/P&gt;&lt;P&gt;t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Clear the contents of the internal table which holds work days&lt;/P&gt;&lt;P&gt;refresh: t_workdates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If plant radiobutton is set&lt;/P&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the material/plant combination&lt;/P&gt;&lt;P&gt;perform check_material using c_werks_1000 c_pltyp_805.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the material/plant combination&lt;/P&gt;&lt;P&gt;perform check_material using c_werks_1005 c_pltyp_810.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the uploaded file is in monthly format&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the record is for the first day of the month&lt;/P&gt;&lt;P&gt;perform check_first_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the value is within the range for the infotype&lt;/P&gt;&lt;P&gt;perform check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that an 'SCP' unit of measure exists and convert value&lt;/P&gt;&lt;P&gt;perform check_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Otherwise if the file is in weekly format&lt;/P&gt;&lt;P&gt;elseif rb_week = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that the record corresponds to a monday&lt;/P&gt;&lt;P&gt;perform check_monday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the value is within the range for the infotype&lt;/P&gt;&lt;P&gt;perform check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that an 'SCP' unit of measure exists and convert value&lt;/P&gt;&lt;P&gt;perform check_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check the value is within the range for the infotype&lt;/P&gt;&lt;P&gt;perform check_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error = 'X'.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Check that an 'SCP' unit of measure exists and convert value&lt;/P&gt;&lt;P&gt;perform check_uom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If split monthly flag has been chosen&lt;/P&gt;&lt;P&gt;if rb_spmon = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Process value using split monthly process&lt;/P&gt;&lt;P&gt;perform process_monthly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Otherwise, if weekly split&lt;/P&gt;&lt;P&gt;elseif rb_spwk = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Process value using split weekly process&lt;/P&gt;&lt;P&gt;perform process_weekly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Otherwise daily split&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Process value using split daily process&lt;/P&gt;&lt;P&gt;perform process_daily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " populate_post_split_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_idoc&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build and submit the idoc for processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form post_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the logical system for ALE processing&lt;/P&gt;&lt;P&gt;perform get_ale_data.&lt;/P&gt;&lt;P&gt;check not logsys is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate the IDOC control record&lt;/P&gt;&lt;P&gt;perform build_control_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Sort the data by material, date and value&lt;/P&gt;&lt;P&gt;sort i_post_split by matnr datum value fromdat todat split_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build idocs and post them&lt;/P&gt;&lt;P&gt;loop at i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: e1lipp0,&lt;/P&gt;&lt;P&gt;t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Move i_post_split header to a work area&lt;/P&gt;&lt;P&gt;w_post_split = i_post_split.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at new datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: e1lipm0, e1lipv0, t_edidd.&lt;/P&gt;&lt;P&gt;refresh t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the general characteristic segment&lt;/P&gt;&lt;P&gt;perform build_e1lipm0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the general version segment&lt;/P&gt;&lt;P&gt;perform build_e1lipv0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Build the performance measure segment&lt;/P&gt;&lt;P&gt;perform build_e1lipp0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Submit IDOC for inbound processing&lt;/P&gt;&lt;P&gt;perform submit_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_idoc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:34:22 PM&amp;amp;#9668;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form submit_idoc&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start inbound processing of IDOC&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form submit_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'IDOC_WRITE_AND_START_INBOUND'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_edidc = edidc&lt;/P&gt;&lt;P&gt;do_commit = 'X'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;docnum = w_docnum&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;i_edidd = t_edidd&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;idoc_not_saved = 1&lt;/P&gt;&lt;P&gt;others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERSION_EXIT_ALPHA_OUTPUT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;input = w_docnum&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;output = w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform check_idoc_status_records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;t_exception-index = w_post_split-index.&lt;/P&gt;&lt;P&gt;t_exception-matnr = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;t_exception-datum = w_post_split-datum.&lt;/P&gt;&lt;P&gt;t_exception-message = t_edids-statxt.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If the no SCP UoM flag is set, write an entry to exception table&lt;/P&gt;&lt;P&gt;if w_post_split-flg_noscp = 'X'.&lt;/P&gt;&lt;P&gt;t_exception-index = w_post_split-index.&lt;/P&gt;&lt;P&gt;t_exception-matnr = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;t_exception-datum = w_post_split-datum.&lt;/P&gt;&lt;P&gt;t_exception-value = w_post_split-value.&lt;/P&gt;&lt;P&gt;t_exception-docnum = w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_exception-message = text-005.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " write_idoc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_control_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Build the IDOC control record&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_control_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear edidc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-idoctp = 'SOPGEN01'. " Basic type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;edidc-mestyp = c_mestyp_805. " Message type&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;edidc-mestyp = c_mestyp_810. " Message type&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-rcvprt = c_rcvprt. " Partner type of receiver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate 'SAP' sy-sysid(3) into edidc-rcvpor. " Receiver port&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate sy-sysid(3) 'CLNT' sy-mandt into edidc-rcvprn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-direct = '2'. " Inbound&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate 'SAP' sy-sysid(3) into edidc-sndpor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edidc-sndprt = c_sndprt. " Partner type of sender&lt;/P&gt;&lt;P&gt;edidc-sndprn = c_sndprn. " Partner number of sender&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_control_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form get_ale_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get logical system for ALE processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_ale_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'OWN_LOGICAL_SYSTEM_GET'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;own_logical_system = logsys&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;own_logical_system_not_defined = 1&lt;/P&gt;&lt;P&gt;others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;clear logsys.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " get_ale_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_e1lipv0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create the general version segment&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_e1lipv0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipv0-vrsio = 'A00'.&lt;/P&gt;&lt;P&gt;e1lipv0-avrsi = 'X'.&lt;/P&gt;&lt;P&gt;e1lipv0-vetxt = 'Active Version'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move e1lipv0 to t_edidd-sdata.&lt;/P&gt;&lt;P&gt;move 'E1LIPV0' to t_edidd-segnam.&lt;/P&gt;&lt;P&gt;t_edidd-hlevel = '02'.&lt;/P&gt;&lt;P&gt;append t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " send_idoc&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_e1lipm0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_e1lipm0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipm0-vontg = w_post_split-fromdat.&lt;/P&gt;&lt;P&gt;e1lipm0-bistg = w_post_split-todat.&lt;/P&gt;&lt;P&gt;e1lipm0-perio = '0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;e1lipm0-m01 = c_werks_1000.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;e1lipm0-m01 = c_werks_1005.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipm0-m02 = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;e1lipm0-m03 = 'SCP'.&lt;/P&gt;&lt;P&gt;e1lipm0-m06 = 'T'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move e1lipm0 to t_edidd-sdata.&lt;/P&gt;&lt;P&gt;move 'E1LIPM0' to t_edidd-segnam.&lt;/P&gt;&lt;P&gt;t_edidd-hlevel = '01'.&lt;/P&gt;&lt;P&gt;append t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_e1lipm0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form build_e1lipp0_segment&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_e1lipp0_segment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e1lipp0-sptag = w_post_split-split_date.&lt;/P&gt;&lt;P&gt;if rb_mgx = 'X'.&lt;/P&gt;&lt;P&gt;e1lipp0-kz02 = w_post_split-split_value.&lt;/P&gt;&lt;P&gt;e1lipp0-kz03 = '/'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;e1lipp0-kz02 = '/'.&lt;/P&gt;&lt;P&gt;e1lipp0-kz03 = w_post_split-split_value.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move e1lipp0 to t_edidd-sdata.&lt;/P&gt;&lt;P&gt;move 'E1LIPP0' to t_edidd-segnam.&lt;/P&gt;&lt;P&gt;t_edidd-hlevel = '03'.&lt;/P&gt;&lt;P&gt;append t_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_e1lipp0_segment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_idoc_status_records&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_idoc_status_records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: t_edids.&lt;/P&gt;&lt;P&gt;refresh: t_edids.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from edids into table t_edids where docnum = w_docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_edids.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: w_statva.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single statva from stacust into w_statva&lt;/P&gt;&lt;P&gt;where status = t_edids-status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case w_statva.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*When the status group is of type 'E' or 'F'.&lt;/P&gt;&lt;P&gt;when 'E' or 'F'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_exception-value = w_post_split-value.&lt;/P&gt;&lt;P&gt;t_exception-index = w_post_split-index.&lt;/P&gt;&lt;P&gt;t_exception-matnr = w_post_split-matnr.&lt;/P&gt;&lt;P&gt;t_exception-datum = w_post_split-datum.&lt;/P&gt;&lt;P&gt;t_exception-docnum = w_docnum_no_zero.&lt;/P&gt;&lt;P&gt;t_exception-message = t_edids-statxt.&lt;/P&gt;&lt;P&gt;append t_exception.&lt;/P&gt;&lt;P&gt;w_error = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when others.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if w_error is initial.&lt;/P&gt;&lt;P&gt;add 1 to w_count_idoc_posted.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;add 1 to w_count_idoc_errors.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_idoc_status_records&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;12:34:35 PM&amp;amp;#9668;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form rename_file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Form to rename file&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form rename_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: l_filename_new(120), " New filename&lt;/P&gt;&lt;P&gt;l_filename_temp(120), " Temporary filename&lt;/P&gt;&lt;P&gt;l_command(250), " Unix command line&lt;/P&gt;&lt;P&gt;w_extension(14).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move p_file to l_filename_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Replace the file extension of the file to indicate that it has been&lt;/P&gt;&lt;P&gt;*processed&lt;/P&gt;&lt;P&gt;concatenate '.proc_' sy-datum into w_extension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace '.txt' with w_extension into l_filename_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create UNIX rename command&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;concatenate 'mv' p_file l_filename_new&lt;/P&gt;&lt;P&gt;into l_command separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create temporary unique file name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;concatenate p_file 'TEMP'&lt;/P&gt;&lt;P&gt;into l_filename_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move l_filename_new to p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Open temporary dataset but use the filter command to execute the UNIX&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;rename command 'mv'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This method has been used instead of SAP external commands because&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of file length limitations. The external command only allows a line of&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;128 chars which means filenames can only be about 62chars when doing&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;a move i.e. mv &amp;lt;file1&amp;gt; &amp;lt;file2&amp;gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;open dataset l_filename_temp for output filter l_command.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-007.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Close the temporary dataset&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;close dataset l_filename_temp.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-007.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delete the temporary dataset&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;delete dataset l_filename_temp.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-007.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " rename_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form material_internal_format&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form material_internal_format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERSION_EXIT_ALPHA_INPUT'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;input = i_file-matnr&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;output = i_file-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " material_internal_format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form error_report&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form error_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format color col_normal.&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;*Loop at exception table and output contents&lt;/P&gt;&lt;P&gt;loop at t_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / t_exception-index,&lt;/P&gt;&lt;P&gt;t_exception-matnr,&lt;/P&gt;&lt;P&gt;24 t_exception-datum,&lt;/P&gt;&lt;P&gt;t_exception-value right-justified,&lt;/P&gt;&lt;P&gt;t_exception-docnum,&lt;/P&gt;&lt;P&gt;t_exception-message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if t_exception[] is initial.&lt;/P&gt;&lt;P&gt;message s005(z1) with text-s01.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;message s005(z1) with text-s02.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format reset.&lt;/P&gt;&lt;P&gt;write : /40 text-eor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " error_report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form check_file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form check_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*The source format in the report selection should match the upload file&lt;/P&gt;&lt;P&gt;*naming conventions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*start of insert - mpc01&lt;/P&gt;&lt;P&gt;if not t_filelist is initial.&lt;/P&gt;&lt;P&gt;refresh: t_filelist.&lt;/P&gt;&lt;P&gt;clear: t_filelist.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;split p_file at '/' into table t_filelist.&lt;/P&gt;&lt;P&gt;describe table t_filelist lines sy-tabix.&lt;/P&gt;&lt;P&gt;sy-tabix = sy-tabix - 1.&lt;/P&gt;&lt;P&gt;delete t_filelist from 1 to sy-tabix.&lt;/P&gt;&lt;P&gt;read table t_filelist index 1.&lt;/P&gt;&lt;P&gt;*end of insert - mpc01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case t_filelist-name(1).&lt;/P&gt;&lt;P&gt;when 'M'.&lt;/P&gt;&lt;P&gt;if rb_month &amp;lt;&amp;gt; 'X'.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-t15.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when 'W'.&lt;/P&gt;&lt;P&gt;if rb_week &amp;lt;&amp;gt; 'X'.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-t16.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when 'D'.&lt;/P&gt;&lt;P&gt;if rb_daily &amp;lt;&amp;gt; 'X'.&lt;/P&gt;&lt;P&gt;message e005(z1) with text-t17.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " check_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form top_of_page&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FORMAT COLOR COL_HEADING INTENSIFIED OFF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;format reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START PKA01&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if rb_1000 = 'X'.&lt;/P&gt;&lt;P&gt;write: / 'Plant: ', 25 c_werks_1000.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / 'Plant: ', 25 c_werks_1005.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_mgx = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t02, 25 'MGX'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / text-t02, 25 'Other'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_month = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t03, 25 'Monthly'.&lt;/P&gt;&lt;P&gt;elseif rb_week = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t03, 25 'Weekly'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / text-t03, 25 'Daily'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if rb_spmon = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t04, 25 'Month'.&lt;/P&gt;&lt;P&gt;elseif rb_spwk = 'X'.&lt;/P&gt;&lt;P&gt;write: / text-t04, 25 'Weekly'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write: / text-t04, 25 'Daily'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'Number of records uploaded: ', w_count_recs_uploaded.&lt;/P&gt;&lt;P&gt;write: / 'Number of IDOCs posted : ', w_count_idoc_posted.&lt;/P&gt;&lt;P&gt;write: / 'Number of IDOC errors : ', w_count_idoc_errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write: / 'File: ', p_file.&lt;/P&gt;&lt;P&gt;skip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format color col_heading intensified on.&lt;/P&gt;&lt;P&gt;uline.&lt;/P&gt;&lt;P&gt;write: /6 'File',&lt;/P&gt;&lt;P&gt;13 'Material',&lt;/P&gt;&lt;P&gt;24 'Forecast',&lt;/P&gt;&lt;P&gt;40 'Value',&lt;/P&gt;&lt;P&gt;46 'IDOC',&lt;/P&gt;&lt;P&gt;67(70) 'Error '.&lt;/P&gt;&lt;P&gt;write: /6 'Index',&lt;/P&gt;&lt;P&gt;13 'Number',&lt;/P&gt;&lt;P&gt;24 'Date',&lt;/P&gt;&lt;P&gt;67(70) 'Message'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format color col_heading intensified off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " top_of_page&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2007 10:07:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759472#M642311</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-14T10:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759473#M642312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;define internal table. e.g. it_data &amp;amp; follow the steps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************&lt;/P&gt;&lt;P&gt;PARAMETERS: p_rfname LIKE rlgrap-filename OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_rfname.&lt;/P&gt;&lt;P&gt;  PERFORM get_desktop_file_help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Form  get_desktop_file_help&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM get_desktop_file_help.&lt;/P&gt;&lt;P&gt;  DATA : v_file LIKE rlgrap-filename.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      program_name  = syst-repid&lt;/P&gt;&lt;P&gt;      dynpro_number = syst-dynnr&lt;/P&gt;&lt;P&gt;      field_name    = 'P_RFNAME'&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      file_name     = v_file&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      mask_too_long = 1&lt;/P&gt;&lt;P&gt;      OTHERS        = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE i368(00) WITH 'Enter Correct File'.&lt;/P&gt;&lt;P&gt;    STOP.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    MOVE : v_file TO p_rfname.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " get_desktop_file_help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM upload_file_from_desktop CHANGING g_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Form  upload_file_from_desktop&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM upload_file_from_desktop CHANGING p_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT sy-batch IS INITIAL.&lt;/P&gt;&lt;P&gt;    MESSAGE e368(00) WITH 'Files can only be uploaded'&lt;/P&gt;&lt;P&gt;                          'in foreground'.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                = p_rfname&lt;/P&gt;&lt;P&gt;        filetype                = 'DAT'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        data_tab                = it_data&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        conversion_error        = 1&lt;/P&gt;&lt;P&gt;        invalid_table_width     = 2&lt;/P&gt;&lt;P&gt;        invalid_type            = 3&lt;/P&gt;&lt;P&gt;        no_batch                = 4&lt;/P&gt;&lt;P&gt;        unknown_error           = 5&lt;/P&gt;&lt;P&gt;        gui_refuse_filetransfer = 6&lt;/P&gt;&lt;P&gt;        OTHERS                  = 7.&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;      MESSAGE i368(00) WITH 'Error while reading data from file'.&lt;/P&gt;&lt;P&gt;      MOVE : 'X' TO p_error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM.                    "upload_file_from_desktop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2007 10:12:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759473#M642312</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-14T10:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759474#M642313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first get the local file by using f4 help..Remove the FM'S FILE_GET_NAME.and also code related to appication server..rest evrything remains same&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS :  p_file TYPE rlgrap-filename .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'F4_FILENAME'"#EC *&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      PROGRAMNAME      = SY-REPID&lt;/P&gt;&lt;P&gt;      DYNPRO_NUMBER    = SY-DYNNR&lt;/P&gt;&lt;P&gt;      FIELD_NAME       = P_FILE. &lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      filename         = pv_file&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      inv_winsys       = 1&lt;/P&gt;&lt;P&gt;      no_batch         = 2&lt;/P&gt;&lt;P&gt;      selection_cancel = 3&lt;/P&gt;&lt;P&gt;      selection_error  = 4&lt;/P&gt;&lt;P&gt;      OTHERS           = 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0 AND sy-subrc &amp;lt;&amp;gt; 3.&lt;/P&gt;&lt;P&gt;    MESSAGE i134.&lt;/P&gt;&lt;P&gt;    LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PV_FILE will be the file selected from presentation server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now call the FM &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      filename                = PV_FILE&lt;/P&gt;&lt;P&gt;      filetype                = c_asc&lt;/P&gt;&lt;P&gt;      has_field_separator     = c_x&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data_tab                = i_temp&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      file_open_error         = 1&lt;/P&gt;&lt;P&gt;      file_read_error         = 2&lt;/P&gt;&lt;P&gt;      no_batch                = 3&lt;/P&gt;&lt;P&gt;      gui_refuse_filetransfer = 4&lt;/P&gt;&lt;P&gt;      invalid_type            = 5&lt;/P&gt;&lt;P&gt;      no_authority            = 6&lt;/P&gt;&lt;P&gt;      unknown_error           = 7&lt;/P&gt;&lt;P&gt;      bad_data_format         = 8&lt;/P&gt;&lt;P&gt;      header_not_allowed      = 9&lt;/P&gt;&lt;P&gt;      separator_not_allowed   = 10&lt;/P&gt;&lt;P&gt;      header_too_long         = 11&lt;/P&gt;&lt;P&gt;      unknown_dp_error        = 12&lt;/P&gt;&lt;P&gt;      access_denied           = 13&lt;/P&gt;&lt;P&gt;      dp_out_of_memory        = 14&lt;/P&gt;&lt;P&gt;      disk_full               = 15&lt;/P&gt;&lt;P&gt;      dp_timeout              = 16&lt;/P&gt;&lt;P&gt;      OTHERS                  = 17.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; File not found.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    MESSAGE e138.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now data will be uploaded to the internal table i_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2007 10:18:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759474#M642313</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2007-09-14T10:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: gui_upload</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759475#M642314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;could u observe my code and pls build the code accordingly at proper place and send me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2007 10:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload/m-p/2759475#M642314</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-14T10:18:59Z</dc:date>
    </item>
  </channel>
</rss>

