BAPI billing

Hi
i am working with bap_billingdoc_createmultiple
when i am trying to create the billing,
if the customers are repeated it is adding the values of conditiontype it is adding all the records creating only one document for one customer
loop at it_bill1 INTO WA_BILL1.
    wa_billingdata-salesorg = WA_bill1-sorg.
    wa_billingdata-distr_chan = WA_BILL1-dist.
    wa_billingdata-division = WA_BILL1-div.
    wa_billingdata-doc_type = 'ZSO5'.
    wa_billingdata-ordbilltyp = 'FX'.
    wa_billingdata-bill_date = WA_BILL1-BDATE.
    wa_billingdata-sold_to = WA_BILL1-CUSTNO.
    wa_billingdata-price_date = WA_BILL1-BDATE.
    wa_billingdata-country = WA_BILL1-CNTRY.
    wa_billingdata-plant = WA_BILL1-PLANT.
    wa_billingdata-material = WA_BILL1-MATDESC.
    wa_billingdata-REQ_QTY = '2'.
    wa_billingdata-currency = WA_BILL1-CURR.
    wa_billingdata-wbs_elem = it_posid-posid.
    append wa_billingdata to billingdata.
     wa_CONDITIONDATA-cond_value = WA_BILL1-ADVERTISCOST.
    wa_conditiondata-cond_type = 'EK01'.
endif.
    conditiondata-cond_value = WA_BILL1-COMM.
   conditiondata-cond_type = 'ZCOM'.
    append wa_conditiondata to conditiondata.
  endloop.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
   EXPORTING
     CREATORDATAIN         = creaord
    TESTRUN               = 'X'
    POSTING               =
    TABLES
     BILLINGDATAIN         =  billingdata
     CONDITIONDATAIN       =  conditiondata
    CCARDDATAIN           =
    TEXTDATAIN            =
    ERRORS                =
      RETURN                = bapiret
      SUCCESS               = succ
please help me how to work this
if u have please send the code
Regards,
Edited by: abap on Jul 16, 2008 8:51 AM

you have to refresh conditiondata and billingdata before each new billingrecord .
and where is the if of the endif within the loop ??
Edited by: A. de Smidt on Jul 16, 2008 9:08 AM

Similar Messages

  • Enhance BOR for Billing document

    Hi ,
       I have a requirement to enhance the BOR with two extra fields. Can you please let me know, how i shud proceed.
    Thank you.

    Hi ,
    If you want to add a import field u need to have a acess key.
    Else
    you need to copy the function module and needs to implement your own Z F/M  fields are to be inserted.
    After insertion go to T-code SWO1 and place BUS2037 then add ur z funtion module in BAPI: Billing Document
    I hope this may helpfull.
    Thank you,
    Thanks,
    AMS

  • How to create Billing Plan in sales order using Function module /BAPI

    hi,
    How to create Billing Plan in sales order using Function module /BAPI
    i hv check few FM such
    BILLING_SCHEDULE_READ
    BILLING_SCHEDULE_GET_NUMBER
    BILLING_SCHEDULE_SAVE
    But unable to create billing plan for a sales order.....any other method to create???

    Hi,
    Use this link.
    Create sales order with billing plan via LSMW and BAPI BUS2032
    BAPI or Function to update Billing Plan in Sales Order Items
    Hope this will help you.
    Regards,
    Vijay

  • Create Excise invoice(J1IIN) document while creating billing document using bapi BAPI_BILLINGDOC_CREATEMULTIPLE

    Dear Experts,
    My scenario is:
    We have batch split scenario, where the parent line item of billing document has 0 quantity and its subsequent item (item with batch number) holds actual quantity data.
    When we create billing document using VF01 against delivery document, system creates billing document along with excise invoice document (J1IIN Document). And in excise document contain same number of line items that of billing document. Please see the below attachment: 
    Biiling document screen shot:
    While creating billing document, the J1IIN Document created automatically. Below is the screen-shot for the same.
    Now the issue is:
    When we create billing document using BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE system creating only billing document and not creating excise invoice document.
    When we create excise document manually using J1IIN the zero quantity line items are excluded in excise invoice document.
    Please see the below screen-shot for the same; The z quantity line items are missing.
    We want excise document to be created while creating billing document using BAPI BAPI_BILLINGDOC_CREATEMULTIPLE. Or is there any other BAPI for the same purpose.
    Customization is also maintained for creating excise invoice document automatically.
    Regards,
    Rajesh Sadula.

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

  • Creating Billing Plan data for sales order using BAPI

    Hello,
    Someone ones if there is any way to create a sales order (BAPI) and then create a billing plan (by means of another BAPI)?
    Or is there any way to create both at the same time?
    Kind Regards.

    Hi David and Nisha here is the code for creating sales order with bapi
    *& Report  YOBJ_BAPI_SALESORDER
    *& REPORT : CREATING SALES ORDER USING STANDARD BAPI
    *& AUTHOR : S.PAVAN KUMAR INUMARTHY
    REPORT  YOBJ_BAPI_SALESORDER.
    DATA : ORDER_HEADER_IN LIKE STANDARD TABLE OF BAPISDHD1 WITH HEADER LINE.
    DATA : ORDER_ITEMS_IN LIKE STANDARD TABLE OF BAPISDITM WITH HEADER LINE.
    DATA : ORDER_PARTNERS LIKE STANDARD TABLE OF BAPIPARNR WITH HEADER LINE.
    DATA : RETURN TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
    DATA : SALESDOCUMENT LIKE BAPIVBELN-VBELN.
    *APPENDING VALUES FOR HEADER.
    ORDER_HEADER_IN-DOC_TYPE = 'TA'.
    ORDER_HEADER_IN-SALES_ORG = '1000'.
    ORDER_HEADER_IN-DISTR_CHAN = '10'.
    ORDER_HEADER_IN-DIVISION = '00'.
    ORDER_HEADER_IN-SALES_GRP = '130'.
    ORDER_HEADER_IN-SALES_OFF = '1030'.
    APPEND ORDER_HEADER_IN.
    *APPENDING VALUES FOR ITEM
    ORDER_ITEMS_IN-MATERIAL = 'M-13'.
    ORDER_ITEMS_IN-PLANT = '1000'.
    ORDER_ITEMS_IN-SALES_UNIT = 'ST'.
    ORDER_ITEMS_IN-DIVISION = '07'.
    ORDER_ITEMS_IN-GROSS_WGHT = '28000'.
    ORDER_ITEMS_IN-NET_WEIGHT = '28000'.
    ORDER_ITEMS_IN-UNTOF_WGHT = 'KG'.
    ORDER_ITEMS_IN-VOLUME = '0.780'.
    ORDER_ITEMS_IN-VOLUNIT = 'M3'.
    APPEND ORDER_ITEMS_IN.
    *APPENDING VALUES FOR PARTNER
    ORDER_PARTNERS-PARTN_ROLE = 'AG'.
    ORDER_PARTNERS-PARTN_NUMB = '0000001000'.
    ORDER_PARTNERS-COUNTRY = 'DE'.
    ORDER_PARTNERS-TRANSPZONE = 'D000080000'.
    APPEND ORDER_PARTNERS.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
    *   SALESDOCUMENTIN               =
        ORDER_HEADER_IN               = ORDER_HEADER_IN
    *   ORDER_HEADER_INX              =
    *   SENDER                        =
    *   BINARY_RELATIONSHIPTYPE       =
    *   INT_NUMBER_ASSIGNMENT         =
    *   BEHAVE_WHEN_ERROR             =
    *   LOGIC_SWITCH                  =
    *   TESTRUN                       =
    *   CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                  = SALESDOCUMENT
      TABLES
       RETURN                         = RETURN
       ORDER_ITEMS_IN                 = ORDER_ITEMS_IN
    *   ORDER_ITEMS_INX               =
        ORDER_PARTNERS                = ORDER_PARTNERS
    *   ORDER_SCHEDULES_IN            =
    *   ORDER_SCHEDULES_INX           =
    *   ORDER_CONDITIONS_IN           =
    *   ORDER_CONDITIONS_INX          =
    *   ORDER_CFGS_REF                =
    *   ORDER_CFGS_INST               =
    *   ORDER_CFGS_PART_OF            =
    *   ORDER_CFGS_VALUE              =
    *   ORDER_CFGS_BLOB               =
    *   ORDER_CFGS_VK                 =
    *   ORDER_CFGS_REFINST            =
    *   ORDER_CCARD                   =
    *   ORDER_TEXT                    =
    *   ORDER_KEYS                    =
    *   EXTENSIONIN                   =
    *   PARTNERADDRESSES              =
              IF SY-SUBRC = 0.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    *           EXPORTING
    *             WAIT          =
    *           IMPORTING
    *             RETURN        =
               ENDIF.
    WRITE : 'SALES ORDER IS :', SALESDOCUMENT.
    I have tested and go it.
    please go through it

  • BAPI to create a billing document with reference to delivery or sales order

    Hi,
    Does anyone know any BAPI or function module that allows the creation of a billing document with reference to a sales order or to a delivery.
    Maybe the BAPI_BILLINGDOC_CREATEFROMDATA may be used to create a billing document with reference to a sales document, but i'm looking for a solution where I only need to indicate the number of the reference sales order or the reference delivery and maybe some few data more without the need of transfer all the items and conditions information.
    Thanks.
    Kind regards,
    Paulo Sousa

    Hello Paulo,
    To create a billing document based on a delivery use BAPI_BILLINGDOC_CREATEMULTIPLE. In table BILLINGDATAIN insert one line with the following data:
    REF_DOC = Delivery number
    REF_DOC_CA = 'J'
    If it runs fine, table SUCCESS will bring back useful data, like BILL_DOC (Billing document number).
    Regards,
    Joã

  • Change Bill-of-lading&package no in Outbound Delivery using BAPI or any FM

    Dear ABAP Gurus,
    How to change Bill of Lading(BOLNR) and Number of Packages(ANZPK) in Outbound Delivery using BAPI or some other Function MOdule.( BDC is not required for this).
    Regards,
    Rajesh

    MOVE 'BAPE_VBAP' TO lwa_extension-structure.
          lwa_bape_vbap-vbeln = lwa_final-vbeln.
          lwa_bape_vbap-posnr = lv_posnr.
          MOVE lwa_final-yyslotid TO  lwa_bape_vbap-yy_slotid.
          MOVE lwa_bape_vbap TO lwa_extension-valuepart1.
          APPEND  lwa_extension TO  lt_extension.
          CLEAR  lwa_extension.

  • BAPI for billing plan and billing order

    Hi Sap Guru, i need your help on bellow questions :
    Are there any BAPIs or MF standard used to read billing plan from the business partner (header and lines) ? Are there any that permit to create, simulate, modifify or cancel a billing plan ?
    Are there any BAPIs or MF standard used to obtain payment from a Busines Partner or Contract Account ? Are there any that allow to obtain views on the accounting records (header, extension, set of payments, discharges...)
    Thanks in advance for all reply.

    Check the BOR object  PAYSCHEME . You would find all the methods there

  • BAPI to create Billing DOC for deliveries

    Hi All,
    I am looking for a BAPI to create a billing document based on the Shipment number.
    I found Bapi_BILLINGDOC_CREATEMULTIPLE,  but not working as expected.
    If anyone has used above or another bapi, please inform.
    Thx-Praveen

    Hi Praveen,
        i'm using same bapi and i'm able to create the invoice for the del.doc.
    for your ref. , here i'm attaching the code , please go through once.
              LS_BAPIVBRK-REF_DOC = DELIVERY_NO.
               CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                 EXPORTING
                   INPUT  = LS_BAPIVBRK-REF_DOC
                 IMPORTING
                   OUTPUT = LS_BAPIVBRK-REF_DOC.
               LS_BAPIVBRK-REF_DOC_CA = '8'.  Shipment
               APPEND LS_BAPIVBRK TO LT_BAPIVBRK.
               CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
                 TABLES
                   BILLINGDATAIN = LT_BAPIVBRK
                   ERRORS        = LT_BAPIVBRKERRORS
                   RETURN        = LT_BAPIRET1
                   SUCCESS       = LT_BAPIVBRKSUCCESS.
    after this do commit.
    you might miss the document category .
    Regards,
    Krishna

  • Require bapi for create billing document

    Hi,
    Guru.....
    Please provide the Bapi for Backgournd create Billing document with refrence to Delivery.
    Thanks
    Arun

    HI
    Try with T-Code VF06 for automatic back- ground billing document creation based on delivery with PGI
    Check the Below link
    [Re: automatic delivery and billing|automatic delivery and billing;
    Regards,
    Prasanna
    Edited by: prasanna_sap on Feb 1, 2012 12:09 PM

  • BAPI to change Billing document for output type

    Hi Gurus,
            I need to know if there is a BAPI to change a Billing document SD to add a new output type.
    Thanks in advance.
    Mariano.

    Hi all,
          To be more specific, my requirement is determinate a new output type in the billing document if other output type already was printed, so as I can't determinate automaticaly the output type by standard I need to create a program to insert an output type in the billing document if other one was printed; for that I need to know if there is a BAPI to change the billing document to insert this new output type.
    Thanks,
    Mariano.

  • BAPI FOR DELETE BILLING DOCUMENT

    Hi to all,
    do you know a BAPI to cancel a billing document?
    I have tried the BAPI_BILLINGDOC_CANCEL1 but it doesn't work.
    Thanks!!
    Silvia

    Hi,
    In test run give TESTRUN = ''.
    After Execute that BAPI run
    BAPI_TRANSACTION_COMMIT. FM
    Cheers,
    Naveen

  • FM/BAPI to get partners of billing document...

    Hello Experts,
    Are there any FMs or BAPIs that will give me the partner numbers(ship to, sold to, etc) for
    both header and line item level of a billing document?
    Thank you guys and take care!

    Hi,
    check the BAPI "BAPI_BPCONTACT_GETDETAIL".
    Regards,
    Nagaraj

  • BAPI or Function to update Billing Plan in Sales Order Items

    Hello all !
         I have to update some fields in the billing plan data in sales order's item (VA02) with a program (receiving it's data form csv files).
         I've searched a BAPI but infortunately there are no "Billing Plan" data structure to update thoses fields.
         The transaction in VA02, the billing plan data is found in FPLT table, linked to VBKD table with key field VBKD-FPLNR.
         I've tried theses Functions with no result :
    BILLING_SCHEDULE_MAINTAIN
    BAPI_SALESORDER_CHANGE
    BAPI_SALESORDER_CHANGEBOS
    BAPI_SALESDOCUMENT_CHANGE
    For now I'm searching how VA02 is saving the billing plan data, but it's very tricky and maybe not reusable.
         If someone have an idea for updating billing plan data in a abap program ( and not a batch input of VA02 because the line to update can have a variable position ).
    Thanks a lot.
    Message was edited by: Thomas B.

    Thanks Kiran I for your answer.
        This function might be helpful but there is a strange control at the begining of the code.
    (I guess VBAK must be filled somewhere..)
      IF I_VBELN NE VBAK-VBELN.
        MESSAGE A044 WITH I_VBELN VBAK-VBELN.
      ENDIF.
    But I've found another way to update the billing plan dates: using the function BILLING_SCHEDULE_SAVE (with BILLING_SCHEDULE_READ before). My point is solved.

  • Billing plan in BAPI

    Hi,
    Am creating Sales orders through my program using the Function Module "BAPI_SALESORDER_CREATEFROMDAT2".
    For every sales order i have to create an invoice of billing type F1. To create this billing type F1 invoice i must maintain billing plan in my sales order.
    I couldn't find into which structure's(parameter's) field in the above BAPI funtion module should this Billing plan to be mapped.
    When tried manually am able to fill in this billing plan but through this BAPI i couldn't.
    I am working on ECC-6.
    Thanks,
    Adithya M.

    Thanks Kiran I for your answer.
        This function might be helpful but there is a strange control at the begining of the code.
    (I guess VBAK must be filled somewhere..)
      IF I_VBELN NE VBAK-VBELN.
        MESSAGE A044 WITH I_VBELN VBAK-VBELN.
      ENDIF.
    But I've found another way to update the billing plan dates: using the function BILLING_SCHEDULE_SAVE (with BILLING_SCHEDULE_READ before). My point is solved.

Maybe you are looking for

  • Rejecting a source file based on validation

    Hi, I hav an xls file as source. I want to check, whether one of its field matches the specified validation criteria.say "p_num>6" where p_num is a column name in d xls file. If the condition is not satisfied,then i dont want to process the file inst

  • TABLE function to simulate parameterized view

    Hi all, Since view can not have parameters, I tried to used stored procedure to return ref cursor then used TABLE function in select statement to simulate a view with parameters, since it's easy to pass parameters to a stored procedure. The idea is l

  • Sherlock - shame about eBay...

    Whilst delighted I switched from a PC (after 8 years) to a Mac-Mini (OS 10.4.7) somewhat disappointed to find that searching eBAY via Sherlock, I'm restricted to the USA. [And that' s the only critcism I can think of ] Mac Mini   Mac OS X (10.4.7)  

  • Presets and Profiles

    1.  What is the specific difference between the 2?  Is a profile purely about colour? (as the sliders in the profile pane only relate to colour adjustments). 2.  A preset can be applied on import  (eg, I am now running a  'capture sharpening' preset

  • XiSecurityRuntimePermission

    Attempting to apply message level security and encryption to an XI configuration for invocation of an external web services. Configuration for certificates and encryption has been completed, but we get the following error when testing the interface: