Call BAPI to Create Invoice During PGI(VL01N) via BADI

Hi,
Requirement: During PGI (VL01N), we have implemented a BADI (IF_EX_DELIVERY_PUBLISH) in method (PUBLISH_AFTER_SAVE) to call BAPI (BAPI_BILLINGDOC_CREATEMULTIPLE) to create invoice simultaneously with the PGI. In DEV box, the call BAPI is working fine (invoice is created). However in QA box there is a update termination occuring in the call BAPI, thus no invoice is being created. The thing is, how do I locate why the BAPI is terminating in QA but not in DEV? Is the BADI used correct? I have searched SAP Notes related to this termination when doing PGI in VL01N. Up to now we still do not know why in DEV is okay in QA it is not.
SAP Notes:
782447 Runtime error SAPSQL_ARRAY_INSERT_DUPREC when posting GIs
777409 Foreign trade: Update termination EXPIMP_POSTING
ST22 dump analysis:
In the source code you have the termination point in line 51
of the (Include) program "LV50EU05".
The program "SAPLV50E" was started in the update system.
The termination is caused because exception "CX_SY_OPEN_SQL_DB" occurred in
procedure "EXPIMP_POSTING" "(FUNCTION)", but it was neither handled locally nor
declared
in the RAISING clause of its signature.
The procedure is in program "SAPLV50E "; its source code begins in line
1 of the (Include program "LV50EU05 ".
Source code:
DESCRIBE TABLE XEIKP LINES LIN.
IF LIN GT 0.
   INSERT EIKP FROM TABLE XEIKP.         <<< the dump is happening in this standard logic
   REFRESH XEIKP.
ENDIF.
Edited by: Mawi C. Ng on Sep 2, 2009 2:24 PM

Hi,
  Based on the DUMP i can say that in the below statement :
INSERT EIKP FROM TABLE XEIKP. <<< the dump is happening in this standard logic
The program is trying to insert lines which have duplicate key values check the btable XEIKP at this point and see if the records that are there do they have key fields values that already exist. You can put a break-point at that statement and check.
Regards,
Himanshu

Similar Messages

  • Bapi to create Invoice with reference to SalesOrder

    Hi All,
    I want to create Invoice with reference to SalesOrder ,
    can anybody help me regarding
    --> what is the Bapi to Create Invoice with reference to SalesOrder
    --> what are the import parameters
    Thanks in Advance
    Regards
    Srinivas

    Hi Giuseppi,
    Thanks to your reply,
    i have used BAPI_BILLINGDOC_CREATEMULTIPLE , i have given the following input values in the BILLINGDATAIN
      -- salesorg,distrchan,division,doc-type,sold-to,plant,material,doc-number,item-number , when  i execute the Bapi , i got the DocNo:0090021983 , but i did not find that DocNo. by executing the Bapi BAPI_BILLINGDOC_GETLIST.
    i found the short description for
    BAPI_BILLINGDOC_CREATEMULTIPLE -- is for Individual Customer Billing Document, is it the correct Bapi to create invoice
    what is the correct Bapi to create invoice based on the salesorder.
    RV_INVOICE_CREATE OR GN_INVOICE_CREATE OR BAPI_BILLINGDOC_CREATEMULTIPLE.
    Can u specify the import parameters for that Bapi.
    Thanks & Regards
    Srinivas

  • Performance issue calling bapi po create in test mode to get error messages

    Hi,
    We have  a report which displays in alv the purchase orders that got created in SAP, but either got blocked due to not meeting PO Release Strategy tolerances or have failed output messages .We are displaying the failed messages too.
    We are looping the internal table of eban(purchase requisition) and calling bapi po create in test mode to get failed messages.
    Now we are facing performance issue in production.What can be the other effecient way to get the error messages without effecting performance.
    Regards,
    Suvarna

    Hi Suvarna,
    so you need to reduce the number of PO-simulations.
    - Likely you checked already, that all EBAN-entries should already be converted into POs. If there would be a large number of "new" EBAN-entries, they don't need to be simulated.
    - If it's a temporary problem: give aid to correct the problems (maintain prices or whatever the error-reasons are) Then the amount of not-converted purchase requisitions (PR) should drop, too
    - If it's likely, that your volume of open PR will stay high: create a Z-Table with key of EBAN and a counter, simulate (once a day) PO conversions and store the results in the Z-table. In your report you can use the results... if they are "new enough". From time to time new simulations should be done, missing master data might be available.
    Maybe users should be allowed to start this 2nd report manually (in background), too -> then they can update the messages after some data corrections themself, without waiting for the result (just check later in online report and do something different in between).
    And you might need to explain, PO simulation takes as long as PO creation... there is no easy or fast way around this.
    Best regards,
    Christian

  • BAPI for Create Invoice

    Hi everyone
    I need to create an invoice document using some bapi, i found this two bapi BAPI_BILLINGDOC_CREATEMULTIPLE and BAPI_INCOMINGINVOICE_CREATE; but i don't know how can i use. Can anyone help me please?
    Thanks & Regards
          David N

    Hi,
    Check this example..
    DATA: s_vbap TYPE vbap.
    TABLES: vbak,vbap,likp, lips.
    DATA: t_billing TYPE STANDARD TABLE OF bapivbrk WITH HEADER LINE.
    DATA: t_conditions TYPE STANDARD TABLE OF bapikomv WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapireturn1 WITH HEADER LINE.
    DATA: t_ccard TYPE STANDARD TABLE OF bapiccard_vf WITH HEADER LINE.
    DATA: t_errors TYPE STANDARD TABLE OF bapivbrkerrors WITH HEADER LINE.
    DATA: t_success TYPE STANDARD TABLE OF bapivbrksuccess WITH HEADER LINE
    PARAMETERS: p_vbeln TYPE vbeln.
    select single * from likp
    where vbeln = p_vbeln.
    SELECT SINGLE * from lips where
    vbeln = likp-vbeln.
    t_billing-salesorg = likp-vkorg.
    t_billing-ref_doc = likp-vbeln.
    t_billing-ref_item = lips-posnr.
    t_billing-doc_number = p_vbeln.
    t_billing-itm_number = lips-posnr.
    t_billing-ordbilltyp = '<b>Billing document type</b>'.
    t_billing-price_date = sy-datum.
    t_billing-ref_doc_ca = likp-vbtyp.
    t_billing-material = lips-matnr.
    t_billing-plant = lips-werks.
    APPEND t_billing.
    CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
    TABLES
    billingdatain = t_billing
    return = t_return
    success = t_success
    commit work.
    Thanks,
    Naren

  • Addition of the tab in the PO Create / Change using ME21N/ME22N Via BADi.

    Hi All,
    I am trying to add an additional tab in the scree of the Transacton ME21N / ME22N at the Item Level. The Label  of the tab is 'Test123'.
    I have already created a Separate screen ZTEST1_111 Dynpro 0100 and have a box with two input fields and the twp radio buttons
    and a Push button.
    I have Created the Implementation of the BAdi ME_GUI_PO_CUST and have Written the code inside the Method Suscribe where I have put in the code as follows:
    wa_susc-name = 'BOX1'.
    wa_susc-program = 'ZTEST1_111'.
    wa_susc-dynpro = '0100'.
      wa_susc-STRUCT_NAME = 'ZMEPO_BADI_STRUCT1'.
      wa_susc-label = 'Test123'.
    wa_susc-position = 5.
    wa_susc-height = 7.
    append wa_susc to RE_SUBSCRIBERS.
    I have also written some piece of code to the other methods as well.
    Please do let me know where have I gobe wrong. why there is no result inspite of doing the right coding.
    Am I missing on something...?
    Please guide me the right way..? If in case I need to do anything more..?
    Regards,
    Deepak.

    Hi,
    You have to implement ME_PROCESS_PO_CUST for this.
    method if_ex_me_process_po_cust~fieldselection_item this method enables you to influence the field selection properties for a field.
    By making changes to this table CH_FIELDSELECTION - Field selection table, you can influence the display properties of a field.
    it has following for selection status
    '-'   Field is suppressed
    *''   Field is purely a display field
    '.'   Input field
    '+'  Mandatory field.
    Hope this helps.
    Regards,
    Pawan

  • A proxy and in that proxy we will call the BAPI for creating Purchase Requi

    HI all,
    I am explaining a situation please resolve if possible.
    I got source data to create purchase requisition .  the source data was not cleaned and requires lot of validations and crossmapping with actual sap tables . I did it for testing and used bapi ( bapi_requsition_create) and was able to test the data to create a pr in sap. but now as per the instructions from my onsite co-ordinator , they told thy will use  a proxy( in place of idoc) and in that we will call bapi to create purchase requisition in sap. please explain about what kind of proxy it may be and how we call bapi in it . thanx in adv..

    HI all,
    I am explaining a situation please resolve if possible.
    I got source data to create purchase requisition .  the source data was not cleaned and requires lot of validations and crossmapping with actual sap tables . I did it for testing and used bapi ( bapi_requsition_create) and was able to test the data to create a pr in sap. but now as per the instructions from my onsite co-ordinator , they told thy will use  a proxy( in place of idoc) and in that we will call bapi to create purchase requisition in sap. please explain about what kind of proxy it may be and how we call bapi in it . thanx in adv..

  • Performance issue: Calling a BAPI PO create in test mode to get error msgs

    Hi,
    We have an ALV report in which we display purchase orders that got created in SAP, but either got blocked due to not meeting PO Release strategy tolerances or have failed output messages. we are displaying the failed messages even.
    We are looping the internal table of eban(PR) & calling bapi po create in test mode to get failed messages.
    Now we are facing performance issue in production. What can be the alternate efficient way to get the error msgs with efficiency
    Regards,
    Ayub H.
    Moderator message: duplicate post (different ID, same company...), see below:
    Performance issue calling bapi po create in test mode to get error messages
    Edited by: Thomas Zloch on Mar 9, 2012

    Hi Suvarna,
    so you need to reduce the number of PO-simulations.
    - Likely you checked already, that all EBAN-entries should already be converted into POs. If there would be a large number of "new" EBAN-entries, they don't need to be simulated.
    - If it's a temporary problem: give aid to correct the problems (maintain prices or whatever the error-reasons are) Then the amount of not-converted purchase requisitions (PR) should drop, too
    - If it's likely, that your volume of open PR will stay high: create a Z-Table with key of EBAN and a counter, simulate (once a day) PO conversions and store the results in the Z-table. In your report you can use the results... if they are "new enough". From time to time new simulations should be done, missing master data might be available.
    Maybe users should be allowed to start this 2nd report manually (in background), too -> then they can update the messages after some data corrections themself, without waiting for the result (just check later in online report and do something different in between).
    And you might need to explain, PO simulation takes as long as PO creation... there is no easy or fast way around this.
    Best regards,
    Christian

  • Using BAPI_ACC_INVOICE_RECEIPT_POST to create Invoice Receipt

    Hi,
    I'm using the above BAPI to create invoice receipts (to mimic MIRO) but if I enter the OBJ_TYPE RMRP it gives me an error:
    'Incorrect entry in field OBJ_TYPE: RMRP'
    I've checked table TTYP and this object type does exist.  Has anyone come across this error before?
    Basically I want to be able to pass it a Purchase Order document number and it should create an invoice receipt document like it does in MIRO.  I'm on version 4.6c but do have access to 640 and I know nothing about financials (I leave that to the FI/CO consultants).
    Any help would be appreciated.
    Gill

    Hi Gill,
    I need to meet the same requirement 'Enter Invoice with Reference to Purchase Order MIRO'. I was reading the threat you created. Which BADI did you use to create invoice with reference to PO? If you can provide and tip or test program that which fields I need to provide in BAPI.
    Thanks for ur help

  • How to create invoice using bapi  base on delivery number with example

    hi,
    Pl give me one example to create invoice using bapi base on delivery number (PGI).

    Use this code
    * Pass the delivery no to the FM to create the invoice
          wa_vbsk-smart = u2018Fu2019.
            wa_komfk-vbeln = nast-objky. u201CuF0DF-----delivery number
            APPEND wa_komfk TO it_komfk.
            CLEAR wa_komfk.
    *    To fill the message structure
    *        l_wa_error-vbeln_vl = nast-objky. " Delivery No.
    *        l_wa_error-fkart = wa_ztab-bil_doc_type." Billing Doc type
            CALL FUNCTION 'RV_INVOICE_CREATE'
                    EXPORTING
    *                 delivery_date             = 0
                     invoice_date              = v_date  u201C<- date
    *                 invoice_type              = '    '
    *                 pricing_date              = 0
                     vbsk_i                    = wa_vbsk
                     with_posting              = u2018Du2019
    *                 select_date               = 0
                     i_no_vblog                = ' '
                     i_analyze_mode            = ' '
                     id_utasy                  = ' '
                     id_utswl                  = ' '
                     id_utsnl                  = ' '
                     id_no_enqueue             = ' '
                     id_new_cancellation       = ' '
    **             IMPORTING
    *               VBSK_E                    =
    *               OD_BAD_DATA               =
    *               DET_REBATE                =
                    TABLES
                      xkomfk                    = it_komfk
                      xkomv                     = it_komv
                      xthead                    = it_thead
                      xvbfs                     = it_vbfs
                      xvbpa                     = it_vbpa
                      xvbrk                     = it_xvbrk
                      xvbrp                     = it_vbrp
                      xvbss                     = it_vbss
    *               XKOMFKGN                  =
    *               XKOMFKKO                  =

  • BAPI to create Excise Invoice and Commercial Invoice

    Hi All,
    Can u tell me the BAPI for creating Excise and Commercial Invoice.
    Moderator message: please do some research before asking.
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Mar 2, 2011 5:56 PM

    Hi,
    You can make the appropriate setting in Customizing for Excise Duty, by choosing Basic Settings -> Maintain Excise Groups, and selecting Create EI (Create Excise Invoice Automatically)
    Also maintain the default excise and series group in the configuration.
    Logistics general>Tax on Goods Movement>India>Basic Settings>Maintain Excise groups. For your Excise group maintain the check Excise invoice during Billing.
    After maintaining the same also maintain the default values in Logistics general>Tax on Goods Movement>India>Business transactions>Outgoing Excise invoices-->Maintain Default Excise groups and Series groups.
    Regards,

  • How to create an Accounting Document by calling BAPI

    Hai friends ,
    please tell me how to call this BAPI and fulfill all the parameters .. Please help me , I dont know the head and tail of it ...
    create an Accounting Document by calling BAPI  BAPI_ACC_DOCUMENT_POST
    Below is the step to fill the parameters for BAPI:
    Enter company code, invoice no, invoice date, document type, header text into DOCUMENTHEADER
    Enter customer, item text, company code, payment term into ACCOUNTRECEIVABLE
    Enter offset account, company code, document type, item text into ACCOUNTGL
    Enter currency type u201800u2019, currency, exchange rate, amount into CURRENCYAMOUNT. Please note there will be two rows in this table, one positive amount and one negative amount
    Call the BAPI to create the AR document. If p_check is checked, call the BAPI only without COMMIT and then do the message processing
    If p_check is initial, COMMIT the data to the database tables.
    Check the RETURN table after each BAPI, if no u2018Eu2019 message type found, output the document no. Otherwise, output the error messge to the screen with the message type u2018Eu2019.
    thanks in advance ...

    Hi,
    Check the link
    http://www.sapbrainsonline.com/sapinfo/tutorial.php?artid=617
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_acc_document_post-error-1973720
    http://delaynomore.spaces.live.com/blog/cns!D2BFFB84EDFE4189!528.entry
    http://sap4.com/wiki/index.php?title=BAPI_ACC_DOCUMENT_POST
    http://www.sapfans.com
    Anurodh

  • How to create invoicing plan with BAPI?

    Dear Experts,
          I am using this BAPI to create PO,it is ok,but I can not create invoicng plan. could you please tell me how create this po with invoicing plan?
        CALL FUNCTION 'BAPI_PO_CREATE'
          EXPORTING
            PO_HEADER                        = ITAB_PO_HEAD
            PO_HEADER_ADD_DATA               = ITAB_PO_HEAD_ADD
            HEADER_ADD_DATA_RELEVANT         = 'X'
         IMPORTING
           PURCHASEORDER                    =  WF_PO_NUMBER
          TABLES
            PO_ITEMS                         = ITAB_PO_ITEM
            PO_ITEM_SCHEDULES                = ITAB_PO_ITEM_DATE
            PO_ITEM_ACCOUNT_ASSIGNMENT       = ITAB_PO_ACCOUNT
            RETURN                           =  PO_RETURN
             PO_SERVICES                      = ITAB_PO_SERVICE
             PO_SRV_ACCASS_VALUES             = ITAB_PO_SERV_ACC_VAL
    Best regards,
    Shinny

    Thank you

  • BAPI or FM to create Invoice in SRM , without reference to PO ?

    Dear Colleagues,
    We have a situation where we have to create invoices in SRM from a file from a legacy system, that means we have no POs in SRM.
    Which process, BAPI or Function Module would you recommend me? Is it possible to create "standard" invoices in SRM with a BAPI, and have those invoices be displayed afterward in the standard SRM functionality/transactions, plus have a subsequent invoice created in the backend?
    Will award point to helpful answers.
    Many thanks,
    David

    Thanks for your help, but I still dont know which FM is best, or what is the difference.
    Can i use this FM to post an invoice without reference to a PO? How do I fill/pass the vendor and item data? Do you have any example on how to pass the data to the FM?
    Which FM are called by the system when a vendor creates a NON-PO Invoice? Any idea?
    If I use the FM to transfer to backend, will the invoice go through all standard verifications in SRM and R/3?
    Thanks again, regards
    David

  • BAPI needed to create invoice and creditmemo

    Hi all,
          Is there any BAPI available to create invoice and creditmemo when material no is not given.
          My requirement is to create credit memo and  invoice through FB75 or FB70 transaction. I am able to achieve the same through BDC. Is there any BAPI availabe for the same to create credit memo or invoice to avoid BDC.
          Input given to the program is a excel file in which i have the following fields
          Transaction -- which separates credit memo or
                         invoice
          Company code, purchase order number, GL account
          number, cost center, profit center, amount etc...
    Please let me know some pointers.
    Regards,
    Karthik.

    GN_INVOICE_CREATE or BAPI_BILLINGDOC_CREATEMULTIPLE
    Please find the sample code for Billing document BAPI.
    t_billing-salesorg = vbak-vkorg.
    t_billing-DISTR_CHAN = vbak-vtweg.
    t_billing-DIVISION = vbak-spart.
    t_billing-DOC_TYPE = vbak-auart.
    t_billing-ref_doc = vbak-vbeln.
    t_billing-ref_item = vbap-posnr.
    t_billing-doc_number = vbak-vbeln.
    t_billing-ITM_NUMBER = vbap-posnr.
    t_billing-ordbilltyp = 'BILLING TYPE'.
    t_billing-price_date = sy-datum.
    t_billing-ref_doc_ca = vbak-vbtyp.
    t_billing-sold_to = vbak-kunnr.
    t_billing-material = vbap-matnr.
    t_billing-plant = vbap-werks.
    APPEND t_billing.
    CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
    TABLES
    billingdatain = t_billing
    return = t_return
    success = t_success.
    commit work.
    Regards

  • BAPI create invoice

    I use BAPI_ACC_INVOICE_RECEIPT_CHECK to create automatically an invoice but I don't know how to add parameters to tables to create an invoice with 3 positions: for example with amount 200 , -195, -5
    How many there will be positions with:
    IT_ACCOUNTPAYABLE--ITEMNO_ACC
    IT_CURRENCYAMOUNT-ITEMNO_ACC
    IT_ACCOUNTGL-ITEMNO_ACC
    Every position have an own account number

    hi,
    Please find the below links.
    http://www.sapdev.co.uk/java/jco/bapi_jco.pdf
    http://sapabaplive.blogspot.com/search/label/BAPI
    Sample code:
    Invoice data is sent by the vendors in a text file and an inbound
    interface is required to create Vendor Invoices in SAP.
    The file contains the Purchase Order information, material quantity
    received from vendor along with the amount.
    Here the requirement becomes a little complex as there might be
    several ocuurences of same Purchase Order item in one invoice.
    Only a incomplete sample coding is given here and it can only be used
    as a base for writing a program.
    Populate internal Table I_ITAB from the data uploaded
    from text data file.
    Populate Item Table from item data in data file
    Processing for header records of data file.
    set up header data for BAPI call.
    Check whwther it's an Incoice or Credit Memo.
    And populate Invoice indicator accordingly.
    IF I_ITAB-TRANS EQ '-'.
    I_HEADER-INVOICE_IND = C_X.
    ELSE.
    CLEAR I_HEADER-INVOICE_IND.
    ENDIF.
    I_HEADER-PSTNG_DATE = I_ITAB-BUDAT.
    I_HEADER-DOC_DATE = I_ITAB-BLDAT.
    I_HEADER-CURRENCY = W_WAERS.
    I_HEADER-GROSS_AMOUNT = I_ITAB-DMBTR.
    I_HEADER-COMP_CODE = I_ITAB-BUKRS.
    I_HEADER-HEADER_TXT = I_ITAB-SGTXT.
    I_HEADER-REF_DOC_NO = I_ITAB-XBLNR.
    IF NOT I_ITAB-INV_REC_DATE IS INITIAL.
    I_HEADER-INV_REC_DATE = I_ITAB-INV_REC_DATE.
    ELSE.
    I_HEADER-INV_REC_DATE = I_ITAB-BLDAT.
    ENDIF.
    I_HEADER-PYMT_METH = I_ITAB-ZLSCH.
    APPEND I_HEADER.
    Populate Item Table from item data in data file
    lv_count = 0.
    LOOP AT I_ITAB.
    Processing for header records of data file.
    lv_count = lv_count + 1.
    Item Data
    I_ITEM-INVOICE_DOC_ITEM = lv_COUNT.
    I_ITEM-PO_NUMBER = I_ITAB-EBELN.
    I_ITEM-PO_ITEM = I_ITAB-EBELP.
    I_ITEM-TAX_CODE = I_ITAB-MWSKZ2.
    I_ITEM-ITEM_AMOUNT = I_ITAB-NETWR.
    Populate quantities if not a blanket order
    IF I_ITAB-BLANKET EQ SPACE.
    I_ITEM-QUANTITY = I_ITAB-MENGE.
    PERFORM GET_MEINS USING I_ITAB-EBELN " Use table EKPO
    I_ITAB-EBELP
    CHANGING I_ITEM-PO_UNIT.
    I_ACCOUNTINGDATA-PO_UNIT = I_ITEM-PO_UNIT.
    IF I_ITEM-QUANTITY EQ 0.
    I_ITEM-PO_UNIT = SPACE.
    ENDIF.
    ENDIF.
    Item Text
    I_ITEM-ITEM_TEXT = I_ITAB-ITEM_TEXT.
    APPEND I_ITEM.
    Populate Accounting Data
    IF I_ITAB-BLANKET EQ SPACE.
    I_ACCOUNTINGDATA-INVOICE_DOC_ITEM = lv_COUNT.
    I_ACCOUNTINGDATA-SERIAL_NO = '01'.
    I_ACCOUNTINGDATA-TAX_CODE = I_ITAB-MWSKZ2.
    I_ACCOUNTINGDATA-ITEM_AMOUNT = I_ITAB-NETWR.
    SELECT SINGLE SAKTO KOSTL VBELN VBELP ANLN1 ANLN2 DABRZ
    FISTL GEBER GRANT_NBR GSBER IMKEY KOKRS KSTRG PAOBJNR
    PRCTR PS_PSP_PNR AUFNR MENGE
    FROM EKKN
    INTO (I_ACCOUNTINGDATA-GL_ACCOUNT, I_ACCOUNTINGDATA-COSTCENTER,
    I_ACCOUNTINGDATA-SD_DOC, I_ACCOUNTINGDATA-SDOC_ITEM,
    I_ACCOUNTINGDATA-ASSET_NO, I_ACCOUNTINGDATA-SUB_NUMBER,
    I_ACCOUNTINGDATA-REF_DATE, I_ACCOUNTINGDATA-FUNDS_CTR,
    I_ACCOUNTINGDATA-FUND, I_ACCOUNTINGDATA-GRANT_NBR,
    I_ACCOUNTINGDATA-BUS_AREA, I_ACCOUNTINGDATA-RL_EST_KEY,
    I_ACCOUNTINGDATA-CO_AREA, I_ACCOUNTINGDATA-COSTOBJECT,
    I_ACCOUNTINGDATA-PROFIT_SEGM_NO, I_ACCOUNTINGDATA-PROFIT_CTR,
    I_ACCOUNTINGDATA-WBS_ELEM, I_ACCOUNTINGDATA-ORDERID,
    I_ACCOUNTINGDATA-QUANTITY)
    WHERE EBELN EQ I_ITAB-EBELN
    AND EBELP EQ I_ITAB-EBELP
    AND ZEKKN EQ '01'.
    IF EKKO-BSART NE 'LTV'.
    CLEAR I_ACCOUNTINGDATA-QUANTITY.
    CLEAR I_ACCOUNTINGDATA-PO_UNIT.
    ENDIF.
    APPEND I_ACCOUNTINGDATA.
    ENDIF.
    ENDLOOP.
    The following coding is to solve the problem
    mentioned in OSS Note 518338.
    Same PO item within several invoice items.
    SORT I_ITEM BY PO_NUMBER PO_ITEM.
    LOOP AT I_ITEM.
    ON CHANGE OF I_ITEM-PO_NUMBER OR I_ITEM-PO_ITEM.
    W_COUNTER = 1.
    LOOP AT I_ITEM WHERE PO_NUMBER = I_ITEM-PO_NUMBER
    AND PO_ITEM = I_ITEM-PO_ITEM.
    IF W_COUNTER EQ 1.
    I_ACCOUNTINGDATA-SERIAL_NO = '01'.
    I_ACCOUNTINGDATA-XUNPL = ' '.
    ELSE.
    I_ACCOUNTINGDATA-SERIAL_NO = ' '.
    I_ACCOUNTINGDATA-XUNPL = 'X'.
    ENDIF.
    MODIFY I_ACCOUNTINGDATA
    TRANSPORTING SERIAL_NO XUNPL
    WHERE INVOICE_DOC_ITEM = I_ITEM-INVOICE_DOC_ITEM.
    W_COUNTER = W_COUNTER + 1.
    ENDLOOP.
    To solve the repetition of PO item in subsequent invoices.
    ELSEIF SY-TABIX EQ 1.
    W_COUNTER = 1.
    LOOP AT I_ITEM WHERE PO_NUMBER = I_ITEM-PO_NUMBER
    AND PO_ITEM = I_ITEM-PO_ITEM.
    IF W_COUNTER EQ 1.
    I_ACCOUNTINGDATA-SERIAL_NO = '01'.
    I_ACCOUNTINGDATA-XUNPL = ' '.
    ELSE.
    I_ACCOUNTINGDATA-SERIAL_NO = ' '.
    I_ACCOUNTINGDATA-XUNPL = 'X'.
    ENDIF.
    MODIFY I_ACCOUNTINGDATA
    TRANSPORTING SERIAL_NO XUNPL
    WHERE INVOICE_DOC_ITEM = I_ITEM-INVOICE_DOC_ITEM.
    W_COUNTER = W_COUNTER + 1.
    ENDLOOP.
    ENDON.
    ENDLOOP.
    Changes over for OSS Note 518338.
    SORT I_ITEM BY INVOICE_DOC_ITEM PO_NUMBER PO_ITEM.
    CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
    EXPORTING
    HEADERDATA = I_HEADER
    IMPORTING
    INVOICEDOCNUMBER = W_BELNR
    FISCALYEAR = W_GJAHR
    TABLES
    ITEMDATA = I_ITEM
    ACCOUNTINGDATA = I_ACCOUNTINGDATA
    TAXDATA = I_TAX
    RETURN = I_RETURN.
    if sy-subrc 0.
    message e999(re) with 'Problem occured'.
    else.
    loop at return.
    if not return is initial.
    clear bapi_retn_info.
    move-corresponding return to bapi_retn_info.
    if return-type = 'A' or return-type = 'E'.
    error_flag = 'X'.
    endif.
    append bapi_retn_info.
    endif.
    endloop.
    if error_flag = 'X'.
    message e999(re) with 'Problem occured'.
    rollback work.
    else.
    Return Table from BAPI call is empty
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = I_RETURN.
    endif.
    endif.
    hope this helps.
    regs,
    hema.

Maybe you are looking for

  • House bank account balances and turnovers

    Hello, at our customer company we have configured few G/L accounts for multiple bank accounts - e.g. one for each house bank ID per local/foreign currency - so for each bank we have two G/L accounts configured. This works very well until we need to s

  • 90422 and 90421 not saving meetings information

    90411 worked fine for this (but had a large list of issues anyway). Basically if I create a meeting of any kind I can put whatever I like in the comment field but as soon as I save it the comments are not retained. If I send an email notification to

  • Delta field for Data Source 0BP_RELATIONS_ATTR

    Hi Experts, I need to know how to find which field is Delta enabled for standard Data Sources. In my requrement for Data Source 0BP_RELATIONS_ATTR. As the Data Source is being accessed by BODS sysetm and they need to know the Delta field to extract d

  • Populating values in jsp without submitting the form

    Hi, I have a jsp page in which i have 2 select boxes. The values to these select boxes should come from database. When i change the selection of select box, the corresponding values from database should be displayed in the other select box without su

  • Help with Slideshow?

    I created a slideshow using Keynote complete with all transitions and delays, etc. I exported it to IDVD. Once it was complete I attampted to burn a DVD and got an error message. On checking the map of the DVD, it tells me I have empty drop zones. Ho