Skip to Content
author's profile photo Former Member
Former Member

fm

Hi,

I am creating new fm and i am uploading a file. i use the gui upload fm in the folling way. when i am excuting its going start dump.

plz let me know what i want to do for this....should i want to declare the file name in string and i want pass it r else....plz can onr help me to do slove it....

FUNCTION CLIENT_LOAD .

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(I_PRODUCT) TYPE ZPRODUCT

*" REFERENCE(FILENAME) LIKE RLGRAP-FILENAME DEFAULT SPACE

*" REFERENCE(FILETYPE) LIKE RLGRAP-FILETYPE DEFAULT 'ASC'

*" EXPORTING

*" REFERENCE(RETURN_CODE) TYPE SY-SUBRC

*"----


CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = filename

FILETYPE = 'ASC'

TABLES

DATA_TAB = t_data.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Thanks

Ankitha....

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Nov 21, 2007 at 11:24 AM

    Hi Ankitha..

    GUI_UPLOAD expects the Filename to be of Type STRING.

    So.. Do this way....

    FUNCTION CLIENT_LOAD .

    *"----


    ""Local interface:

    *" IMPORTING

    *" REFERENCE(I_PRODUCT) TYPE ZPRODUCT

    *" REFERENCE(FILENAME) LIKE RLGRAP-FILENAME DEFAULT SPACE

    *" REFERENCE(FILETYPE) LIKE RLGRAP-FILETYPE DEFAULT 'ASC'

    *" EXPORTING

    *" REFERENCE(RETURN_CODE) TYPE SY-SUBRC

    *"----


    <b>DATA: L_FILE TYPE STRING.

    MOVE FILENAME TO L_FILE.

    </b>

    CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

    <b>FILENAME = L_FILE</b>

    FILETYPE = 'ASC'

    TABLES

    DATA_TAB = t_data.

    IF SY-SUBRC <> 0.

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

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

      ENDIF.

      <b>reward if Helpful.</b>

      Add a comment
      10|10000 characters needed characters exceeded

    • author's profile photo Former Member
      Former Member
      Posted on Nov 21, 2007 at 08:02 AM

      Hi Ankitha,

      The file which you are uploading and Internal table t_data might not be compatible. Either maintain the file data in the same order as t_data or change the order of fields in internal table as per the file structure.

      Regards,

      Satish

      Add a comment
      10|10000 characters needed characters exceeded

    • Posted on Nov 21, 2007 at 09:15 AM

      Hi Ankitha,

      you can pass the file name in either way...

      ex.

      File = 'C:\RG1.TXT'

      CALL FUNCTION 'GUI_UPLOAD'

      EXPORTING

      FILENAME = L_FILE

      OR

      CALL FUNCTION 'GUI_UPLOAD'

      EXPORTING

      FILENAME = 'C:\RG1.TXT'

      and make sure the structure on itab is same as that of file.

      Sachin

      Add a comment
      10|10000 characters needed characters exceeded

    Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.