<?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: BAdI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631108#M281660</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Bhasker&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before diving into your code I would recommend a simple "smoke" test:&lt;/P&gt;&lt;P&gt;- clear the field SORTF for all entries in your itab and see what happens. If nothing happens this suggests that you cannot update your entries with empty SORTF using this BAdI method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With respect to the coding I have some suggestions:&lt;/P&gt;&lt;P&gt;(1) You know that the structure of your itab is STPOB. Thus, there is no need to use a field symbol.&lt;/P&gt;&lt;P&gt;(2) Define a second itab (with fields MATNR MATKL) and make a single SELECT on MARA with the option FOR ALL ENTRIES IN gt_stpob. Sort this itab by matnr. Within the loop you make a READ gt_2nd_itab with BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Sep 2006 21:56:06 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2006-09-27T21:56:06Z</dc:date>
    <item>
      <title>BAdI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631107#M281659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on BAdI BOM_UPDATE ( method Change_at_save)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to populate the sort string field (sortf) at the commponent level at BOM save (CS01 and CS02) with Material Group value + Component Item number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the item doesnt have a material group I should not populate the sort string&lt;/P&gt;&lt;P&gt;But if the sort string field is already populated and the item doesnt have the material group value, I need to clear the sort string(sortf).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I see in the debug mode sort string is getting cleared for the materials which doesnt have material group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I bo back and check the tranasaction after change sort string field is not blank (not getting cleared)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one tell me whats wrong with my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code in the method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The field symbol &amp;lt;TABLE&amp;gt; refers to the method(CHANGE_AT_SAVE) parameter DELTA_STPOB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue is after end method statement updated values in the table &amp;lt;TABLE&amp;gt; are not going into DELTA_STPOB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_matkl type mara-matkl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: stpob TYPE stpob.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: FIELD_NAME(30) VALUE '(SAPLCSBT)O1-STPOB[]'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;TABLE&amp;gt; TYPE TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN (FIELD_NAME) TO &amp;lt;TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;TABLE&amp;gt; INTO STPOB.&lt;/P&gt;&lt;P&gt;clear l_matkl&lt;/P&gt;&lt;P&gt;clear stpob-sortf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single matkl&lt;/P&gt;&lt;P&gt;from MARA&lt;/P&gt;&lt;P&gt;into l_matkl&lt;/P&gt;&lt;P&gt;where matnr = stpob-idnrk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt; if not l_matkl is initial.&lt;/P&gt;&lt;P&gt;  concatenate l_matkl(3) '.' stpob-posnr(3) into-sortf.&lt;/P&gt;&lt;P&gt;  modify &amp;lt;table&amp;gt; from stpob.&lt;/P&gt;&lt;P&gt; else.&lt;/P&gt;&lt;P&gt;  modify &amp;lt;table&amp;gt; from stpob.&lt;/P&gt;&lt;P&gt; endif.&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;Thanks&lt;/P&gt;&lt;P&gt;Bhasker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 20:29:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631107#M281659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-27T20:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: BAdI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631108#M281660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Bhasker&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before diving into your code I would recommend a simple "smoke" test:&lt;/P&gt;&lt;P&gt;- clear the field SORTF for all entries in your itab and see what happens. If nothing happens this suggests that you cannot update your entries with empty SORTF using this BAdI method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With respect to the coding I have some suggestions:&lt;/P&gt;&lt;P&gt;(1) You know that the structure of your itab is STPOB. Thus, there is no need to use a field symbol.&lt;/P&gt;&lt;P&gt;(2) Define a second itab (with fields MATNR MATKL) and make a single SELECT on MARA with the option FOR ALL ENTRIES IN gt_stpob. Sort this itab by matnr. Within the loop you make a READ gt_2nd_itab with BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 21:56:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631108#M281660</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-09-27T21:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: BAdI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631109#M281661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Uwe,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your suggestion I tried to clear the field for all entries in &amp;lt;TABLE&amp;gt;, but nothing happend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In cs02 when I change some field for BOM component item then only sortf field is getting updated for that particular component, but remaining components are not getting updated. When I add a new BOM component item, then also sortf field is getting updated ie my code is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I need to update all the components at save eventhough there is no change in components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Bhasker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 23:00:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/badi/m-p/1631109#M281661</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-27T23:00:21Z</dc:date>
    </item>
  </channel>
</rss>

