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

Converting output file format

Former Member
0 Likes
688

hello all,

i m transferring data to application server from a Z program and it is transferring successfully but problem is that it is coming in single row while i have to take it in multiple rows. please help.

my ITAB value is like :

INV123 test1 desc set2 INV222 test2 desc2 set3 INV333 test3 desc3 set4 INV444 test4 desc5 set6

it is giving same in output also.

while i need in output as it will start from new row with every INV :

INV123 test1 desc set2

INV222 test2 desc2 set3

INV333 test3 desc3 set4

INV444 test4 desc5 set6

regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
637

Hi,

Try in some thing like this..


LOOP AT ITAB.
wf_rest = itab-line.
while not wf_rest is initial.
 split wf_Rest at space into wf_temp and wf_rest.
if wf_temp cs 'INV*'.
 append itab2.
 clear itab2.
 ENDIF.
concatenate itab2-line wf_temp into itab2-line separated by space.
ENDDO.
 append itab2.
 clear itab2.

ENDLOOP.

Nag

5 REPLIES 5
Read only

Former Member
0 Likes
638

Hi,

Try in some thing like this..


LOOP AT ITAB.
wf_rest = itab-line.
while not wf_rest is initial.
 split wf_Rest at space into wf_temp and wf_rest.
if wf_temp cs 'INV*'.
 append itab2.
 clear itab2.
 ENDIF.
concatenate itab2-line wf_temp into itab2-line separated by space.
ENDDO.
 append itab2.
 clear itab2.

ENDLOOP.

Nag

Read only

0 Likes
637

hi nag,

thanx for reply, actually my ITAB is without header line so it dont have any field like LINE so please help me that how can i break it at particullar point and append it in new ITAB?

ITAB has Value :

INVSUM;071;5013315;;1500;2;100104;21.12.2009;. .;1;1;SGD;USD;;;1.000.000,000;0000000000000;C_BPRATAMA;21.12.2009;;;A;G;N;04.01.2010;INVPO;613313;00.00.0000;INVLIN;001;0000000;613313;00001;000000000000900001;TEST;0,00;0,00;0,00;CS;5;1.000.000,000;SG;;INVCMT;;INVSCMT;;00000;;000;

and i have to separate it at INV and have to append it to new internal table.

regards.

Read only

0 Likes
637

Hi,

Declare work_area type ITAB.

and while split using ";" as that is separator in your line

and rest of logic remains as it is...

sample code


LOOP AT ITAB *INTO WF_WORKAREA*.
wf_rest = WF_WORKARE.
while not wf_rest is initial.
 split wf_Rest at space into wf_temp and wf_rest.
if wf_temp cs 'INV*'.
 append itab2.
 clear itab2.
 ENDIF.
concatenate itab2-line wf_temp into itab2-line separated by ';'.  " changed
ENDDO.
 append itab2.
 clear itab2.
 
ENDLOOP.

Nag

Read only

0 Likes
637

hello naga,

then how would i define wf_rest & wf_temp ? because when i m declaring it as type C and Type String then it is throwing an error.

please seggest.

regards.

Read only

0 Likes
637

Hi,

can you please post your internal table declaration.. it should not give any problem for Type string (infact .. should be type string)

Nag