Creating credit memo with two positions using Bapi

Hi all, i are creating a credit memo using BAPI_BILLINGDOC_CREATEMULTIPLE with manual price condition for each position and have a problem.
All the positions use the last condition value of the CONDITIONDATAIN table.
Thes is an example code used.
t_billing-salesorg    = 'SI01'.
t_billing-DISTR_CHAN  = '05'.       
t_billing-DIVISION    = '01'.
t_billing-DOC_TYPE    = p_dtype.             " ZC07 o TA
t_billing-ORDBILLTYP  = 'ZC06'.              " ZC06 o FX
t_billing-SOLD_TO     = p_clie.              "'0000200002'.
t_billing-ITEM_CATEG  = 'ZG2N'.              " ZG2N o TAN
t_billing-PLANT       = '1100'.
t_billing-BILL_TO     = p_clie.              "'0000200002'.
t_billing-PAYER       = p_clie.              "'0000200002'.
t_billing-SHIP_TO     = p_clie.              "'0000200002'.
t_billing-MATERIAL    = '0000000000300003'.
t_billing-REQ_QTY     = p_cant.              "'1.000'.
t_billing-item        = '1'.
APPEND t_billing.
t_conditions-DATA_INDEX = '1'.
t_conditions-COND_TYPE  = 'ZCON'.
t_conditions-COND_VALUE =  '12.0000'.
append t_conditions.
t_billing-salesorg    = 'SI01'.
t_billing-DISTR_CHAN  = '05'.               
t_billing-DIVISION    = '01'.
t_billing-DOC_TYPE    = p_dtype.             " ZC07 o TA
t_billing-ORDBILLTYP  = 'ZC06'.              " ZC06 o FX
t_billing-SOLD_TO     = p_clie.              "'0000200002'.
t_billing-ITEM_CATEG  = 'ZG2N'.              " ZG2N o TAN
t_billing-PLANT       = '1100'.
t_billing-BILL_TO     = p_clie.              "'0000200002'.
t_billing-PAYER       = p_clie.              "'0000200002'.
t_billing-SHIP_TO     = p_clie.              "'0000200002'.
t_billing-MATERIAL    = '0000000000300004'.
t_billing-REQ_QTY     = p_cant.              "'1.000'.
t_billing-item        = '2'.
APPEND t_billing.
t_conditions-DATA_INDEX = '2'.
t_conditions-COND_TYPE  = 'ZCON'.
t_conditions-COND_VALUE =  '24.0000'.
append t_conditions.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
  EXPORTING
    CREATORDATAIN         = t_creator
  TABLES
    billingdatain   = t_billing
    CONDITIONDATAIN = t_conditions
    return          = t_return
    success         = t_success.
In these example, the first position have a value of 12 and the seccond a value of 24.
The generated document have a value of 24 for the two positions.
Do you helpme??
Regards
Adrián Callejón
Message was edited by:
        Adrian Callejon

Thank you Jack. That's exactly what I needed to know.
Now it works. As an example I attach some code that also uses the credit card functionality
pos-salesorg  = 'EESP'.
pos-distr_chan = 'ES'.
pos-division  = 'TI'.
pos-ref_doc    = '1'.
pos-material  = mat10.
pos-req_qty    = 1.
pos-itm_number = 1.
pos-ref_item  = 1.
APPEND pos TO billdata.
pos-material  = mat11.
pos-req_qty    = 1.
pos-itm_number = 2.
pos-ref_item  = 2.
APPEND pos TO billdata.
lincond-data_index = '1'.
lincond-cond_type  = 'PR01'.
lincond-cond_value = '1.85'.
lincond-cond_curr  = 'EUR'.
APPEND lincond TO conddata.
lincond-data_index = '2'.
lincond-cond_type  = 'PR01'.
lincond-cond_value = '1.70'.
lincond-cond_curr  = 'EUR'.
APPEND lincond TO conddata.
lincard-cc_type    = 'VISA'.
lincard-cc_number  = '4560000000000038'.
lincard-cc_valid_t = sy-datum + 90.
lincard-cc_name    = 'Pedro Pérez'.
lincard-authamount = '1.85'.
lincard-currency  = 'EUR'.
lincard-auth_flag  = 'X'.
lincard-auth_date  = sy-datum.
lincard-cc_auth_no = 'autno10'.
lincard-bill_value = '1.85'.
APPEND lincard TO carddata.
CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
* EXPORTING
*    CREATORDATAIN        =
*    TESTRUN              =
*    POSTING              =
  TABLES
    BILLINGDATAIN    = billdata
    CONDITIONDATAIN  = conddata
    CCARDDATAIN      = carddata
*    TEXTDATAIN        =
    ERRORS            = t_errores
    RETURN            = t_bapiret
    SUCCESS          = t_success.

Similar Messages

  • BAPI to create credit memo with the item configuration

    Hi Experts,
    I have used BAPI SD_SALESDOCUMENT_CREATE to create a credit memo.
    But in the memo created,while trying to process output types,I get an error message saying that the document is incomplete and in the log I can see item configuration details missing.
    Kindly let me know if the item configuration details can be filled using any other BAPI or is there any other work around.
    Regards,
    Sridevi

    BAPI_SALESDOCU_CREATEFROMDATA, create credit memo request
    SD_SALESDOCUMENT_CREATE error
    Edited by: VENKATESWARAREDDY D on Oct 7, 2009 1:57 PM

  • How can we create credit memo with reference to INV

    Hi,
    Pls tell how can we post credit memo with reference to Invoice which is posted through SD.
    Is there any use with reference to field in T.Code FB75.
    Thanks in advance,
    Padmaja

    Hi Vijay,
    I could not found any field for Inv. reference in the Payment Tab of T.Code FB75.
    Is there any facility in SAP to create Credit Memo for a particular customer with reference to Invoice. All the details of that Invoice should get updated in the credit memo automatically.
    Thanks in advance,
    Padmaja

  • Create Credit memo with reference to billing in VF01

    Hi all:
    I want to create a credit memo with direct reference to the original billing. Thus the creation of CMR is not required. This is the new feature as of release 4.5a. In SAP system, I've done the configuration for copying control from billing document to billing document, source (F2) target (G2). Copying requirement 027. Pos/neg qty = + and Pricing type = D. I can create a credit memo with reference to a billing now. However, the system allow multiple credit memos. Duplicate credit memo are unwanted in the system.
    How to control the system to avoid duplicate credit memo?
    Thanks and regards,
    Sim

    Hi Mei,
       In t-code "VTFF" under your item category,the field VBRK/VBRP skuldn't be 001.
       Keep them as zero.
       Reward points if it helps.
    Regards
    Karan

  • Re: Creating credit memo with reference to Sales Order in ICWC

    Hello gurus
    I am new to CRM and we hv ECC 6.0 & CRM 6.0 in our environment.
    We have a process where a Credit Memo Request is created with reference to a Sales Order.
    Now till this point we had launched VA01 in the ICWC and were creating the CMR with reference to the Standard Order.
    Henceforth we want to move this to the CRM ICWC.
    In ICWC we create Standard Sales order using Work Center IC_BT_SLO tied to the Navigation profile.
    I am looking for some way of copying this order to a Credit Memo Request in the ICWC.
    I tried adding the Complaints button on the navigation profile ... however it creates a new CMR ... not sure how to enable copying it from the Original Sales order in ICWC
    Any thoughts ?
    Thanks
    Vinit

    closed
    Edited by: vinit parkar on Sep 1, 2011 4:25 PM

  • Creating a material with its classification using BAPI's

    Hi there,
               I am creating a function module to create a material master using BAPI's. I am using the BAPI 'BAPI_MATERIAL_SAVEDATA'. However I did not find a way to pass the classification details to this BAPI. As I need to create a classification data along with material basic data, can you please tell me how I can do it. Are there any BAPI's which I can use to create classification data?
             Please help, I have stuck here from a longer time.
    Thanks,
    Ganesh.

    hi
    good
    Use FM 'BAPI_OBJCL_GETDETAIL' to retrieve the classification data.
    Import params:
    1. Object key : give the material number
    2. Object table : give material master table i.e. MARA
    3. Class Num: Give the class name from which u have to fetch the characteristic data
    4. Class type: give '001' for material
    You will get the classification data in the following tables:
    ALLOCVALUESNUM
    ALLOCVALUESCHAR
    ALLOCVALUESCURR
    This should be helpful, do get back in case of any queries.
    thanks
    mrutyun^

  • Create Credit Memo with Reference to Multiple Documents

    Hi.  I have the challenge of Creating a Credit Memo via VA01 referencing Multiple Billing Documents.  Anyone know any tricks to be able to reference Multiple Billing Documents in batch? 
    Cheers,
    Jerry Tischer
    Message was edited by:
            Jerry Tischer

    Hi Kamlesh,
    I think except for the Sold-to-party (which ensures same account assignment group, ur 5th point) all other can be modified in VA01. From the Billing Date of Ref Inv it takes the "pricing date" if they are different then "invoice splitting" happens for the credit / Debit memo request. Similar thing happen in case of different "terms of payment", "Inco Term" etc.
    Thanks,
    Ashish

  • Creating credit memo request - V1 498 / missing order quantity

    Hi Experts,
    could any of You pls help me with a credit memo creation issue?
    I credit memo needed to be created based on invoice, so configuration  and copy control is done as usual, but I have a failure during CR order creation referring to an invoice F2.
    I got an error message: V1 498 - Credit  already exist for item... - and no qty is transferred to new document
    I have gone thought the threads on Forum, but none of the suggested solution was appropriate to solve the issue:
    - the document flow is updated in copy control ,
    - I can no remove the schedule line flag at VOV7 - the order qty will be missed but target qty is used, and end up incompletition (VU 019 error messge), so billing is faile
    - completition control set as B at VOV7,
    Still have the problem
    Could any of You pls help me - answers will be appreciated.

    V1 498 - Credit already exist for item...
    What the above message means is that lines items have already been used as reference for the creation of credit memo request(s).
    Create a new sales order, delivery and billing document. Then create credit memo request with reference to this new billing document and test.
    In VTAF copy control, at item level, field "Pos./neg. quantity" dictates how the quantity in the source document is affected by copy control.
    PS - I tried to create credit memo with reference to billing document (F2), there were no issues there. Therefore I am taking that the issue is with credit memo request (copied with ref to billing document F2)

  • Credit Memo with the reference of multiple Billing document

    Hi SD Gurus,
    I wanted to create credit memo with the reference of multiple billing document for a single customer.
    Is it possible in standard SAP? If YES please tell me HOW…
    Thanks in advance...
    Ratish Patil

    hello, friend.
    yes, you actually can.  first you enter VA01 and choose the document type.  press ENTER.
    then in the order Overview screen, go to SALES DOCUMENT > CREATE WITH REFERENCE.  a dialog box will ask you which billing document you want as reference.  enter the document number and press COPY.
    you can repeat this process as many time as you wish.  the items of the referenced documents will be copied into your Sales Document.
    hope this helped.  reward if useful.
    jty

  • Procedure for creating credit memo for sales return

    Dear Gurus,
    Please let me know the procedure creating a credit memo for sales returns.
    I am able to cancel the invoice using vf11. create a return sales order using vao1. create a retrun delivery using vl01n, transfer the stock from returns to blocked to unrestricted use using mb1b and movement types 459 and 343.
    Pls let me know the procedure for creating the credit memo for the goods receipt of sales return.

    Dear,
             I am not geeting your question but well i explain in my company scenarion,
        1)    We create the Sales Order : VA01 ( Order type : ZREW : Return without invoice, ZRES : Return with Invoice)
                Here, ZREW is our own created order type and it is maintain in config.
                         ZRES is use for Return with invoice. In that we enter the bill number in return sales order which sales.
        2)    In Delivery : VL01N : That is base on Return Sales order.
        3)    In Billing   : VF01 : Create credit memo with resp. to delivery number.
                      Credit memo type : Same as sales order,
                                                    ZREW : Crd Return (W/O Inv)
                                                    ZRES  : Credit For Returns.
    Hope it will help you.
    Regards,
    Sandip

  • Credit memo with different Pricing procedure

    Hi all,
    I am Creating Credit memo with reference to contract, my requirement is system should not copy Contract pricing procedure for Credit Memo we have different Pricing procedure for credit memo
    But the Problem is while i am creating a credit Memo with reference to Contract system will coping contract pricing procedure i need Credit Memo pricing Procedure in credit memo and system should populate all credit memo condition types default y  in credit memo
    i am using credit memo condition types condition class A - Discount or surcharge and Calculat.type - B - Fixed amount
    can any one guide me how config in sap while creating credit memo with reference to sales contract system should copy different Pricing procedure its having own condition types
    Thanks
    Rajesh

    Hi
    Check it out your Pricing type in Copy Controls(SPRO-Sales & Distribution-Sales-Maintain copy control for Sales Documents-Copy control Sales document to Sales document- Select your Source & Target document types- Select your Item categorty- details)
    Regards

  • Credit memo with reference to a sales order with reference to a contract?

    Hello All
    Now I created a quantity contract and the customer paid the Amount that means the billing is done then I started creating sales orders with reference to the contract, can I create credit memos with reference to these sales orders?
    Regards
    Jacopo Francois

    Hi,
    You can create a contract for a longer duartion say 1 year, andyou can create sales order in reference to your contract. This would be an ideal scenario in case of service materials.
    You can now surely create credit memo's in reference to this sales order.
    You will invoice the sales order first and create a credit memo request in reference to your sales invoice and then invoice the credit memo request to raise your credit memo for the customer.
    Reward if helpful.
    Regards
    Ravi

  • Problem while creating credit memo request using BAPI

    HI,
    I am trying to create credit memo request using the BAPI_SALESDOCU_CREATEFROMDATA1..
    I am getting the error as " No customer master data is available for the customer". But the customer exists in the KNA1 table. What is the mistake i hv done.. this s my code..
    REPORT  ZSV_CREDITMEMO_TEST1.
    Data declarations.
    DATA: v_vbeln            LIKE vbak-vbeln.
    DATA: header             LIKE bapisdhead1.
    DATA: headerx            LIKE bapisdhead1x.
    DATA: item               LIKE bapisditem  OCCURS 0 WITH HEADER LINE.
    DATA: itemx              LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner            LIKE bapipartnr  OCCURS 0 WITH HEADER LINE.
    DATA: return             LIKE bapiret2    OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx   TYPE STANDARD TABLE OF bapischdlx
                             WITH HEADER LINE.
    DATA: lt_schedules_in    TYPE STANDARD TABLE OF bapischdl
                             WITH HEADER LINE.
    DATA: lt_schedules_ink    TYPE STANDARD TABLE OF bapisdhead1
                             WITH HEADER LINE.
    START-OF-SELECTION.
    Header data
    Sales document type
      header-doc_type = 'G2'. 
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = '0001'.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = ''.
      headerx-distr_chan = 'X'.
    Division
      header-division = ''.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    *Complete delivery
        header-COMPL_DLV = ''.
        header-COMPL_DLV = 'X'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = '0000C10130'.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = ''.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = 'C20011'.
      itemx-material = 'X'.
    Plant
      item-plant    = ''.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = '10000'. 
      itemx-target_qty = 'X'.
    item category
      itemx-ITEM_CATEG = 'X'.
      APPEND item.
      APPEND itemx.
      Fill schedule lines
      lt_schedules_in-itm_number = '000010'.
      lt_schedules_in-sched_line = '0001'.
      lt_schedules_in-req_qty    = '10000'.
      APPEND lt_schedules_in.
      Fill schedule line flags
      lt_schedules_inx-itm_number  = '000010'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
      CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
           EXPORTING
                sales_header_in     = header
                sales_header_inx    = headerx
           IMPORTING
                salesdocument_ex    = v_vbeln
           TABLES
                return              = return
                sales_items_in      = item
                sales_items_inx     = itemx
                sales_schedules_in  = lt_schedules_in
                sales_schedules_inx = lt_schedules_inx
                sales_partners      = partner.
    Check the return table.
      LOOP AT return WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error in creating document'.
      ELSE.
    Commit the work.
        COMMIT WORK AND WAIT.
        WRITE: / 'Document ', v_vbeln, ' created'.
      ENDIF.
    can anyone tell what the error is.?

    Hi
    please look at code below code this succefully creating credit memo may some help to you
    header-doc_type = 'ZS4'.
        PERFORM get_plant.
        headerx-doc_type    = 'X'.
        header-sales_org    = wa_temp1-vkorg.
        headerx-sales_org   = 'X'.
        header-purch_no     = wa_temp1-bstnk.
        header-distr_chan   = wa_temp1-vtweg.
        headerx-distr_chan  = 'X'.
        header-division     = wa_temp1-spart.
        header-purch_no_s   = wa_temp1-bstnk.
        headerx-division    = 'X'.
        wa_partner-partn_role = 'AG'.
        wa_partner-partn_numb = wa_temp1-kunnr.
        APPEND wa_partner TO it_partner.
        wa_partner-partn_role = 'WE'.
        wa_partner-partn_numb = wa_temp1-kunnr.
        APPEND wa_partner TO it_partner.
        CLEAR: wa_partner.
        LOOP AT lt_temp2 INTO wa_temp2 WHERE kunnr = wa_temp1-kunnr.
          "AND matnr = wa_temp1-matnr.
    *wa_item-itm_number = wa_temp2-posnr .
          wa_item-material   = wa_temp2-matnr.
          wa_item-plant      = wa_temp2-werks.
          wa_item-req_qty    = wa_temp2-fkimg * 1000.
          wa_item-target_qty = wa_temp2-fkimg * 1000.
          APPEND wa_item TO it_item.
        ENDLOOP.
        CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
          EXPORTING
            order_header_in       = header
    *   WITHOUT_COMMIT            = ' '
    *   CONVERT_PARVW_AUART       = ' '
         IMPORTING
           salesdocument          = v_vbeln
    *   SOLD_TO_PARTY             =
    *   SHIP_TO_PARTY             =
    *   BILLING_PARTY             =
           return                 = return
          TABLES
           order_items_in         = it_item
           order_partners         = it_partner.
        IF v_vbeln <> space.
          wa_vbeln-vbeln = v_vbeln.
          APPEND wa_vbeln TO lt_vbeln.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
          HIDE wa_vbeln-vbeln.
          CLEAR: wa_partner,header,v_vbeln, wa_temp2.
          REFRESH: it_partner,it_item.
        ELSE.
    *    LOOP AT return .
          it_error-srno = idx.
          it_error-err_msg = return-message.
          APPEND it_error.
    *    ENDLOOP.
        ENDIF.
        idx = idx + 1.
      ENDLOOP.
    Regards

  • Create Credit Memo using BAPI

    Dear All,
    I have to create credit memo using XL file.In XL file there are following fields:
    1.order type
    2.sales organization/division/distribution
    3.sold to party
    4.order refrence
    5.Material code
    6.Quantity
    7.Price.
    Is it possible to create Credit memo using BAPI?If yes then please reccomend any BAPI.
    Regards,
    AMAR

    Hi,
    { Changing the Object Status to Approve
        CALL FUNCTION 'I_CHANGE_STATUS'
          EXPORTING
            objnr          = is_vbakch-objnr
            estat_inactive = c_e0001
            estat_active   = c_e0002
          EXCEPTIONS
            cannot_update  = 1
            OTHERS         = 2.
        IF sy-subrc EQ 0.
          is_billing-salesorg = is_vbakch-vkorg.
          is_billing-distr_chan = is_vbakch-vtweg.
          is_billing-division = is_vbakch-spart.
          is_billing-doc_type = is_vbakch-auart.
          is_billing-ref_doc = is_vbakch-vbeln.
          is_billing-bill_date = sy-datum.
          is_billing-sold_to = is_vbakch-kunnr.
          is_billing-ref_doc_ca = c_x.
          APPEND is_billing TO it_billing.
        ENDIF.
      ENDLOOP.
    BAPI To create Billing for the Credit Memo.
      CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
        TABLES
          billingdatain = it_billing
          return        = it_returncg
          success       = it_bilsuccess.
    Please use these for Credit memo creation using upload .. If u want i can send the coding also ..
    Regards,
    Srinivas.

  • Creating a Credit memo with reference to Billing document

    Hi All,
    I am creating a Credit memo say CM by with reference to a Billing document say B.The Billing document has been created from a Contract say C.
    Now while creating the CM the contract dates need to be copied from C to the contract data screen of CM.
    I have used Copying control Billing Document to Sales Document for achieving this.
    I have edited the VEDA(Contract data) in the routines 302,303,402 etc. but its not reflecting in Contract data of CM screen neither at header level nor item level.
    Please help me in resolving this.
    Replies appreciated.
    Thanks and Regards,
    Blessy

    Dear Rupak,
    Your price / Quantity is copying correctly from Billing means your Copy Control settings are proper.
    Now while creating Credit Memo Request, after you change Quantity you are currently selecting Update & "B" - i.e. Carry out new pricing.
    Here instead of "B" select "A".
    A means - Copy price components and redetermine scales.
    Here the system:
    1. does not determine any new condition types
    2. and only redetermines the scale prices for changed quantities
    I guess this will definitely solve your problem.
    Hope this helps...
    Thanks,
    Jignesh Mehta

Maybe you are looking for

  • STO to be created in intra/inter company within same warehouse

    Hello, We want the following scenario to be replicated. STO to be created for Inter/Intra company stock transfer within the same warehouse. Source plant - X Destination plant - Y Both sharing the same warehouse basically  there is no physical goods m

  • Nakisa image export doesn't work.

    Hi Luke, I installed the Export Pack 3.0 and the pdf export works fine, but the image doesn't: Nakisa SVTN 2.0 SP3 with Export Pack 3.0  (IIS restart.after installation ) Server Error in '/OrgChart' Application. The system cannot find the file specif

  • More Porting/Carrier Switching Advice Needed

    Seasons greetings, all! I've been researching and toying with the iPhone for the last several months. My wife and I have been with Verizon since they were Airtouch. My wife got me an Apple gift certificate so I could get an iPhone which I'm ecstatic

  • Help - Mail not playing voicemail sound attachments

    Help needed please - I have got used to the amazing feature where Mail will directly play my vonage forwarded voicemails ( forwarded from my voip voicemail as wavs) . This has been an absolute life-saver and a killer feature as it means I can quickly

  • Printing failed - Unable to connect to CIFS host

    I cannot verify the connection from my linux client to a Windows network printer using Samba (and I can therefore not print, with the error displayed being the one above in the subject). I've checked the following: - part of groups lp and sys - servi