<?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: select statement question in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269910#M492979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct logic and as long as both values are same then you will get results ..&lt;/P&gt;&lt;P&gt;otherwise ur select query failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wempf (char 12) equals this 5 char field - instead of doing this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;within loop &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wempf+0(5) = ur field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2007 19:24:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-25T19:24:57Z</dc:date>
    <item>
      <title>select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269906#M492975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have two selects where I am trying to select records from the MSEG table. I am using the FOR ALL ENTRIES IN to select the based on the records from my work table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the two selects both use the same work table. I have a field in the work table that is set up with the domain text5. I have a 5 character value in the field. I am trying to select records where the field wempf (char 12) equals this 5 char field and in the other select I am trying to select records where the field lifnr (char 10) equals this 5 char field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure if this can be done using the 1 field or if I have to create a field with the length of 12 and a field with a length of 10 in order to get my two selects to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 19:09:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269906#M492975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T19:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269907#M492976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can i have your code ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;source field properties should match target field ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 19:15:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269907#M492976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T19:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269908#M492977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you use FOR ALL ENTRIES all key fields must be the same type and lenght....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can't do this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*Field1 --&amp;gt; Char 5
*My_Tab-Field1 --&amp;gt; Char 10

FOR ALL ENTRIES IN MY_TAB
WHERE FIELD1 EQ MY_TAB-FIELD1
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 19:16:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269908#M492977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T19:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269909#M492978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the code that hs the structure defined and the two selects. the statement in question is in bold&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_zfi_gl_subcontrk,&lt;/P&gt;&lt;P&gt;        bukrs_from     TYPE zz_bukrs_fr,   "Company Code From&lt;/P&gt;&lt;P&gt;        bukrs_to       TYPE zz_bukrs_to,   "Company Code To&lt;/P&gt;&lt;P&gt;        werks_virtual  TYPE zz_werks_vir,  "Plant Virtual&lt;/P&gt;&lt;P&gt;        werks_from     TYPE zz_werks_fr,   "Plant From&lt;/P&gt;&lt;P&gt;        werks_to       TYPE zz_werks_to,   "Plant To&lt;/P&gt;&lt;P&gt;        werks_select   TYPE zz_werks_select, "Plant Select&lt;/P&gt;&lt;P&gt;        bwart          TYPE bwart,         "Movement Type (Inventory Management)&lt;/P&gt;&lt;P&gt;        matnr          TYPE matnr,         "Material Number&lt;/P&gt;&lt;P&gt;        saknr          TYPE saknr,         "G/L account number&lt;/P&gt;&lt;P&gt;        cfmefac        TYPE cfmefac,       "Quantity factor&lt;/P&gt;&lt;P&gt;        conv_matnr     TYPE matnr,         "Conversion material number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       END OF ty_zfi_gl_subcontrk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$ Form SELECT_DATA643_MSEG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Check for the data existance in table MSEG for the select query&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;FORM select_data643_mseg USING p1_tvarv_date       TYPE ty_t_tvarv_date&lt;/P&gt;&lt;P&gt;                               p1_tvarv_time       TYPE ty_t_tvarv_time&lt;/P&gt;&lt;P&gt;                               p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk&lt;/P&gt;&lt;P&gt;                      CHANGING p1_it_mseg          TYPE ty_t_mseg643.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table declaration for tvarv_date - this works&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  DATA: wa_tvarv_date type ty_tvarv_date.&lt;/P&gt;&lt;P&gt;  DATA: wa_tvarv_time type ty_tvarv_time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.&lt;/P&gt;&lt;P&gt;  READ TABLE p1_tvarv_time INTO wa_tvarv_time INDEX 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT a&lt;SUB&gt;bukrs  a&lt;/SUB&gt;werks a&lt;SUB&gt;matnr a&lt;/SUB&gt;erfmg a~erfme&lt;/P&gt;&lt;P&gt;         a&lt;SUB&gt;kostl a&lt;/SUB&gt;bwart a&lt;SUB&gt;mblnr a&lt;/SUB&gt;wempf a&lt;SUB&gt;charg a&lt;/SUB&gt;kzbew a&lt;SUB&gt;lgort b&lt;/SUB&gt;budat&lt;/P&gt;&lt;P&gt;    FROM mseg AS a INNER JOIN mkpf AS b ON a&lt;SUB&gt;mblnr EQ b&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;      AND b~budat &amp;lt;= wa_tvarv_date-high&lt;/P&gt;&lt;P&gt;      AND b~budat &amp;gt;= wa_tvarv_date-low&lt;/P&gt;&lt;P&gt;        INTO TABLE p1_it_mseg&lt;/P&gt;&lt;P&gt;        FOR ALL ENTRIES IN p1_zfi_gl_subcontrk&lt;/P&gt;&lt;P&gt;        WHERE a~bukrs   EQ p1_zfi_gl_subcontrk-bukrs_from&lt;/P&gt;&lt;P&gt;        AND   a~werks   EQ p1_zfi_gl_subcontrk-werks_from&lt;/P&gt;&lt;P&gt;        &amp;lt;b&amp;gt;AND   a&lt;SUB&gt;wempf   EQ p1_zfi_gl_subcontrk-werks_select&amp;lt;/b&amp;gt;        AND   a&lt;/SUB&gt;matnr   EQ p1_zfi_gl_subcontrk-matnr&lt;/P&gt;&lt;P&gt;        AND   a~bwart   EQ'643'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Issue error message if the select fails&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check for back ground mode&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF sy-batch IS INITIAL.&lt;/P&gt;&lt;P&gt;      MESSAGE i899 WITH text-027.&lt;/P&gt;&lt;P&gt;      LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      MESSAGE e899 WITH text-027.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="22" type="ul"&gt;&lt;P&gt;  NOTE  !!! ****************************************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; move system date and time to work areas for updating tvatrv table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; upon successful completion of program&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Sort the internal table for binary search later&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   SORT p1_it_mseg BY  bukrs prctr DESCENDING matnr ASCENDING werks .&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDFORM. " FORM SELECT_DATA643_MSEG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$ Form SELECT_DATA101_MSEG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Check for the data existance in table MSEG for the select query&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;FORM select_data101_mseg USING p1_tvarv_date       TYPE ty_t_tvarv_date&lt;/P&gt;&lt;P&gt;                               p1_tvarv_time       TYPE ty_t_tvarv_time&lt;/P&gt;&lt;P&gt;                               p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk&lt;/P&gt;&lt;P&gt;                      CHANGING p1_it_mseg          TYPE ty_t_mseg643.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table declaration for tvarv_date - this works&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  DATA: wa_tvarv_date type ty_tvarv_date.&lt;/P&gt;&lt;P&gt;  DATA: wa_tvarv_time type ty_tvarv_time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.&lt;/P&gt;&lt;P&gt;  READ TABLE p1_tvarv_time INTO wa_tvarv_time INDEX 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT a&lt;SUB&gt;bukrs a&lt;/SUB&gt;werks a&lt;SUB&gt;matnr a&lt;/SUB&gt;erfmg a~erfme&lt;/P&gt;&lt;P&gt;        a&lt;SUB&gt;kostl a&lt;/SUB&gt;bwart a&lt;SUB&gt;mblnr a&lt;/SUB&gt;wempf a&lt;SUB&gt;charg a&lt;/SUB&gt;kzbew a&lt;SUB&gt;lgort b&lt;/SUB&gt;budat&lt;/P&gt;&lt;P&gt;    FROM mseg AS a INNER JOIN mkpf AS b ON a&lt;SUB&gt;mblnr EQ b&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;      AND b~budat &amp;lt;= wa_tvarv_date-high&lt;/P&gt;&lt;P&gt;      AND b~budat &amp;gt;= wa_tvarv_date-low&lt;/P&gt;&lt;P&gt;        INTO TABLE p1_it_mseg&lt;/P&gt;&lt;P&gt;        FOR ALL ENTRIES IN p1_zfi_gl_subcontrk&lt;/P&gt;&lt;P&gt;        WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_to&lt;/P&gt;&lt;P&gt;        AND   a~werks EQ p1_zfi_gl_subcontrk-werks_to&lt;/P&gt;&lt;P&gt;        &amp;lt;b&amp;gt;AND   a~lifnr EQ  p1_zfi_gl_subcontrk-werks_select&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;        AND   a~matnr EQ p1_zfi_gl_subcontrk-matnr&lt;/P&gt;&lt;P&gt;        AND   a~bwart EQ'101'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Issue error message if the select fails&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check for back ground mode&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF sy-batch IS INITIAL.&lt;/P&gt;&lt;P&gt;      MESSAGE i899 WITH text-027.&lt;/P&gt;&lt;P&gt;      LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      MESSAGE e899 WITH text-027.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM. " FORM SELECT_DATA101_MSEG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 19:18:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269909#M492978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T19:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269910#M492979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct logic and as long as both values are same then you will get results ..&lt;/P&gt;&lt;P&gt;otherwise ur select query failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wempf (char 12) equals this 5 char field - instead of doing this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;within loop &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wempf+0(5) = ur field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 19:24:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/2269910#M492979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T19:24:57Z</dc:date>
    </item>
  </channel>
</rss>

