Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adding 2 Files

Former Member
0 Likes
850

Hie guys i have this scenario.I am downloading a file to a local server,but now i want a scenario whereby each time i run the program,the file should add to the existing file(append).For history sake ,at the end of the week i need a composite file which constitute all the daily runs.

please help with sample code. I am using the GUI_Download function .Add fro internal tables.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
823

in GUI_DOWNLOAD FM there is an option APPEND , give that value as X

6 REPLIES 6
Read only

Former Member
0 Likes
824

in GUI_DOWNLOAD FM there is an option APPEND , give that value as X

Read only

0 Likes
823

i am getting Exception condition "CONTROL_FLUSH_ERROR" raised.

Error analysis

A RAISE statement in the program "SAPLSFES " raised the exception

condition "CONTROL_FLUSH_ERROR".

Since the exception was not intercepted by a superior program

in the hierarchy, processing was terminated.

Short description of exception condition:

For detailed documentation of the exception condition, use

Transaction SE37 (Function Library). You can take the called

function module from the display of active calls.

Read only

Former Member
0 Likes
823

I am getting :Exception condition "CONTROL_FLUSH_ERROR" raised.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'C:\SAP\SD_INTERFACE.TXT'

  • FILETYPE = 'ASC'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = IT_FILE.

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

0 Likes
823

Hi

U should use the EXCEPTIONS of GUI_DOWNLOAD to avoid the dump.

Anyway we can't know why that exception is raised, u haveing some problems on your frontend control, so perhaps some gui problem:

CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
          FILENAME                = 'C:SAPSD_INTERFACE.TXT'
     TABLES
          DATA_TAB                = IT_FILE
     EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21 "<-------------
          OTHERS                  = 22.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Max

Read only

0 Likes
823

I guess the exception is raised because of APPEND .

How many records are there in your file each time you you run the program, I guess as the number of records are increased hugely it is giving that error

Read only

0 Likes
823

Hi,

Kindly follow the steps

1. Using GUI_UPLOAD, you first upload the downloaded file.

2.Then append your data to the same internal table to which you have just uploaded the file.

3. Then use GUI_DOWNLOAD with the same file name so that it will replace the existing one.

Validation: Make sure there is data into the internal table while downloading.Otherwise file will be gone..

Note: If ur prob solves,Kindly appreciate with points

Regards,

Rushikesh