‎2009 Jan 06 12:14 PM
Hi,
I need to display classical report with following layout
Material Jan Feb march april -
Total
____________________________________________
ABC
SD 10 20 30 60
SE 10 20 30
In my internal table I have month wise data.
How to display it in one line under respective months.
For e.g. in internal table I have two rows of SD with quantity is two different months. Now I need to display this in above format
Please help.
‎2009 Jan 06 12:17 PM
‎2009 Jan 06 12:18 PM
Hi,
Give me the details of the table.
Please give ur requirement clearly.
Thanks.
‎2009 Jan 06 12:18 PM
HI.
Use Under with Write statement
Refer this code.
Table-type output of flight connections.
DATA: carrid TYPE spfli-carrid,
connid TYPE spfli-connid.
WRITE: 10 'Carrier', 40 'Connection'.
ULINE.
SELECT carrid connid
FROM spfli
INTO (carrid,connid).
WRITE: / carrid UNDER 'Carrier',
connid UNDER 'Connection'.
ENDSELECT.
Regards.
Jay
‎2009 Jan 06 12:20 PM
Hi,
I need to display classical report with following layout
Material Jan Feb march april -
Total
____________________________________________
ABC
SD 10 20 30 60
SE 10 20 30
In my internal table I have month wise data.
How to display it in one line under respective months.
For e.g. in internal table I have two rows of SD with quantity is two different months. Now I need to display this in above format
Hi,
suppose itab is ur internal table with fields A = material B= month C = qty
sort itab by A.
loop at itab.
case B.
when 'Jan'.
v_Jan = C.
when 'Feb'.
v_Feb = C.
....
endcase.
at end of A.
write: / A , V_Jan ,v_Feb ......
endat.
endloop.
Edited by: Marcelo Ramos on Jan 6, 2009 11:30 AM
‎2009 Jan 06 12:21 PM
Sorry I copied ur question also before....
pasting again d answer...
Hi,
suppose itab is ur internal table with fields A = material B= month C = qty
sort itab by A.
loop at itab.
case B.
when 'Jan'.
v_Jan = C.
when 'Feb'.
v_Feb = C.
....
endcase.
at end of A.
write: / A , V_Jan ,v_Feb ......
endat.
endloop.
‎2009 Jan 06 12:21 PM
Hello,
What is the structure of your int. table? Please provide it so that we can help.
BR,
Suhas
‎2009 Jan 06 12:25 PM
Hi,
For eg: if you have your itab with fields called month, material , quantity.
then the data would be
Jan ABC 10
Feb abc 30
jan SD 10
feb sd 20
mar sd 30
jan se 10
feb se 20
mar se 60
Then
sort itab by material.
loop at itab assigning <fs_itab>.
at new material .
write:/ <fs_itab>-material.
endat.
case <fs_itab>-month.
when 'JAN'.
write: 10 <fs_itab>-quantity
when 'FEB'.
write:20 <fs_itab>-quantity.
.
.
.
.
.
endcase.
endloop.
Regards,
Venkatesh
‎2009 Jan 06 12:28 PM
for eg: I have astructure with following fields:
werks, matkl, matnr, month, fkimg1, fkimg2, total.
following is test data in respective fields:
144a 0601 ABC 01 10 20
144a 0601 ABC 12 11
where werks = 144a
matkl = 0601
matnr = ABC
month = 01, 12
fkimg1 = 10, 11
fkimg2 = 20
Internal table has uniques record.
now i need to display this in following format:
144a
0601______Jan___Feb___March_............Dec___Total
ABC
_____ SD __10______________________11_____21
_____ SE__ 20______________________00_____20
I hope this is bit clear now.
Please help.
‎2009 Jan 06 12:30 PM
Hi Vanita,
Check the following code, this is similar to your requirement...
Row wise output:
1.000 100.001
1.000 100.002
1.000 100.003
1.000 100.003
1.000 100.004
Column wise output:
1.000 1.000 1.000 1.000 1.000
100.001 100.002 100.003 100.003 100.004TYPES: BEGIN OF ty_tab,
a TYPE i,
b TYPE i,
END OF ty_tab.
TYPES: BEGIN OF ty_fields,
field TYPE c,
END OF ty_fields.
DATA: it_tab TYPE STANDARD TABLE OF ty_tab WITH HEADER LINE,
it_fields TYPE STANDARD TABLE OF ty_fields, "Table which stores the field names
wa_fields TYPE ty_fields,
wa_tab TYPE ty_tab.
DATA: w_value TYPE ty_fields-field.
FIELD-SYMBOLS: <fs> TYPE ANY.
wa_tab-a = 1000.
wa_tab-b = 100001.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100002.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100003.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100003.
APPEND wa_tab TO it_tab.
wa_tab-a = 1000.
wa_tab-b = 100004.
APPEND wa_tab TO it_tab.
wa_fields-field = 'A'. "In this example columns are A and B
APPEND wa_fields TO it_fields.
wa_fields-field = 'B'.
APPEND wa_fields TO it_fields.
WRITE:/ 'Row wise output:'.
LOOP AT it_tab.
WRITE: / it_tab-a,
it_tab-b.
ENDLOOP.
WRITE:/,/, 'Column wise output:',/.
LOOP AT it_fields INTO wa_fields. "Dispalying columnwise o/p
w_value = wa_fields-field.
LOOP AT it_tab INTO wa_tab.
ASSIGN COMPONENT w_value OF STRUCTURE wa_tab TO <fs>.
WRITE: <fs>.
UNASSIGN <fs>.
ENDLOOP.
WRITE: /.
ENDLOOP.Modify this example to ur requirement.
Revert incase of any issues.
Regards,
Manoj Kumar P
‎2009 Jan 06 12:37 PM
the code given by me above will work for your requirement....