How to update Prodcution order qty using /AFS/BAPI_GOODSMVT_CREATE

Hi Friends,
I need your help desperately,
I am using the BAPI, '/AFS/BAPI_GOODSMVT_CREATE' its working fine but it gets updated only Inv management / warehouse management perfectly, but my requirement is this return qty to be adjusted against the production order material. (MB1A with movement type '262' - for returns)
I need to know any other parameters to be included in the BAPI to update the production order also.
I have attached the code.
please reply ASAP.
Thanks
Shankar
*Header Structure
  st_gm_code-gm_code          = '03'. "
  st_gm_header-pstng_date     = st_gm_header-doc_date = sy-datum.
  SORT itab BY aufnr matnr j_3asized.
  LOOP AT itab.
    itab_afs_gm_itemx-material     = itab-matnr.
    itab_afs_gm_itemx-plant        = itab-werks.
    itab_afs_gm_itemx-stge_loc     = itab-lgort.
    itab_afs_gm_itemx-batch        = itab-new_charg .
    itab_afs_gm_itemx-stock_cat    = itab-j_4kscat.
    itab_afs_gm_itemx-stck_type    = 'F'.
    itab_afs_gm_itemx-move_type     = '262'.
    itab_afs_gm_itemx-entry_qnt     = itab-j_3aerfmg  .
    itab_afs_gm_itemx-grid_value   = itab-j_3asized.
    itab_afs_gm_itemx-orderid = itab-aufnr.
    APPEND itab_afs_gm_itemx .
  ENDLOOP.
  CALL FUNCTION '/AFS/BAPI_GOODSMVT_CREATE'
  EXPORTING
    goodsmvt_header             = st_gm_header
    goodsmvt_code               = st_gm_code
IMPORTING
   goodsmvt_headret            = st_gm_headret
   materialdocument            = mat_doc
   matdocumentyear             = doc_year
  TABLES
    afs_goodsmvt_item           = itab_afs_gm_itemx
    return                      = bapi_return .
  IF sy-subrc = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    itsoh-mat_doc = mat_doc.
    itsoh-doc_year = doc_year.
    APPEND itsoh.
    status = '06'.
  ENDIF.

u can use  'BAPI_SALESORDER_CHANGE'
and see the following link
http://abap.wikiprog.com/wiki/BAPI_SALESORDER_CHANGE
Edited by: krupa jani on Nov 25, 2008 11:15 AM

Similar Messages

  • How to update Sales Order status using  BAPI_SALESORDER_CHANGE

    Hi,
    I want to update Sales Order status using BAPI_SALESORDER_CHANGE, this BAPI is called from middle ware, but there is no parameter to pass the status value to this function, please help me how to update sales order status using BAPI only.
    Thanks
    RK

    Hi,
    Can u give me details of what status u would like to update in sales order.
    If we are able to update the status from VA02, Then BAPI will assist for the same.
    Regards.

  • How to update j_1ipart1 j_1ipart2 by using bapi BAPI_GOODSMVT_CREATE

    i want to update records in j_1ipart1 , j_1ipart2 , rg1  as it gets updated when posting in MIGO with refer to excise incoice.
    i want to do the same  by using the bapi BAPI_GOODSMVT_CREATE.  Any one who can help me out , for what are the steps involved .
    thanks in advance

    Hi,
    Refer the following SAP notes.
    1. Note 485557 - BAPI_REQUISITION_CREATE: 'EXTENSIONIN' customer enhancements
    2. Note 584902 - BAPI_REQUISITION_CHANGE: ExtensionIn not connected
    3. Note 792132 - EBAN, EBKN: user-defined fields are not filled
    Regards,
    Harish

  • Update sales order qty through BAPI_SALESORDER_CREATEFROMDAT2

    HI
    Can anybody help me out.  I have the requirement for creating sales order through BAPI_SALESORDER_CREATEFROMDAT2. The sales order is created but with 0 quantity.
    I am using fields RNDDLV_QTY and TARGET_QTY and REQ_QTY in schedule lines & also setting the update indicator to 'X'  in the corresponding itemx structures.
    In fact it used to work earlier and has stopped now. I am also checking if there could be any change in configuration but don't think this should be the reason.
    Can someone guide me as to which quantity fields of the BAPI are the right ones to update sales order qty?
    thanks

    Hi,
    You are using the correct fields i.e. TARGET_QTY and REQ_QTY. Just check if you are passing the same Item Number in both the tables.
    Hope it helps...
    Lokesh

  • I open Firefox. It tries to install an update. Updating fails and I get a message" "Another copy of Firefox must be open. Close it. " A second copy is not open a far as I'm concerned. I have to refuse the update in order to use Firefox.

    I don't know what more I can tell you except that I have to refuse an update in order to use Firefox.

    ■ Have a look at these two articles that may help
    # [[firefox hangs]]
    # [[Software update failed]]
    Take care if you update by the last resort method mentioned in the linked article, if you delete settings it will remove all bookmarks etc from all versions of firefox

  • How to update the FB01L transaction using the FM  bapi_acc_document_post

    Hi All,
            How to update the FB01L transaction using the bapi_acc_document_post but there is no ledger group field in the bapi function module.
    Please help me how to do it.

    hi,
    use batch input method for the same.
    check this.
    [https://forums.sdn.sap.com/click.jspa?searchID=19107237&messageID=884744]

  • How to update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE

    Hi guys,
    I posted a question regarding a function module here:
    How to update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE
    If you have experience about this FM, kindly visit the link and share your wisdom. Thanks.
    Regards,
    Carl

    Hi guys,
    I posted a question regarding a function module here:
    How to update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE
    If you have experience about this FM, kindly visit the link and share your wisdom. Thanks.
    Regards,
    Carl

  • How to update java.sql.Clob using javax.persistence.EntityManager?

    Hello.
    Can anyone tell me (or show me some example) how to update java.sql.Clob using javax.persistence.EntityManager.
    When I’m trying to update column (with type Clob) value is not inserting, after update column is empty. I haven’t any error during update, I’m using database Oracle 10g.
    Edited by: ernest211 on Jul 16, 2009 1:24 AM

    Post some code so we can see how you are doing it. If you are using JPA entities take a look at the @Lob annotation.
    m

  • How to update the ztable by using table handling function

    how to update the ztable by using table handling function
    It is very urgent ...............................
    thanks in advance

    see the  below code for the direct   ztable update
    Report  ZUPDATE_PRPS.
    tables: zprps.
    parameter: p_wbs like zprps-pspnr,
               p_value like zprps-fakkz default 'X'.
    data: wa_fakkz type zprps-fakkz.
    *START-OF_SELECTION
    start-of-selection.
    call function 'CONVERSION_EXIT_ABPSP_INPUT'
         exporting
             input     = p_wbs
        importing
             output    = p_wbs
        exceptions
             not_found = 1
             others    = 2.
    select single fakkz
      into wa_fakkz
      from zprps
    where pspnr eq p_wbs.
    if sy-subrc eq 0.
       update zprps set fakkz = p_value where PSPNR eq p_wbs.
       if p_value is initial.
         message i999(za) with 'Billing element field has been unchecked'.
       else.
         message i999(za) with 'Billing element field has been checked'.
       endif.
    else.
      message i999(za) with 'WBS element not found'.
    endif.
    reward  points if it is usefull .....
    Girish

  • How to update sales orders using B1WS in SAP 8.8 PL18

    Hello all.
    We are having a problem updating sales orders using Sap Business One Web Service ( B1WS ).
    We are running SBO 8.8 PL18, MS-SQL 2008, and all is fine when using the SBO client.
    But when it comes to updating sales orders through B1WS we just cannot get it to work.
    We can add new orders easily without problems. Updating orders always gives this error:
    \[ORDR.PayDuMonth\]\[line: 0\] , 'Field cannot be updated (ODBC -1029)'
    We have checked and verified multiple times that our setup is correct.
    Also the WDSL files are verified.
    We can update orders just fine using the sboclient.
    And using B1WS we can basically do everything, besides updating.
    We have also tried this on different company db's, so we are quite sure this is not
    something related to some general setting we missed, but who knows?
    We have tried different ways to "assemble" the order before updating, but it always
    ends with the above error.
    Here is an example of one of the tests, where we load an order by docentry,
    increment the quantity of all open lines by '1', and then try to update it.
            protected void Page_Load(object sender, EventArgs e)
                // First we login
                string sessionId = "";
                LoginService.LoginService l_login = new LoginService.LoginService();
                LoginService.LoginDatabaseType l_dbtype = LoginService.LoginDatabaseType.dst_MSSQL2008;
                LoginService.LoginLanguage _lang = LoginService.LoginLanguage.ln_English;
                string _server = "SAP-8_8PL18";
                string _licserver = "SAP-8_8PL18:30000";
                string _db = "my_test_company";
                string _user = "manager";
                string _pass = "********";
                try
                    sessionId = l_login.Login(_server, _db, l_dbtype, true, _user, _pass,
                               _lang, true, _licserver);
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                if (sessionId == "")
                    Response.Clear();
                    Response.Write("No sessionId");
                    Response.End();
                // We are logged in and have a sessionId
                // Now load a valid open order by docentry
                try
                    OrdersServiceRef.OrdersService orderService = new OrdersServiceRef.OrdersService();
                    orderService.MsgHeaderValue = new OrdersServiceRef.MsgHeader();
                    orderService.MsgHeaderValue.SessionID = sessionId;
                    orderService.MsgHeaderValue.ServiceName = OrdersServiceRef.MsgHeaderServiceName.OrdersService;
                    orderService.MsgHeaderValue.ServiceNameSpecified = true;
                    OrdersServiceRef.DocumentParams docParams = new OrdersServiceRef.DocumentParams();
                    docParams.DocEntry = 31; // Docentry of a known open order
                    docParams.DocEntrySpecified = true;
                    OrdersServiceRef.Document order = orderService.GetByParams(docParams);
                    OrdersServiceRef.DocumentDocumentLine line = null;
                    for (int i = 0; i < order.DocumentLines.Length; i++)
                        line = order.DocumentLines<i>;
                        if (line.LineStatus == OrdersServiceRef.DocumentDocumentLineLineStatus.bost_Open)
                            line.Quantity += 1;
                    orderService.Update(order);
                catch (System.Web.Services.Protocols.SoapException ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                Response.Clear();
                Response.Write("All OK");
                Response.End();
    I hope that someone has an idea as to why this happens.
    The customer often changes quantity or adds lines on their orders,
    and the only way to solve it so far has been to make a new order and
    close the old one.
    Thanks in advance
    J. Thomsen

    Hi,
    Welcome you post on the forum.
    Have you checked if you only update a specific line instead of a loop?
    Thanks,
    Gordon

  • How to update sale order haeder conditions

    hi
    how to update header conditions using sale order bapi ' create from data 2'.
    regards
    Siva Shanmugam.A.V.

    u can use  'BAPI_SALESORDER_CHANGE'
    and see the following link
    http://abap.wikiprog.com/wiki/BAPI_SALESORDER_CHANGE
    Edited by: krupa jani on Nov 25, 2008 11:15 AM

  • IS-RETAIL: How to update custom enhancement field using BAPI?

    Hi gurus,
    Like ECC BAPI: BAPI_MATERIAL_SAVEDATA,
    This BAPI(BAPI_MATERIAL_MAINTAINDATA_RT) is specific for IS-RETAIL to create and update material master data.
    But now If I append one custom field "ZFIELD" to end of table MARA, my question is how to update this custom enhancement field(ZFIELD) using BAPI(BAPI_MATERIAL_MAINTAINDATA_RT)
    Thanks in advance!

    Hi DongHai,
    I suggest you create your own BAPI. Just copy the codes in BAPI_MATERIAL_MAINTAINDATA_RT and add your custom fields. If you want to append the data of the custom field in table MARA, first, you have to create a structure table then goto SE11, type MARA and display. Click the APPEND STRUCTURE then choose the structure that you've created. Hope this will help.
    Rewards if useful
    Regards,
    Mark

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

  • HOW TO CLOSED PRODCUTION ORDER

    HI
    ALL SAP GUY'S
    PL TELL ME HOW TO CLOSED PRODUCTION ORDER AFTER CONFORMATION
    REGARDS

    Hello,
    You should follow following steps for Order Settlement after confirmation :
    1. After Final Confirmation of Order ( Status : CNF) make GR for for order using Tcode : MIGO / MB31 so Production Order Status will be DLV.
    2. Then complete the order technically by using Tcode : CO02--> Functions ( Menu)---> Restrict Processing -
    > Technically Complete. You can carry out TECO for multiple Orders in Tcode : COHV (Mass Processing).
    3.Now Calculate Overheads using Tcode : KGI2 - Individual Processing
    CO43 - Collective Processing
    4.Calculate WIP using Tcode : KKAX - Individual Processing
    KKAO - Collective Processing
    5.Calculate Variance by using Tcode : KKS2 - Individual Processing
    KKS1 - Collective Processing
    6.Finally do the settlement of Order in Tcode : KO88 - Individual Processing
    CO88 - Collective Processing
    Hope this helps.
    Revert if any doubt and reward points if useful,.
    Regards,
    R.Brahmankar

  • 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.

Maybe you are looking for

  • Open item are not showing

    hi when iam using t code F-07 out going payment.iam getting there are no open items managed in account 250001(rental account) iam unable to post.

  • Doubt in FM RSPO_OPEN_spoolrequest

    hi friends in the above function module there is an mandatory import parameter DEST of type TSP01-RQDEST in which what is the thing we need to pass and what is the functionality of that parameter Any pointers to this pls welcome

  • Robohelp 10 -Solution -IE- Active X blocking script

    Currently we are using robohelp10 for generating webhelp documents. We purchased that too.. Now we are facing following issues,     1. Active x is blocking our script in IE- Please suggest us some solution to unblock that programmatically .     2. Go

  • Photoshop Elements crashes

    Why does Photoshop Elements 10 keep crashing and freezing my computer? I lost a potential sale today because of this crashing/freezing. Message title was edited by: Brett N

  • HELP!  Flashing, flashing, flashing....

    Hi, all. Need a bit of help here. I just purchased a Time Capsule (500GB) so that I can back-up my files from my Mac Pro desktop. (Don't need the TC to do anything else.) The Time Capsule is plugged in, but all that's happening is a flashing green li