I am writing this blog as a guide for those who will have the same requirement.
It might not solve your queries directly but I believe it will still throw some light if kind of relevant to my requirement.
Overview of Requirement:
Recently I got an enhancement to suppress the invoice list creation during invoice creation in VF01/VF04
Creation of invoice list will be controlled by checking “if the invoice to be created” in VF01/VF04 has a combination stored in our custom table.
So…If the combination is maintained (RELEVANT for invoice list creation)
then do not change anything
If the combination is NOT maintained (NOT RELEVANT for invoice list creation)
then I need to:
1. Clear the Invoice list details in the Header Details section of VF01/VF04.
2. No invoice creation will happen/ no results in VF24 upon successful invoice creation in VF01/VF04.
3. Clear 1 field in VBUK-RELIK (relevancy for invoice list)
4. Clear 2 fields in VBRK-FKART_RL (invoice list type) & VBRK-FKDAT_RL invoice list billing date
I do have a limited understanding of the whole detailed SD flow but what I know is:
1. Once we create an invoice in VF01/VF04 -> it will create an invoice list by SAP standard process if the document is properly configured which we can see in VF24. (see below)
2. Should the invoice is not created after running VF01/VF04 -> then there could be a set up to make it invoice list creation relevant (I tapped my SD functional for this configurations and he did it for me)
3. I am also checking the header part in VF01/VF04 (before creating of invoice list) if it is relevant for invoice creation if there is Invoice List Type and billing date on the header part. If the Invoice List is not relevant for creation then we should make both fields blank.
1. & 4 Clearing Invoice list Type and Billing date in Header part can be done on Include MV60AF0V_VBRK_BEARBEITEN.
In this include, the header details are still being initialized.
I put an implicit enhancement to clear both fields in table VBRK and in XVBRK – see below
Once the invoice list is NOT RELEVANT, (see below) –> If we Press on header details icon or go to Header – header, both Invoice list type and billing date is blank.
# 4 issue – will also be solved as once we clear both VBRK fields (Invoice List type and billing date from this point, once we press save, it will not create any data in VBRK upon invoice posting later on)
Now done with issue number #1 & #4.
moving forward with # 2 & 3.
2. & 3. VBUK data is not yet present in the above include so we need to find another spot to initialize VBUK data (relik) and the invoice list creation suppression (for it not to show in VF24).
Once we hit on save – there is a FM being called – named “RV_INVOICE_DOCUMENT_ADD which will add the invoice data to the data base tables.
I placed my logic inside this subroutine – see below:
In line 234 you can see that I cleared VBUK data
Being VBUK-RELIK (Invoice List creation Relevance Indicator) blank – this means that it will no longer be relevant for invoice list creation.
This will solve # 2 & # 3.