<?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 How does Select-Options from multiple tables work in CDS VIEW context? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585769#M23425</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;i basically ask my question in the subject title. I am pretty new to ABAP and programming in general. I created a program which joined some tables together and u can refine your search via select options.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;*&amp;amp; Selectionsbildschirm
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS: bsart FOR ls_ekko-bsart,
                ebeln FOR ls_ekko-ebeln,
                ekgrp FOR ls_ekko-ekgrp,
                banfn FOR ls_ekpo-banfn,
                werks FOR ls_ekpo-werks OBLIGATORY DEFAULT '0001' TO '0004'.
SELECTION-SCREEN END OF BLOCK b1.

SKIP.

PARAMETERS: layout LIKE disvariant-variant DEFAULT '/B'.

&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;... later in the code I have the select statement, where i select my tables, and also the join conditions and after that this comes:&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt;So when I was correct, this is how a select-option possibility can look like. Now I am trying to implement a CDS VIEW instead. I tried some things that I get from the internet but I have basically no idea how a select option can be implemented. Have it to be in the DDL Source? &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;@AbapCatalog.sqlViewName:'Z_PSP_CDS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK 
@EndUserText.label: 'CDS_VIEW_PSP'
@VDM.viewType: #BASIC
@Analytics.dataExtraction.enabled: true



define view Z_PSP 
    as select from ekko as a left outer 

    join ekkn as b 
    on b.ebeln = a.ebeln   

    join ekpo as c 
    on a.ebeln = c.ebeln
    
    join zs1ek_banf_tools as d
    on d.banfn = c.banfn   

    join user_addr as e
    on e.bname = d.aussteller
      {
    a.bsart,
    a.aedat,
    a.ebeln,
    a.ekgrp,
    b.ebelp,
    b.sakto,
    b.ps_psp_pnr,
    c.banfn,
    c.matnr,
    c.txz01,
    c.werks,
    d.aussteller,
    d.gettyp,
    d.kunde,
    e.name_last
    }
//     where a.bsart = bsart
//       and a.ebeln = a.ebeln
//       and a.ekgrp = ekgrp
//       and c.banfn = c.banfn

&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt; or in the report somewehre itself?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;**1... Declare SELECT-OPIONS
SELECT-OPTIONS: bsart FOR ekko-bsart,
                ebeln FOR ekko-ebeln,
                banfn FOR ekpo-banfn.
START-OF-SELECTION.

*2... Create object reference ALV with IDA
 DATA(lo_alv_display) = cl_salv_gui_table_ida=&amp;gt;create( iv_table_name = 'EKKO' ).

*3... Build range tables
DATA(lo_range_collector) = NEW cl_salv_range_tab_collector( ).

lo_range_collector-&amp;gt;add_ranges_for_name( iv_name = 'BSART'

                                         it_ranges = bsart[] ).

lo_range_collector-&amp;gt;add_ranges_for_name( iv_name = 'EBELN'

                                         it_ranges = ebeln[] ).
                                      
lo_range_collector-&amp;gt;add_ranges_for_name( iv_name = 'BANFN'

                                         it_ranges = banfn[] ).                                         

lo_range_collector-&amp;gt;get_collected_ranges(
                    IMPORTING
                       et_named_ranges = DATA(lt_select_options) ).

*4... Set select options

lo_alv_display-&amp;gt;set_select_options( it_ranges = lt_select_options ).


*5... Display ALV
*lo_alv_display-&amp;gt;fullscreen( )-&amp;gt;display( ).
cl_salv_gui_table_ida=&amp;gt;create_for_cds_view( 'Z_PSP' )-&amp;gt;fullscreen( )-&amp;gt;display( ).

&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt;I have zero clue what and how I should do. Any advice would be appreciated&lt;/P&gt;
  &lt;P&gt;greetings Dustin&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 18:34:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2018-03-08T18:34:37Z</dc:date>
    <item>
      <title>How does Select-Options from multiple tables work in CDS VIEW context?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585769#M23425</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;i basically ask my question in the subject title. I am pretty new to ABAP and programming in general. I created a program which joined some tables together and u can refine your search via select options.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;*&amp;amp; Selectionsbildschirm
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS: bsart FOR ls_ekko-bsart,
                ebeln FOR ls_ekko-ebeln,
                ekgrp FOR ls_ekko-ekgrp,
                banfn FOR ls_ekpo-banfn,
                werks FOR ls_ekpo-werks OBLIGATORY DEFAULT '0001' TO '0004'.
SELECTION-SCREEN END OF BLOCK b1.

SKIP.

PARAMETERS: layout LIKE disvariant-variant DEFAULT '/B'.

&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;... later in the code I have the select statement, where i select my tables, and also the join conditions and after that this comes:&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt;So when I was correct, this is how a select-option possibility can look like. Now I am trying to implement a CDS VIEW instead. I tried some things that I get from the internet but I have basically no idea how a select option can be implemented. Have it to be in the DDL Source? &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;@AbapCatalog.sqlViewName:'Z_PSP_CDS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK 
@EndUserText.label: 'CDS_VIEW_PSP'
@VDM.viewType: #BASIC
@Analytics.dataExtraction.enabled: true



define view Z_PSP 
    as select from ekko as a left outer 

    join ekkn as b 
    on b.ebeln = a.ebeln   

    join ekpo as c 
    on a.ebeln = c.ebeln
    
    join zs1ek_banf_tools as d
    on d.banfn = c.banfn   

    join user_addr as e
    on e.bname = d.aussteller
      {
    a.bsart,
    a.aedat,
    a.ebeln,
    a.ekgrp,
    b.ebelp,
    b.sakto,
    b.ps_psp_pnr,
    c.banfn,
    c.matnr,
    c.txz01,
    c.werks,
    d.aussteller,
    d.gettyp,
    d.kunde,
    e.name_last
    }
//     where a.bsart = bsart
//       and a.ebeln = a.ebeln
//       and a.ekgrp = ekgrp
//       and c.banfn = c.banfn

&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt; or in the report somewehre itself?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;**1... Declare SELECT-OPIONS
SELECT-OPTIONS: bsart FOR ekko-bsart,
                ebeln FOR ekko-ebeln,
                banfn FOR ekpo-banfn.
START-OF-SELECTION.

*2... Create object reference ALV with IDA
 DATA(lo_alv_display) = cl_salv_gui_table_ida=&amp;gt;create( iv_table_name = 'EKKO' ).

*3... Build range tables
DATA(lo_range_collector) = NEW cl_salv_range_tab_collector( ).

lo_range_collector-&amp;gt;add_ranges_for_name( iv_name = 'BSART'

                                         it_ranges = bsart[] ).

lo_range_collector-&amp;gt;add_ranges_for_name( iv_name = 'EBELN'

                                         it_ranges = ebeln[] ).
                                      
lo_range_collector-&amp;gt;add_ranges_for_name( iv_name = 'BANFN'

                                         it_ranges = banfn[] ).                                         

lo_range_collector-&amp;gt;get_collected_ranges(
                    IMPORTING
                       et_named_ranges = DATA(lt_select_options) ).

*4... Set select options

lo_alv_display-&amp;gt;set_select_options( it_ranges = lt_select_options ).


*5... Display ALV
*lo_alv_display-&amp;gt;fullscreen( )-&amp;gt;display( ).
cl_salv_gui_table_ida=&amp;gt;create_for_cds_view( 'Z_PSP' )-&amp;gt;fullscreen( )-&amp;gt;display( ).

&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt;I have zero clue what and how I should do. Any advice would be appreciated&lt;/P&gt;
  &lt;P&gt;greetings Dustin&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 18:34:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585769#M23425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-03-08T18:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: How does Select-Options from multiple tables work in CDS VIEW context?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585770#M23426</link>
      <description>&lt;P&gt;You cannot use select options in CDS directly.&lt;/P&gt;
  &lt;P&gt;You can use select options in the WHERE condition of Open SQL when reading from CDS entities.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 18:55:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585770#M23426</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2018-03-08T18:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: How does Select-Options from multiple tables work in CDS VIEW context?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585771#M23427</link>
      <description>&lt;P&gt;I find a problem with this code because this can not use the select options here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;cl_salv_gui_table_ida=&amp;gt;create_for_cds_view( 'Z_PSP' )-&amp;gt;fullscreen( )-&amp;gt;display( ).="&amp;lt;-wrong code&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the code will print the ALV from the CDS but no through the select options, why?  because it's not used properly the object in the declaration,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;*2... Create object reference ALV with IDA
 DATA(lo_alv_display) = cl_salv_gui_table_ida=&amp;gt;create( iv_table_name = 'EKKO' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then we will have to call the class object with the method that prints the data using the select options and it would be like this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lo_alv_display=&amp;gt;create_for_cds_view( 'Z_PSP' )-&amp;gt;fullscreen( )-&amp;gt;display( ). &amp;lt;-- rigth code&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I hope this can help everyone.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 09:34:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585771#M23427</guid>
      <dc:creator>Ab0587260304</dc:creator>
      <dc:date>2022-06-14T09:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: How does Select-Options from multiple tables work in CDS VIEW context?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585772#M23428</link>
      <description>&lt;P&gt;Yes, You can use select options in CDS directly.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 09:42:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-does-select-options-from-multiple-tables-work-in-cds-view-context/m-p/585772#M23428</guid>
      <dc:creator>Ab0587260304</dc:creator>
      <dc:date>2022-06-14T09:42:44Z</dc:date>
    </item>
  </channel>
</rss>

