08-09-2012 6:30 PM
Hi, good day, i need your help. I have a program report, so it call a function and fill a table, so i need to show all fields, until here all is right. this table has many fields, so i am writing field by field to show all. I do not know if there is a sentence to show all fields of table instead field by field. I have not found any reference to do i want
It is the code to write the content, field by field.
LOOP AT v_NOTE_HEADER into wa_note_header.
write:/ wa_note_header-ELEM_NO, wa_note_header-n, .....
ENDLOOP.
thank you!
08-09-2012 7:55 PM
Forget the WRITE statement, do this:
data: gr_alv type ref to cl_salv_table.
...
call method cl_salv_table=>factory
importing
r_salv_table = gr_alv
changing
t_table = v_note_header.
gr_alv->display( ).
Thomas
08-09-2012 8:34 PM
Hi! Thomas than you it works ,
one more doubt, the function return more one table, to show result set for more tables, Have i to call method for each table?
Or One method call can take all tables and return all fields?
08-09-2012 9:52 PM
Hi Saul,
no. One ALV, one table.
But you can use a splitter container ans use one ALV with one table per split area.
Regards
Clemens
Message was edited by: Clemens Li
08-10-2012 8:33 AM
If you have two tables linked by one column (like header and item data linked by a document number), you can use class CL_SALV_HIERSEQ_TABLE.
Otherwise use containers as suggest by Clemens.
All this is well documented and there are many example programs, please search for information.
Thomas
08-09-2012 8:31 PM
Hi Saul,
I don't have a simple solution based on write statements. I guess you can do this dynamically, but fear this might be a bit cumbersome.
Have you thought about using the ALV grid (function REUSE_ALV_GRID_DISPLAY)? That would probably also be much easier for the user, because he could filter, sort, re-order the columns...
Best regards
Thorsten
08-13-2012 1:45 AM
if you still want to use write:
field-symbols: <WA> type any, <COMP> type any.
loop at GT_XML.
clear SY-SUBRC.
* write /.
assign GT_XML to <WA>.
while SY-SUBRC = 0.
assign component SY-INDEX of structure <WA> to <COMP>.
check SY-SUBRC = 0.
write <COMP>.
endwhile.
endloop.