<?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: Set Commodity Code in Purchase order in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395777#M191756</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;looks quite good, just a small hint:&lt;/P&gt;&lt;P&gt;check the sy-subrc after method im_item-&amp;gt;get_foreign_trade.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you had no foreign trade data / there was a problem while reading and thus you can't update the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jun 2006 14:51:09 GMT</pubDate>
    <dc:creator>christian_wohlfahrt</dc:creator>
    <dc:date>2006-06-29T14:51:09Z</dc:date>
    <item>
      <title>Set Commodity Code in Purchase order</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395776#M191755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have implemented a BADi for purchase order for updating the commodity code/weight and Volume from material configuration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works fine with updating for weight and volume. But when trying to update the Commodity code I got a "time out" because it stops just before the call "CALL Method-&amp;gt;Set_foreign_trade".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I miss something???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the codes below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;METHOD if_ex_me_process_po_cust~process_item .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: ls_mepoitem TYPE mepoitem.&lt;/P&gt;&lt;P&gt;  DATA: it_conf TYPE TABLE OF conf_out.&lt;/P&gt;&lt;P&gt;  DATA: wa_conf TYPE conf_out.&lt;/P&gt;&lt;P&gt;  DATA: gs_zvcsd_conf TYPE zvcsd_conf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: im_data TYPE mepoitem.&lt;/P&gt;&lt;P&gt;  DATA: l_data_new  TYPE mepoitem.&lt;/P&gt;&lt;P&gt;  DATA: lv_mtart TYPE mtart.&lt;/P&gt;&lt;P&gt;  DATA: len TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: ls_mepo_eipo TYPE mepo_eipo.&lt;/P&gt;&lt;P&gt;  DATA: ls_mepo_eipo_new TYPE mepo_eipo.&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;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get data &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  ls_mepoitem = im_item-&amp;gt;get_data( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check entry from control table zvcsd_conf&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT SINGLE * FROM zvcsd_conf INTO gs_zvcsd_conf&lt;/P&gt;&lt;P&gt;  WHERE matnr EQ ls_mepoitem-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE mtart&lt;/P&gt;&lt;P&gt;  FROM mara&lt;/P&gt;&lt;P&gt;  INTO lv_mtart&lt;/P&gt;&lt;P&gt;  WHERE matnr EQ ls_mepoitem-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CHECK lv_mtart EQ  'KMAT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'VC_I_GET_CONFIGURATION_IBASE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      instance           = ls_mepoitem-cuobj&lt;/P&gt;&lt;P&gt;      language           = sy-langu&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      configuration      = it_conf&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      instance_not_found = 1&lt;/P&gt;&lt;P&gt;      OTHERS             = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CHECK sy-subrc =  0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check weight is set from control table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF NOT gs_zvcsd_conf-zweight IS INITIAL.&lt;/P&gt;&lt;P&gt;    READ TABLE it_conf INTO wa_conf WITH KEY atnam = 'VCSD_ZNTGEW'.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      len = STRLEN( wa_conf-atwrt ).&lt;/P&gt;&lt;P&gt;      IF len LE 7.&lt;/P&gt;&lt;P&gt;        REPLACE ',' WITH '.' INTO wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        REPLACE '.' WITH ' ' INTO wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;        REPLACE ',' WITH '.' INTO wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;        CONDENSE wa_conf-atwrt NO-GAPS.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      ls_mepoitem-ntgew = wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;      ls_mepoitem-brgew = wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check volume is set from control table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF NOT gs_zvcsd_conf-zvolum IS INITIAL.&lt;/P&gt;&lt;P&gt;    READ TABLE it_conf INTO wa_conf WITH KEY atnam = 'VCSD_ZVOLUM'.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      len = STRLEN( wa_conf-atwrt ).&lt;/P&gt;&lt;P&gt;      IF len LE 7.&lt;/P&gt;&lt;P&gt;        REPLACE ',' WITH '.' INTO wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        REPLACE '.' WITH ' ' INTO wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;        REPLACE ',' WITH '.' INTO wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;        CONDENSE wa_conf-atwrt NO-GAPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      ls_mepoitem-volum =  wa_conf-atwrt.&lt;/P&gt;&lt;P&gt;      ls_mepoitem-voleh = gs_zvcsd_conf-voleh.&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;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set weight and volume &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  l_data_new = ls_mepoitem.&lt;/P&gt;&lt;P&gt;  CALL METHOD im_item-&amp;gt;set_data( im_data = l_data_new ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;End of get data&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;Get commodity code from configuration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF NOT gs_zvcsd_conf-zstawn IS INITIAL.&lt;/P&gt;&lt;P&gt;    READ TABLE it_conf INTO wa_conf WITH KEY atnam = 'VCSD_STAWN'.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      ls_mepo_eipo_new-stawn = wa_conf-atwrt.&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;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get foreign trade data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD im_item-&amp;gt;get_foreign_trade&lt;/P&gt;&lt;P&gt;     RECEIVING&lt;/P&gt;&lt;P&gt;        re_data = ls_mepo_eipo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ls_mepo_eipo-po_item = ls_mepoitem-ebelp.&lt;/P&gt;&lt;P&gt;  ls_mepo_eipo-stawn = ls_mepo_eipo_new-stawn.&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;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set foreign trade &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD im_item-&amp;gt;set_foreign_trade&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      im_data = ls_mepo_eipo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 13:36:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395776#M191755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-29T13:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set Commodity Code in Purchase order</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395777#M191756</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;looks quite good, just a small hint:&lt;/P&gt;&lt;P&gt;check the sy-subrc after method im_item-&amp;gt;get_foreign_trade.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you had no foreign trade data / there was a problem while reading and thus you can't update the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2006 14:51:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395777#M191756</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-06-29T14:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Set Commodity Code in Purchase order</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395778#M191757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added the check sy-subrc = 0. And the sy-subrc is 0, but it didn't help.&lt;/P&gt;&lt;P&gt;                                                            &lt;/P&gt;&lt;P&gt;check sy-subrc  = 0.                                                                                &lt;/P&gt;&lt;P&gt;ls_mepo_eipo-po_item = ls_mepoitem-ebelp.          &lt;/P&gt;&lt;P&gt;ls_mepo_eipo-stawn = ls_mepo_eipo_new-stawn.       &lt;/P&gt;&lt;P&gt;                                                            &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set foreign trade                                  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD im_item-&amp;gt;set_foreign_trade             &lt;/P&gt;&lt;P&gt;EXPORTING im_data = ls_mepo_eipo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 08:18:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395778#M191757</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T08:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Commodity Code in Purchase order</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395779#M191758</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;at least it was a chance...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think from looking at the code we can get any more hints, you should start to debug this more detailed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Goal: to find the exact statement / loop, which causes the high runtime. Maybe you don't need to debug the method set_foreign_trade step-by-step. You can trigger the debugger from SM50. &lt;/P&gt;&lt;P&gt;First have a look, if SM50 shows an obvious problem, e.g. something like waiting for RFC or a select statement for a hugh table. Then you should start the debugger in menu Program -&amp;gt; Program -&amp;gt; debug. I expect you are in an endless loop - at least that would be the most common reasons for a time-out. Try to find the loop (by some F7-jumps).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 10:19:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395779#M191758</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-06-30T10:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set Commodity Code in Purchase order</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395780#M191759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your comments and the quick response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have solved my problem now. I found two sap notes regarding this situation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;841803 - &lt;/P&gt;&lt;P&gt;ME_PROCESS_PO_CUST: Endless loop with SET_FOREIGN_TRADE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;803749 - &lt;/P&gt;&lt;P&gt;ME_PROCESS_PO_CUST - Endless Loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have found out an other thing. When I'm using the SAP Notes Search and type the key word "SET_FOREIGN_TRADE" and "ME_PROCESS_PO_CUST" I found nothing. Then I try to create a Customer Message and as you already knew that you have to enter a some words in the "Search term*"  before you are allowed to create a customer message. The system shows the note 841803. Strange, rite? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my conclusion is, if I can't find any note from SAP Notes Search then I will try to create an customer message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Linh Nguyen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 12:29:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-commodity-code-in-purchase-order/m-p/1395780#M191759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T12:29:22Z</dc:date>
    </item>
  </channel>
</rss>

