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

DATA: s_order_header_in LIKE bapisdh1.
DATA: s_order_header_inx LIKE bapisdh1x.
DATA: BEGIN OF i_order_item_in OCCURS 0.
DATA: END OF i_order_item_in.
DATA: BEGIN OF i_order_item_inx OCCURS 0.
DATA: END OF i_order_item_inx.
DATA: BEGIN OF it_return OCCURS 0.
DATA: END OF it_return.
DATA: END OF i_sched.
DATA: BEGIN OF i_schedx OCCURS 10.
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.
salesdocument = xvbap-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
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.
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

Similar Messages

  • 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
    Is it possible to create Credit memo using BAPI?If yes then please reccomend any BAPI.

    { Changing the Object Status to Approve
            objnr          = is_vbakch-objnr
            estat_inactive = c_e0001
            estat_active   = c_e0002
            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.
    BAPI To create Billing for the Credit Memo.
          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 ..

  • Creating Vendor Credit Memo Using BAPI  BAPI_ACC_DOCUMENT_POST

    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

    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,

    Using below FM we can create SD.

  • As an update, I installed an update 5.7on my Mac laptop, now the Lightroom 5.0 has become a "Lightroom Mobile" version.  How can change it back to the laptop version?

    As an update, I installed an update 5.7on my Mac laptop, now the Lightroom 5.0 has become a "Lightroom Mobile" version.  How can change it back to the laptop version 5.7?
    Thanks for any help you can provide.

    LR on your laptop is still a desktop version.  It is just now able to upload to the cloud to replicate photos to either or an iPad that has LR Mobile installed.
    I think you probably just want to change the LR 5 identity plate back so it doesn’t mention LR Mobile all the time.  Hover over the identity-plate area, and click on the little triangle that appears, then choose Change Identity Plate.

  • How to change a setting in the Java Control Panel with command line

    I am trying to figure out how to change a setting in the Java Control Panel with command line or with a script. I want to enable "Use SSL 2.0 compatible ClientHello format"
    I can't seem to find any documentation on how to change settings in the Java Control Panel via the command line
    Edited by: 897133 on Nov 14, 2011 7:15 AM

    OK figured it out. This is for the next person seeking the same solution.
    When you click on the Java Control Panel (found in the Control panel) in any version of Windows, it first looks for a System Wide Java Configuration (found here: C:\Windows\Sun\Java\Deployment). At this point you must be wondering why you don't have this folder (C:\Windows\Sun\Java\Deployment) or why its empty. Well, for an enterprise environment, you have to create it and place something in it - it doesn't exist by default. So you'll need a script (I used Autoit) to create the directory structure and place the the two files into it. The two files are "" and "deployment.config".
    Example: When you click on the Java Control Panel it first checks to see if this directory exists (C:\Windows\Sun\Java\Deployment) and then checks if there is a "deployment.config". If there is one it opens it and reads it. If it doesn't exist, Java creates user settings found here C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment on Windows 7.
    It should look like this inside:
    *#Mon Nov 14 13:06:38 AST 2011*
    *# The First line below specifies if this config is mandatory which is simple enough*
    *# The second line just tells Java where to the properties of your Java Configuration*
    *# NOTE: These java settings will be applied to each user file and will overwrite existing ones*
    If you look in C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment on Windows 7 for example you will find "". You can use this as your default example and add your settings to it.
    Easy. If you want to add *"Use SSL 2.0 compatible ClientHello format"*
    Add this line:
    Maybe you want to disable Java update (which is a big problem for enterprises)
    Add these lines:
    Below is a basic AutoIt script you could use (It compiles the files into the executable. When you compile the script the two Java files must be in the directory you specify in the FileInstall line, which can be anything you choose. It will also create your directory structure):
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    Func _JavaConfig()
         $ConfigFile_1 = @TempDir & "\"
         $ConfigFile_2 = @TempDir & "\deployment.config"
         FileInstall ("D:\My Documents\Autoit\Java config\", $ConfigFile_1)
    FileInstall ("D:\My Documents\Autoit\Java config\deployment.config", $ConfigFile_2)
         FileCopy($ConfigFile_1, @WindowsDir & "\Sun\Java\Deployment\", 9)
         FileCopy($ConfigFile_2, @WindowsDir & "\Sun\Java\Deployment\", 9)
         FileDelete(@TempDir & "\")
         FileDelete(@TempDir & "\deployment.config")
    Now if you have SCUP and have setup Self Cert for your organization, you just need to create a SCUP update for JRE.
    Edited by: 897133 on Nov 16, 2011 4:53 AM

  • How to change a connection with the database in Runtime?

    How to change a connection with the database in Runtime?
    My connection was made using ADF Business component (ApplicationModule).
    ADF Swing.
    JDeveloper Studio

    When deploying ADF applications with database connection, you should be using JDBC data sources configured in the weblogic server.
    You could change the JDBC data sources to a different DB instance or location - by changing the JDBC data source and restarting the weblogic server.
    For more details, check

  • How to find the Transactions that has credit memos

    I have to write a query which should fetch all the invoices and the credit memos against the invoices.
    for example : invoice# 12345 amt 1000
    CM# 45678 amt -500
    I tried to the fetch the data by using the previuos_customer_trx_id in ra_customer_trx_all, but the column is null in my case.
    please provide inputs is there any other way of getting the data.

    Receivable application data would be available in AR_RECEIVABLE_APPLICATIONS_ALL. The APPLIED_CUSTOMER_TRX_ID in this table would be the CUSTOMER_TRX_ID of your Invoice from RA_CUSTOMER_TRX_ALL and the CUSTOMER_TRX_ID in AR_RECEIVABLE_APPLICATIONS_ALL would be be the CUSTOMER_TRX_ID of your Credit Memo from RA_CUSTOMER_TRX_ALL.

  • How to have confirmed quantity 0 for credit blocked sales orders

    I have the following problem. I have one sales order blocked because credit. Using material A the quantity confirmed is 0 but using other material B the quantity is confirmed. All the materials have no avaliability check group no arelevant for vailability .
    How can I customize in order to always have quantity confirmed in 0 for sales orders bloked because credit check?
    Thanks in advance for your help!

    I resolved the issue

  • Hi,sorry for my english.My question is how to change country when i have credit in my account.My account is US and i've 0.5 USD.Now,one frind from Canado bought some credit cards and i can't recharge my account.Tank you for helping me.

    Hi,sorry for my english.My question is how to change country when i have credit in my account.My account is US and i've 0.5 USD.Now,one frind from Canado bought some credit cards and i can't recharge my account.Tank you for helping me.

    BellaMichelle wrote:
    For some reason, I have had misgivings about partioning my internal HD.. not sure why.. sort of feels like I'm creating my own computer sybil ;-)  Truthfully, it seems weird to split it.. I don't think I can articulate it really.. but are there complications that can come with doing this?
    It's a common way to run multiple OSs, if there's room.  I've had two on my internal HD for a couple of years.  Plus a small partition for a copy of my Snow Leopard Install disc.  Just be sure to leave at least 10% to 15% free on each partition.
    Running Lion on a partition of the disk that also contains your backups is not a good idea; if that drive fails, you risk losing both copies of your stuff!
    OSX will also run somewhat more slowly, because access to an external is slower.  That probably won't be very significant, though.
    Also, would the decision be effected by how long I want to maintain the SL section?  I am assuming once I sort out what to replace Quicken with, I won't want to keep the SL section.  So would it be easy enough to 'clear out the SL data, and open the partition?
    Review #3 in Formatting, Partitioning, Verifying, and Repairing Disks. 
    All things considered, your best bet may be to  "clone" your SL partition to the second one, then (once you're sure everything is cool), erase the original (top) SL partition.  You can use the Restore tab of Disk Utility for that (#7 in the same link), or a "cloning" app such as CarbonCopyCloner or SuperDuper.  Then install Lion on the top partition.
    When you're done with SL, just delete it's partition and expand the Lion partition down into the vacated space.

  • Implement the following scenario for credit memo

    Dear experts!
    Thank you for your attention!
    how to implement the following scenario for credit memo??????
    1.Credit memo requests are usually blocked for billing (that is, credit) upon creation until the
    employee responsible releases this block.
    2.Within our company, we want make the definition of the point at which the check is carried out and
    the employee responsible dependent upon the value of the credit memo request.
    3.If the value of the credit memo request is below a certain minimum limit, then it can be released
    automatically by the system.
    4.The workflow within the framework of credit memo processing now guarantees that the employee
    responsible is automatically determined and informed when a credit memo request is created,
    depending on the value involved.
    waiting for your help!!!!!
    Best regard!

    Hope so you know all the setting regarding credit memo customizing.
    Otherwise use the standard one.
    Regarding authorization go to PFCG and create a new role.
    In that you can maintain the authorization regarding the minimum credit limit.
    Please check out this setting.
    And update me also if I was wrong.

  • Amount of the paid invoice after credit memo not correct

    Hi all
    I am using AP, CM and GL.
    I register an invoice in Payables with amount 10000.
    After two days the supplier send me a document with when he is telling that i have to pay only 8000.
    I register this document as credit memo with amount 2000 and apply on the invoice.
    But i pay in the bank only 8000 and i can not pay both documents because, it will not reflect correct actions in bank statements.
    Can you please tell me how to solve this situation?
    Thank you and best regards
    Edited by: user567002 on Nov 23, 2010 4:28 AM

    That depends on how you created the credit memo. Did you use the credit balance/line feature to create the credit memo or was that a standalone CM that you keyed in ? If it was the former, the previous_customer_trx_id field on the CM record will contain the customer_trx_id of the invoice. But if the CM was manually keyed in, that field would be blank.
    Either which way, you should be able to identify the link between the invoice and credit memo using the ar_receivable_applications_all table.

  • Put the balance back in credit memo if I cancel the refund invoice in AP

    Hi Friends,
    .When I Crete a the refund in AR for the credit memo , an invoice will be created for the party in AP. But if I cancel the AP invoice. This is not putting back the balance in my AR credit memo. We are on 12.1 , Please suggest if there are any patches or any addition setup to be done to put the balance back in credit memo if I cancel the refund invoice in AP.
    . Is there any program create refunds invoice in AP for all the credit memos available in AR?
    Please give some suggestions,

    When I Crete a the refund in AR. it creates a Payment request invoice in AP for that party. But if i cancel the invoice create in AP for the refund, that is not effecting the customer balance in AR. Please suggest.

  • Order more that the quantity in the schedule agreement

        Is it possible to order more that the quantity in the schedule agreement ?
       If yes the please explain in detail.

    I hope its not possible to create schedule lines more than the quantity mentioned in scheduling agreement.

  • Quantity zero in credit memo

    Dears Experts,
    I have the following question / problem.
    I am creating a credit memo request with reference to a invoice, but in the credit memo request I need to have the quantity in zero because the credit memo is created for incorrect pricing (it is no a return) but the system brings the quantity from the invoice.
    This is incorrect. I need to have zero quantity in the credit memo request independently that the invoice that I am using as reference has quantity.
    I suspects that there is something in the copy control to controls this but I don’t find it.
    I Hill reward if it is helpful.
    Thanks in advance!

    You can correct the price using Invoice Correction Request(RK)
    RK sales document used in complaints processing to correct the quantity or price of one or more items in an invoice.
    The invoice correction request is the same as the differential credit memo in the SAP R/2 System.
    You can create an invoice correction request if the wrong prices have been calculated for the customer. The invoice correction request can be automatically blocked by the system so that it can be checked.
    The system calculates the difference between the amount that was originally calculated and the corrected amount for each item.
    Once it has been approved, you can remove the block. If the difference in amounts is positive, the system creates a credit memo with reference to the credit memo request. If it is negative, the system creates a debit memo.
    An invoice correction request is a type of sales order, like the standard order. For more information on sales documents, see Working With Sales Documents
    An invoice correction request has the following structure:
    This contains the data that is relevant for the whole invoice correction request, e.g. sold-to party and payer.
    Item pairs
    Two items are automatically created for each item from the invoice to be copied for the invoice correction request:
    first item: credit item
    second item: debit item
    These contain the same value and quantity.
    In the credit item, the system credits the customer with the full value. If you change the debit item (for example, due to new pricing or a change in quantities), this results in a difference amount.
    In the standard system, the invoice correction request is characterized as a credit memo request, which means that the system creates a credit memo based on the invoice correction request.
    In Customizing you can change this so that the invoice correction request is characterized as a debit memo request. In this case, the system creates a debit memo, based on the invoice correction request.
    Regardless of whether the invoice correction request is a credit or debit memo, the first item is always a credit item and the second is a debit item.
    You can change these settings in Customizing under Sales ® S ales Documents ® Sales document header ® Define sales document types in the Sales document categ. field.
    You create invoice correction requests with reference to an invoice.
    The system creates either a credit or a debit memo according to the total value of the invoice correction request.

Maybe you are looking for