<?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: Selction screen options problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701587#M891236</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 1:&lt;/P&gt;&lt;P&gt;You can use left outer joins for all the three tables to retrieve the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible try to make at least 1 field mandatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 2: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select saknr, kostl from BSEG for all the records  where saknr in s_saknr&lt;/P&gt;&lt;P&gt;and kostl in s_kostl.. Say it_bseg internal table has 10000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the second internal table by using for all entries in it_bseg select the data from bkpf where condition in&lt;/P&gt;&lt;P&gt;s_blart..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_final-saknr  = wa_bseg-saknr...&lt;/P&gt;&lt;P&gt;wa_final-kostl  = wa_bseg-kostl...&lt;/P&gt;&lt;P&gt;read it_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_final-blart = wa_bseg-blart....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read it_ztest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_co_num = wa_ztest-co_num&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks,&lt;/P&gt;&lt;P&gt;Chaithanya K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Apr 2008 16:07:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-14T16:07:28Z</dc:date>
    <item>
      <title>Selction screen options problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701586#M891235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a scenario where I have got three tables two std ones and the third one is the custom one bseg,bkpf and ztest, and based on three fields i.e. belnr, blart and bukrs( which is in all the three tables )to join these tables and need to retreive the following the data from each table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From BSEG - - -&amp;gt; saknr,kostl&lt;/P&gt;&lt;P&gt;From BKPF- - - - &amp;gt; blart,bldat &lt;/P&gt;&lt;P&gt;and &lt;/P&gt;&lt;P&gt;From Ztest -&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;&amp;gt; co_num, co_name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the problem is that at the selection screen there is no field mandatory for the user to enter and the following are the different selections options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. from date to date&lt;/P&gt;&lt;P&gt;2. Account number&lt;/P&gt;&lt;P&gt;3. Fiscal year &lt;/P&gt;&lt;P&gt;4. customer name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mean a user can just enter the start date and end date to display the report b/w that period or he can just enter the name of a particular customer to view the report, or he can just enter the account number of a particlular customer and may also enter just fiscal year to have a look at the report leaving every other thing blank !!! Now my concern is I am not being able to figure out how to code this thing...I mean in one scenario a user enters his name and left anything else blank and just execute the report ....and in the other he may leave everythng balnk other than the document number and execute the report. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone of you please tell me how to achieve this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Rajeev !!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2008 15:53:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701586#M891235</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-14T15:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Selction screen options problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701587#M891236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 1:&lt;/P&gt;&lt;P&gt;You can use left outer joins for all the three tables to retrieve the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible try to make at least 1 field mandatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option 2: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select saknr, kostl from BSEG for all the records  where saknr in s_saknr&lt;/P&gt;&lt;P&gt;and kostl in s_kostl.. Say it_bseg internal table has 10000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the second internal table by using for all entries in it_bseg select the data from bkpf where condition in&lt;/P&gt;&lt;P&gt;s_blart..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_final-saknr  = wa_bseg-saknr...&lt;/P&gt;&lt;P&gt;wa_final-kostl  = wa_bseg-kostl...&lt;/P&gt;&lt;P&gt;read it_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_final-blart = wa_bseg-blart....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read it_ztest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_co_num = wa_ztest-co_num&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks,&lt;/P&gt;&lt;P&gt;Chaithanya K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2008 16:07:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701587#M891236</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-14T16:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Selction screen options problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701588#M891237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Rajeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;note:&lt;/P&gt;&lt;P&gt;   it is not advisable to retrieve data from bseg. you can use the tables &lt;STRONG&gt;BSIS&lt;/STRONG&gt; and &lt;STRONG&gt;BSAS&lt;/STRONG&gt; as substitute for &lt;STRONG&gt;BSEG&lt;/STRONG&gt;. I assume that those are the tables that you need since you only need to retrieve the GL Account (SAKNR) and Cost Center (KOSTL) from BSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  another thing is that you cannot link BSEG to BKPF since BSEG is a clustered table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anyway,&lt;/P&gt;&lt;P&gt;try this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
tables:
  budat,
  ztest.

select-options: us_bldat for bkpf-bldat,
                      us_hkont for bsis-hkont.

parameter up_gjahr type gjahr.

select-options us_custo for ztest-co_num.

data:
  it_bkpf type standard table of bkpf,
  it_bsis type standard table of bsis,
  it_ztest type standard table of ztest.

data:
  wa_bkpf type bkpf,
  wa_bsis type bsis,
  wa_ztest type ztest.

data:
  begin of it_otput occurs 0,
    bukrs type bukrs,
    belnr type belnr,
    blart type blart,
    bldat type bldat,    
    hkont type hkont,
    kostl type kostl,
    co_num like ztest-co_num,
    co_name like ztest-co_name,
  end of it_otput.

data:
  wa_otput like line of it_otput.

start-of-selection.
select belnr blart bldat bukrs
  from bkpf
  into corresponding fields of table it_bkpf
 where bldat in us_bldat
    and gjahr eq up_gjahr.

if not it_bkpf[] is initial.
  select belnr hkont kostl
     from bsis
     into corresponding fields of table it_bsis
      for all entries in it_bkpf
    where belnr eq it_bkpf-belnr
       and hkont in us_saknr.

  select belnr hkont kostl
     from bsas
     appending corresponding fields of table it_bsis
     for all entries in it_bkpf
     where belnr eq it_bkpf-belnr
       and hkont in us_saknr.

  select co_num co_name
    from ztest
    into corresponding fields of table ztest
    for all entries in it_bkpf
    where belnr eq it_bkpf-belnr
        and bukrs eq it_bkpf-bukrs
        and co_num in us_custo.
endif.

loop at it_bkpf into wa_bkpf.
   loop at it_bsis into wa_bsis where belnr eq wa_bkpf-belnr.
      move-corresponding wa_bkpf to wa_otput.
      
      move-corresponding wa_bsis to wa_otput.

      read table it_ztest into wa_ztest
         with key bukrs = wa_bkpf-bukrs
                      belnr = wa_bkpf-belnr
                      blart = wa_bkpf-blart.
      if sy-subrc eq 0.
         move-corresponding wa_ztest to wa_otput.
      endif.

      append wa_otput to it_otput.
      clear wa_otput.
   endloop.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2008 16:18:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selction-screen-options-problem/m-p/3701588#M891237</guid>
      <dc:creator>peter_ruiz2</dc:creator>
      <dc:date>2008-04-14T16:18:54Z</dc:date>
    </item>
  </channel>
</rss>

