Delivery Document Lock Issue in Z Program using BAPI(s)

Hi,
I am a functional consultant posting this in ABAP forum. We have developed a Z-Program.
User enters the Service Order no. in this program and executes it.
The program then updates the following linked documents in the following sequence using BAPI(s)
Outbound Delivery
Service Notification
Service Order (This is done using BDC of IW32)
It sometimes happens that once the Program reaches the iw32 bdc, it gives error "Delivery XXXXXXXX is locked by User ID XXXXXX"
The user ID being that of the person executing the transaction.
This happens like 3 out of 100 times in the Production Server. We are unable to replicate this issue in Quality or Development Server.
We believe it to be a performance issue (database updating is slow)
However Client wants us to investigate the Program and see what is possible.
We are thinking of putting WAIT after the BAPI(s) of the Delivery Update.
Any suggestions, please help.

Hello Suhas,
Thanks for the reply.
These documents are seperate objects but are interlinked. i.e I can see in the Document Flow for Service Order, which is the Service Notification and Outbound Delivery for the Material.
Also, If I'm in change mode in the Outbound Delivery, I cannot go into the change mode of the Service Order.
Yes, we are using BAPI_TRANSACTION_COMMIT after each BAPI in the Program. We have used the Wait Statement in all BAPIs for the Service Notification. These BAPI(s) are before the IW32 BDC.
I am copying code from one of the commit BAPI(s)
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                EXPORTING
                  wait = c_x.
              WAIT UP TO 1 SECONDS.
I noticed in the Outbound Delivery BAPI(s) (two of them) don't have the wait in the BAPI_TRANSACTION_COMMIT. Hence I though if we add this, could this resolve the issue?
Service Order gets updated last through BDC for IW32 after all the BAPI(s) are executed for Outbound Delivery and Service Notification.
I understand WAIT would increase processing time, that is why I am posting this to know if we have some other solution available for such a lock issue.

Similar Messages

  • VA41 Conversion program using BAPI's.

    Hi Friends,
    Could u please tell to develop/create conversion program to transfer data using BAPI's by using trx VA41(CREATE CONTRACT), I have Contract Document number(ID).
    This is one time conversion.
    Please tell step by step.
    Thanks in advance.
    Points rewarded for ur kind assistance.
    regard. Vishnu

    Hi Vishnu,
    There is a standard BAPI called <b>BAPI_CONTRACT_CREATEFROMDATA</b> available for VA41. Use that BAPI for the conversion. Get back to me if you got any doubts.
    Reward if useful.
    Thanks
    Aneesh.

  • Program using BAPI and selection screens

    program to compare two infoobjects using BAPI and selection screen in ABAP

    BAPI-step by step procedure
    http://www.sapgenie.com/abap/bapi/example.htm
    list of all BAPI's
    http://www.planetsap.com/LIST_ALL_BAPIs.htm

  • To lock users in ALV list using BAPI

    hi
    i've displayed a list of users who are not logged for 90 days on ALV and i want to lock selected users on that particular list using BAPI.
    help me with this
    regards
    pradeep

    Hi,
    Provide a checkbox on ALV to select records for locking. Provide LOCK button. When this button is clicked call BAPI : BAPI_USER_LOCK. This will lock the user from logging to sap.
    To unlock use bapi : BAPI_USER_UNLOCK.
    Best regards,
    Prashant

  • Issue with BDC program used for FBZ5 (Check Print)

    Hi all,
    I am having one requirement in Check printing. as per that i have made one Z program which will accept multiple Payment documents. I am passing selected accounting documents to BDC routine for Transaction FBZ5. (As in FBZ5 we can take a print for one Payment document not for multiple)
    We can have 3 scenarios in FBZ5
    1. Fresh Check printing (First time check printing)
    2. Old Check (printing for same Check no)
    3. New Check (After voiding older check)
    Category 1 and 2 are working fine but i am facing problem in category 3.
    For Category 3 : BDC Screen flow is like this
    A. Tcode FBZ5 Start program: SAPMFCHK Screen: 750 --> Click on 'Print'
    B. Program: SAPLSPO2 Screen: 0100  --> Here specify option 'New Check'
    C. Program: SAPMFCHK Screen: 0700
        - This program belongs to new Tcode FCH7
        - Here we have to give Void Reason code
    Now issue with Category 3:
    While executing BDC in online and background mode my control is terminating at step C mentioned above
    Troubleshooting:
    I have debugged standard program of FBZ5
    1. in Include MFCHKFD0 we can see call to Tcode FCH7  (PERFORM AUFRUF_FCH7.)
    2. in form AUFRUF_FCH7 i found code related to BDC
       also there one statement is getting triggered -->   CALL TRANSACTION 'FCH7' USING BDC MODE 'A'.
    So there is a BDC call inside my Z BDC program, so is this a reason why my program is not working for above scenario ?
    Or can't we handle above scenario in a way mentioned above?

    Hi Sandra,
    I was trying to upload customer master in fd01 using bdc. The screens were different while recording. So could not perform the upload. Thenone screen was skipped so that the bdc was working fine and the data was uploaded.
    This is the flow of the recording.
    'SAPMF02D' '0105'.
    SAPMF02D' '7105'
    SAPMF02D' '0111
    SAPMF02D' '0120
    SAPMF02D' '0130
    SAPMF02D' '0210
    SAPMF02D' '0215
    SAPMF02D' '0220'
    SAPMF02D' '0230'
    SAPMF02D' '0610
    After the second screen was deleted the bdc worked fine.

  • MIRO delivery document number issue.

    Hi Experts,
    When we try to book invoice through MIRO by taking reference of purchase order  and delivery confirmation, the Delivery Note No is not appearing in MIRO, even after delliverly confirmation done we are unable to view delivery note no.
    Normally we book PO through Delivery Note no reference, here this is the first time we encountered this issue.
    Kindly suggest is any work around to over come this issue.
    Thanks a lot
    Satish

    HI AP,
    Thanks for your reply !
    Sorry could you please explain me indetail ?
    Regards,
    Satish.

  • Error while doing Good Issue for Production Order using BAPI

    Hi All,
    I am facing an error like 'u2018Content of order 1011907: MDT218AJ10 transferred to interface (IMSEG): T-86410-71".
    I have written the code as below. Please let me know what is missing when using the BAPI 'BAPI_GOODSMVT_CREATE'. What is the cause of this error ?
    *Action in Transaction (GM_CODE)
    *GM Code for Goods Issue for Production Order is 03
      gs_gmcode-gm_code = '03'.
    *Header Data
    *Posting date
      gs_header-pstng_date = sy-datum.
    *Document date
      gs_header-doc_date   = sy-datum.
    *Item Data
    *Material
      gs_item-material  = zptp_s_rf_migo_261-matnr1.
    *Movement Type
      gs_item-move_type = '261'.
    *Movement Indicator
      gs_item-mvt_ind   = 'F'.
    *Stock Type
      gs_item-stck_type = 'F'.
    *Plant
      gs_item-plant     = gv_plant.
    *Storage Location
      gs_item-stge_loc  = gv_str_loc.
    *Quantity
      gs_item-entry_qnt = zptp_s_rf_migo_261-menge2.
    *Unit
      gs_item-entry_uom = gv_uom.
    *ISO code for unit of measurement
      gs_item-entry_uom_iso = gv_uom.
    *Order Number
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = zptp_s_rf_migo_261-aufnr
        IMPORTING
          output = gs_item-orderid.
    *Reservation Number
      gs_item-reserv_no = gv_resv_num.
    *Reservation Item
      gs_item-res_item = gv_resv_itm.
    *Reservation Type
      gs_item-res_type = gv_resv_type.
      APPEND gs_item TO gt_item.
    Calling BAPI_GOODSMVT_CREATE to create the Material Document Number
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          goodsmvt_header       = gs_header
          goodsmvt_code         = gs_gmcode
        IMPORTING
          goodsmvt_headret      = gs_headret
        TABLES
          goodsmvt_item         = gt_item
          goodsmvt_serialnumber = gt_serial
          return                = gt_return.
    Thanks in Advance.

    hi,
    did you look at message ?
    System says, there are differences between the interface data and the order data. It can be anything. I think you should check
    data in the interface . 
    this is the long explanation of your message :
    Diagnosis
    When calling the function module MB_CREATE_GOODS_MOVEMENT or the BAPI GoodsMovement.CreateFromData (BAPI_GOODSMVT_CREATE) to post a goods receipt for a production order, there are differences between the interface data and the order data.
    Example: The order was created for plant 0001, but plant 0002 is passed on in the interface.
    The system checks this for the material and the order item.
    System response
    Due to this difference, the system cannot post the goods receipt.
    Procedure
    Check the data in the interface (IMSEG-WERKS, IMSEG-AUFNR). If necessary, correct the plant or the order number in the interface.
    << Moderator message - Point begging removed >>
    Edited by: Rob Burbank on Feb 6, 2012 11:24 AM

  • Working on Well Creation Program using BAPI

    Hi,
    My requirement is to be create well using standard BAPI
    'BAPI_WELLID_CREATE'. T-code is O3U_Wl1.
    When I am calling this bapi into my program it's not creating entries in O3U_Wl3.
    Can anyone please help me out?
    Thank-You,
    Sony

    I am not able to see this bapi in my system but just to add a note here -
    Check in BAPI Code if there is something like this at the end of fm.
      IF lf_commit_requested NE ' '.
        COMMIT WORK.
      ENDIF.
    If it is present, keep a break point at IF statement. Set IF_COMMIT_REQUESTED in debug to 'X'. And see. This will save data.
    You may have to try this explicitlye in custom program. Some BAPIs save data only when they are used in a custom program. So create a custom program, pass parameter values, call bapi and use COMMIT WORK. This should help you out. It is strange but it has worked for me.
    Message was edited by: Ashish Gundawar

  • Purchase order locking issue

    Hi ,
    We are processing IDoc. The IDoc FM does GR of STO by using MIGO transaction via BDC , then FM also does GR of STO Delivery number by using VL02N transaction . MIGO transaction is successful but while doing GR of STO Delivery number via VL02N we are getting an error like ' Purchase order XXXXXXXXXX is currently locked by user XXXXXX .
    This happens if we process the IDoc in background . If I process the IDoc in foreground  by putting breakpoint at MIGO and VL02N , it executes successfully .
    I feel it is a locking issue . I tried using FM DEQUEUE_ALL , MM_DEQUEUE_DOCUMENT after MIGO but it did not work out .
    Please suggest for any pointers on this locking issue .
    Regards,
    Kiran.

    Forget about WAIT statement.
    Use:
    set update task local.
    ...before starting MIGO.
    regards

  • Cancellation of multiorder delivery document.

    Hi Experts,
    I have generated one delivery document from ten sales orders by using the collective processing ( VL10A ).
    Now when I am going to cancel the delivery document from the T-code- 'VL09', system is not allowing me to do it.
    Can any one please suggest how can I cancell this delivery document.
    Thanks & regards,
    Rupam.
    Edited by: RUPAM KR SEN on Jul 29, 2010 1:42 PM

    Hi Rupam,
    I checked this scenario.
    After invoice creation, I cancelled the invoice in VF11, then did PGI reversal in VL09 and then deleted the delivery in VL02N.
    When I deleted the Delivery, it gave a warning saying that the invoice number exists, but it allowed me to delete the delivery.
    Consequently, the sales order now has the Open status.
    The invoice has the delivery document number in the document flow, however the delivery number is not available in the system.
    This will be the same case for you also if you try this scenario. I dont see any problem in this. If you are ok with this process, you can execute this for the problamatic sales orders.
    Hope this helps

  • Print Layout Designer:Due date in Delivery document

    In print layout designer in 2005 version for Delivery document when they preview the document in document printing it compute an automatic due date but if the preview was done in the delivery document itself the due date is the same as posting date.
    And as to delivery document in SAP no due date will be computed because due date will be determine upon invoice. But upon checking on their database, the same layout/template was used in the preview of the document in the delivery itself and in the document printing. The due date used in the layout was delivery due date.
    They want to apply the scenario of having automatic computation of due date in Delivery document in the print layout designer in their 2007 version. All details created in the Print layout designer in 2005 version are defined already in their 2007 version but when the document was preview in document printing no computation of due date.
    Is the layout used in the preview of delivery document itself was different when i used the document printing and select the same document and preview it? Is it possible to compute the due date in delivery document?
    Can someone help me?

    Hi Paul,
    Yes, we already informed our customer that in delivery document no due date will be computed. But my question is it is possible that the print layout used in the preview of delivery document itself was different when the preview is done in the document printing window? To preview the document in document printing, select or highlight one transactions and click preview.
    When we check the customer database and preview the delivery document itself the due date is
    the same as posting date but when i preview the document in the document printing when you check the
    field due date it was not the same as posting date.
    We check the layout and the field is Database Delivery: Due date. The layout name was also the same when we preview
    the transactions in delivery document itself and in the document printing.
    Can someone tell me if the layout was different in the document printing window under Sales A/R module?
    Thanks,
    Janice

  • Issue in Material creation from BAPI

    Hi All,
    I am working on Mass material upload from the program using BAPI function module: BAPI_MATERIAL_SAVEDATA.
    But the problem is for Material Type 'Finished Product' I could get all the views from the structure BAPIMATHEAD except for views Oil-specific data and Plant Stock.
    So is there any other FM or Structure which includes there 2 views also as its field?
    Thanks.

    Hi,
    Check the bellow links for Material Master Bapi.
    Create Material Master Data with BAPI
    And Check the bellow BAPI for your requirement.
    BAPI_MATERIAL_GET_DETAIL
    or
    BAPI_MATERIAL_GETDETAIL
    Regards,
    Goutam Kolluru.

  • Data transfer using BAPI'S

    please get me the detailed procedure  ( including code) of any data transfer program using BAPI's

    check the sample code....it is used to transfer the data to MM01 tcode.
    *TO CREATE MATERIAL USING BAPI.
    STRUCTURE DECLARATIONS *
    TABLES: BAPIMATHEAD, "Headerdata
    BAPI_MARA, "Clientdata
    BAPI_MARAX, "Clientdatax
    BAPI_MARC, "Plantdata
    BAPI_MARCX, "Plantdatax
    BAPI_MAKT, "Material description
    BAPI_MBEW, "VALUATION DATA
    BAPI_MBEWX,
    BAPI_MARM,
    BAPI_MARMX,
    bapi_mean,
    BAPIRET2. "Return messages
    DATA:V_FILE TYPE STRING. "input data file
    DATA:
    BEGIN OF LSMW_MATERIAL_MASTER,
    MATNR(018) TYPE C, "Material number
    MTART(004) TYPE C, "Material type
    MBRSH(001) TYPE C, "Industry sector
    WERKS(004) TYPE C, "Plant
    MAKTX(040) TYPE C, "Material description
    DISMM(002) TYPE C, "Extra Field Added In the Program as itsrequired
    MEINS(003) TYPE C, "Base unit of measure
    MATKL(009) TYPE C, "Material group
    SPART(002) TYPE C, "Division
    LABOR(003) TYPE C, "Lab/office
    PRDHA(018) TYPE C, "Product hierarchy
    MSTAE(002) TYPE C, "X-plant matl status
    MTPOS_MARA(004) TYPE C, "Gen item cat group
    BRGEW(017) TYPE C, "Gross weight
    GEWEI(003) TYPE C, "Weight unit NTGEW(017) TYPE C, "Net weight
    GROES(032) TYPE C, "Size/Dimensions
    MAGRV(004) TYPE C, "Matl grp pack matls
    BISMT(018) TYPE C, "Old material number
    WRKST(048) TYPE C, "Basic material
    PROFL(003) TYPE C, "DG indicator profile
    KZUMW(001) TYPE C, "Environmentally rlvt
    BSTME(003) TYPE C, "Order unit
    VABME(001) TYPE C,
    EKGRP(003) TYPE C, "Purchasing group
    XCHPF(001) TYPE C, "Batch management
    EKWSL(004) TYPE C, "Purchasing key value
    WEBAZ(003) TYPE C, "GR processing time
    MFRPN(040) TYPE C, "Manufacturer part number
    MFRNR(010) TYPE C, "Manufacturer number
    VPRSV(001) TYPE C, "Price control indicator
    STPRS(015) TYPE C, "Standard price
    BWPRH(014) TYPE C, "Commercial price1
    BKLAS(004) TYPE C, "Valuation class
    bwkey(004) type c,
    END OF LSMW_MATERIAL_MASTER.
    INTERNAL TABLE DECLARATIONS *
    *to store the input data
    DATA:
    BEGIN OF it_matmaster OCCURS 0.
    INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
    DATA:
    END OF it_matmaster.
    *for material description
    DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
    INCLUDE STRUCTURE BAPI_MAKT .
    DATA:END OF IT_MATERIALDESC.
    *FOR gross wt
    data: begin of it_uom occurs 0.
    include structure BAPI_MARM.
    data:end of it_uom.
    DATA: BEGIN OF IT_UOMX OCCURS 0.
    INCLUDE STRUCTURE BAPI_MARMX.
    DATA:END OF IT_UOMX.
    data:begin of it_mean occurs 0.
    include structure bapi_mean.
    data:end of it_mean.
    DATA:BEGIN OF IT_MLTX OCCURS 0.
    INCLUDE STRUCTURE BAPI_MLTX.
    DATA:END OF IT_MLTX.
    *to return messages
    DATA:BEGIN OF IT_RETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF IT_RETURN.
    SELECTION SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
    PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1 .
    AT SELECTION SCREEN *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    PROGRAM_NAME = SYST-CPROG
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = 'P_FILE'
    IMPORTING
    FILE_NAME = P_FILE.
    TO UPLOAD THE DATA *
    START-OF-SELECTION.
    V_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = V_FILE
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = 'X'
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    tables
    data_tab = IT_MATMASTER
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    NO_AUTHORITY = 6
    UNKNOWN_ERROR = 7
    BAD_DATA_FORMAT = 8
    HEADER_NOT_ALLOWED = 9
    SEPARATOR_NOT_ALLOWED = 10
    HEADER_TOO_LONG = 11
    UNKNOWN_DP_ERROR = 12
    ACCESS_DENIED = 13
    DP_OUT_OF_MEMORY = 14
    DISK_FULL = 15
    DP_TIMEOUT = 16
    OTHERS = 17
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ELSE.
    *DELETE IT_MATMASTER INDEX 1.
    ENDIF.
    DATA POPULATIONS *
    LOOP AT IT_MATMASTER.
    *HEADER DATA
    BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
    BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
    BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
    BAPIMATHEAD-BASIC_VIEW = 'X'.
    BAPIMATHEAD-PURCHASE_VIEW = 'X'.
    BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
    *CLIENTDATA
    BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
    BAPI_MARA-DIVISION = IT_MATMASTER-SPART.
    BAPI_MARA-DSN_OFFICE = IT_MATMASTER-LABOR.
    BAPI_MARA-PROD_HIER = IT_MATMASTER-PRDHA.
    BAPI_MARA-PUR_STATUS = IT_MATMASTER-MSTAE.
    BAPI_MARA-ITEM_CAT = IT_MATMASTER-MTPOS_MARA.
    BAPI_MARA-NET_WEIGHT = IT_MATMASTER-NTGEW.
    BAPI_MARA-PO_UNIT = 'KG'.
    BAPI_MARA-UNIT_OF_WT_ISO = 'KG'.
    BAPI_MARA-UNIT_OF_WT = 'KG'.
    BAPI_MARA-PACK_VO_UN = 'KG'.
    BAPI_MARA-BASE_UOM_ISO = 'KG'.
    bapi_mara-size_dim = it_matmaster-groes.
    BAPI_MARA-MAT_GRP_SM = IT_MATMASTER-MAGRV.
    BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
    BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
    BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
    BAPI_MARA-HAZMATPROF = IT_MATMASTER-PROFL.
    BAPI_MARA-ENVT_RLVT = IT_MATMASTER-KZUMW.
    BAPI_MARA-PO_UNIT = IT_MATMASTER-BSTME.
    BAPI_MARA-VAR_ORD_UN = IT_MATMASTER-VABME.
    BAPI_MARA-PUR_VALKEY = IT_MATMASTER-EKWSL.
    BAPI_MARA-MANU_MAT = IT_MATMASTER-MFRPN.
    BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
    BAPI_MARAX-MATL_GROUP = 'X'.
    BAPI_MARAX-DIVISION = 'X'.
    BAPI_MARAX-DSN_OFFICE = 'X'.
    BAPI_MARAX-PROD_HIER = 'X'.
    BAPI_MARAX-PUR_STATUS = 'X'.
    BAPI_MARAX-ITEM_CAT = 'X'.
    BAPI_MARAX-NET_WEIGHT = 'X'.
    BAPI_MARAX-UNIT_OF_WT = 'X'.
    BAPI_MARAX-UNIT_OF_WT_ISO = 'X'.
    bapi_maraX-size_dim = 'X'.
    BAPI_MARAX-MAT_GRP_SM = 'X'.
    BAPI_MARAX-OLD_MAT_NO = 'X'.
    BAPI_MARAX-BASE_UOM = 'X'.
    BAPI_MARAX-BASE_UOM_ISO = 'X'.
    BAPI_MARAX-BASIC_MATL = 'X'.
    BAPI_MARAX-MFR_NO = 'X'.
    BAPI_MARAX-HAZMATPROF = 'X'.
    BAPI_MARAX-ENVT_RLVT = 'X'.
    BAPI_MARAX-PO_UNIT = 'X'.
    BAPI_MARAX-PACK_VO_UN = 'X'.
    BAPI_MARAX-VAR_ORD_UN = 'X'.
    BAPI_MARAX-PUR_VALKEY = 'X'.
    BAPI_MARAX-MANU_MAT = 'X'.
    BAPI_MARAX-MFR_NO = 'X'.
    *PLANT DATA
    BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
    BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
    BAPI_MARC-BATCH_MGMT = IT_MATMASTER-XCHPF.
    BAPI_MARC-GR_PR_TIME = IT_MATMASTER-WEBAZ.
    BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
    BAPI_MARCX-PUR_GROUP = 'X'.
    BAPI_MARCX-BATCH_MGMT = 'X'.
    BAPI_MARCX-GR_PR_TIME = 'X'.
    *VALUATION DATA
    BAPI_MBEW-PRICE_CTRL = IT_MATMASTER-VPRSV.
    BAPI_MBEW-STD_PRICE = IT_MATMASTER-STPRS.
    BAPI_MBEW-COMMPRICE1 = IT_MATMASTER-BWPRH.
    BAPI_MBEW-VAL_AREA = IT_MATMASTER-BWKEY.
    BAPI_MBEW-VAL_CLASS = IT_MATMASTER-BKLAS.
    BAPI_MBEWX-PRICE_CTRL = 'X'.
    BAPI_MBEWX-STD_PRICE = 'X'.
    BAPI_MBEWX-COMMPRICE1 = 'X'.
    BAPI_MBEWX-VAL_AREA = IT_MATMASTER-BWKEY.
    BAPI_MBEWX-VAL_CLASS = 'X'.
    IT_MATERIALDESC-LANGU = 'EN'.
    IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
    append IT_materialdesc.
    IT_UOM-GROSS_WT = IT_MATMASTER-BRGEW.
    IT_UOM-ALT_UNIT = 'KG'.
    IT_UOM-ALT_UNIT_ISO = 'KG'.
    IT_UOM-UNIT_OF_WT = IT_MATMASTER-GEWEI.
    APPEND IT_UOM.
    IT_UOMX-GROSS_WT = 'X'.
    IT_UOMX-ALT_UNIT = 'KG'.
    IT_UOMX-ALT_UNIT_ISO = 'KG'.
    IT_UOMX-UNIT_OF_WT = 'X'.
    APPEND IT_UOMX.
    it_mean-unit = 'KD3'.
    append it_mean.
    it_mltx-langu = 'E'.
    it_mltx-text_name = it_matmaster-matnr.
    APPEND IT_MLTX.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = BAPIMATHEAD
    CLIENTDATA = BAPI_MARA
    CLIENTDATAX = BAPI_MARAx
    PLANTDATA = BAPI_MARc
    PLANTDATAX = BAPI_MARcx
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA = BAPI_MBEW
    VALUATIONDATAX = BAPI_MBEWX
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA =
    SALESDATAX =
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    FLAG_ONLINE = ' '
    FLAG_CAD_CALL = ' '
    IMPORTING
    RETURN = IT_RETURN
    TABLES
    MATERIALDESCRIPTION = IT_MATERIALDESC
    UNITSOFMEASURE = IT_UOM
    UNITSOFMEASUREX = IT_UOMX
    INTERNATIONALARTNOS = it_mean
    MATERIALLONGTEXT = IT_MLTX
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    read table it_return with key TYPE = 'S'.
    if sy-subrc = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN =
    *else.
    *CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
    IMPORTING
    RETURN =
    endif.
    WRITE:/ IT_RETURN-TYPE,
    2 IT_RETURN-ID,
    22 IT_RETURN-NUMBER,
    25 IT_RETURN-MESSAGE.
    IT_RETURN-LOG_NO,
    IT_RETURN-LOG_MSG_NO,
    IT_RETURN-MESSAGE_V1,
    IT_RETURN-MESSAGE_V2,
    IT_RETURN-MESSAGE_V3,
    IT_RETURN-MESSAGE_V4,
    IT_RETURN-PARAMETER,
    IT_RETURN-ROW,
    IT_RETURN-FIELD,
    IT_RETURN-SYSTEM.
    ENDLOOP.[/code]
    Reward if useful.
    Dara.

  • How to post invoice parked using  BAPI-  BAPI_INCOMINGINVOICE_CREATE

    Hi all,
    Can anybody help me with the following scenario:
    I am parking Invoice document using BAPI:  <b>BAPI_INCOMINGINVOICE_PARK</b>. It gives me a document no. which I can see in frontend system also by committing the BAPI.
    But when I try to post the same using BAPI: <b>BAPI_INCOMINGINVOICE_CREATE</b> , It gives me a different document no.
    Means it is not posting the document which has been parked earlier but it is creating totally a new document. Can anybody  tell me using BAPIs how to post the same document that I had parked using  BAPI:  <b>BAPI_INCOMINGINVOICE_PARK</b>??
    Thanks
    Saurabh

    Hi Shraman,
    For a requirement for Intercompany GL posting, use BAPI_ACC_DOCUMENT_POST for standard posting with some advanced parameters
    In Header of the BAPI, pass the hardcoded values like
    DOCUMENTHEADER
           OBJ_TYPE            =            FKKSU
           OBJ_KEY             =          $
           OBJ_SYS              =          System name 
           BUS_ACT             =           RFBU
    Other parameters you can pass in Header is:
    USERNAME
    HEADER_TXT
    COMP_CODE
    DOC_DATE
    PSTNG_DATE
    TRANS_DATE
    FISC_YEAR
    FIS_PERIOD
    DOC_TYPE
    REF_DOC_NO
    If you are posting a document in cross-companies 1000 & 1001, you need to pass cost-center with the line item. That is the mandatory field.
    Thanks,
    Guru

  • Triggering program form(subroutine)  from MIGO using output types gives lock issue with Bapi_sag_change

    Hi,
    On creating the GR from MIGO tcode, based on the quantity check i am updating the field ELIKZ using BAPI_SAG_CHANGE.
    And updation logic is written in a zprogram using with in FORM XXXXX...ENDFORM XXXXX. ( FORM XXXXX is configured in the output type ).
    So the problem i am facing is on creation of the first GR with scheduling agreement number GR is posted successfully and under the output tab the i can see the green icon.
    But on creation of the second GR with same scheduling agreement its showing red icon. The following is the error message " User locked the scheduling agreement ...."
    I even tried using dequeue fm and transaction commit, but it didnt work. Please let me know how to over come the lock issue.
    Thanks & regards,
    Manojkumar K

    Solved it myself....
    Regards,
    Manoj

Maybe you are looking for