<?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: How to use same Data Type and Length for two fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696117#M1577493</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it_bkpf-awkey+0(10)&lt;/P&gt;&lt;P&gt; it_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.in it_bkpf filed make provision for two fields with same data type as belnr and gjahr . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.populate this new fields with appropriate string manipulations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.refer to the internal table with direct datatype &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE belnr = it_bkpf-belnr&lt;/P&gt;&lt;P&gt;AND gjahr = it_bkpf-gjahr.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Mar 2011 07:00:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-03-09T07:00:14Z</dc:date>
    <item>
      <title>How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696115#M1577491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to use same data type and length for two fields when using 'FOR ALL ENTRIES IN' in a select statement? For instance the select queries are :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT bukrs gjahr belnr lifnr budat bldat zlspr dmbtr waers shkzg&lt;/P&gt;&lt;P&gt;FROM bsik&lt;/P&gt;&lt;P&gt;INTO TABLE it_bsik&lt;/P&gt;&lt;P&gt;WHERE bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;AND lifnr IN s_lifnr.&lt;/P&gt;&lt;P&gt;IF it_bsik IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;SELECT belnr gjahr awkey awtyp&lt;/P&gt;&lt;P&gt;FROM bkpf&lt;/P&gt;&lt;P&gt;INTO TABLE it_bkpf&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_bsik&lt;/P&gt;&lt;P&gt;WHERE belnr = it_bsik-belnr&lt;/P&gt;&lt;P&gt;AND gjahr = it_bsik-gjahr.&lt;/P&gt;&lt;P&gt;IF it_bkpf IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;SELECT belnr gjahr lifnr xblnr&lt;/P&gt;&lt;P&gt;FROM rbkp&lt;/P&gt;&lt;P&gt;INTO TABLE it_rbkp&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_bkpf&lt;/P&gt;&lt;P&gt;WHERE belnr = it_bkpf-awkey+0(10)&lt;/P&gt;&lt;P&gt;AND gjahr = it_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here it gives an error in the 3rd select query that 'When you use the addition "FOR ALL ENTRIES IN itab", the fields "GJAHR" and "IT_BKPF2-AWKEY+10(4)" must have the same type and the same length.'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly clarify.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 06:56:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696115#M1577491</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T06:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696116#M1577492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;first you need to check if you have declared table IT_BKPF2.&lt;/P&gt;&lt;P&gt;I believe you have fetched the data in IT_BKPF, there is no table IT_BKPF2 and you are not doing any selection in this table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to error the type and length of GJAHR and AWKEY should be same.&lt;/P&gt;&lt;P&gt;check the type of GJAHR and AWKEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can change the type while declaring the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Lalit Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 06:59:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696116#M1577492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T06:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696117#M1577493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it_bkpf-awkey+0(10)&lt;/P&gt;&lt;P&gt; it_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.in it_bkpf filed make provision for two fields with same data type as belnr and gjahr . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.populate this new fields with appropriate string manipulations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.refer to the internal table with direct datatype &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE belnr = it_bkpf-belnr&lt;/P&gt;&lt;P&gt;AND gjahr = it_bkpf-gjahr.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 07:00:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696117#M1577493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T07:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696118#M1577494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yeah i've made the change in the table BKPF  for the field GJAHR as:&lt;/P&gt;&lt;P&gt;    LOOP AT it_bkpf INTO wa_bkpf.&lt;/P&gt;&lt;P&gt;        wa_bkpf2-belnr = wa_bkpf-belnr.&lt;/P&gt;&lt;P&gt;        wa_bkpf2-awkey = wa_bkpf-awkey.&lt;/P&gt;&lt;P&gt;        wa_bkpf2-awtyp = wa_bkpf-awtyp.&lt;/P&gt;&lt;P&gt;        wa_bkpf2-gjahr = wa_bkpf-gjahr.&lt;/P&gt;&lt;P&gt;        APPEND wa_bkpf2 to it_bkpf2.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;taking GJAHR field in the table BKPF2 as character type with length 20. But it is further required to select that field from RBKP table. So even if i write &lt;/P&gt;&lt;P&gt;   SELECT belnr gjahr lifnr xblnr&lt;/P&gt;&lt;P&gt;      FROM rbkp&lt;/P&gt;&lt;P&gt;      INTO TABLE it_rbkp&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN it_bkpf2&lt;/P&gt;&lt;P&gt;      WHERE belnr = it_bkpf2-awkey+0(10)&lt;/P&gt;&lt;P&gt;      AND gjahr = it_bkpf2-awkey+10(4).&lt;/P&gt;&lt;P&gt;it gives the same error. Kindly explain how to resolve it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 07:30:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696118#M1577494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T07:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696119#M1577495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saurabh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use FOR ALL ENTRIES, the data types must be matched in the where condition. You ask ur Functional consultant for some other fields for GJAHR and BELNR instead of AWKEY, otherwise use LOOP and ENDLOOP, instead of for all entries.&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;Chandu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: chandra sekhar narra on Mar 9, 2011 8:57 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 07:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696119#M1577495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T07:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696120#M1577496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saurabh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the example code that I have developed for you. It will help you solve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTEST_3 .

tables : BKPF.

data : begin of it_bkpf occurs 1,
         belnr type RE_BELNR,
         awkey type awkey,
         awtyp type awtyp,
         gjahr type GJAHR,
       end of it_bkpf.

data : begin of it_bkpf1 occurs 1,
         belnr type RE_BELNR,
         awkey type gjahr,              " change the data type
         awtyp type awtyp,
         gjahr type GJAHR,
       end of it_bkpf1.

data : begin of it_rbkp occurs 1,
         belnr type BELNR_D,
         gjahr type gjahr,
         lifnr type LIFRE,
         xblnr type XBLNR,
       end of it_rbkp.

select belnr
       awkey
       awtyp
       gjahr
       from bkpf
       into table it_bkpf
       where BUKRS = 'TELH'.

loop at it_bkpf.
it_bkpf1-belnr = it_bkpf-belnr.
it_bkpf1-awkey = it_bkpf-awkey+10(4).           "Here only append the required length.
it_bkpf1-awtyp = it_bkpf-awtyp.
it_bkpf1-gjahr = it_bkpf-gjahr.
append it_bkpf1.
clear it_bkpf1.
endloop.

select  belnr
        gjahr
        lifnr
        xblnr
        from RBKP
        into table it_rbkp
        for all entries in it_bkpf1
        where belnr = it_bkpf1-belnr
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is just an example. Change the fields according to your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Abhii on Mar 9, 2011 9:08 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 08:07:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696120#M1577496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T08:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696121#M1577497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi saurabh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try the below code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table bkpf2 only contains two fields belnr and gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_bkpf INTO wa_bkpf.&lt;/P&gt;&lt;P&gt;wa_bkpf2-belnr = wa_bkpf-wa_bkpf-awkey+0(10)..&lt;/P&gt;&lt;P&gt;wa_bkpf2-gjahr = wa_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;APPEND wa_bkpf2 to it_bkpf2.&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;SELECT belnr gjahr lifnr xblnr&lt;/P&gt;&lt;P&gt;FROM rbkp&lt;/P&gt;&lt;P&gt;INTO TABLE it_rbkp&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_bkpf2&lt;/P&gt;&lt;P&gt;WHERE belnr = it_bkpf2-belnr&lt;/P&gt;&lt;P&gt;AND gjahr = it_bkpf2-gjahr.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 08:17:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696121#M1577497</guid>
      <dc:creator>nirajgadre</dc:creator>
      <dc:date>2011-03-09T08:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696122#M1577498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But the select query will continue to throw the error message until you change the data type of AWKEY to GJAHR in internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In IT_BKPF1 declare AWKEY as below :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : begin of it_bkpf occurs 1,
         belnr type RE_BELNR,
         awkey type awkey,
         awtyp type awtyp,
         gjahr type GJAHR,
       end of it_bkpf.

data : begin of it_bkpf1 occurs 1,
         belnr type RE_BELNR,
         awkey type gjahr,
         awtyp type awtyp,
         gjahr type GJAHR,
       end of it_bkpf1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do refer the code I have posted above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 09:51:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696122#M1577498</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-09T09:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696123#M1577499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saurabh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In internal table IT_RBKP, try declaring both the variables BELNR and GJAHR as type AWKEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Mar 2011 08:03:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696123#M1577499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-10T08:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use same Data Type and Length for two fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696124#M1577500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhii,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not getting an error when I modify the code as per Niraj mentioned. I modified it as :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT belnr gjahr awkey awtyp&lt;/P&gt;&lt;P&gt;      FROM bkpf&lt;/P&gt;&lt;P&gt;      INTO TABLE it_bkpf&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN it_bsik&lt;/P&gt;&lt;P&gt;      WHERE belnr = it_bsik-belnr&lt;/P&gt;&lt;P&gt;      AND gjahr = it_bsik-gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT it_bkpf INTO wa_bkpf.&lt;/P&gt;&lt;P&gt;        wa_bkpf2-belnr = wa_bkpf-awkey+0(10).&lt;/P&gt;&lt;P&gt;        wa_bkpf2-gjahr = wa_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;        APPEND wa_bkpf2 to it_bkpf2.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Mar 2011 10:40:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-use-same-data-type-and-length-for-two-fields/m-p/7696124#M1577500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-10T10:40:21Z</dc:date>
    </item>
  </channel>
</rss>

