Application Development 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: 

fm

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

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>

3 REPLIES 3

Former Member
0 Kudos

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

former_member184619
Active Contributor
0 Kudos

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

varma_narayana
Active Contributor
0 Kudos

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>