<?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 ABAP 740 inline VALUE FOR - able to create a table sourced from 2 different tables? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458331#M14258</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;This may be a stupid question, so apologies if so. I'm aware of the VALUE iterator and the FOR iterator in order to declare a table inline, but is it possible to use 2 FOR statements to utilize 2 separate tables during declaration?&lt;/P&gt;&lt;P&gt;For example, tables A and B are the same type (tables of VBELN and POSNR). Normally I'd just append 1 to the other, but for the sake of understanding what's possible syntactically, can I do something like below?:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(lt_vbeln_comb) = VALUE ty_vbeln_t(
FOR ls_A IN table_A   #first table
FOR ls_B IN table_B   #second table
( vbeln = #I want to use both ls_A-vbeln and ls_B-vbeln here
  posnr = 1 )

).&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Jun 2017 13:48:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2017-06-07T13:48:03Z</dc:date>
    <item>
      <title>ABAP 740 inline VALUE FOR - able to create a table sourced from 2 different tables?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458331#M14258</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;This may be a stupid question, so apologies if so. I'm aware of the VALUE iterator and the FOR iterator in order to declare a table inline, but is it possible to use 2 FOR statements to utilize 2 separate tables during declaration?&lt;/P&gt;&lt;P&gt;For example, tables A and B are the same type (tables of VBELN and POSNR). Normally I'd just append 1 to the other, but for the sake of understanding what's possible syntactically, can I do something like below?:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(lt_vbeln_comb) = VALUE ty_vbeln_t(
FOR ls_A IN table_A   #first table
FOR ls_B IN table_B   #second table
( vbeln = #I want to use both ls_A-vbeln and ls_B-vbeln here
  posnr = 1 )

).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jun 2017 13:48:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458331#M14258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-06-07T13:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP 740 inline VALUE FOR - able to create a table sourced from 2 different tables?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458332#M14259</link>
      <description>&lt;P&gt;Sorry, that's the best I can come up with. Maybe look into BASE and if it can help appending the tables in an inline expression to loop over in a for expression.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF gty_struct,
         name TYPE string,
         date TYPE d,
       END OF gty_struct,
       BEGIN OF gty_line,
         text   TYPE string,
         number TYPE i,
       END OF gty_line,
       gty_tab        TYPE STANDARD TABLE OF gty_line WITH DEFAULT KEY,
       gty_struct_tab TYPE STANDARD TABLE OF gty_struct WITH DEFAULT KEY,
       gty_ref_tab    TYPE STANDARD TABLE OF REF TO gty_struct_tab WITH DEFAULT KEY.

DATA(gt_tab_a) = VALUE gty_struct_tab(
  ( name = `Teststring1` date = sy-datum )
  ( name = `Teststring2` date = sy-datum )
  ( name = `Teststring3` date = sy-datum )
  ( name = `Teststring4` date = sy-datum )
).

DATA(gt_tab_b) = VALUE gty_struct_tab(
  ( name = `Teststring5` date = sy-datum )
  ( name = `Teststring6` date = sy-datum )
  ( name = `Teststring7` date = sy-datum )
  ( name = `Teststring8` date = sy-datum )
).

DATA(gt_combined) = VALUE gty_tab(
  LET tab = VALUE gty_ref_tab( ( REF #( gt_tab_a ) ) ( REF #( gt_tab_b ) ) ) IN
    FOR a IN tab
      FOR b IN a-&amp;gt;*
      ( text = b-name number = line_index( a-&amp;gt;*[ table_line = b ] ) )
).

cl_demo_output=&amp;gt;display( gt_combined ).
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jun 2017 14:55:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458332#M14259</guid>
      <dc:creator>fabianlupa</dc:creator>
      <dc:date>2017-06-07T14:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP 740 inline VALUE FOR - able to create a table sourced from 2 different tables?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458333#M14260</link>
      <description>&lt;P&gt;&lt;A href="https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenvalue_constructor_params_itab.htm" target="test_blank"&gt;https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenvalue_constructor_params_itab.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I see the option of several FORs there, furthermore, there is a BASE, a LET ...&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:10:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458333#M14260</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-06-07T15:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP 740 inline VALUE FOR - able to create a table sourced from 2 different tables?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458334#M14261</link>
      <description>&lt;P&gt;@Horst, @Fabian, thank you, I had tried using the 2 FOR statements and had issues originally, but just tried again and now I've got the behavior I was looking for. However, I found BASE to be what I was looking for, as the 2 FOR statements caused duplicate entries the way I was trying to use them.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:51:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-740-inline-value-for-able-to-create-a-table-sourced-from-2-different/m-p/458334#M14261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-06-07T15:51:45Z</dc:date>
    </item>
  </channel>
</rss>

