Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to split Invoice by Material group(MATKL)

Former Member
0 Kudos

Hi Experts,

I'm trying to create an invoice based on delivery document, however it is still being split into multiple invoices as per stndard rules (i.e. type of order, delivery or billing document on which the sales document is based).

My requirement is to split the invoices based on the matreial groups.

Example: There is one delivery having 8 line items, first 5 line items are having material group xxx and remaining items having material group yyy. So as per my requirement two invoices has to split. First invoice should 5 line items and second invoice should have 3 line items. Kindly suggest how to fulfill this requirement.

Regards,

Shaiksha Vali.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

Kindly manipulate VBRK-ZUKRI field. If the field differs in two line items, invoice will split.. The coding needs to be done in Data Transfer routine from delivery to invoice. ( Check the standard routine - 003 for reference ).

Regards,

DPM

3 REPLIES 3

Former Member
0 Kudos

HI,

Kindly manipulate VBRK-ZUKRI field. If the field differs in two line items, invoice will split.. The coding needs to be done in Data Transfer routine from delivery to invoice. ( Check the standard routine - 003 for reference ).

Regards,

DPM

atul_mohanty
Active Contributor
0 Kudos

Hi Vali -

You can achieve through VOFM Routines.

1. Go to Transaction VOFM.

Menu -> Data Transfer -> Billing Documents.

Create a new routine like 901.

(Please refer to the code of standard routine 003 under the same path.)

You need make VBRK-ZUKRI as the Material Group (VBRP-MATKL)

Example :

    DATA: BEGIN OF ZUK,
          MODUL(3) VALUE '901',
            MATKL LIKE VBRP-MATKL,
        END OF ZUK.
 

  ZUK-MATKL= VBRP-MATKL.
 

  VBRK-ZUKRI = ZUK.

2. Check with functional consultant to configure the routine in VTFL transaction for the respective delivery to billing doc (invoice) for copy  under Item for the item category.

Let us know, if it helps.

Regards,

Atul Mohanty

0 Kudos

Hi,

Thanks for your guidence. Achieved split scenario as per below code.

It is perfectly working....

* Additional split criteria

DATA : BEGIN OF ZUK,

           MODUL(3) VALUE '902',

        matkl LIKE vbrp-matkl,

   END OF zuk.

  DATA : lv_regio TYPE t001w-regio.


  CLEAR lv_regio.

SELECT SINGLE regio INTO lv_regio FROM t001w WHERE werks = lips-werks.

  if lv_regio = '19' AND vbkd-pltyp = '33'.

    if vbrp-matkl = 'XYZ' or vbrp-matkl = 'XYY' or vbrp-matkl = 'XZZ' or vbrp-matkl = 'XXZ'.

*if lv_ind = 'X'

      zuk-matkl = 'X'.

      VBRK-ZUKRI = ZUK.

   else.

   zuk-matkl = 'Y'.

   VBRK-ZUKRI = ZUK.

   endif.

endif.