Application Development and Automation 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: 
Read only

VBKD table update for VA01

Former Member
0 Likes
4,467

Hello Guru's,

My requirement is to update VBKD-BSTKD_E field with the sales document number for VA01 transaction code.

I am using 'USEREXIT_SAVE_DOCUMENT' to update the internal table XVBKD-BSTKD_E by VBAK-VBELN. I can able to modify the XVBKD internal table but these entries are not reflecting in standard VBKD database table.

Only 'USEREXIT_SAVE_DOCUMENT' is holding the document number other userexits 'USEREXIT_SAVE_DOCUMENT_PREPARE' and 'USEREXIT_MOVE_FIELD_TO_VBKD' are not getting the document number value.

Please help me in the above requirement.

Thanks & Regards,

Naresh Durki.

Hello Guru's,

My requirement is to update VBKD-BSTKD_E field with the sales document number for VA01 transaction code.

I am using 'USEREXIT_SAVE_DOCUMENT' to update the internal table XVBKD-BSTKD_E by VBAK-VBELN. I can able to modify the XVBKD internal table but these entries are not reflecting in standard VBKD database table.

Only 'USEREXIT_SAVE_DOCUMENT' is holding the document number other userexits 'USEREXIT_SAVE_DOCUMENT_PREPARE' and 'USEREXIT_MOVE_FIELD_TO_VBKD' are not getting the document number value.

Please help me in the above requirement.

Thanks & Regards,

Naresh Durki.

11 REPLIES 11
Read only

Former Member
0 Likes
3,063

Any solution please.

Thanks & Regards,

Naresh.

Read only

Former Member
0 Likes
3,063

Hi Naresh,

If I am not mistaken,

XVBKD is the internal table.

VBKD is the work area.

use

VBKD-BSTKD_E = VBAK-VBELN
modify xvbkd from vbkd.

Regards,

Jovito

Read only

Former Member
0 Likes
3,063

Hi

Something doesn't sound good

If you're using transaction VA01, it means you're creating a sales order, so you can know the document number as soon as you save it: that explain as you can see it in USEREXIT_SAVE_DOCUMENT

I believe any exit can help you, but you need to change the standard program

Max

Read only

0 Likes
3,063

Hello Max,

I am getting the VBELN value and updating the same value to XVBKD internal table. But, the field value is not getting updated to the standard database VBKD table.

--Naresh.

Read only

0 Likes
3,063

Hi

Yes I've understood it

That's is because probaly you update XVBKD in USEREXIT_SAVE_DOCUMENT: only here you can know the sales order number

But this exit is to update some own tables, so every change done in sales document is lost here, you shoudl use USEREXIT_SAVE_DOCUMENT_PREPARE: but here you can't know the number.

That's mean you need to place your code between those two user-exits, but any exit is there, so you have to change the standard: or you try to change it after saving the sales order.

One chance can be to call a function module USEREXIT_SAVE_DOCUMENT, this function has to be called in UPDATE TASK, here you can transfer the sales order number and call the bapi BAPI_SALESORDER_CHANGE in order to change the value of VBKD

Max

Read only

0 Likes
3,063

Hello Max,

Thank..you very much for you reply.

Do you have any idea where can I update the field BSTKD_E(Ship to party reference PO number) in BAPI BAPI_SALESORDER_CHANGE.

Thanks & Regards,

Naresh.

Read only

0 Likes
3,063

See field PURCH_NO_S in ORDER_HEADER_IN & ORDER_HEADER_INX

Read only

0 Likes
3,063

Hi

Yes Vinod is right

The field is ORDER_HEADER_IN-PURCH_NO_S and set the corresponding field flag in ORDER_HEADER_INX

Max

Read only

0 Likes
3,063

Hello Vinod,

As I am expecting the BSTKD_E in item table. why because, for each line item I can have different BSTKD_E value. But this field is in Header and I can not maintain for different line items of an sales order.

Please help me.

--Naresh

Read only

0 Likes
3,063

Hi

If you get some records from VBKD table, you can see there's always a record having the item number equal to 000000, this particular record is valid for all items (except the item having an own record in VBKD, in this case the VBKD-POSNR = VBAP-POSNR):

that's as usually the data of VBKD are the same for all items

So if you need to set a value valid for all items, you need to set BSTKD_E in header data (ORDER_HEADER_IN), if you need to set a different value for every item or for certain item, you have to set PURCH_NO_S in the corrisponding item of ORDER_ITEM_IN:

infact both structures ORDER_HEADER_IN and ORDER_HEADER_IN have the field PURCH_NO_S.

Now you need to set the sales order number in PURCH_NO_S, and it will be the same for all item, so it should be correct to transfer the value as header data.

Anyway just before calling the BAPI, you can do a selection for VBKD table in order to know if there is the header record only or if there are records for some items:

in this case you need to transfer the value in header and item structure too:

SELECT * FROM VBKD WHERE VBELN = P_VBELN.
   IF VBKD-POSNR = '000000'
      ORDER_HEADER_IN-PURCH_NO_S = P_VBELN.
      ORDER_HEADER_INx-PURCH_NO_S = 'X'.
  ELSE.
      ORDER_ITEM_IN-PURCH_NO_S = P_VBELN.
      ORDER_ITEM_INx-PURCH_NO_S = 'X'.      
      APPEND ORDER_ITEM_IN.
  ENDIF.
ENDSELECT.

Max

Read only

0 Likes
3,063

Hello Max,

I resolved my issue by creating a BDC program for VA02.

Thanks a lot for your timely help.

Regards,

Naresh.