<?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 field AS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110390#M1617438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Damn! OK guys - got this working. But you won't guess what caused the problem or confusion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified, for testing purposes, the appropriate EKPO record, however, I didn't do it in field LOEKZ but in field PUT_BACK. The later is displayed in UC_SE16N grid's header almost equal to LOEKZ hence I've updated the wrong data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks guys for reading - points awarded!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Sep 2011 07:08:34 GMT</pubDate>
    <dc:creator>MichiFr</dc:creator>
    <dc:date>2011-09-16T07:08:34Z</dc:date>
    <item>
      <title>SELECT field AS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110385#M1617433</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;I've got this type and data definition:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  TYPES:
    BEGIN OF t_purchase,
        ebeln   TYPE ekpo-ebeln,
        ebelp   TYPE ekpo-ebelp,
        bukrs   TYPE ekko-bukrs,
        bstyp   TYPE ekko-bstyp,
        bsart   TYPE ekko-bsart,
        loekz   TYPE ekko-loekz,
        matnr   TYPE ekpo-matnr,
        txz01   TYPE ekpo-txz01,
        menge   TYPE ekpo-menge,
        meins   TYPE ekpo-meins,
        loekz2  TYPE ekpo-loekz,
    END OF t_purchase
    .
  DATA:
    l_tab_purchase TYPE STANDARD TABLE OF t_purchase.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and would like to fill the internal table with this join statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    SELECT
        ekkn~aufnr ekkn~ebeln ekkn~ebelp 
        ekko~loekz ekko~bedat
        ekpo~ebeln ekpo~ebelp ekko~bukrs ekko~bstyp
        ekko~bsart ekko~loekz ekpo~matnr ekpo~txz01
        ekpo~menge ekpo~loekz as loekz2
       INTO CORRESPONDING FIELDS OF TABLE l_tab_purchase
       FROM ( ( ekpo INNER JOIN ekkn ON ekpo~ebeln = ekkn~ebeln
                                    AND ekpo~ebelp = ekkn~ebelp )
                     INNER JOIN ekko ON ekko~ebeln = ekkn~ebeln )
                                  WHERE ekkn~aufnr = i_document-reference.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As one will notice the above type/table has got two different deletion markers loekz and loekz2. The first one is or should be filled from table EKKO and the second one from table EKPO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately both markers do have the same names in each database table which means the MOVE-CORRESPONDING will get into some troubles while finding the correct field.&lt;/P&gt;&lt;P&gt;Of course the statement is executed properly, however, field LOEKZ2 is not filled up correctly. I guess the statement AS LOEKZ2 is simply ignored, at least it does not do its job at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to get this running? I mean to select two identical fieldnames but move them to different target fields?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cu,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 14:26:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110385#M1617433</guid>
      <dc:creator>MichiFr</dc:creator>
      <dc:date>2011-09-15T14:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT field AS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110386#M1617434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strange, I can confirm that AS works as desired for me in a similar scenario. As a workaround you could arrange the selected columns in the same order as the target structure and omit the CORRESPONDING FIELDS OF.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 15:05:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110386#M1617434</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2011-09-15T15:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT field AS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110387#M1617435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A more elegant way of writing that using alias for table names is, this should work for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 SELECT
        A~ebeln
        A~ebelp 
        C~bukrs 
        C~bstyp 
        C~bsart  
        C~loekz  
        A~matnr 
        A~txz01 
        A~menge
        A~meins 
        A~loekz
      
    INTO TABLE l_tab_purchase
       FROM

ekpo as A 
INNER JOIN ekkn as B
ON  A~ebeln = B~ebeln
AND A~ebelp = B~ebelp 

INNER JOIN ekko as C 
ON  C~ebeln = B~ebeln 

WHERE B~aufnr = i_document-reference.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NB: Using alias table names is optional though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 23:30:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110387#M1617435</guid>
      <dc:creator>sjeevan</dc:creator>
      <dc:date>2011-09-15T23:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT field AS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110388#M1617436</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;Remove INTO CORRESPONDING FIELDS OF TABLE and make the sequence of the SELECT fields same as of TYPES declarations.  The system will automatically move the value LOEKZ of EKPO to LOEKZ2 of ITAB since the length and data type are same.&lt;/P&gt;&lt;P&gt;Please try below code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES:
   BEGIN OF t_purchase,
       ebeln   TYPE ekpo-ebeln,
       ebelp   TYPE ekpo-ebelp,
       bukrs   TYPE ekko-bukrs,
       bstyp   TYPE ekko-bstyp,
       bsart   TYPE ekko-bsart,
       loekz   TYPE ekko-loekz,
       matnr   TYPE ekpo-matnr,
       txz01   TYPE ekpo-txz01,
       menge   TYPE ekpo-menge,
       meins   TYPE ekpo-meins,
       loekz2  TYPE ekpo-loekz,
   END OF t_purchase
   .
DATA:
  l_tab_purchase TYPE STANDARD TABLE OF t_purchase.



SELECT ekpo~ebeln
      ekpo~ebelp
      ekko~bukrs
      ekko~bstyp
      ekko~bsart
      ekko~loekz
      ekpo~matnr
      ekpo~txz01
      ekpo~menge
      ekpo~loekz
     INTO l_tab_purchase
     FROM ( ( ekpo INNER JOIN ekkn ON ekpo~ebeln = ekkn~ebeln
                                  AND ekpo~ebelp = ekkn~ebelp )
                   INNER JOIN ekko ON ekko~ebeln = ekkn~ebeln
 INNER JOIN ekko ON ekko~ebeln = ekkn~ebeln )
                                  WHERE ekkn~aufnr = i_document-reference ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 23:44:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110388#M1617436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-15T23:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT field AS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110389#M1617437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked your exact Select statement and it works FINE for me. Field LOEKZ2  is filled correctly.&lt;/P&gt;&lt;P&gt;I have No idea why it is not working for you, btw I am in ECC 6.0 but don't think it has anything to do with that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though, personally I will never use 'into corresponding fields of' unless it is MUST which is not the case here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Diwakar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 02:29:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110389#M1617437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-16T02:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT field AS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110390#M1617438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Damn! OK guys - got this working. But you won't guess what caused the problem or confusion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified, for testing purposes, the appropriate EKPO record, however, I didn't do it in field LOEKZ but in field PUT_BACK. The later is displayed in UC_SE16N grid's header almost equal to LOEKZ hence I've updated the wrong data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks guys for reading - points awarded!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 07:08:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-field-as/m-p/8110390#M1617438</guid>
      <dc:creator>MichiFr</dc:creator>
      <dc:date>2011-09-16T07:08:34Z</dc:date>
    </item>
  </channel>
</rss>

