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

data read from text file(notepad) not enterd into particular field

Hi frends, I have used function "F4_FILENAME" and "GUI_UPLOAD" to upload a text file in notepad on my desktop to an internal table in SAP.after that i used the folowing code line to copy data from one table to other:

" insert tab2 from table itab accepting duplicate keys. "

But my problem is that in tab2 i have total 5 fields.In notepad file i have written following two words:

achal

mehra

now when i copy the data from itab to tab2 , it shows word "achal" in the field 1 of 1st row and "mehra" in field 1 of 2nd row only.

what i want is to store "a" in field1 "c" in field2 and so on in row 1.

similarly "m" in the second row and field1.

PLZ guide me.I am new to ABAP.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 06:59 AM

    for this you need to pass any delimeter like (|(pipe symbol) or ,(comma) in your notepad. after that in your program use SPLIT command and pass the data to your internal tbale.

    here your notepad fields order and internal table fields order should be the same..

    CALL function gui_upload

    EXPORTING

    filename = pa_price

    filetype = 'ASC'

    CHANGING

    data_tab = gt_file2

    LOOP AT gt_file2 INTO lwa.

    • Split the characters between the separators to individual fields.

    SPLIT lwa_file2 AT pa_sep INTO lwa-filed1

    lwa-filed2

    lwa-filed3

    lwa-filed4.

    APPEND lwa TO itab.

    CLEAR lwa.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2009 at 09:18 AM

    i gt the answer

    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.