Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10548

Re: How To UPLOAD a DATA (.DAT) fiel from PC to internal table and then split it into the data different columns

$
0
0

Uploading data from a flat file,which has delimiters other than tab.

 

FM GUI_UPLOAD supports flat files which are TAB delimited.other than TAB, if any other delimiters is used, then following programming technique used to upload data into internal table.

 

 

for example if the flat file have values like

1317,0001,0001

1318,0001,0001

1319,0001,0001

 

 

REPORT ZUPLOAD.

 

DATA : BEGIN OF ITAB1 OCCURS 1,

FLD(80),

END OF ITAB1.

 

 

 

DATA : BEGIN OF ITAB OCCURS 1,

F1 TYPE LIFNR,

F2 TYPE EKORG,

F3 TYPE KTOKK,

END OF ITAB.

 

 

 

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME     =     'D:\ VENDORS1.TXT'

FILETYPE     =     'ASC'

HAS_IELD_SEPRATOR      =     ITAB1.

 

 

LOOP AT ITAB1.

WRITE :/ ITAB1-FLD.

ENDLOOP.

 

 

SKIP.

 

 

LOOP AT ITAB1.

SPLIT ITAB1-FLD AT  ',' INTO ITAB-F1 ITAB-F2 ITAB-F3.

APPEND ITAB.

ENDLOOP.

 

 

SKIP.

 

 

LOOP AT ITAB.

WRITE :/ ITAB-F1, ITAB-F2, ITAB-F3.

ENDLOOP.

 

 

 

OUTPUT.

 

1317     0001     0001

1318     0001     0001

1319     0001     0001

 

 

 

Regards.

RV Karthikeyan


Viewing all articles
Browse latest Browse all 10548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>