2008 Jan 24 9:11 AM
Hi Experts
In dialog programming, am using table control inwhich i want to upload a text file for each row in a particular field. How to store the text file for a field in the database.
Pls explain me with the example also.
Thanks in advance.
Regards
Rajaram
Hi Experts
In dialog programming, am using table control inwhich i want to upload a text file for each row in a particular field. How to store the text file for a field in the database.
Pls explain me with the example also.
Thanks in advance.
Regards
Rajaram
2008 Jan 24 9:15 AM
Hi Raja,
You just need to use GUI_UPLOAD function module.
There give the path of your .txt file and in tables give the internal table name which you used in the screen.
Thats enough. thing is that, In screen internal tbales values only will display. Thats it.
Example:
DATA: BEGIN OF g_t_itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF g_t_itab.
DATA: g_t_bdcdata TYPE TABLE OF bdcdata.
DATA: path TYPE string,
path1 type string.
path = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test.txt'.
path1 = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test1.txt'.
**************************
*contents of test.txt *
*
*TEST1 ,BOT *
*TEST2 ,BOT *
*TEST3 ,BUT *
**************************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = path
TABLES
data_tab = g_t_itab.
LOOP AT g_t_itab.
WRITE:/1(18) g_t_itab-matnr, 20(40) g_t_itab-maktx.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = path1
filetype = 'ASC'
TABLES
data_tab = g_t_itab.
Reward If Helpful.
Regards
--
Sasidhar Reddy Matli.
Edited by: Sasidhar Reddy Matli on Jan 24, 2008 2:47 PM
2008 Jan 24 9:17 AM
Can you pls provide me the example code for the same.
Regards
Rajaram
2008 Jan 24 9:21 AM
Hello Raja,
Please find the example code.
Example:
DATA: BEGIN OF g_t_itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
END OF g_t_itab.
DATA: g_t_bdcdata TYPE TABLE OF bdcdata.
DATA: path TYPE string,
path1 type string.
path = 'C:\Documents and Settings\ssr3kor\Desktop\TEST\test.txt'.
**************************
*contents of test.txt *
*
*TEST1 ,BOT *
*TEST2 ,BOT *
*TEST3 ,BUT *
**************************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = path
TABLES
data_tab = g_t_itab.
LOOP AT g_t_itab.
WRITE:/1(18) g_t_itab-matnr, 20(40) g_t_itab-maktx.
ENDLOOP.
*CALL FUNCTION 'GUI_DOWNLOAD'
*EXPORTING
*filename = path1
*filetype = 'ASC'
*TABLES
*data_tab = g_t_itab.
Reward If Helpful.
Regards
--
Sasidhar Reddy Matli.
Edited by: Sasidhar Reddy Matli on Jan 24, 2008 2:53 PM
2008 Jan 24 9:23 AM
2008 Jan 24 9:32 AM
Hello Raja,
You should have text file in local disk. You have to give the path of that text file to the function module.
The have given the contents of the text file also in the programs with comments. according to that code which i sent, the text file name should be TEST.txt . In this contents are: material nnumber and description seperated by comma. as matnr having 18 length you shoud give comma after after 18 character along including matnr.
The data will be saved automatically into the internal table through FM. This internal table contents only u r displaying in the screen right...?
Regards
--
Sasidhar Reddy Matli.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |