<?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: Insert Workarea Into Table with Parameters - Problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261589#M1987095</link>
    <description>&lt;P&gt;Thanks, man : )&lt;/P&gt;&lt;P&gt;Just another quick question.&lt;/P&gt;&lt;P&gt;Is there an easier way instead of writing &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa-number = '1234'.
wa-id = 'Test X'.
wa-location = 'Test Location X'.
wa-password = 'Test Password X'.
wa-user = 'Test User X'.

INSERT wa INTO TABLE lt_data. &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;three times, e. g. in ABAP 7.40 ?? &lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 13:37:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2020-08-24T13:37:03Z</dc:date>
    <item>
      <title>Insert Workarea Into Table with Parameters - Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261587#M1987093</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;My sample Code&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;Workarea/Table (Data)&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;DATA: go_salv     TYPE REF TO cl_salv_table,
      go_function TYPE REF TO cl_salv_functions_list,
      
      BEGIN OF wa,
        number   TYPE string,
        id       TYPE string,
        location TYPE string,
        password TYPE string,
        user     TYPE string,
      END OF wa,
      lt_data LIKE TABLE OF wa.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Insert some sample data&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;wa-number = '1234'.
wa-id = 'Test 1'.
wa-location = 'Test Location 1'.
wa-password = 'Test Password 1'.
wa-user = 'Test User 1'.

INSERT wa INTO TABLE lt_data.


wa-number = '5678'.
wa-id = 'Test 2'.
wa-location = 'Test Location 2'.
wa-password = 'Test Password 2'.
wa-user = 'Test User 2'.

INSERT wa INTO TABLE lt_data.


wa-number = '9999'.
wa-id = 'Test 3'.
wa-location = 'Test Location 3'.
wa-password = 'Test Password 3'.
wa-user = 'Test User 3'.

INSERT wa INTO TABLE lt_data.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Parameter (Selection-Screen)&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS: bu_numb TYPE string.
SELECTION-SCREEN END OF BLOCK b1.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Display ALV Grid&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;IF wa-number = bu_numb.

* Displaying ALV Grid
  TRY.
      CALL METHOD cl_salv_table=&amp;gt;factory(
        IMPORTING
          r_salv_table = go_salv
        CHANGING
          t_table      = lt_data
      ).

      go_function = go_salv-&amp;gt;get_functions( ).
      go_function-&amp;gt;set_default( abap_true ).
      go_salv-&amp;gt;display( ).

    CATCH cx_salv_msg.

  ENDTRY.
ELSE.
  MESSAGE 'Not found' TYPE 'E'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;My Problem: &lt;/STRONG&gt;1234 and 5678 are showing Not found Error message, and 9999 is showing all three entries, but i want to show each entry if it matches the number.&lt;/P&gt;
  &lt;P&gt;&lt;IMG alt="" /&gt;&lt;/P&gt;If there is another way instead of writing
  &lt;PRE&gt;&lt;CODE&gt;wa-number = '1234'.
wa-id = 'Test 1'.
wa-location = 'Test Location 1'.
wa-password = 'Test Password 1'.
wa-user = 'Test User 1'.

INSERT wa INTO TABLE lt_data. &lt;/CODE&gt;&lt;/PRE&gt;three times, I would also be happy if someone has an idea. Thanks in advance ; )</description>
      <pubDate>Mon, 24 Aug 2020 12:36:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261587#M1987093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-08-24T12:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Workarea Into Table with Parameters - Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261588#M1987094</link>
      <description>&lt;P&gt;This coding will help you solve your problem based on your requirement description.&lt;/P&gt;&lt;P&gt;There might of course be more and better solutions, but for that all requirements need to be known.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"IF wa-number = bu_numb. " =&amp;gt; You are only comparing against the wa value
                         "    which contains data of the last record
                         "    this way, you do not check against all values of lt_data

" the following would work based on your requirement description
CLEAR lt_data2.
LOOP AT lt_data INTO wa WHERE number = bu_numb.
  INSERT wa INTO TABLE lt_data2. " lt_data2 is like lt_data, but only will contain data of bu_numb numbers
ENDLOOP.

IF lt_data2[] IS NOT INITIAL. " display of mapping records
* Displaying ALV Grid
  TRY.
      CALL METHOD cl_salv_table=&amp;gt;factory(
        IMPORTING
          r_salv_table = go_salv
        CHANGING
          t_table      = lt_data2
      ).

      go_function = go_salv-&amp;gt;get_functions( ).
      go_function-&amp;gt;set_default( abap_true ).
      go_salv-&amp;gt;display( ).

    CATCH cx_salv_msg.

  ENDTRY.
ELSE.
  MESSAGE 'Not found' TYPE 'E'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:17:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261588#M1987094</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-08-24T13:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Workarea Into Table with Parameters - Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261589#M1987095</link>
      <description>&lt;P&gt;Thanks, man : )&lt;/P&gt;&lt;P&gt;Just another quick question.&lt;/P&gt;&lt;P&gt;Is there an easier way instead of writing &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa-number = '1234'.
wa-id = 'Test X'.
wa-location = 'Test Location X'.
wa-password = 'Test Password X'.
wa-user = 'Test User X'.

INSERT wa INTO TABLE lt_data. &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;three times, e. g. in ABAP 7.40 ?? &lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:37:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261589#M1987095</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-08-24T13:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Workarea Into Table with Parameters - Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261590#M1987096</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;newuser1206&lt;/SPAN&gt;, no, not in ABAP 7.40. In ABAP 7.5x there are further options to reduce the amount of code lines for tasks like this.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:56:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261590#M1987096</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-08-24T13:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Workarea Into Table with Parameters - Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261591#M1987097</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/1050376/newuser1206.html"&gt;new user&lt;/A&gt; This code is possible since &lt;STRONG&gt;7.40&lt;/STRONG&gt;: (search Constructor Expressions/Constructor Operators for more information):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lt_data = VALUE #(
( number = '1234' id = 'Test X' location = 'Test Location X' password = 'Test Password X' user = 'Test User X' )
( number = '5678' id = 'Test 2' location = 'Test Location 2' password = 'Test Password 2' user = 'Test User 2' )
( number = '9999' id = 'Test 3' location = 'Test Location 3' password = 'Test Password 3' user = 'Test User 3' )
).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Aug 2020 17:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261591#M1987097</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-08-24T17:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Workarea Into Table with Parameters - Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261592#M1987098</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/1091/sandra.rossi.html"&gt;Sandra Rossi&lt;/A&gt;, thank you for the update. You are right, the VALUE operator as well as NEW, LET, CONV, CAST where indeed introduced with ABAP 7.40. So yes &lt;A href="https://answers.sap.com/users/1050376/newuser1206.html"&gt;new user&lt;/A&gt;, you can already use the VALUE operator in your system, in order to 'simplify' the insert of rows into the table.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 04:53:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-workarea-into-table-with-parameters-problem/m-p/12261592#M1987098</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-08-25T04:53:59Z</dc:date>
    </item>
  </channel>
</rss>

