Skip to Content
author's profile photo
Former Member

about downloading the file

hi

i have this coding

DATA : BEGIN OF ITAB OCCURS 0,

MATNR LIKE MARA-MATNR,

ERNAM LIKE MARA-ERNAM,

END OF ITAB.

DATA: v_file TYPE string.

PARAMETER : P_FILE TYPE RLGRAP-FILENAME.

SELECT MATNR ERNAM FROM MARA INTO TABLE ITAB.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

PERFORM UPLOAD.

START-OF-SELECTION.

V_FILE = P_FILE.

PERFORM UPLOAD1.

FORM UPLOAD.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_FILE'

IMPORTING

FILE_NAME = P_FILE

.

ENDFORM.

FORM UPLOAD1.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_FILENAME = 'V_FILE'

DEF_PATH = ' '

  • MASK = ' '

  • MODE = ' '

  • TITLE = ' '

  • IMPORTING

  • FILENAME =

  • RC =

  • EXCEPTIONS

  • INV_WINSYS = 1

  • NO_BATCH = 2

  • SELECTION_CANCEL = 3

  • SELECTION_ERROR = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

FILENAME = 'V_FILE'

FILETYPE = 'DAT'

MODE = 'A'

  • 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.

ENDFORM.

in this coding i can download the itab , after the selecting the file from selectionscreen , it storing the itab in another file , WHY IT IS LIKE THAT

PLS HELP ON THIS MATTER

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Posted on Aug 23, 2007 at 12:04 PM

    Hii..

    Jamshad...

    You have to Pass the FileName as Variable (So V_File should not be in Single Quotes)

    Check it Below : Changes are in BOLD....

    And one more thing Use GUI_DOWNLOAD instead of WS_DOWNLOAD(which is obselete)

    FORM UPLOAD1.

    CALL FUNCTION 'WS_FILENAME_GET'

    EXPORTING

    <b>DEF_FILENAME = V_FILE</b>

    DEF_PATH = ' '

    • MASK = ' '

    • MODE = ' '

    • TITLE = ' '

    • IMPORTING

    • FILENAME =

    • RC =

    • EXCEPTIONS

    • INV_WINSYS = 1

    • NO_BATCH = 2

    • SELECTION_CANCEL = 3

    • SELECTION_ERROR = 4

    • OTHERS = 5

    .

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    CALL FUNCTION 'WS_DOWNLOAD'

    EXPORTING

    • BIN_FILESIZE = ' '

    • CODEPAGE = ' '

    <b>FILENAME = V_FILE</b>

    FILETYPE = 'DAT'

    MODE = 'A'

    • 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.

    ENDFORM.

    <b>Reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 23, 2007 at 11:53 AM

    If you want to upload the file, use FM 'GUI_UPLOAD' instead of WS_DOWNLOAD.

    If you want to download the file, use FM 'GUI_DOWNLOAD'

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      If you are familiar with ABAP objects, try these methods:

      CALL METHOD cl_gui_frontend_services=>gui_upload

      CALL METHOD cl_gui_frontend_services=>gui_download

      Arne

  • author's profile photo
    Former Member
    Posted on Aug 23, 2007 at 12:07 PM

    Hi Jamshad,

    I didn't understand ' in another file'. Can u clarify me what do u mean by storing itab in another file..

    Regards,

    Sai

    Add comment
    10|10000 characters needed characters exceeded