<?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: Return just the exist table in method output in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519542#M1655622</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF lty_input,
        operation TYPE char10,
        name      TYPE char30,
      END   OF lty_input.
DATA: li_input TYPE STANDARD TABLE OF lty_input.
DATA: lwa_input LIKE LINE OF li_input.
lwa_input-operation = 'Operation1'.
lwa_input-name      = 'name1'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation1'.
lwa_input-name      = 'name2'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation1'.
lwa_input-name      = 'name3'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation2'.
lwa_input-name      = 'name4'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation2'.
lwa_input-name      = 'name5'.
APPEND lwa_input TO li_input.

SORT li_input BY operation.
DATA: lwa_exp LIKE LINE OF li_export,
      lwa_name LIKE LINE OF lwa_exp-name.

LOOP AT li_input INTO lwa_input.
  lwa_exp-operation = lwa_input-operation.
  lwa_name-field = lwa_input-name.
  APPEND lwa_name TO lwa_exp-name.
  AT END OF operation.
    APPEND lwa_exp TO li_export.
  ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Jan 2012 17:02:30 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2012-01-26T17:02:30Z</dc:date>
    <item>
      <title>Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519537#M1655617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have table with list of names and operations ,the table can store more than one name per operation and&lt;/P&gt;&lt;P&gt;there is option that in the table can be 1...n operation ,In the output of the method I need to return all&lt;/P&gt;&lt;P&gt;the operation in different table ,I.e. table for the list of names operation1 , names and operation2 etc.&lt;/P&gt;&lt;P&gt;I Have 10 potential operations and I don't want to export 10 tables in the method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is elegant way to do it ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tables that I need to return is like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;name &lt;/P&gt;&lt;P&gt;operation_type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 14:33:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519537#M1655617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-26T14:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519538#M1655618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can u explain in a bit more detail, may be with an example&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 14:47:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519538#M1655618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-26T14:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519539#M1655619</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;You can return a table ( GT_MAIN_TABLE ) that has of a deep structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TT_STANDART&lt;/P&gt;&lt;P&gt;name type char50&lt;/P&gt;&lt;P&gt;operation_type  optype " That is your data type &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GT_MAIN_TABLE &lt;/P&gt;&lt;P&gt;name type char50&lt;/P&gt;&lt;P&gt;all_operations type TT_STANDART " Which consists of two fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eveyline&lt;/P&gt;&lt;P&gt;Name -&amp;gt; "Myoperation"&lt;/P&gt;&lt;P&gt;all_operations -&amp;gt; TABLE Which has n entries -&amp;gt;&amp;gt;&amp;gt; "Myoperation"      01&lt;/P&gt;&lt;P&gt;                                                                      "Myoperation2"    02&lt;/P&gt;&lt;P&gt;                                                                       "Myoperation3"   03&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 14:53:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519539#M1655619</guid>
      <dc:creator>huseyindereli</dc:creator>
      <dc:date>2012-01-26T14:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519540#M1655620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try creating Deep Internal table and export it back from the method. In the Deep table, create a Field for Operation and and a table to contain the names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF lty_name,
         field TYPE char30,
       END   OF lty_name.
TYPES: lty_t_name TYPE STANDARD TABLE OF lty_name WITH DEFAULT KEY.
TYPES: BEGIN OF lty_export,
          operation TYPE char10,
          name TYPE lty_t_name,
       END OF lty_export.
DATA: li_export TYPE STANDARD TABLE OF lty_export.
FIELD-SYMBOLS: &amp;lt;lfs_exp&amp;gt; LIKE LINE OF li_export,
               &amp;lt;lfs_name&amp;gt; LIKE LINE OF &amp;lt;lfs_exp&amp;gt;-name.
APPEND INITIAL LINE TO li_export ASSIGNING &amp;lt;lfs_exp&amp;gt;.
&amp;lt;lfs_exp&amp;gt;-operation = 'Operation1'.
APPEND INITIAL LINE TO &amp;lt;lfs_exp&amp;gt;-name ASSIGNING &amp;lt;lfs_name&amp;gt;.
&amp;lt;lfs_name&amp;gt;-field = 'name1'.
APPEND INITIAL LINE TO &amp;lt;lfs_exp&amp;gt;-name ASSIGNING &amp;lt;lfs_name&amp;gt;.
&amp;lt;lfs_name&amp;gt;-field = 'name2'.
APPEND INITIAL LINE TO &amp;lt;lfs_exp&amp;gt;-name ASSIGNING &amp;lt;lfs_name&amp;gt;.
&amp;lt;lfs_name&amp;gt;-field = 'name3'.

APPEND INITIAL LINE TO li_export ASSIGNING &amp;lt;lfs_exp&amp;gt;.
&amp;lt;lfs_exp&amp;gt;-operation = 'Operation2'.
APPEND INITIAL LINE TO &amp;lt;lfs_exp&amp;gt;-name ASSIGNING &amp;lt;lfs_name&amp;gt;.
&amp;lt;lfs_name&amp;gt;-field = 'name4'.
APPEND INITIAL LINE TO &amp;lt;lfs_exp&amp;gt;-name ASSIGNING &amp;lt;lfs_name&amp;gt;.
&amp;lt;lfs_name&amp;gt;-field = 'name5'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 15:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519540#M1655620</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2012-01-26T15:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519541#M1655621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Naimesh Patel ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created deep structure but my question is assume that the table is like follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;it_input 

Name  operation
aaaa      t
bbbb      t
sssss    q
yyyyy    q
.....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need in this case (assume that I have just 2 operation)   table with two entries &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;it_out

operation    names
t  -&amp;gt; table that include aaa and bbbb 
q  -&amp;gt;table that include ssss and yyyyy&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;How I can do that , I try loop with case to operation but I dont succeeded?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Joy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 16:49:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519541#M1655621</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-26T16:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519542#M1655622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF lty_input,
        operation TYPE char10,
        name      TYPE char30,
      END   OF lty_input.
DATA: li_input TYPE STANDARD TABLE OF lty_input.
DATA: lwa_input LIKE LINE OF li_input.
lwa_input-operation = 'Operation1'.
lwa_input-name      = 'name1'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation1'.
lwa_input-name      = 'name2'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation1'.
lwa_input-name      = 'name3'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation2'.
lwa_input-name      = 'name4'.
APPEND lwa_input TO li_input.
lwa_input-operation = 'Operation2'.
lwa_input-name      = 'name5'.
APPEND lwa_input TO li_input.

SORT li_input BY operation.
DATA: lwa_exp LIKE LINE OF li_export,
      lwa_name LIKE LINE OF lwa_exp-name.

LOOP AT li_input INTO lwa_input.
  lwa_exp-operation = lwa_input-operation.
  lwa_name-field = lwa_input-name.
  APPEND lwa_name TO lwa_exp-name.
  AT END OF operation.
    APPEND lwa_exp TO li_export.
  ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 17:02:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519542#M1655622</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2012-01-26T17:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519543#M1655623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have 2 input tables it1 and it2 with same data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it1 by operation&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from it1 comparing operation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it1.&lt;/P&gt;&lt;P&gt;loop at it2 where operation = it1-operation.&lt;/P&gt;&lt;P&gt; populate your deep table here.&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kartik Tarla on Jan 26, 2012 10:33 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 17:03:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519543#M1655623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-26T17:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Return just the exist table in method output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519544#M1655624</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;I think this could give an idea. First get distinct operations and collect all data into it_main_output.&lt;/P&gt;&lt;P&gt;Then use it anywhere as your needed operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  zz_test.


TYPES : BEGIN OF ts_input  ,
            name TYPE char50 ,
            operation TYPE char50,
            END OF ts_input.

TYPES : t_input TYPE TABLE OF ts_input .

DATA : it_input TYPE TABLE OF ts_input WITH HEADER LINE.
DATA : ls_input LIKE LINE OF it_input.
DATA : BEGIN OF it_input_ops OCCURS 0,
            operation TYPE char50,
       END OF it_input_ops.
*DATA : it_

*** Here it_input is filled with values
***aaaa      t
***bbbb      t
***sssss    q
***yyyyy    q
it_input-name = 'aaaa'.
it_input-operation = 't'.
APPEND it_input.
it_input-name = 'bbbb'.
it_input-operation = 't'.
APPEND it_input.
it_input-name = 'sssss'.
it_input-operation = 'q'.
APPEND it_input.
it_input-name = 'yyyyy'.
it_input-operation = 'q'.
APPEND it_input.


DATA : BEGIN OF it_main_output OCCURS 10,
            operation TYPE char50,
            content TYPE t_input,  " Here is the table for one name of operation
           END OF it_main_output.

SORT it_input.

LOOP AT it_input.
  CLEAR : it_input_ops.
  it_input_ops-operation = it_input-operation.
  COLLECT it_input_ops.
ENDLOOP.

LOOP AT it_input_ops. " Distinct Operations
  CLEAR : it_main_output.
  it_main_output-operation = it_input_ops-operation.
  LOOP AT it_input INTO ls_input
      WHERE operation = it_input_ops-operation.
    " If we have same entry Collect will prevent to double
    " Otherwise we can use append here
    COLLECT ls_input INTO it_main_output-content.
  ENDLOOP.
  APPEND it_main_output.
ENDLOOP.

"RESULT ROWS OF it_main_output.
"1  t Standard Table[2x2(200)]
"2  q Standard Table[2x2(200)]


***To get an operations TABLE
READ TABLE it_main_output WITH KEY operation = 't'.
IF sy-subrc EQ 0.
  LOOP AT it_main_output-content INTO ls_input.
    WRITE : / ls_input-name , ls_input-operation.
  ENDLOOP.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the output of the program is ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;aaa                                               t
bbb                                               t&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jan 2012 17:15:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/return-just-the-exist-table-in-method-output/m-p/8519544#M1655624</guid>
      <dc:creator>huseyindereli</dc:creator>
      <dc:date>2012-01-26T17:15:23Z</dc:date>
    </item>
  </channel>
</rss>

