cancel
Showing results for 
Search instead for 
Did you mean: 

SD Billing: invoice splitting with different billing types

Former Member
0 Kudos

Hallo,

 

We’re facing an issue about invoice splitting. Customer requirements is: according to some item
characteristic a Sales Order with two items when invoiced must determine au tomatically two different billing documents of different type and different number ranges (Order-related Billing documents).

Example:

 

Sales Order Z1 with two
items: MAT1 and MAT2. Sales Order is related to Billing Type Z1

 

Item with MAT1 -->
billing type Z1 / number range 2200020020

 

Item with MAT2 -->
billing type Z2 / number range 3300020020

We are trying to reach this goal in the following way:

- implementation of exit
USEREXIT_FILL_VBRK_VBRP (RV60AFZC) : if vbrp-matnr = MAT2 then VBRK-FKART = Z2.

 

- implementation of a new
split routine in copy control.

- implementation of exit USEREXIT_NUMBER_RANGE_INV_DATE
(RV60AFZC): select from TVFK with VBRK-FKART = Z2 and retrieve TVFK-NUMKI

What do you think about this solution? Have you ever faced this issue?

Many thanks in advance,

Marco Sette

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi all, happy new year!

During the implementation of the solution described above we're experimenting an episodic problem: sometimes, when we split invoices, the "standard" invoice type (that is linked to the sales order) shows a strange behavior: the sistem tries to assign  a wrong number to the billing document, causing a rollback and an error business workplace document.

When we check the last document number assigned into VN01 transaction we find that the last assigned number has been brought back to the first number. The system seems not to check last assignment number, trying to re-assign the first number of the range.

Example:

Sales Order Z1 with two
items product codes: MAT1 and MAT2. Sales Order is related to Billing Type Z1

 

Item with MAT1 -->
billing type Z1 / number range 22000000 and last assignment number 22000036

 

Item with MAT2 -->
billing type Z2 / number range 33000000 (new)

When we try to create the billing documents we receive the error: ABAP Processor: SAPSQL_ARRAY_INSERT_DUPREC

Checking out into VN01 we find that number range 22000000 last assignment is 22000001.

If we manually change last assignment up to 22000036 and try again to invoice the sales order, the error doesn't occur anymore and we obtain invoice documents Z1 (number 22000037) and Z2 (33000001).

In transaction SNRO the object type RV_BELEG is not buffered.

Any idea about that?

Thanks,

Marco

Former Member
0 Kudos

Hi Marco,

Why don't you copy and create a new routine (based on your requirement) and assign the same in your copy control settings.

Regards

Ankit

Former Member
0 Kudos

Hi Ankit,

we are trying to do exactly what you suggest, copying an existent split routine and adding in it our rules to determine billing type and a split criteria.

Still this thing isn't enough, because SAP can't determine the new number range.

We had to solve this problem through user exit USEREXIT_NUMBER_RANGE_INV_DATE, where we explicitly find and assign the correct number range (from TVFK table) to our billing type.

A similar solution seems to be implemented by SAP expecially for India: check out standard split routines 349 and 350. Our solution seems to work correctly, but we'd be more confident if someone else would have successfully faced and solved this issue.

Thanks a lot, regards.

Marco    

Former Member
0 Kudos

Hi,

is there anyone who faced this issue?

Thks

Marco     

Lakshmipathi
Active Contributor
0 Kudos
according to some item characteristic a Sales Order with two items when invoiced must determine au tomatically two different billing documents

What are those characteristics ?  For information, we can force the system to split the billing with standard configuration itself.  Straightaway, dont go for user exit.  Explore the possibility to address through standard configuration itself.

G. Lakshmipathi

Former Member
0 Kudos

Hi,

thanks for your answer: I know that we can split the billing using only standard or custom split routines, but in that way we can only create two billing document of the same type.

Even split routines 349 and 350, especially provided for India, can only change the billing type according to VAT code of sales order items, but that change doesn't change the number range.

A.e.:

- Billing type Z1 with number range 12000/12999

- Billing type Z2 with number range 22000/22999

If we use a split routine to split the billing and change (for some items) the billing type, a.e, from Z1 to Z2, we obtain this result:

billing doc. 1 type Z1 number 12001

billing doc. 2 type Z2 number 12002

We can't find no standard configuration to split a sales order into two different types of billing document having different number ranges. If you know the solution to this problem would you give me some tips?

Thanks,

Marco   

Lakshmipathi
Active Contributor
0 Kudos

If you have already analysed the requirement in detail, then it is okay.  May be you can try with USEREXIT_FILL_VBRK_VBRP in program RV60AFZC) or USEREXIT_NUMBER_RANGE in program RV60AFZZ

G. Lakshmipathi

Former Member
0 Kudos

Hi G.

once again thanks for your suggest: we checked both exits USEREXIT_NUMBER_RANGE in program RV60AFZZ and USEREXIT_NUMBER_RANGE_INV_DATE in program RV60AFZC. When we try to invoice a SO with two items we find that USEREXIT_NUMBER_RANGE is accessed only one time, while USEREXIT_NUMBER_RANGE_INV_DATE is accessed twice ( in general once for each item) so we'll try to use the second exit.

Anyway, I thank you very much for your help.

Marco