Application Development 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: 

show all fields with WRITE statement

Former Member
0 Kudos

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!

6 REPLIES 6

ThomasZloch
Active Contributor
0 Kudos

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

0 Kudos

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?

0 Kudos

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

0 Kudos

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

schneidertho
Advisor
Advisor
0 Kudos

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

Former Member
0 Kudos

  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.