<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: displaying fields from z table column wise in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874353#M1139405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Harini,&lt;/P&gt;&lt;P&gt;Say for example you have a internal table named &lt;STRONG&gt;'it_tab'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;with two columns 'A' and 'B'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a new table which contains only the column names of the table &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;it_tab&lt;/STRONG&gt; like below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_fields-field = 'A'.
APPEND wa_fields TO it_fields.

wa_fields-field = 'B'.
APPEND wa_fields TO it_fields.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you print record column wise using the following code,&lt;/P&gt;&lt;P&gt;I have declared a variable &lt;STRONG&gt;'w_value'&lt;/STRONG&gt; to hold the column names inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field symbol declaration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_fields INTO wa_fields.

  w_value = wa_fields-field.

  LOOP AT it_tab INTO wa_tab.
    ASSIGN COMPONENT w_value OF STRUCTURE wa_tab TO &amp;lt;fs&amp;gt;.
    WRITE: &amp;lt;fs&amp;gt;.
    UNASSIGN &amp;lt;fs&amp;gt;.
  ENDLOOP.

  WRITE: /.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Dec 2008 10:47:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-09T10:47:33Z</dc:date>
    <item>
      <title>displaying fields from z table column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874348#M1139400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;my rqmt is like this :&lt;/P&gt;&lt;P&gt;i have some recodrs in my z table.&lt;/P&gt;&lt;P&gt;im running loop and displaying records from z table using classical report.&lt;/P&gt;&lt;P&gt;the fields of first record should come in first column (line by line) that is &lt;/P&gt;&lt;P&gt;first field in 1st line, 2nd field in 2nd line.....(i used  /  for this)&lt;/P&gt;&lt;P&gt;after completion of first record then the second record fields should display in second column.(again line by line)&lt;/P&gt;&lt;P&gt;and third record fields in third column.... and so on...( it should be done in classical report)&lt;/P&gt;&lt;P&gt;can any body suggest solution for my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance,&lt;/P&gt;&lt;P&gt;harini.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 09:37:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874348#M1139400</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T09:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: displaying fields from z table column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874349#M1139401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Harini,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To generate a field catalog automatically:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare an internal table of type LVC_T_FCAT . &lt;/P&gt;&lt;P&gt;Call function module LVC_FIELDCATALOG_MERGE and pass the DDIC structure of the output table and the internal table for the field catalog. The function module generates the field catalog and fills the internal table accordingly. &lt;/P&gt;&lt;P&gt;Read the rows you want to change, and adapt the fields accordingly. If your output table contains more fields than are stored in the Data Dictionary, you must append one row for each new field to the field catalog.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 09:46:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874349#M1139401</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T09:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: displaying fields from z table column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874350#M1139402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is something like RESERVE n lines. This can help in your case of classical report. &lt;/P&gt;&lt;P&gt;Through this you shud be able to loop as u have described.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Revert if you need further on this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 10:22:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874350#M1139402</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T10:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: displaying fields from z table column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874351#M1139403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;form f_modify_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at assigning .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if p_field is not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign component p_field of structure to .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'GENERIC_CONVERSION_EXIT_INPUT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_tabname = p_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_fieldname = p_field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input_text = p_value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;output_text = &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;invalid_ddic_parameters = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;invalid_input = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;others = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if p_systm is not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Default values for system fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_x031l into is_x031l.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if is_x031l-dtyp = 'CLNT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fixed_val sy-mandt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif is_x031l-rollname = 'ERDAT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or is_x031l-rollname = 'ERSDA'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or is_x031l-rollname = 'AEDAT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or is_x031l-rollname = 'LAEDA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fixed_val sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif is_x031l-rollname = 'ERTIM'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or is_x031l-rollname = 'AETIM'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fixed_val sy-uzeit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif is_x031l-rollname = 'ERNAM'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or is_x031l-rollname = 'AENAM'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fixed_val sy-uname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "f_modify_table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 10:24:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874351#M1139403</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T10:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: displaying fields from z table column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874352#M1139404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop through the internal table  of your z table, and create another internal table ( with line type string )using FIELD-SYMBOLS ,  wherin the records of the z table are stored in columns . Then loop through this table to display the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : col type i,&lt;/P&gt;&lt;P&gt;        count type i.&lt;/P&gt;&lt;P&gt;field-symbols :  &amp;lt;f&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;col = &amp;lt;no of fields in z table &amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_cust into wa.&lt;/P&gt;&lt;P&gt; count = 1.&lt;/P&gt;&lt;P&gt; do col times.&lt;/P&gt;&lt;P&gt;     assign component count of structure wa to &amp;lt;f&amp;gt; .&lt;/P&gt;&lt;P&gt;     read table it_test index count into wa_test.&lt;/P&gt;&lt;P&gt;     concatenate &amp;lt;f&amp;gt; wa_test-line  into wa_test-line separated by space.&lt;/P&gt;&lt;P&gt;     modify it_test index count from wa_test.&lt;/P&gt;&lt;P&gt;     if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      append  wa_test to it_test.&lt;/P&gt;&lt;P&gt;     endif.&lt;/P&gt;&lt;P&gt;    count = count + 1.&lt;/P&gt;&lt;P&gt;    clear wa_test.&lt;/P&gt;&lt;P&gt; enddo.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_test into wa_test.&lt;/P&gt;&lt;P&gt;write / wa_test-line.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vartika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 10:31:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874352#M1139404</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T10:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: displaying fields from z table column wise</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874353#M1139405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Harini,&lt;/P&gt;&lt;P&gt;Say for example you have a internal table named &lt;STRONG&gt;'it_tab'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;with two columns 'A' and 'B'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a new table which contains only the column names of the table &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;it_tab&lt;/STRONG&gt; like below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_fields-field = 'A'.
APPEND wa_fields TO it_fields.

wa_fields-field = 'B'.
APPEND wa_fields TO it_fields.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you print record column wise using the following code,&lt;/P&gt;&lt;P&gt;I have declared a variable &lt;STRONG&gt;'w_value'&lt;/STRONG&gt; to hold the column names inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field symbol declaration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_fields INTO wa_fields.

  w_value = wa_fields-field.

  LOOP AT it_tab INTO wa_tab.
    ASSIGN COMPONENT w_value OF STRUCTURE wa_tab TO &amp;lt;fs&amp;gt;.
    WRITE: &amp;lt;fs&amp;gt;.
    UNASSIGN &amp;lt;fs&amp;gt;.
  ENDLOOP.

  WRITE: /.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 10:47:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-fields-from-z-table-column-wise/m-p/4874353#M1139405</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T10:47:33Z</dc:date>
    </item>
  </channel>
</rss>

