BAPI_SALESORDER_CHANGE add new line and conditions with a condition value

Hi,
I am using BAPI_SALESORDER_CHANGE to add new lines to a credit memo. All works fine except that I can not seem to put a condition value on the new lines. The condition is created but with a value of 0. I can popluate the condition amount field, KBETR but not KWERT. BAPICONDX seems to only have the COND_VALUE field in it and not CONDVALUE as in BAPICOND. Does anyone have any idea how to do this? In the code below I just want to change the material on the first line of the credit memo and not add the condition. Then add new lines with the the condition.
lw_order_header_inx-updateflag  = 'U'.
  LOOP AT i_accru INTO wa_accru.
    lv_count = lv_count + 1.
    lv_posnr = lv_count * 10.
* Order Items
    lw_order_item_inx-itm_number = lv_posnr.
    lw_order_item_inx-material   = 'X'.
    IF lv_count = 1.
      lw_order_item_inx-updateflag    = 'U'.
    ELSE.
      lw_order_item_inx-updateflag    = 'I'.
    ENDIF.
    APPEND lw_order_item_inx TO lt_order_item_inx.
    lw_order_item_in-itm_number = lv_posnr.
    lw_order_item_in-material   = wa_accru-vakey.
    APPEND lw_order_item_in TO lt_order_item_in.
* Conditions
    IF lv_count <> 1.
      lw_conditions_inx-itm_number = lv_posnr.
      lw_conditions_inx-cond_st_no = '905'.
      lw_conditions_inx-cond_count = '01'.
      lw_conditions_inx-cond_type  = 'ZHIE'.
      lw_conditions_inx-currency   = 'X'.
      lw_conditions_inx-updateflag = 'I'.
      APPEND lw_conditions_inx TO lt_conditions_inx.
      lw_conditions_in-itm_number = lv_posnr.
      lw_conditions_in-cond_st_no = '905' .
      lw_conditions_in-cond_count = '01'.
      lw_conditions_in-cond_type  = 'ZHIE'.
      lw_conditions_in-condvalue  = wa_accru-accru.
      lw_conditions_in-currency   = 'GBP'.
      APPEND lw_conditions_in TO lt_conditions_in.
    ENDIF.
  ENDLOOP.
* Change the credit memo
  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument               = lv_vbeln
      order_header_in             = lw_order_header_in
      order_header_inx            = lw_order_header_inx
*   SIMULATION                  =
*   BEHAVE_WHEN_ERROR           = ' '
*   INT_NUMBER_ASSIGNMENT       = ' '
*   LOGIC_SWITCH                =
*   NO_STATUS_BUF_INIT          = ' '
    TABLES
      return                      = lt_return
      order_item_in               = lt_order_item_in
      order_item_inx              = lt_order_item_inx
*   PARTNERS                    =
*   PARTNERCHANGES              =
*   PARTNERADDRESSES            =
*   ORDER_CFGS_REF              =
*   ORDER_CFGS_INST             =
*   ORDER_CFGS_PART_OF          =
*   ORDER_CFGS_VALUE            =
*   ORDER_CFGS_BLOB             =
*   ORDER_CFGS_VK               =
*   ORDER_CFGS_REFINST          =
*   SCHEDULE_LINES              =
*   SCHEDULE_LINESX             =
*   ORDER_TEXT                  =
*   ORDER_KEYS                  =
     conditions_in               = lt_conditions_in
     conditions_inx              = lt_conditions_inx
*   EXTENSIONIN                 =
  IF sy-subrc = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
  ENDIF.

Hi Rob,
Have you managed to solve this issue. If so, could you please share the solution.
I am also facing similar problem.
Thanks for your help.
Anoop

Similar Messages

  • Cannot Add new line using BI IP query

    Hi All,
    We have created a planning application (BI IP Query) and used it in VC 7.1 model using BI Query Wizard service. Now we are able to customize existing rows ( existing rows are using flat file upload)... we can able to change the existing record values and save it.
    But we are not able to add new line... its going to dump... We are able to add new line using WAD with same query but not in VC 7.1
    This issue is same as below 2 threads...
    Re: How to create new records through a VC form in an input-ready query??
    Re: Cannot add new records through VC form when consuming IP write back query?
    Thanks,
    PradeeP

    Its working now... SAP has given the fix (patch) for this issue when we deployed it, everything is working fine... I think they will release this fix (patch)soon...
    Raise an Sap OSS message for solution

  • Add new line item in VA02 by copying same Order line details

    Hi All,
    I've a requirement where i need to add new line items in the Sales Order (T Code VA02) with reference to the same Order lines . For e.g an Order 80000100 which has 2 line items and the requirement is to create a new line i.e. line item 0030 by copying the details from the existing line item 0010 of the same order .
    I've checked the BAPI - BAPI_SALESDOCUMENT_COPY which is for Order Creation T Code VA01 . I'm looking out for Sales Order Change BAPI where i can give the reference as Order no and Order line item which will create a new line item in the same Order with the same details of the reference Order line item .
    Do let me know your thoughts !!!!
    Thanks,
    Bintu

    Hi -
    Please check these two FM's BAPI_SALESORDER_GETDETAILBOS & BAPI_SALESORDER_CHANGE.
    Regards,
    Atul Mohanty

  • Add new line in VA01

    hi
    I want to add a new line in va01 when a condition is requested. So for example i put 3 line and when a condition is ok i want to create so insert in vbap a new line in the order. I try with  the badi BADI_SD_SALES_ITEM and ITEM_PREPARE but it's not work . Any idea ??
    thanks

    hI,
    The badi BADI_SD_SALES_ITEM is the purpose of SAP Internal use (Check the Checkbox in Attributes Tab)so u can't implement the BADI.
    try to keep the code even in USEREXIT_SAVE_DOCUMENT/USEREXIT_CHECK_VBAP in MV45AFZB.check the theard
    Re: add a new tab in transaction ME51N
    Regards
    Kiran Sure
    Edited by: Kiran Sure(skk) on May 20, 2008 5:19 PM

  • How to add new line item to SO using BAPI_SALESORDER_CREATEFROMDAT2

    Hi,
    I have sales order A with 1 line item, now i want to add new line item with material x and quantity y to the existing sales order A
    using BAPI_SALESORDER_CREATEFROMDAT2.
    Line item no for new line item should be generated by SAP internally.Please let me know the mandatory parameters to be passed to the BAPI to fulfill the requirement.
    DATA: order_header TYPE bapisdhd1,
               order_inx TYPE bapisdhd1x,
               partners TYPE TABLE OF bapiparnr,
               wa_partners TYPE bapiparnr.
    CLEAR: salesdocument,order_header_inx,wa_in, wa_inx.
    REFRESH: item_in, item_inx.
      salesdocument = wa_vbup-vbeln.
      order_header_inx-updateflag = 'X'.
      wa_in-itm_number = ' '.
      wa_in-material = p_nmatnr.
      wa_in-target_qty = gv_menge - gv_wemng.
      APPEND wa_in TO item_in.
      wa_inx-itm_number = ' '.
      wa_inx-updateflag = 'U'.
      wa_inx-target_qty = 'X'.
      APPEND wa_inx TO item_inx.
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
           salesdocumentin               = salesdocument
           order_header_in               = order_header
           order_header_inx              = order_inx
          IMPORTING
           salesdocument                 = salesdocument
          TABLES
           return                              = return
           order_items_in                = item_in
           order_items_inx               = item_inx
           order_partners                = partners.
    Thanks
    Bhuvana

    Hello,
    You can use FM: BAPI_SALESORDER_CHANGE with update indicator I (insert)
      call function 'BAPI_SALESORDER_CHANGE'
        exporting
          salesdocument    = l_vbeln
          order_header_inx = l_wa_order_header_inx
          simulation       = l_simulation
        tables
          return           = l_i_return
          order_item_in    = l_i_order_item
          order_item_inx   = l_i_order_item_inx
          partners         = l_i_partners
          schedule_lines   = l_i_schedule_lines
          schedule_linesx  = l_i_schedule_linesx
          extensionin      = l_i_extensionin.
    Thanks
    Subhankar

  • Add new line in the Flat file based on the field value

    Hi,
    Following is my Flat File -
    Customer   X      Y
    1001          1       2
    1002          0       1
    Based on the X and Y value I need to add new lines in the Flat file. If X>0 then add a new line with repeating row and Y>0 add again a new line with repeating row. If X or Y=0 then no need to add any repeating new line. 
    So, here for the above example I need output as-
    Customer    X    Y
    1001          1      2
    1001         1       2
    1001         1       2
    1002          0       1
    1002          0        1
    Suggest how we can achieve this?
    Regards,
    Tridib Konwar 

    Hi Tridib,
        I tried your scenario and You will have to use the custom xslt to get the expected result.
        Please find bellow the xslt code which you can use in your map.
    <?xml version="1.0" encoding="utf-16" ?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns0="http://PracticeAtul.XYFlatFileSchema">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/ns0:XYComp" />
    </xsl:template>
    <xsl:template match="/ns0:XYComp">
    <ns0:XYComp>
    <XYComp_Child1>
    <XYComp_Child1_Child1>
    <xsl:value-of select="XYComp_Child1/XYComp_Child1_Child1/text()" />
    </XYComp_Child1_Child1>
    <XYComp_Child1_Child2>
    <xsl:value-of select="XYComp_Child1/XYComp_Child1_Child2/text()" />
    </XYComp_Child1_Child2>
    <XYComp_Child1_Child3>
    <xsl:value-of select="XYComp_Child1/XYComp_Child1_Child3/text()" />
    </XYComp_Child1_Child3>
    <xsl:value-of select="XYComp_Child1/text()" />
    </XYComp_Child1>
    <xsl:for-each select="XYComp_Child2">
    <XYComp_Child2>
    <XYComp_Child2_Child1>
    <xsl:value-of select="XYComp_Child2_Child1/text()" />
    </XYComp_Child2_Child1>
    <XYComp_Child2_Child2>
    <xsl:value-of select="XYComp_Child2_Child2/text()" />
    </XYComp_Child2_Child2>
    <XYComp_Child2_Child3>
    <xsl:value-of select="XYComp_Child2_Child3/text()" />
    </XYComp_Child2_Child3>
    </XYComp_Child2>
    <xsl:if test="XYComp_Child2_Child2/text()!=0">
    <XYComp_Child2>
    <XYComp_Child2_Child1>
    <xsl:value-of select="XYComp_Child2_Child1/text()" />
    </XYComp_Child2_Child1>
    <XYComp_Child2_Child2>
    <xsl:value-of select="XYComp_Child2_Child2/text()" />
    </XYComp_Child2_Child2>
    <XYComp_Child2_Child3>
    <xsl:value-of select="XYComp_Child2_Child3/text()" />
    </XYComp_Child2_Child3>
    </XYComp_Child2>
    </xsl:if>
    <xsl:if test="XYComp_Child2_Child3/text()!=0">
    <XYComp_Child2>
    <XYComp_Child2_Child1>
    <xsl:value-of select="XYComp_Child2_Child1/text()" />
    </XYComp_Child2_Child1>
    <XYComp_Child2_Child2>
    <xsl:value-of select="XYComp_Child2_Child2/text()" />
    </XYComp_Child2_Child2>
    <XYComp_Child2_Child3>
    <xsl:value-of select="XYComp_Child2_Child3/text()" />
    </XYComp_Child2_Child3>
    </XYComp_Child2>
    </xsl:if>
    </xsl:for-each>
    </ns0:XYComp>
    </xsl:template>
    </xsl:stylesheet>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.
    Atul Toke

  • Add new line item in existing outbound delivery

    Hi,
    I am trying to add new line item in existing outbound delivery with material number and quantity.
    for this i tried BAPI_OUTB_DELIVERY_CHANGE and LE_MOB_DELIVERY_UPDATE.
    but both fm doesn't work and this will not add new line in that delivery.
    please help me how can i add new line item in delivery.
    I hope someone will help me........plz
    Thanks

    This kind of question is about to become a FAQ, I think....search the forum for similar questions.

  • To add new Line Items in Accounting Document using BTE

    Hi,
    We have a requirement to add new GL line items while doing PGI through VL02N. The requirement is as below. Please confirm, if we can use BTE 1120 for this and if yes, how to use it to add new line items.
    Orig line items:
    Item PK Acct No USD
    001 99 12200 565.00
    002 81 40000 565.00
    New DESIRED line items:
    Item PK Acct No USD
    001 99 12200 565.00
    002 81 40000 565.00
    003 91 40000 565.00
    004 81 40001 565.00
    Regards
    Sai

    Hi,
    I need to add new line items previously to save the FI document too.
    Could you explain how we can use BTE 1120 to change or add new lines, please?
    I have done a test but it don't work:
    (Function open_fi_perform_00001120_p)
    L_BSEG[] = T_BSEG[].
    Call to the function that handle the BTE, with L_BSEG[] parameter.
    T_BSEG[]  = L_BSEG[].                                "Note 996552
    Then our new values in T_BSEG table are replace for the original table, and our changes are be deleted.
    Thanks in advance,
    Susana

  • How to add new lines

    hai Friends , i've some problems, i really don't know how to add new line when typing
    Thanks

    Sorry you feel that way. It is still a new platform and is improving with every update. Hopefully the next update will make things better for you then.
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • How to add new line in transact move order line

    Hi,
    i am able to update locaotr in Transact move order.
    But i want to add two locators for the same line.
    I tried to insert one more record in data base, but getting error unique index error.
    so how can we add new line in transact move order line .
    please help to slove this isse.
    Thanks In Advance
    Venu.

    Hi,
    the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
    nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
    So, I don't see why you need to add a new line in transact move order.
    You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
    Thanks

  • How to add new line in message on my S890

    My stock keyboard in Lenovo S890 doesn't have enter key, is this normal ? How to add new line ?
    However this happened only in messages, while using whatsapp the enter key present.

    Hi,
    the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
    nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
    So, I don't see why you need to add a new line in transact move order.
    You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
    Thanks

  • Adding new line and sapaces in between the text in AI Script

    areaText.contents = "This is an Area Text in a rectangle. See how it flows to the next line.";
    i want to break the sentance from 'Text' ie i want to add new line in between and also some more spaces can any one plz help
    for example
    I want to write the above text like this way
    this is an Area
    Text in a rectangle.   See
        how it       flows to the
    next line  

    that's a much better explanation, you didn't have to create another thread, you could have replied to my reply in the original thread.
    we use the "\r" character to insert a new line and we can use "\t" to insert a "tab" for the spaces, or the actual spaces in a variable
    var sixSpaces = "      ";
    areaText.contents = "This is an Area\rText in a rectangle." + sixSpaces + "See\r" + sixSpaces + "how it" + sixSpaces + "flows to the\rnext line.";

  • Ever since the last update I don't have my old bookmarks, can't add new ones and can't import my HTML file. How do I fix this?

    ever since the last firefox update I don't have my old bookmarks, can't add new ones and can't add my HTML file of my bookmarks

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • ALV  List Layout add new button  and modify Append Row Button Text and Logi

    Hi All,
    I am working on Employee custom development Application in Webdynpro ABAP>
    In my ALV list Layout  I have to add new  two Buttons  Top or Bottom of the ALV List.
    If I am adding I have to add logic for those Buttons. How to add and add logic for those buttons.
    as well as I have to Change the  Text  for  Existing Button ''Append Row''    to  "ADD NEW ROWS"
    and I have to add logic in this button while Append New Row I have to generate ID no for New Rows .
    Kindly help/advice  me to proceed further.
    Thanks in advance.
    Dav

    Hi Dav,
    To Add buttons please refer this thred,
    ALV with user-defined buttons on toolbar in wd abap
    To change or rename text in ALV standard buttons, please refer this ...
    How can i change the text of an standard button in ALV?
    and also see this article on self defined functions...
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true
    Thanks,
    Kris.
    Edited by: kissnas on Feb 22, 2011 5:59 AM

  • Add new line items in ISA B2B

    Hi All,
    My requirement is to add new line items automatically onto the shopping basket based on a main configurable line item addition.
    Unfortunately this could not be configured for a variety of reasons.
    This has to done after the user clicks on Accept on the config pop-up for this Part and before he returns to the shopping basket.(I believe the CRM_ISA_BASKET_CHANGE would be called at this point)
    ISA would pass to the backend the extension values for the new Material to be added and the Main item(config item number) in the function call.
    So technically what would be best approach to add new line items and tie it to a parent line item if ISA can send both the values(new Material/Parent Product) in extension table to the backend?
    Did someone face this situation before. If yes can you please let me know which methods in the backend were used?
    Thanks a lot.

    Hi,
    May I know how did you resolve this problem.
    Thanks in advance.
    amar.s

Maybe you are looking for