<?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: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120531#M444349</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvaro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the currency in customer master data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Suresh Ganti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Apr 2007 15:32:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-16T15:32:27Z</dc:date>
    <item>
      <title>Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120527#M444345</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'm using BAPI_SALESORDER_CREATEFROMDAT2 to generated invoices...but there's something wrong...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got two companies and I must generate two invoices for each (one in PEN and other one in USD).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that for the first company, both invoices are generated in PEN and for the second company both are generated in USD....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a piece of code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  LOOP AT T_KUNNR_WONG ASSIGNING &amp;lt;KUNNR&amp;gt;.

    PERFORM BORRAR_TABLAS.

    LOOP AT T_FACT_WONG ASSIGNING &amp;lt;FACT&amp;gt;
    WHERE WAERS EQ 'PEN'
      AND KUNNR EQ &amp;lt;KUNNR&amp;gt;-KUNNR.
      W_POSICION = W_POSICION + 10.
      IF ORDER_HEADER_IN[] IS INITIAL.
        ORDER_HEADER_IN-DOC_TYPE = C_DOC_TYPE.
        ORDER_HEADER_IN-SALES_ORG = &amp;lt;FACT&amp;gt;-VKORG.
        ORDER_HEADER_IN-DISTR_CHAN = C_VTWEG.
        ORDER_HEADER_IN-DIVISION = C_SPART.
        ORDER_HEADER_IN-PURCH_DATE = SY-DATUM.
        ORDER_HEADER_IN-CURRENCY = &amp;lt;FACT&amp;gt;-WAERS.
        APPEND ORDER_HEADER_IN.
        ORDER_HEADER_INX-UPDATEFLAG = 'I'.
        ORDER_HEADER_INX-PURCH_DATE = 'X'.
        ORDER_HEADER_INX-DOC_TYPE = 'X'.
        ORDER_HEADER_INX-SALES_ORG = 'X'.
        ORDER_HEADER_INX-DISTR_CHAN = 'X'.
        ORDER_HEADER_INX-DIVISION = 'X'.
        APPEND ORDER_HEADER_INX.
      ENDIF.
      ORDER_ITEMS_IN-MATERIAL = T_CONSTANTS-LOW.
      ORDER_ITEMS_IN-PO_ITM_NO = W_POSICION.
      ORDER_ITEMS_IN-TARGET_VAL = &amp;lt;FACT&amp;gt;-ZVANETO.
      ORDER_ITEMS_IN-CURRENCY = &amp;lt;FACT&amp;gt;-WAERS.
      ORDER_ITEMS_IN-PLANT = &amp;lt;FACT&amp;gt;-VKBUR.
      APPEND ORDER_ITEMS_IN.
      ORDER_SCHEDULES_IN-ITM_NUMBER = W_POSICION.
      ORDER_SCHEDULES_IN-REQ_QTY = 1.
      ORDER_SCHEDULES_IN-REQ_DATE = SY-DATUM.
      ORDER_SCHEDULES_IN-DLV_DATE = SY-DATUM.
      APPEND ORDER_SCHEDULES_IN.
      ORDER_ITEMS_INX-UPDATEFLAG = 'I'.
      ORDER_ITEMS_INX-MATERIAL = 'X'.
      ORDER_ITEMS_INX-TARGET_VAL = 'X'.
      ORDER_ITEMS_INX-PLANT = 'X'.
      APPEND ORDER_ITEMS_INX.
      ORDER_PARTNERS-PARTN_ROLE = C_AG.
      ORDER_PARTNERS-PARTN_NUMB = &amp;lt;FACT&amp;gt;-KUNNR.
      APPEND ORDER_PARTNERS.
      ORDER_CONDITIONS_IN-COND_TYPE = C_ZPR1.
      ORDER_CONDITIONS_IN-ITM_NUMBER = W_POSICION.
      ORDER_CONDITIONS_IN-COND_VALUE = &amp;lt;FACT&amp;gt;-ZVANETO.
      ORDER_CONDITIONS_IN-CURRENCY = &amp;lt;FACT&amp;gt;-WAERS.
      APPEND ORDER_CONDITIONS_IN.
    ENDLOOP.

    IF NOT ORDER_ITEMS_IN[] IS INITIAL.
      PERFORM BAPI TABLES ORDER_HEADER_IN
                          ORDER_HEADER_INX
                          ORDER_ITEMS_IN
                          ORDER_ITEMS_INX
                          ORDER_PARTNERS
                          ORDER_SCHEDULES_IN
                          ORDER_CONDITIONS_IN.
    ENDIF.
ENDLOOP.

FORM BAPI TABLES T_ORDER_HEADER_IN STRUCTURE BAPISDHD1
                 T_ORDER_HEADER_INX STRUCTURE BAPISDHD1X
                 T_ORDER_ITEMS_IN STRUCTURE BAPISDITM
                 T_ORDER_ITEMS_INX STRUCTURE BAPISDITMX
                 T_ORDER_PARTNERS STRUCTURE BAPIPARNR
                 T_ORDER_SCHEDULES_IN STRUCTURE BAPISCHDL
                 T_ORDER_CONDITIONS_IN STRUCTURE BAPICOND.

  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
       EXPORTING
            ORDER_HEADER_IN       = T_ORDER_HEADER_IN
            ORDER_HEADER_INX      = T_ORDER_HEADER_INX
            INT_NUMBER_ASSIGNMENT = 'X'
       TABLES
            RETURN                = RETURN
            ORDER_ITEMS_IN        = T_ORDER_ITEMS_IN
            ORDER_ITEMS_INX       = T_ORDER_ITEMS_INX
            ORDER_PARTNERS        = T_ORDER_PARTNERS
            ORDER_SCHEDULES_IN    = T_ORDER_SCHEDULES_IN
            ORDER_CONDITIONS_IN   = T_ORDER_CONDITIONS_IN.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  PERFORM SLEEP.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I clean all tables before each BAPI call....Can you help me on this???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 14:37:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120527#M444345</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T14:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120528#M444346</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;Please check the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Clear the header record before the loop ..... endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. In debugging, check all the tables that have WAERS and what are the values populated before the BAPI call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. For the 1st Loop ...... there is no ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Suresh Ganti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 14:51:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120528#M444346</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T14:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120529#M444347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suresh:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yeah...There wasn't an ENDLOOP, but it was just a typo error -:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm cleaning the header for the other LOOPS...Also I'm using FIELD-SYMBOLS, so I don't think that's the real problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked the DATA a lot of times, and even when CURRENCY is set to USD...The invoice generate a PEN one...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:01:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120529#M444347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T15:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120530#M444348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvaro , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you check the account group of customer , may be currency is not defined for the customer master data .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure this would be handy ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Caglar Ozkor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:25:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120530#M444348</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T15:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120531#M444349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvaro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the currency in customer master data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Suresh Ganti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:32:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120531#M444349</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T15:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120532#M444350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Caglar:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currency is defined for both customers...As I said...BAPI should create something like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WONG PEN
WONG USD
METR PEN
METR USD
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it's creating&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WONG PEN
WONG PEN
METR USD
METR USD
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:32:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120532#M444350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T15:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem regarding BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120533#M444351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I fixed -:D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This line was needed...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
ORDER_HEADER_INX-CURRENCY = 'X'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 16:40:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-regarding-bapi-salesorder-createfromdat2/m-p/2120533#M444351</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T16:40:05Z</dc:date>
    </item>
  </channel>
</rss>

