11-21-2007 7:23 AM
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....
11-21-2007 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>
11-21-2007 8: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
11-21-2007 9: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
11-21-2007 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>