Application Development and Automation 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: 
Read only

pls help

Former Member
0 Likes
803

hi all,

Im loading sales transaction in text format where roughly containing 1000 lines, and its going to run in background every night using BAPI.

The inbound file looks like these:

I,"20050808","ZA","10","customer po".

I am facing difficulty to map those each field to my internal table as the actual data looks funny with the code " ".

For your information, as per requirement, we cant change the text format, thats the current format that has to be read from server and loaded to transaction code VA01.

What is the quickes way to remove the code " "? Any idea will be really helpful.

many thanks.

Alia

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
779

Hi,

try this:

1) read file into wa

2) manipulate every field of your wa with :

assign component sy-index of structure wa to <f>.
   translate <f> using '" '.
   shift <f> by 1 places left.

Andreas

6 REPLIES 6
Read only

Former Member
0 Likes
779

Alia,

Did you try this in your program that picks up the file? Before passing to the BAPI use the REPLACE command and removed the "".

REPLACE

[ FIRST OCCURRENCE OF | ALL OCCURRENCES OF ]

[ SUBSTRING ] old

IN [ SECTION OFFSET off LENGTH len OF ] text

WITH new.

Regards,

Ravi

Read only

Former Member
0 Likes
779

The following may help you

split <C> at <del> into C1 C2 C3...

The system searches the field <c> for the separator <del>. The parts before and after the separator are placed in the target fields <c1> ... <cn>.

To place all fragments in different target fields, you must specify enough target fields. Otherwise, the last target field is filled with the rest of the field <c> and still contains delimiters.

You can use ' " ' in place of <del>

Read only

guillaume-hrc
Active Contributor
0 Likes
779

Make sure that your business do not use the code " " as content for the fields !! Otherwise, the REPLACE statement could be hazardous...

One way to do it would be to use the SPLIT ... INTO TABLE statement to cut each line on the "," character and then remove the leading and tailing code " " for each entry in the table.

That is not ideal anyway, for the coma is much more often used in the data that the code " "

Read only

andreas_mann3
Active Contributor
0 Likes
780

Hi,

try this:

1) read file into wa

2) manipulate every field of your wa with :

assign component sy-index of structure wa to <f>.
   translate <f> using '" '.
   shift <f> by 1 places left.

Andreas

Read only

0 Likes
779

Hi,

Many thanks for all. I will try to manipulate in the loop.

alia

Read only

0 Likes
779

Alia,

Please do NOT forget to reward points. It is one of the motivation factors we all have to answer queries.

Regards,

Ravi