cancel
Showing results for 
Search instead for 
Did you mean: 

How to create credit note automatically after PGR?

Former Member
0 Kudos

Hello SD Gurus,

Client's Business Process: Return Order (ZRE, ZPOR, ZARE, and ZMTR) is created with reference to billing document number and item category used for this order type is REN or ZREN. After the order is created, they do PGR (Return Delivery Type is LR) and then credit memo is created "manually". So, the issue with this process is that it is very time consuming and a lot of manual intervention is required.

To-be Process: The requirement is to create credit note "automatically" after the PGR is done to reduce the manual intervention and expedite the process. If item category is REN, then credit note will be created with invoice value. If item category is ZREN, then credit note will be created with Zero Value.

How should I write code in the user exit MV50AFZ1?

Regards,

Mohammed Anwar

Accepted Solutions (1)

Accepted Solutions (1)

Lakshmipathi
Active Contributor
0 Kudos
If item category is ZREN, then credit note will be created with Zero Value

For what purpose you want the system to generate a zero value credit memo which is not at all required.  The very purpose of creating billing document / debit memo / credit memo is to post the related values in FI.  Nevertheless, you can automate the generation of credit memo via VF06 where you can schedule the job periodically depending upon the number of credit memos to be generated.

Still if you want to achieve this requirement, try with USEREXIT_FILL_VBRK_VBRP in program RV60AFZC where you need to validate the item category.  Tell the logic to your ABAPer so that they will provide solution to your requirement.

G. Lakshmipathi

Answers (3)

Answers (3)

Former Member
0 Kudos

Adding to the solution provided by Lakshmi Sir

1. modify item category ZREN to be NOT RELEVANT FOR PRICING

2. Use JOB for creation of Credit Memo from Delivery.

I think this can solve the issue.

Need a bit more clarity of process/trial in sandbox to see if modification of ZREN to Not Relevant for Pricing will actually be helpful.

Former Member
0 Kudos

Hi Mohammed,

As I see your requirement is to create a Credit Note automatically after posting a GR for returns, we had a similar requirement in past which we fulfilled using an output determination.

We created a new output type for this requirement and assigned it to the output determinaiton procedure of delivery.

Routine 001 is assigned to this output type so that output will be triggered onlg after GI is posted.

We created our own access sequence inorder to controll this output type for certain sales areas and plant and document types

Created a new report which is called in the background which indid calls the tcode VF01 to create an invoice using a delivery document number.

We additionally had a logic in place to trigger an email to the person who processed this output type in case if output is in error.

Rest of the logic you can built in the report based on the item category

moazzam_ali
Active Contributor
0 Kudos

Hi

Apart from Lakshmipathi's suggestion you can share the below logic with your ABAPER. There are two BAPIs we use to create billing automatically. Check whether you can call these BAPIs in userexit you have mentioned in your post.

CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
* EXPORTING
*   CREATORDATAIN         =
*   TESTRUN               =
*   POSTING               =
        TABLES
          billingdatain         = billingdatain
          conditiondatain       = conditiondatain
*   CCARDDATAIN           =
*   TEXTDATAIN            =
*   ERRORS                =
          return                = return3
          success               = success
                .
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.

      READ TABLE return3 WITH KEY type = 'E'.
      IF sy-subrc = 0.
        record-inv_rem = return3-message.
      ENDIF.

      WAIT UP TO 2 SECONDS.

*      READ TABLE return3 WITH KEY type = 'E'.
*      IF return3-type = 'E'.
*        WRITE:/ return3-message.
*      ENDIF.

      READ TABLE success INDEX 1.
      CLEAR: vbeln_vf.
      vbeln_vf = success-bill_doc.
    ENDIF.

Thank$