Updating delivery block using 'BAPI_SALESDOCUMENT_CHANGE'

Hi!
I need to update the delivery block field of a sales order.
I am using  'BAPI_SALESDOCUMENT_CHANGE' and passing
delivery block also.
  ls_order_header_in-dlv_block = lp_lifsk.
  ls_order_header_inx-dlv_block = lp_lifsk.
Could you please let me know how to achieve it.
Thanks.
-Shreyas
PS: Helpful answers will be rewarded.

Hi
please check the following code ..hope it will help you
LOOP AT l_i_headr ASSIGNING <l_fs_headr>.
    l_wa_order_in-dlv_block = space(the desired value which u want to update).
    l_wa_header_inx-updateflag = l_c_update.
    l_wa_header_inx-dlv_block = l_c_set.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument    = <l_fs_headr>-vbeln
        order_header_in  = l_wa_order_in
        order_header_inx = l_wa_header_inx
      TABLES
        return           = l_i_return.
Check for abort messages and error messages
    LOOP AT l_i_return TRANSPORTING NO FIELDS WHERE type EQ l_c_abort OR
                                                    type EQ l_c_error.
Set the flag to indicate that there is an error.
      l_v_error_flg = l_c_set.
    ENDLOOP.
*Commit the changes in the database only if there are no errors
    IF l_v_error_flg IS  INITIAL.
*UPDATE the delivery block to space
Commit work
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = space.
    ELSE.
Roll back the changes if there are errors.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ENDIF.
  ENDLOOP.

Similar Messages

  • How to update delivery block in delivery(vl02n) using BAPI

    hi all,
    i have to update delivery block of a delivery using a BAPI. can any one suggest which bapi i have to use. and if possible let me know what are the mandatory fields that i have to fill in that bapi.
    thank you all in advance

    HI,
    Use the BAPI BAPI_OUTB_DELIVERY_CHANGE..
    Pass the delivery number DELIV_NUMB in both HEADER_DATA and HEADER_CONTROL..
    In HEADER_DATA-DLV_BLOCK pass the delivery block.
    In HEADER_CONTROL-DLV_BLOCK_FLG pass 'X'
    Thanks
    Naren

  • User exit for updating delivery block of Sales order before Delivery

    Hi  Folks,
    Need to have an user exit for updating Delivery Block indicator for a Sales order Before creating its delivery
    I have got an exit in Program SAPMV45A
    MV50AFZ1
    FORM USEREXIT_REFRESH_DOCUMENT.
    that hits before processing the delivery block fro delivery (Correct me if i m wrong with this )
    Now i want now how to change the Delivery Block indicator of Sales order in that exit
    any FM available ?
    Thanks n regards
    Sonal...

    Hi  ,
    How did you solved this issue?
    I am having similar scenario in which while pressing the save button  delivery block should update if multiple schedule line exist.
    Tried by two different approaches in various user exit without any success.
    AFAIK we have two ways to achieve this functionality.
    1) Count the no of rows in vbep. If greater than 1 then multiple schedule line exist and we can assign the value to VBAK-LIFSK(delivery block) as per our requirement.
    This is not correct. If there are two line items both with single schedule line . This case total no lines in vbep will 2 and above condition will true which is incorrect.
    2) There is a indicator for multiple schedule line (VBAPD-EPMEH , xvbap-epmeh ) if it is check then multiple schedule line exist and we can assign the value to VBAK-LIFSK(delivery block) as per our requirement.
    If I write code in USEREXIT_SAVE_DOCUMENT_PREPARE.
    Multiple schedule line indicator is not populate so can not use 2nd approach.
    If I write code in  USEREXIT_SAVE_DOCUMENT it of no use as vbak is updated before reaching this user exit.
    If I write code in USEREXIT_MOVE_FIELD_TO_VBAK as this user exit is also called while pressing the enter key for this I have use
    the condition of fcode but it also fails in some condition.
    If fcode eq 'SICH'.
    Read table xvbap with key epmeh = 'X'.
    IF SY-SUBRC = 0.
    VBAK-LIFSK = '03'.
    Else.
    VBAK-LIFSK = ' '.
    Endif.
    Endif.
    Please help me to get the desired functionality working for all cases.
    1) One line item with multiple schedule line                                              
    2) Two line item with multiple schedule line                                             
    3) One line item having one schedule line and second one having multiple
    4)Two line item both with single schedule line.

  • Problem to update delivery block (sales order header level)

    hi all,
    after few tries, we got message "Field 'LIFSK' cannot be changed, VBAKKOM 0001279765 ready for input".
    this message come when we try to update the delivery block with some value when the delivery block in the sales document is blank (no block).
    please advise how to solve the problem. thanks.

    Well, you said that only some orders are failing - try to find what's so different about them. Also check if there are any other messages in the RETURN table.
    Sometimes these errors might be difficult to catch because the field might not be available for input only at the moment when your BAPI runs, but later, when you go to VA02, it is available. Here is an example. We were trying to update the reason for rejection field. It becomes available, for example, when the delivery line item has been confirmed, but for the lower amount. The program with BAPI was running at the background. Sometimes there was an error in the delivery, which was corrected by a user. So when later in the day we went to research this, we couldn't figure out what's wrong. You might want to check the Changes log on the order and on the delivery.
    And, of course, there is always the debugger - set the whatchpoint for where this message occurs.

  • Update delivery block on inbound Orders IDoc

    Hi Folks,
    I am using the following to code to place delivery block.
          zvbak-lifsk = zblock. "ZZ
          MOVE: 'X' TO z_d_flag_k-kde2.
          dxvbak = zvbak.
    But some how my code is not placing delivery block on the sales order.
    Can you guys tell me what am i doing wrong here??
    Thanks,
    Matt
    Edited by: Creasy Matthew on Jul 29, 2009 4:19 PM

    Hi,
    Could you please tell me the IDoc type and Inbound Function Module u are using.
    is it ORDERS05 and  IDOC_INPUT_ORDERS

  • Problem when updating delivery quantity using 'BAPI_OUTB_DELIVERY_CHANGE'

    Hi experts,
    I have a requirement in which i need to update the material's delivery quantity in VL03N transaction.   For this im trying the BAPI
    'BAPI_OUTB_DELIVERY_CHANGE' and im passing the following values.
    HEADER_DATA : Delivery no.
    DELIVER : Delivery no.
    ITEM_DATA : Delivery no,
    item no,
    DLV_QTY quantity(changed),
    FACT_UNIT_NOM ( default to value '1')
    FACT_UNIT_DENOM ( default to value '1')
    ITEM_CONTROL : Delivey no,
    item no,
    CHG_DELQTY ( value "X")
    Then i use 'BAPI_TRANSACTION_COMMIT' for updating the changes. 
    Here the problem is, the BAPI is working fine for some quantity , say if i enter the DLV_QTY as 2 in ITEM_DATA, it is gettting updated.  But if i pass some other quantity , say 12, it is returning the folowing error.
    T ID                   NUM MESSAGE
    E VL                   363
    Pls tell why this error comes. and how to successfully update the delivery quantity for a set of material?
    Regards,
    Shanthi

    not answered

  • Removing of Delivery block in Sales Order using Authorization

    Hello,
    I have a urgent requirement on removing a Delivery block using authorization.
    The object V_VBAK_AAT is assigned to me and the ACTVT : 43 is permitted so I can release the block.
    As this was  not working I have created my own object with values ACTVT as 01, 02 , 43 and LIFSK : 1-10,11,12-99 .
    I am trying to remove the block from VA14L from VA14L I select my order with respect to delivery block and it navigates to VA02.
    From VA02 I am trying to remove the block.
    As this requirement may be simple but it is blocking my development.
    Thanks.

    Please correct whether I understood your issue correctly or not.
    You have developed the program only to put delivery block to Sales Order. This block should be approved by Authorized people for allowing the users to create delivery else Sales order delivery should not be possible. Is that program has any other additional functionality other than setting Delivery block??
    To keep delivery impossible till the Authorized person approves Sales order, you have the option of User Status. Process for creation of User Status for your requirement
    Create User Status Profile in OIBS
    Keep BLCK (Blocked for Delivery) & APPR (Approved for Delivery) as 2 statuses (No. of status can be as per your requirement. Here, simply I have 2 statuses)
    Assign Object types as "Sales Order Header" (if you want the Authorized people to approve at header level) or "Sales Order Item" (if you want the Authorized people to approve at Item level, may be for partial delivery)
    Keep BLCK as Initial status & Double click on BLCK status & click New entries on "Business transactions"
    There are many Business transactions such as "Create Delivery" / "Create Goods Issue for delivery". As per your requirement, select Forbidden option in one of the above mentioned business transaction
    Create Authorization Key in BS52 for Authorized People, say, as MNGR (Manager)
    Assign that Authorization Key to APPR user status in User status profile
    Using PFCG, you can create separate role by assigning this Authorization key
    This can be different kind of solution from your way. For reference, you can refer below document. Document content points some other space & transaction. But you can relate to above steps mentioned.
    User Status in SAP

  • Function Module or BAPI to update Sales Order (delivery Block)

    Hi,
    Is there a Function Module or BAPI available that can update the Delivery Block for a looping Sales Order?
    Thanks,
    John

    Hi,
    check this sample code to update delivery block..
    DATA: BAPISDH1X LIKE BAPISDH1X.
    DATA: BAPISDH1 LIKE BAPISDH1.
    PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY.
    PARAMETERS: P_LIFSK  LIKE VBAK-LIFSK OBLIGATORY.
    * Header
    BAPISDH1-DLV_BLOCK = p_lifsk.   " Delivery block
    * header X
    BAPISDH1X-DLV_BLOCK = 'X'.   " Delivery block
    BAPISDH1X-UPDATEFLAG = 'U'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = P_VBELN
    order_header_in   = BAPISDH1
    order_header_inx = BAPISDH1X
    tables
    return = T_RETURN
    LOOP AT T_RETURN WHERE TYPE = 'E' OR TYPE = 'A'.
      EXIT.
    ENDLOOP.
    * Check for error messages.
    IF SY-SUBRC = 0.
      WRITE: / 'Sales order not updated', T_RETURN-MESSAGE.
    ELSE.
    * Successfully updated
      WRITE: / 'Sales order updated'.
    ENDIF.
    COMMIT WORK.
    Thanks
    Naren

  • Placing delivery block on the inbound Orders IDoc (SO Process)

    Hi EDI Gurus,
    I have a small question.
    I know we can set a delivery block using E1EDK01-LIFSK.
    But I check a base UOM @ item level. If it is not allowable, then I should place a delivery block.
    I am using user exit EXIT_SAPLVEDA_001.
    But how can I set a delivery block @ header level with information available  @ item level.
    Say:
    case zedidd-segnam.
    when 'E1EDK01'
    XXXXXXXXXXXXX
    when 'E1EDP01'.
    ze1edp01 = zedidd-sdata.
    zint-vbap = zxvbap
    zint-vbak = zxvbap.
    if  ze1edp01-MENEE ne 'EA'.
    place delivery block
    endif.
    How can I do this.
    Can anyone throw some light. Even code/field help will be helpful.
    Thanks,
    Matt

    Throw some light Gurus

  • How to update Sales Order Delivery Block while saving Delivery ?

    Hi,
    I have a requirement wherein i need to update sales order delivery block field(VBAK-LIFSK) while saving the delivery for the order.
    Also I need to remove this block while execution of  Backorder Rescheduling program SDV03V02 (Tcode : V_V2),
    Can anybody help me out in this?
    regards,
    Nitin

    HI,
    try using BAPI_SALESORDER_CHANGE
    pass ur vbeln in SALESDOCUMENT
    pass an 'X' to    BAPISDH1-DLV_BLOCK
    and 'X' to        BAPISDH1X-DLV_BLOCK
    Also add the UPDATE task clause, you will want to set the flag only when delivery is being saved, not before that.

  • How to set delivery block in va01 by not use delivery block reason.

    Dear SAP Gurus.
    I have one scenario. I need to do delivery block on sales order while i create sales order via VA01.
    Normally, I use delivery block reason in header and set delivery block in schedule line.
    In addtion, i dont want to use above method and not use complete delivery (Tick on it)
    So, I would like to know it has other way to do delivery block.
    The cause is my manager do not allow to use  this field from company's policy.
    Please help me to solve this problem.
    Thank you in advance for your kindly help.
    Best Regards,
        Surakit

    Surakit,
    Well, do you want to say that user should not manually user delivery block at header or sch line to block the doc or any other method manually done before saving the sales order.
    In that case, for making default delivery block at header, in Sales doc type (TCode VOV8) in Shipping section, maintain a delivery block as 22-Statutory Compliance(even any other option available) or for Item based block on Sch line cat (TCode VOV6) maintain default delv block there.
    Or if I misunderstood your requirement then we can wait & see other solution coming for the same.
    Thanks & Regards
    JP

  • Delivery block not updated in sales order after released VKM3

    Hi all,
    I am facing below error
    after released  credit block throuh VKM3 also i am unable to delivery becasue it is not updated still block exist in sales order level.
    i made all nacessary settings for that and also i tried through VKM1 but this tcode through error no poosible entries.
    Thanks in advance
    Srinivasa

    hi,
    check the following steps of assignment you did right or not
    1)first check in  t- code FD32 U  assigned authorization person & each credit limit U shud assign
    an authorization person along with credit limit
    2) check - conditon records with KRML output is there or not
    please read standard SAP config help as a check point doc.[Credit mgmt|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/SDBFCM/SDBFCM.pdf]
    Let me know if it is soling your issue...
    rgards,
    rajeev

  • How to delete or remove delivery block in VL01N using userexit?

    Hi All,
    Would like to seek your advice on the above mention subject. There is a scenario where during the creation of sales order (VA01) and the order type is Sample Order (ZSA). The delivery block for the customer has the status '05: Check Free of charge delivery'.
    After creation of sales order, i would like to create a delivery via (VL01N) with reference to the sample sales order that i have creation as mention above. It does not allow me to create and after i hit enter, a display log prompt out with the message text: Order blocked for delivery as a result of credit check.
    Question:
    1. How to set the delivery block to blank or delete the delivery block via user exit during the creation of delivery (VL01N)?
    2. Which form should i use in user exit: MV50AFZ1, is it FORM USEREXIT_SAVE_DOCUMENT or FORM 
        USEREXIT_SAVE_DOCUMENT_PREPARE?
    Steps Taken:
    1. User exit found is MV50AFZ1.
    Appreciate your advice a lot. Thanks in advance..:)

    Hi,
    i would suggest you to read these links first.
    [http://help.sap.com/saphelp_46c/helpdata/en/93/744bf2546011d1a7020000e829fd11/content.htm]
    [http://help.sap.com/saphelp_crm40/helpdata/en/dd/5607b3545a11d1a7020000e829fd11/content.htm]
    this will you an idea of delivery block.
    at delivery level LIKP-LIFSK field stores the delivery block value. in your case it will be 05. 90 is total block i believe.
    so in your case, in user exit check for value in this field and if its 05, make your changes.  be careful when you make this change;  any batch jobs running at background can also get affected and start creating deliveries although it is suppose to have a delivery block.
    Thanks,
    Sam.

  • BAPI_SALESORDER_CHANGE using this i want to change the Delivery Block

    Hi ABAP Gurus,
    i am working on a urgent requirement of changing the Delivery Block of sales order VA02. I am trying to do this using FM            BAPI_SALESORDER_CHANGE .
    Please see the following code which i am giving for the time being.
    it_headerx-updateflag = 'U'.
    append it_headerx.
    it_bapischdl-itm_number = '00010'.
    it_bapischdl-req_dlv_bl = '01'.
    APPEND it_bapischdl.
    it_bapischdlx-itm_number = 'X'.
    it_bapischdlx-req_dlv_bl = 'X'.
    APPEND it_bapischdlx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = '0000000560'
       order_header_in             = it_header
        order_header_inx            = it_headerx
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
      TABLES
        return                      = it_return
      ORDER_ITEM_IN               =
      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              = it_bapischdl
       schedule_linesx             = it_bapischdlx
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
    But the Delivery block is not changing from Credit limit to Pending Allocation
    But i am getting the following messages in the it_return table
    1     S     V4     233     ORDER_HEADER_IN has been processed successfully
    2     S     V1     041     No data was changed
    I am waiting for your suggestions
    Thanks in Advance

    Hi Prashanthi,
    Check whether delivery number is already created or not for that  order.
    If deliver already  existthen u can not create delivery block on that.
    and also check whther r u calling bapi commit after this.
    Regards,
    Siva

  • Update Delivery Text - As done for Sales order using RTEXT-SELKZ

    Dear all,
    We have to update the delivery header texts. But could not find the exact field name for the BDC .
    The similar field name for Sales order is RTEXT-SELKZ.
    Thanks in Advance,
    Regards,
    Vivek K

    Hello,
    if you need to update delivery header texts ,then you can get text data from input file .& then find out what's the text id where you have to insert text data.
    Text id,object,language,Text name ,these 3 fields can help you from delivery.
    Delivery-> display->header-> select particular text-> presss details icon->goto->header.This path will give text id ,object name details of the required text.
    Then use function save_text to load this data for each delivery .
    Hope this helps.
    Thanks.

Maybe you are looking for

  • JSPs and calling a DB function/procedure

    I looked at an example written by Oracle and I saw that they put in the <form> tag (in a JSP) an "action" that is really a name of a DB procedure. It was in the form of: schemaName.packageName.procedureName First: I've tried to do that myself -- just

  • Acrobat 8 Pro. Cannot Scroll/Edit if not Online

    PDF files get stuck if I am not online -(the rainbow goes round and round and round).  I am using an iMac and MacBook Air and I need to be able to edit offline. If I am online all actions are instant. Did I install it incorrectly? is there a box I sh

  • Help with reinstalling Flash CS3

    Hello, I need to reinstall Flash CS3 only which is part of Create Suite Master Collection I own. I am not sure how to install just one of the applications. I have only located Flash encoder dmg on the disks. Please advise. Thank-you.

  • Rebate Agreement Upload: Condition data

    Hello Gurus, My client system is undergoin SAP to SAP implementation, which requires conversion of all the Rebate Agreements. We are providing the SAP table data extracts to the technical team for the conversion. The conditions for the Rebate agreeme

  • "Error-less failure" to export to QT

    Hi all, I'm getting an error-less (i.e., no error message) failure when I try to export my iMovie 6.0.2 movie to QT. Here's the situation: - 18 min movie, bunch of clips and photos, few tunes (no tunes from the music store) - all application updates