cancel
Showing results for 
Search instead for 
Did you mean: 

fiel 2 file scenario - avoiding a line

Former Member
0 Kudos
338

hello experts

I have a txt file to txt file scenario.

I would like to know if it is possibleto avoid a specific line in the text file?

for example

I have a files that contains the same architecture:

FILE=S0123123 REPORTS=000

6019, ,024312

6019, ,024313

6019, ,024313

and I would like that the recieving file will contain only:

6019, ,024312

6019, ,024313

6019, ,024313

(to avoid the first line). is it possible to do? how can I avoid the first line

Thanks

Kfir

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

In the FCC specify the Document Offset value as 1.

This will always skip reading the first line from the file.

Thanks

SaNv...

Former Member
0 Kudos

where exactly to set the offset value as 1 in the communication channel

in the file content conversion?

didnt understand exactly where to set the value in which part

santhosh_kumarv
Active Contributor
0 Kudos

>>in the file content conversion?

Yes..

Do the following in the sender file adapter.

1. Select the message protocol as File content conversion

2. Scroll down to the content conversion parameter.

3. Specify the Document Offset value as 1.

Thanks

SaNv...

Former Member
0 Kudos

Thanks for all your help.

but still, my problem is not quite solved. now in the mapping my recieving MT is empty, even though the mapping looks ok (unitest working ok. when putting an XML file and recieving message is empty)

any suggestions?

Answers (3)

Answers (3)

santhosh_kumarv
Active Contributor
0 Kudos

>>(to avoid the first line). is it possible to do? how can I avoid the first line

Set the Document Offset value as 1.

This will always skip reading the first line from the file.

http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Thanks

SaNv...

aashish_sinha
Active Contributor
0 Kudos

Hi,

If i am not wrong, you just wanted that watever come into your target file , just remove the first line if it is starting with

>> FILE=S0123123 REPORTS=000

You can do this with the file adapter option Run Operating System command After Processing. Write a small shell script and add it there. In the Shell script write the logic to remove first line. or make it commented. Try this.

Else write an UDF to remove the line if it starts from FILE. If program finds the FILE kepword directly go to next line and check if it again contain the keyword if no then append whole string to resultset.

Hope this will help you.

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Hi,

Can you please take a small example and expain us with the coding..so that we can try this in our scenario.

Looking fwd for your reply.

Cheers.

sunilchandra007
Active Contributor
0 Kudos

hi.....

You can do that in the mapping itself.

Don't map the field in target structure that is not required.

No need to handle it at adapter level.

Regards,

Chandra

Former Member
0 Kudos

this is what I think that I did and I see the error MSG in RWB

Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR converting document line no. 2 according to structure 'Item':java.lang.Exception: ERROR in configuration: more elements in file csv structure than field names specified

Former Member
0 Kudos

Pick the whole file (all fields) and do the mapping as per you need just disable the field which you want to ignore and also remove the FCC parameters for this field in your Receiver File Adapter and then try. It shuold work.

sunilchandra007
Active Contributor
0 Kudos

kfir,

can u let us know the exact source and target structure being used in ur mapping?

Regards,

Chandra