‎2009 Mar 09 4:08 AM
hello gurus,
I got output of a report as bellow.
.
sl no date name state contry
1 10.10.2009 mtm
1 10.10.2009 A1
1 10.10.2009 abc
1 10.10.2009 b1
1 10.10.2009 c1
but my required output is.
sl no date name state contry
1 10.10.2009 A1 mtm ABC
1 10.10.2009 B1
1 10.10.2009 C1
.
can any body tell me how to change the format.
my internal table data contains as displayed output only.
so i need to do operations at internal table level to get the required output.
thanks,
padmaja.
Edited by: padmaja vaddi on Mar 9, 2009 5:09 AM
‎2009 Mar 09 4:11 AM
Hi Padmaja,
while filling your final internal table you need to separate the State and Country fields only based on your date..
Thanks!
Edited by: Prasanth on Mar 9, 2009 9:44 AM
‎2009 Mar 09 4:18 AM
Hi Padmaja,
Make use of text elements if your problem is to align them.
Create a text element and write the required field under it like this.
write w_country under text-004.
where text-004 is 'Country'.
Much Regards,
Amuktha.
‎2009 Mar 09 4:19 AM
Hi,
One alternative is to create another internal table (say it_temp) with fields name, state and country.
Select the details in this internal table and take another internal table same as you have declared already with five fields (say it_final) and select only fields sl no, date and name.
Now use code:-
sort it_final by sl_no date name.
sort it_temp by name.
loop at it_final.
read table it_temp with key name = it_final-name.
if sy-subrc eq 0.
it_final-state = it_temp-state.
it_final-country = it_temp-country.
modify it_final index sy-tabix.
endif.
clear it_temp.
clear it_final.
endloop.
Hope this helps you.
Regards,
Tarun
‎2009 Mar 09 4:20 AM
hello padma ,
while writing the output allocate necessary space for each table of internal table ,
based on number of characters in internal table for each column reserve the space using write statement
hope it solves problem
‎2009 Mar 09 4:25 AM
Hi Padmaja,
the following procedure woulld help in getting the reqd output.
data: w_idx type i.
loop at itab where state = 'mtm'.
w_idx = sy-tabix.
itab-name = 'A1'.
itab-contry = 'ABC'.
modify table itab index w_idx.
endloop.
Regards,
Mdi.Deeba
‎2009 Mar 09 4:35 AM
Hi Padmaja,
Please see the code below:
itab1[ ] = itab[ ].
sort itab1 comparing date name.
delete adjacent duplicates from itab1.-->itab1 will contain 3 records and itab will contain 5 records
loop at itab1 into wa_itab1.
clear: wa_itab2, wa_itab.
loop at itab into wa_itab where date = wa_itab1-date
name = ' '.
if wa_itab-state is not initial.
wa_itab2-state = wa_itab-state.
endif.
if wa_itab-country is not initial.
wa_itab2-country = wa_itab-country.
endif.
endloop.
wa_itab2-name = wa_itab1-name.
wa_itab2-date = wa_itab1-date.
wa_itab2-sl_no = wa_itab1-sl_no.
append wa_itab2 to itab2.
endloop.
And in the internal table itab2 , u will have the required output.
Keerthi.
‎2009 Mar 09 4:41 AM
Hi,
Check your logic while you are populating your internal table. There is some mistake there.
Otherwise if you want to operations at the internal table only you can do something like this:
while displaying the ouput you will be looping at the internal table. instead of directly displaying it you use variables corresponding to the specific fields, and then:
LOOP AT ITAB.
V_DATE = WA_ITAB-date.
V_NAME = WA_ITAB-name.
V_STATE = WA_ITAB-state.
V_COUNTRY = WA_ITAB-country.
IF V_DATE IS NOT INITIAL AND V_NAME IS NOT INITIAL AND V_STATE IS NOT INITIAL AND V_COUNTRY IS NOT INITIAL.
WRITE: /
V_DATE UNDER 'date',
V_NAME UNDER 'name'
V_STATE UNDER 'state',
V_COUNTRY UNDER 'country'.
ENDIF.
ENDLOOP.
Regards.
Edited by: rajan roy on Mar 9, 2009 5:54 AM
‎2009 Mar 09 5:03 AM
Hi,
How are you getting data into the internal table, we cannot give any code before knowing how the data is populated as it may lead to problems in future by just writing code with respect to the output you have provided us....
hence if you can let us know how you are populating data into the internal table then probably can help you with getting the required output...
Regards,
Siddarth
‎2009 Mar 12 4:21 AM
‎2009 Mar 12 4:21 AM