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.

Similar Messages

  • How to change the Quantity in the Credit Memo using BAPI

    Hi All,
    I have a requirement in which i need to change the Quantity Value field available in the Credit Memo using BAPI.
    Can anyone help me out to get any available BAPI to perform this action or any Solution to change the Quantity in the Credit Memo ?.
    Regards,
    Muruganand.K

    Hi,
    Try using BAPI_SALESORDER_CHANGE.
    DATA: s_order_header_in LIKE bapisdh1.
    DATA: s_order_header_inx LIKE bapisdh1x.
    DATA: BEGIN OF i_order_item_in OCCURS 0.
    INCLUDE STRUCTURE bapisditm.
    DATA: END OF i_order_item_in.
    DATA: BEGIN OF i_order_item_inx OCCURS 0.
    INCLUDE STRUCTURE bapisditmx.
    DATA: END OF i_order_item_inx.
    DATA: BEGIN OF it_return OCCURS 0.
    INCLUDE STRUCTURE bapiret2.
    DATA: END OF it_return.
    DATA: BEGIN OF i_sched OCCURS 10.
    INCLUDE STRUCTURE bapischdl.
    DATA: END OF i_sched.
    DATA: BEGIN OF i_schedx OCCURS 10.
    INCLUDE STRUCTURE bapischdlx.
    DATA: END OF i_schedx.
    s_order_header_inx-updateflag = 'U'.
    i_order_item_in-itm_number = vbap-posnr.
    i_order_item_in-TARGET_QTY = rv45a-zzqty.
    i_order_item_inx-updateflag = 'U'.
    i_order_item_inx-itm_number = vbap-posnr.
    i_order_item_inx-TARGET_QTY = 'X'.
    APPEND: i_order_item_in, i_order_item_inx.
    i_sched-itm_number = vbap-posnr.
    i_sched-sched_line = '0002'.
    i_sched-req_qty = rv45a-zzqty.
    APPEND i_sched.
    i_schedx-itm_number = vbap-posnr.
    i_schedx-sched_line = '0002'.
    i_schedx-updateflag = 'U'.
    i_schedx-req_qty = 'X'.
    APPEND i_schedx.
    IF sy-subrc = 0.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = xvbap-vbeln
    order_header_in = s_order_header_in
    order_header_inx = s_order_header_inx
    behave_when_error = 'P'
    TABLES
    return = it_return
    order_item_in = i_order_item_in
    order_item_inx = i_order_item_inx
    schedule_lines = i_sched
    schedule_linesx = i_schedx.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ENDIF.
    Change the fields as per your logic before populating orders item and schedule line data.
    You have to pass the quantity in schedule line items as well in case you want to change quanity in order.
    KR Jaideep,
    Edited by: Jaideep Sharma on Jun 22, 2009 7:35 PM

  • Creating Vendor Credit Memo Using BAPI  BAPI_ACC_DOCUMENT_POST

    Hi,
    I want to create a vendor credit memo using the bapi BAPI_ACC_DOCUMENT_POST but with posting keys as 21 and 50.Is it possible to do so.I tested the bapi passing the data to the accountgl table.Do i have to pass data to another table ?

    hi Eric,
    I even tried passing the data to the accounts receivable and accounts payable tables passing the GL account no in these tables.Still teh document get posted with keys 40 and 50.Also the credit entries should be assigned to COPA segment of sales order/item.
    The vendor credit memo should look as follows look as follows:
    Dr Vendor (PK = 21) $ 35,000
    Cr Freight expense account (PK = 50) $ 10,000……….assigned to COPA segment of sales order/ item 20000397/10
    Cr Freight expense account (PK = 50) $ 5,000……….assigned to COPA segment of sales order/ item 20000397/20
    Cr Freight expense account (PK = 50) $ 20,000……….assigned to COPA segment of sales order/ item 20000398/10

  • Credit memo using BAPI

    Hi,
    In transaction VA01 we are able to create credit memo request (ZRCR order type) with order category K (credit memo). Is this possible to create this order using "BAPI_SALESORDER_CREATEFROMDAT2" and BAPI_SALESORDER_CREATEFROMDAT1 function module.?
    If we try to excute using this function module, following return message is appearing. "Unpermitted combination of business object BUS2032 and sales doc. category K". Any one please give me solution.
    Thanks in advance,
    Murali

    Hi,
    Using below FM we can create SD.
    BAPI_SALESDOCU_CREATEFROMDATA
    BAPI_SALESORDER_CREATEFROMDAT1
    BAPI_SALESORDER_CREATEFROMDAT2
    BAPI_SALESORDER_CREATEFROMDATA
    Regards
    Md.MahaboobKhan

  • Create Credit Memo using B1if

    Hello Experts,
    Have anyone tried to create service Credit Memo using B1if when an AP Invoice is posted by a user for a specific vendor? or Any similar scenario?
    I am new to B1if , looking into the recordings now. Can anyone advise steps or process to acheive this ?

    Hi,
    Please refer below link where PO2SO is generate, same manner you can use CM2AP.
    [https://sap.emea.pgiconnect.com/p26689556/]
    Thanks
    Kevin

  • Not able to Create Credit Memo During Return Sales Order

    Hi Guru's,
    Need your help in the below problem:-
    While Creating Return Sales Order it give us Order No with delivery no. and then finally I am able to do VL02N where I did Post Good Return sucessfully and also check using MB51 that goods got return.
    But when we try to create Credit Memo using VF01 I got the below message in log.
    Error Log
                 0060000799 000000 "Create billing document" not allowed (User Status LKD, object VB0060000799000000)
                LongText
                Technical data   ))))))))
    I have checked all copy control including Iteam Category etc etc all are in place.
    Looking for your help.
    Thanks
    Best Regards
    Bidhan Konar

    Thanks Krishna,
    Thanks for the solution. Find below the steps which i follow:-
    Go to Tcode VA02, Use the sale order reference and execute. From top menu bar, click on "Goto -- Header -- Status. Then again click on "Object Status" and when check I find that lock is there:- A radio button checked at -- 10 LKD Locked and change it to
    --20 REL Released and SAVE. Finally working.
    Thanks
    BR
    Bidhan
    Edited by: Bidhan Konar on Jun 3, 2010 8:35 PM

  • 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

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

  • BAPI to create credit memo requests in SAP

    Hi All,
    I have a requirement to create Credit memo request in SAP SD. I'm trying to use the BAPI which is used for Sales order creation - BAPI_SALESORDER_CREATEFROMDAT2 since credit memos are also sales orders of diff. sales document type. However, the BAPI throws an error as follows
    "Unpermitted combination of business object BUS2032 and sales doc. category K". 
    Does this mean that the business object BUS2032 does not support creation of cerdit memo request ? If yes, can anyone suggest an alternate BAPI  to be used to address this requirement ?
    Thanks,
    Venkat.

    Hi Venkatesh,
    Thanks you for your post, your post has helped me a ton in my work, Infact I was working on BAPI to
    Create Credit Memo request i.e BAPI_SALESORDER_CREATEFROMDAT2 as expected i got the same error as "Unpermitted combination of business object BUS2032 and sales doc. category K" and i tried on  other BAPI it worked, Just i need to know BUS2032 doesn't support Credit Memo Request, How we can find it
    to what Sales document it support?

  • TO CREATE A CREDIT MEMO USING CREDIT MEMO REQUEST

    Hi,
          I have a credit memo request 60000150 and I need to create a credit memo using the above credit memo request.Can anyone suggest a BAPI or some other method to do this and also the parameters to be passed

    Hi,
          I have a credit memo request 60000150 and I need to create a credit memo using the above credit memo request.Can anyone suggest a BAPI or some other method to do this and also the parameters to be passed

  • 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

  • BAPI/Function Module in CRM to create Credit Memo

    Hi,
    It will be great if some one can help me in finding out whether there is any <b>BAPI/Function Module</b> in <b>CRM</b> to create <b>Credit Memo</b>?
    Rgds,
    Sam.

    Hi Venkatesh,
    Thanks you for your post, your post has helped me a ton in my work, Infact I was working on BAPI to
    Create Credit Memo request i.e BAPI_SALESORDER_CREATEFROMDAT2 as expected i got the same error as "Unpermitted combination of business object BUS2032 and sales doc. category K" and i tried on  other BAPI it worked, Just i need to know BUS2032 doesn't support Credit Memo Request, How we can find it
    to what Sales document it support?

  • Create credit memo request using inbound IDOC

    Hi Experts,
    I want to create credit memo request using inbound IDOC, currently I am using GSVERF03 basic type and process code GSVE, I am getting below error:
    No records exist in T661W for vendor XXXXX, plant, unloading point
    Anyone suggest me is this correct message type to create credit memo request or suggest me the correct one. because we are working with customer sales order and invoice not with vendor purchase order.
    Thanks for your help.

    ah, apologies i read outbound! I think you are using the correct message type i.e. GSVERF.
    Can you not simply create the missing entry in T661W? i.e. for the missing records?

  • Create Credit Memo Request

    Hi,
    Is there a bapi which i can use to create credit memo request with reference from a billing document?
    dyl

    Hi Rakesh,
    thank you for your reply. I am using 4.6B. i do not see that function

  • Create Credit Memo Request through txn. FB65

    Hi Experts,
    I want to create Credit Memo Request through txn. FB65.I am using Bapi 'BAPI_ACC_DOCUMENT_POST' to create it.
    Can anyone please tell the the minimum parameters which I will pass in this BAPI to create CreditMemo Request?
    Helpul answers will be rewarded by points.
    Thanks
    Naveen Rana

    Hi Naveen,
    You run this BAPI by giving input till you get the result and then use it in your code.
    Some of the structure to post credit memos are
    *--Populating Header strucuture
    *--To upload the Header Structure required By BAPI
      wa_docheader-bus_act     = c_bus_act.
      wa_docheader-username    = sy-uname.
      wa_docheader-header_txt  = wa_lineitem-header_text.
      wa_docheader-comp_code   = wa_lineitem-header_company.
      wa_docheader-doc_date    = wa_lineitem-invoice_date.
      wa_docheader-pstng_date  = sy-datum.
      wa_docheader-fis_period  = '00'.
      wa_docheader-ref_doc_no  = wa_lineitem-invoice_number.
      wa_docheader-doc_type = wa_lineitem-document_type.
    Document type is KR for Invoice and KG for Credit Memos.
    *--Populating Accounts Payable table
    *--Populating Currency Item Structure
    Thanks
    Sudharshan

Maybe you are looking for