Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

File length in Background

Hi

i am uploading xml file data from apps to ztable.

In foreground the program is working perfectly. but when i read in background, i am not getting full file hence creating dump.. how to over come this..

Looks like the problem lies in reading the full file.

Does anyone faced this scenario before. Please help me overcome this problem.

In background code is like this:

PARAMETERS: pa_file TYPE PATHINTERN.

l_filename = pa_file.

  • upload a file from the apps

OPEN DATASET l_filename FOR INPUT IN BINARY MODE.

IF sy-subrc <> 0.

write:/ 'Invalid File Path'.

ENDIF.

DO.

READ DATASET l_filename INTO l_xml_line.

IF sy-subrc EQ 0.

APPEND l_xml_line TO l_xml_table.

ELSE.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET l_filename.

and in foreground like below:

PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\BP.xml'.

l_filename = pa_file.

  • upload a file from the client's workstation

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename = l_filename

filetype = 'BIN'

IMPORTING

filelength = l_xml_table_size

CHANGING

data_tab = l_xml_table

EXCEPTIONS

OTHERS = 19.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question