<?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 Need help in Select statements in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344651#M801918</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;1.I have tried using this code to fetch the values, but it shows runtime error..I need to fetch values from vbak as well as vbap .The condition is when I execute without any values in select options..it should display'please enter atleast one field' also if i enter any invalid entry it should show ' enter a valid entry' and thats what I have tried here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Also I need to check del block or billing block LIFSK , FAKSK = 'x' and always group by document type and print the total of net value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz review the code give me a suitable solution pls..its very urgent..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
tables : vbak,vbap.

data : begin of itab_vbak occurs 0,
       vbeln(10) type c,
       auart(4) type c,
       netwr(15) type c,
       waerk(5) type c,
       end of itab_vbak.

data : begin of itab_vbap occurs 0,
       zmeng(13) type c,
       zieme(3) type c,
       posnr(6) type c,
       matnr(18) type c,
       end of itab_vbap.

data : it_vbak type table of vbak,
       it_vbap type table of vbap.

select-options : s_vbeln for vbak-vbeln,
                 s_vkorg for vbak-vkorg,
                 s_vtweg for vbak-vtweg,
                 s_spart for vbak-spart.


start-of-selection.

select vbeln auart netwr from vbak into itab_vbak where vbeln in s_vbeln
.

move :  vbak-vbeln to itAB_vbak-vbeln,
        vbak-auart to itab_vbak-auart,
        vbak-netwr to itab_vbak-waerk.

append itab_vbak.

clear itab_vbak.

endselect.


IF   s_vbeln is initial and
     s_vkorg is initial and
     s_vtweg is initial and
     s_spart is initial.

    MESSAGE e000(zam).

  ENDIF.

  IF not s_vbeln[] is initial.

   select * from vbak into table it_vbak where vbeln in s_vbeln.

    IF sy-subrc NE 0.

      MESSAGE e001(zam).

       ENDIF.

   else.


    if not s_vkorg[] is initial.

      select * from vbak into table it_vbak where vkorg in s_vkorg.

         if sy-subrc NE 0.

         message e002(zam).

         endif.

         endif.


     if not s_vtweg[] is initial.

        select * from vbak into table it_vbak where vtweg in s_vtweg.

          if sy-subrc NE 0.

          message e003(zam).

          endif.

          endif.

     if not s_spart[] is initial.

        select * from vbap into table it_vbap where spart in s_spart.

        if sy-subrc NE 0.

        message e004(zam).

        endif.

        endif.

  ENDIF.

  loop at itab_vbak.

write : /25 itab_vbak-vbeln, /30 itab_vbak-auart,/40 itab_vbak-netwr.

endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 7, 2008 8:46 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Feb 2008 08:12:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-07T08:12:56Z</dc:date>
    <item>
      <title>Need help in Select statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344651#M801918</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;1.I have tried using this code to fetch the values, but it shows runtime error..I need to fetch values from vbak as well as vbap .The condition is when I execute without any values in select options..it should display'please enter atleast one field' also if i enter any invalid entry it should show ' enter a valid entry' and thats what I have tried here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Also I need to check del block or billing block LIFSK , FAKSK = 'x' and always group by document type and print the total of net value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz review the code give me a suitable solution pls..its very urgent..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
tables : vbak,vbap.

data : begin of itab_vbak occurs 0,
       vbeln(10) type c,
       auart(4) type c,
       netwr(15) type c,
       waerk(5) type c,
       end of itab_vbak.

data : begin of itab_vbap occurs 0,
       zmeng(13) type c,
       zieme(3) type c,
       posnr(6) type c,
       matnr(18) type c,
       end of itab_vbap.

data : it_vbak type table of vbak,
       it_vbap type table of vbap.

select-options : s_vbeln for vbak-vbeln,
                 s_vkorg for vbak-vkorg,
                 s_vtweg for vbak-vtweg,
                 s_spart for vbak-spart.


start-of-selection.

select vbeln auart netwr from vbak into itab_vbak where vbeln in s_vbeln
.

move :  vbak-vbeln to itAB_vbak-vbeln,
        vbak-auart to itab_vbak-auart,
        vbak-netwr to itab_vbak-waerk.

append itab_vbak.

clear itab_vbak.

endselect.


IF   s_vbeln is initial and
     s_vkorg is initial and
     s_vtweg is initial and
     s_spart is initial.

    MESSAGE e000(zam).

  ENDIF.

  IF not s_vbeln[] is initial.

   select * from vbak into table it_vbak where vbeln in s_vbeln.

    IF sy-subrc NE 0.

      MESSAGE e001(zam).

       ENDIF.

   else.


    if not s_vkorg[] is initial.

      select * from vbak into table it_vbak where vkorg in s_vkorg.

         if sy-subrc NE 0.

         message e002(zam).

         endif.

         endif.


     if not s_vtweg[] is initial.

        select * from vbak into table it_vbak where vtweg in s_vtweg.

          if sy-subrc NE 0.

          message e003(zam).

          endif.

          endif.

     if not s_spart[] is initial.

        select * from vbap into table it_vbap where spart in s_spart.

        if sy-subrc NE 0.

        message e004(zam).

        endif.

        endif.

  ENDIF.

  loop at itab_vbak.

write : /25 itab_vbak-vbeln, /30 itab_vbak-auart,/40 itab_vbak-netwr.

endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 7, 2008 8:46 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2008 08:12:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344651#M801918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-07T08:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Select statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344652#M801919</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;chk this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

tables : vbak,vbap.

data : begin of itab_vbak occurs 0,
vbeln like vbak-vbeln,
auart like vbak-auart,
netwr like vbak-netwr,
waerk like vbak-waerk,
end of itab_vbak.

data : begin of itab_vbap occurs 0,
zmeng(13) type c,
zieme(3) type c,
posnr(6) type c,
matnr(18) type c,
end of itab_vbap.

data : it_vbak type table of vbak,
it_vbap type table of vbap.

select-options : s_vbeln for vbak-vbeln,
s_vkorg for vbak-vkorg,
s_vtweg for vbak-vtweg,
s_spart for vbak-spart.

at selection-screen.

IF s_vbeln is initial and
s_vkorg is initial and
s_vtweg is initial and
s_spart is initial.

MESSAGE e000(zam).

ENDIF.


IF not s_vbeln[] is initial.

select * from vbak into table it_vbak where vbeln in s_vbeln.

IF sy-subrc NE 0.

MESSAGE e001(zam).

ENDIF.

else.

if not s_vkorg[] is initial.

select * from vbak into table it_vbak where vkorg in s_vkorg.

if sy-subrc NE 0.

message e002(zam).

endif.

endif.

if not s_vtweg[] is initial.

select * from vbak into table it_vbak where vtweg in s_vtweg.

if sy-subrc NE 0.

message e003(zam).

endif.

endif.

if not s_spart[] is initial.

select * from vbap into table it_vbap where spart in s_spart.

if sy-subrc NE 0.

message e004(zam).

endif.

endif.

ENDIF.


start-of-selection.

select vbeln auart netwr waerk from vbak
       into table itab_vbak
       where vbeln in s_vbeln.



*move : vbak-vbeln to itAB_vbak-vbeln,
*vbak-auart to itab_vbak-auart,
*vbak-netwr to itab_vbak-waerk.
*
*append itab_vbak.
*
*clear itab_vbak.
*

loop at itab_vbak.

write : /25 itab_vbak-vbeln, 30 itab_vbak-auart, 40 itab_vbak-netwr.

endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do reward if it helps,&lt;/P&gt;&lt;P&gt;priya.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Priya Parvathi Jammalamadaka on Feb 7, 2008 2:59 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2008 13:57:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344652#M801919</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-07T13:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Select statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344653#M801920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change the data type of netwr from character to NETWR. It will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab_vbak occurs 0,&lt;/P&gt;&lt;P&gt;       vbeln(10) type c,&lt;/P&gt;&lt;P&gt;       auart(4) type c,&lt;/P&gt;&lt;P&gt;       netwr type NETWR,&lt;/P&gt;&lt;P&gt;       waerk(5) type c,&lt;/P&gt;&lt;P&gt;       end of itab_vbak.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2008 13:59:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344653#M801920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-07T13:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Select statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344654#M801921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Need to use AT SELECTION-SCREEN ON Field  for individual fied to check for the valid entry.&lt;/P&gt;&lt;P&gt;You can use AT SELECTION-SCREEN event to check and raise error message if all the vlauees are empty.&lt;/P&gt;&lt;P&gt;Later you need to use START-OF_SELECTION.&lt;/P&gt;&lt;P&gt;KindRegards,&lt;/P&gt;&lt;P&gt;khader.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2008 14:02:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-in-select-statements/m-p/3344654#M801921</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-07T14:02:02Z</dc:date>
    </item>
  </channel>
</rss>

