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: 

Changing VBKD items fields

maximiliano_isoba
Contributor
0 Kudos

Hi SAP gurus,

I have a problem trying to change VBKD-J_1AREGIO in table VBKD.

Although I searched the forum for similar questions/cases, I didn´t find an answer that fulfilled our requirements.

Outr client wants to fulfill VBKD-J_1AREGIO with the region of the plant (TW001-REGIO) at ítem level (when VBKD-POSNR <> ‘000000’). Al header level we want the región of the customer (KNA1-REGIO).

The problem is that in USEREXIT_MOVE_FIELD_TO_VBKD the number of registers in VBAP and VBKD are not the same.

We are aware of the way SAP storages information (if data at header level and items level is the same, it only persist the header data register in VBKD). That´s not the case which I´m Talking.

We need to be changing the VBKD-J_1ACAE in both, sales order creation – VA01- and sales order modification –VA02- since the plant of the position could be modified.

Also, after passing values to J_1AREGIO at header and ítems levels, data don´t persist as we want, it gets modified.

Does anyone knows why?

Thanks in advance,

1 REPLY 1

artrahul1
Participant
0 Kudos

Hi Max,

Recently had a same situation where we wanted to set VBKD-KDKG1 = 01 line item wise. As per the VBKD working, it holds header record that applies to all the items of the order, until and unless there is any change in item level VBKD fields. So, to achieve this functionality dynamically via code, I have done below.

Used MV45AFZB-USEREXIT_CHECK_VBKD

1. Checked for the corresponding line item in XVBKD[ ],

a. if available, changed the XVBKD-KDKG1 = 01.

b. if not available, inserted new record to XVBKD[ ] copying header record (i.e. posnr = 000000). And made it's POSNR = VBAP-POSNR.

2. System will use these records for further processing too.

We restricted this for VA01 and VA02.

Gurus, kindly correct me if anywhere it is wrong.