<?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: Abap code Logic for splitting is not working in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230696#M1524823</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_tab INTO wa_tab WHERE prodh4 = rp-prodh4.

      IF sy-subrc EQ 0.
        rp-prodh4 = wa_tab-/bic/znew_mp.
        rp-material = wa_tab-material.
        rp-amount = rp-amount * wa_tab-/bic/zsp_ratio.


      ELSE.
        SELECT SINGLE prodh4 material FROM /bic/azpr4mtcv00 INTO CORRESPONDING
        FIELDS OF wa_oldtab.
        IF sy-subrc EQ 0.
          rp-material = wa_oldtab-material.
          rp-prodh4 = wa_oldtab-prodh4.
          rp-amount = rp-amount.
          rp-prodh3 = wa_oldtab-prodh4+0(9).

        ENDIF.

      ENDIF.
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change to&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_tab INTO wa_tab WHERE prodh4 = rp-prodh4.

        rp-prodh4 = wa_tab-/bic/znew_mp.
        rp-material = wa_tab-material.
        rp-amount = rp-amount * wa_tab-/bic/zsp_ratio.

* append in some other target internal table and work from there

    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Sep 2010 08:33:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-09-03T08:33:59Z</dc:date>
    <item>
      <title>Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230689#M1524816</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 have a requirement to split a single amount and product into several parts. so far my logic is not working as only the first row is being fetched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN of map_tab,
         ZPRODH4 TYPE NEWMAPPINGTABLE-/BIC/ZNEW_MP,
         ZSPRATIO TYPE NEWMAPPINGTABLE-/BIC/ZSP_RATIO,
         ZMATERIAL TYPE NEWMAPPINGTABLE-MATERIAL,
       END OF map_tab.

Data:IT_MAP_TAB TYPE HASHED table of MAP_TAB with unique Key ZPRODH4,

     wa_it_map_tab like line of IT_MAP_TAB.

Data rp TYPE _ty_s_TG_1.

LOOP AT RESULT_PACKAGE into rp.
Clear wa_it_map_tab.

read table IT_MAP_TAB into wa_it_map_tab with table key ZPRODH4 =
rp-prodh4.

IF sy-subrc EQ 0.

select SINGLE /BIC/ZNEW_MP /BIC/ZSP_RATIO MATERIAL into corresponding
fields of wa_it_map_tab from NEWMAPPINGTABLE
where  PRODH4 = rp-PRODH4.

IF sy-subrc EQ 0.
  rp-PRODH4 = wa_it_map_tab-ZPRODH4.
  rp-AMOUNT = rp-AMOUNT * wa_it_map_tab-Zspratio.
  rp-MATERIAL = wa_it_map_tab-ZMATERIAL.
ENDIF.

ENDIF.

MODIFY RESULT_PACKAGE FROM rp.
.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is how my tables looks like&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Source Table&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;PROD                                       AMOUNT &lt;/P&gt;&lt;P&gt;900006600999                          1000&lt;/P&gt;&lt;P&gt;400004400000                           500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;NEW MAPPING TABLE&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;PROD                                      NEWPROD                      MATERIAL                             SPLITRATIO&lt;/P&gt;&lt;P&gt;900006600999                         1000066001111                    7000                                         0.5&lt;/P&gt;&lt;P&gt;900006600999                         1000066002222                    7001                                         0.4&lt;/P&gt;&lt;P&gt;900006600999                         1000066003333                    7002                                         0.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;OLD MAPPING TABLE&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;PROD                              MATERIAL&lt;/P&gt;&lt;P&gt;4000044000000               7100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;TARGET TABLE&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROD                        PROD3               MATERIAL        AMOUNT&lt;/P&gt;&lt;P&gt;1000066001111         100006600            7000                 500             &lt;/P&gt;&lt;P&gt;1000066002222         100006600            7001                 400           &lt;/P&gt;&lt;P&gt;1000066003333         100006600            7002                 100&lt;/P&gt;&lt;P&gt;4000044000000         400004400            7100                 500&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 05:22:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230689#M1524816</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-09-03T05:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230690#M1524817</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;will you explian clearly  how is your data  in internal table   . how many internal table  are there  .&lt;/P&gt;&lt;P&gt;and what you want to do .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i will tell you how to  split  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Deepak.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 05:35:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230690#M1524817</guid>
      <dc:creator>deepak_dhamat</dc:creator>
      <dc:date>2010-09-03T05:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230691#M1524818</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;use this logic &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : delimiter(1) value space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or  data : delemiter(1) value '  ' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at internal table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  split internaltable  at delimiter into   some feilds .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append to another internal table by assigning those values in feilds of intrenal table  .&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;in such way you will get  internal table with two  seperate values prod and amount  in different field .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Deepak.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 05:47:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230691#M1524818</guid>
      <dc:creator>deepak_dhamat</dc:creator>
      <dc:date>2010-09-03T05:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230692#M1524819</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;My requirement is to split the &lt;STRONG&gt;amount 1000&lt;/STRONG&gt; of one MAIN PRODUCT  into several new products based on split ratio values in NEW MAPPING TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROD 900006600999 has amount 1000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IN NEW MAPPING table this same PROD 900006600999  has 3 new Products which are &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1000066001111&lt;/P&gt;&lt;P&gt;1000066002222 &lt;/P&gt;&lt;P&gt;1000066003333 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with different split ratio 0.5 , 0.4 and 0.1 respectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now   I want to split the amount 1000 into 3 different parts according to the split ratio assigned to the new products.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so   I will hava a &lt;STRONG&gt;new amount&lt;/STRONG&gt; after multiplying the split ratio with 1000.&lt;/P&gt;&lt;P&gt;1000066001111 - 500&lt;/P&gt;&lt;P&gt;1000066002222 - 400&lt;/P&gt;&lt;P&gt;1000066003333 - 100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;secondly,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If MAIN PRODUCT ( PROD) is not found in NEW MAPPING TABLE then I should check the MAIN PRODUCT from OLD MAPPING TABLE and pick the amount without splitting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally we load MAIN PRODUCT ( PROD) with values coming NEWPROD into a new table ( TARGET )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far  I have 1 internal table for storing the data from NEW MAPPING TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bhat Vaidya on Sep 3, 2010 7:48 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bhat Vaidya on Sep 3, 2010 7:51 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 05:48:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230692#M1524819</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-09-03T05:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230693#M1524820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI BHAT  ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USE THIS LOGIC &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THIS WILL SOLVE YOUR PROBLEM  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ALSO GIVE PROPER NAME TO INTERNAL TABLE   .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AS GIVEN BELOW  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_SOURCE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE IT_NEWMAP WITH KEY  PROD =  IT_SOURCE-PROD .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; IT_TARGET-PROD  = IT_NEWMAP-NEWPROD .&lt;/P&gt;&lt;P&gt; IT_TARGET-PROD3 = IT_NEWMAP-NEWPROD+0(9) .&lt;/P&gt;&lt;P&gt; IT_TARGET-MATERIAL = IT_NEWMAP-MATERIAL .&lt;/P&gt;&lt;P&gt;IT_TARGET-AMOUNT  = ( IT_NEWMAP * ( 1 / IT_NEWMAP-SPLITRATIO )) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND IT_TARGET .&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE IT_OLDMAPWITH KEY  PROD = IT_SOURCE-PROD  .&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IT_TARGET-PROD  = IT_OLDMAP-PROD .&lt;/P&gt;&lt;P&gt; IT_TARGET-PROD3 = IT_OLDMAP-PROD+0(9) .&lt;/P&gt;&lt;P&gt; IT_TARGET-MATERIAL = IT_OLDMAP-MATERIAL .&lt;/P&gt;&lt;P&gt;IT_TARGET-AMOUNT  =  IT_SOURCE-AMOUNT  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND IT_TARGET .&lt;/P&gt;&lt;P&gt;&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;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS&lt;/P&gt;&lt;P&gt;dEEPAK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please do not write all upper case and use code markups!&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Sep 3, 2010 9:10 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 06:12:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230693#M1524820</guid>
      <dc:creator>deepak_dhamat</dc:creator>
      <dc:date>2010-09-03T06:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230694#M1524821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your READ TABLE only gets 1 entry from IT_MAP_TAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;read table IT_MAP_TAB into wa_it_map_tab with table key ZPRODH4 = rp-prodh4.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT IT_MAP_TAB into wa_it_map_tab WHERE ZPRODH4 = rp-prodh4.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in this loop append an entry to your target internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 07:15:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230694#M1524821</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-03T07:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230695#M1524822</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 have tried and it doesn't work. Main product and amount are not splitted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
* Internal table for New Mapping table
TYPES: BEGIN OF new_tab,
         PRODH4 TYPE /BIC/AZMAP_TAB00-PRODH4,
         /BIC/ZNEW_MP TYPE /BIC/AZMAP_TAB00-/BIC/ZNEW_MP,
         /BIC/ZSP_RATIO TYPE /BIC/AZMAP_TAB00-/BIC/ZSP_RATIO,
         MATERIAL TYPE /BIC/AZMAP_TAB00-MATERIAL,
       END OF new_tab.
       
* Internal table for old Mapping table
TYPES: BEGIN OF old_tab,
         PRODH4 TYPE /BIC/AZPR4MTCV00-PRODH4,
         MATERIAL TYPE /BIC/AZPR4MTCV00-MATERIAL,
       END OF old_tab.

Data: it_tab TYPE STANDARD TABLE OF new_tab INITIAL SIZE 0,

     wa_tab TYPE new_tab.

Data: it_oldtab TYPE STANDARD TABLE OF new_tab INITIAL SIZE 0,

     wa_oldtab TYPE old_tab.
Data rp TYPE  _ty_s_TG_1.

LOOP AT RESULT_PACKAGE INTO rp.

   LOOP AT it_tab into wa_tab where PRODH4 = rp-PRODH4.

   IF sy-subrc EQ 0.
   rp-PRODH4 = wa_tab-/BIC/ZNEW_MP.
   rp-MATERIAL = wa_tab-MATERIAL.
   rp-AMOUNT = rp-AMOUNT * wa_tab-/BIC/ZSP_RATIO.


   ELSE.
  SELECT SINGLE PRODH4 MATERIAL from /BIC/AZPR4MTCV00 into corresponding
  fields of wa_oldtab.
   IF sy-subrc EQ 0.
 rp-MaTERIAL = wa_oldtab-MATERIAL.
rp-PRODH4 = wa_oldtab-PRODH4.
rp-AMOUNT = rp-AMOUNT.
rp-PRODH3 = wa_oldtab-PRODH4+0(9).

ENDIF.

ENDIF.
ENDLOOP.

MODIFY RESULT_PACKAGE FROM rp.

ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 08:24:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230695#M1524822</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-09-03T08:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230696#M1524823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_tab INTO wa_tab WHERE prodh4 = rp-prodh4.

      IF sy-subrc EQ 0.
        rp-prodh4 = wa_tab-/bic/znew_mp.
        rp-material = wa_tab-material.
        rp-amount = rp-amount * wa_tab-/bic/zsp_ratio.


      ELSE.
        SELECT SINGLE prodh4 material FROM /bic/azpr4mtcv00 INTO CORRESPONDING
        FIELDS OF wa_oldtab.
        IF sy-subrc EQ 0.
          rp-material = wa_oldtab-material.
          rp-prodh4 = wa_oldtab-prodh4.
          rp-amount = rp-amount.
          rp-prodh3 = wa_oldtab-prodh4+0(9).

        ENDIF.

      ENDIF.
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change to&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_tab INTO wa_tab WHERE prodh4 = rp-prodh4.

        rp-prodh4 = wa_tab-/bic/znew_mp.
        rp-material = wa_tab-material.
        rp-amount = rp-amount * wa_tab-/bic/zsp_ratio.

* append in some other target internal table and work from there

    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 08:33:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230696#M1524823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-03T08:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230697#M1524824</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;PRE&gt;&lt;CODE&gt;
LOOP AT it_tab INTO wa_tab WHERE prodh4 = rp-prodh4.
 
        rp-prodh4 = wa_tab-/bic/znew_mp.
        rp-material = wa_tab-material.
        rp-amount = rp-amount * wa_tab-/bic/zsp_ratio.
 
* append in some other target internal table and work from there
 
    ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have already declared 2 internal tables to store the data coming from new mapping table and old mapping table. can you please give me an example of what I should do next i.e code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 09:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230697#M1524824</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-09-03T09:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230698#M1524825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try somehting like this. I am using the names from your examples and not from your source code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*Source Table
*PROD AMOUNT
*900006600999 1000
*400004400000 500
*
*NEW MAPPING TABLE
*PROD NEWPROD MATERIAL SPLITRATIO
*900006600999 1000066001111 7000 0.5
*900006600999 1000066002222 7001 0.4
*900006600999 1000066003333 7002 0.1
*
*OLD MAPPING TABLE
*PROD MATERIAL
*4000044000000 7100
*
*TARGET TABLE
*
*PROD PROD3 MATERIAL AMOUNT
*1000066001111 100006600 7000 500
*1000066002222 100006600 7001 400
*1000066003333 100006600 7002 100
*4000044000000 400004400 7100 500

  LOOP AT it_source INTO wa_source.

    LOOP AT it_new_maptab INTO wa_new_maptab WHERE prod EQ wa_source-prod.

      wa_target-prod     = wa_new_maptab-newprod.
      wa_target-prod3    = wa_new_maptab-newprod(9).
      wa_target-material = wa_new_maptab-material.
      wa_target-amount   = wa_source-amount * wa_new_maptab-splitratio.
      APPEND wa_target TO it_target.

    ENDLOOP.
    IF sy-subrc NE 0.
      LOOP AT it_old_maptab INTO wa_old_maptab WHERE prod EQ eq WA_SOURCE-PROD.
        wa_target-prod     = wa_old_maptab-prod.
        wa_target-prod3    = wa_old_maptab-prod(9).
        wa_target-material = wa_old_maptab-material.
        wa_target-amount   = wa_source-amount.
        APPEND wa_target TO it_target.
      ENDLOOP.

    ENDIF.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Sep 2010 09:31:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230698#M1524825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-03T09:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code Logic for splitting is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230699#M1524826</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 rewrote the code the like this and it is still not working as the new value is not being fetched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{* TABLES: ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Defining tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Tables: /BIC/OLDTABLE,/BIC/NEWTABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$ end of global - insert your declaration only before this line -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The follow definition is new in the BW3.x&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;BEGIN OF DATA_PACKAGE_STRUCTURE.&lt;/P&gt;&lt;P&gt;INCLUDE STRUCTURE /BIC/CS8ZSEM_TC03.&lt;/P&gt;&lt;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;RECNO LIKE sy-tabix,&lt;/P&gt;&lt;P&gt;END OF DATA_PACKAGE_STRUCTURE.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE&lt;/P&gt;&lt;P&gt;WITH HEADER LINE&lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;New Material table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: BEGIN OF I_S_NEWTAB,&lt;/P&gt;&lt;P&gt;PRODH4 TYPE /BIC/NEWTABLE-PRODH4,&lt;/P&gt;&lt;P&gt;/BIC/ZNEW_MP TYPE /BIC/NEWTABLE-/BIC/ZNEW_MP,&lt;/P&gt;&lt;P&gt;/BIC/ZSP_RATIO TYPE /BIC/NEWTABLE-/BIC/ZSP_RATIO,&lt;/P&gt;&lt;P&gt;MATERIAL TYPE /BIC/NEWTABLE-MATERIAL,&lt;/P&gt;&lt;P&gt;END OF I_S_NEWTAB.&lt;/P&gt;&lt;P&gt;Data: i_t_newtab LIKE TABLE OF I_S_NEWTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Old Material table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF I_S_OLDTAB,&lt;/P&gt;&lt;P&gt;PRODH4 TYPE /BIC/OLDTABLE-PRODH4,&lt;/P&gt;&lt;P&gt;MATERIAL TYPE /BIC/OLDTABLE-MATERIAL,&lt;/P&gt;&lt;P&gt;END OF I_S_OLDTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: i_t_oldtab like table of I_S_oldTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: e_s_result type STANDARD TABLE OF DATA_PACKAGE_STRUCTURE WITH&lt;/P&gt;&lt;P&gt;HEADER LINE&lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.&lt;/P&gt;&lt;P&gt;data: e_t_result type STANDARD TABLE OF DATA_PACKAGE_STRUCTURE WITH&lt;/P&gt;&lt;P&gt;HEADER LINE&lt;/P&gt;&lt;P&gt;WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: amount type DATA_PACKAGE_STRUCTURE-/BIC/AMOUNT.&lt;/P&gt;&lt;P&gt;data: CUSTSOLD type DATA_PACKAGE_STRUCTURE-/BIC/CUSTSOLD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;selecting data from new table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Select PRODH4 /BIC/ZNEW_MP /BIC/ZSP_RATIO MATERIAL FROM /BIC/NEWTABLE&lt;/P&gt;&lt;P&gt;into corresponding fields of table i_t_newtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT i_t_newtab by PRODH4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selecting data from old material table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Select PRODH4 MATERIAL FROM /BIC/OLDTABLE into corresponding fields&lt;/P&gt;&lt;P&gt;of table i_t_oldtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT i_t_oldtab by PRODH4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT DATA_PACKAGE INTO e_s_result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table i_t_oldtab into i_s_oldtab with key PRODH4 =&lt;/P&gt;&lt;P&gt;e_s_result-PRODH4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;MOVE i_s_oldtab-PRODH4 to e_s_result-PRODH4.&lt;/P&gt;&lt;P&gt;MOVE i_s_oldtab-PRODH4(14) to e_s_result-PRODH3.&lt;/P&gt;&lt;P&gt;MOVE i_s_oldtab-MATERIAL to e_s_result-MATERIAL.&lt;/P&gt;&lt;P&gt;APPEND e_s_result to e_t_result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_t_newtab into i_s_newtab where PRODH4 = e_s_result-PRODH4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;amount = i_s_newtab-/BIC/ZSP_RATIO * e_s_result-/BIC/AMOUNT.&lt;/P&gt;&lt;P&gt;CONCATENATE DATA_PACKAGE-SOLD_TO i_s_newtab-PRODH4(10) into AMOUNT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE i_s_newtab-/BIC/ZNEW_MP to e_s_result-PRODH4.&lt;/P&gt;&lt;P&gt;MOVE i_s_newtab-MATERIAL to e_s_result-MATERIAL.&lt;/P&gt;&lt;P&gt;MOVE i_s_newtab-/BIC/ZNEW_MP(14) to e_s_result-PRODH3.&lt;/P&gt;&lt;P&gt;MOVE amount to e_s_result-/BIC/AMOUNT.&lt;/P&gt;&lt;P&gt;MOVE ZASTUOTE to e_s_result-/BIC/CUSTSOLD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND e_s_result to e_t_result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH DATA_PACKAGE.&lt;/P&gt;&lt;P&gt;MOVE e_t_result to DATA_PACKAGE[].}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Sep 2010 06:18:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-logic-for-splitting-is-not-working/m-p/7230699#M1524826</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-09-22T06:18:13Z</dc:date>
    </item>
  </channel>
</rss>

