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

Creating output file!!

Former Member
0 Likes
462

If CB_BORD(check box) is marked, then an output file must be created (with path to local file).

- Create a structure to fill and transfer it to output file

for this how shall i go abt?

since file path will b provided....and data needs to be downloaded in that file in certain format!!

Regards

Gunjan

If CB_BORD(check box) is marked, then an output file must be created (with path to local file).

- Create a structure to fill and transfer it to output file

for this how shall i go abt?

since file path will b provided....and data needs to be downloaded in that file in certain format!!

Regards

Gunjan

2 REPLIES 2
Read only

Former Member
0 Likes
335

HI

if not cb_bord is initial.

   CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
       FILENAME                        = l_file
     TABLES
       DATA_TAB                        = itab
    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.
   
endif.

Note that 1. L_FILE should be declared of type string which holds the path for local directory,
          2. ITAB is the internal table which holds the data.

Kind Regards

Eswar

Read only

Former Member
0 Likes
335

TRY LIKE THIS CODE.

tables : mara.

data :BEGIN OF ITAB OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MATKL LIKE MARA-MATKL,

END OF ITAB.

select MATNR MTART MATKL FROM MARA INTO CORRESPONDING FIELDS OF TABLE

ITAB UP TO 10 ROWS

.

IF CB_BORD = 'X'.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

FILENAME = 'C:\SPD1.TXT'

FILETYPE = 'ASC'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = itab

  • FIELDNAMES =

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDIF.