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

Updating vbak

Former Member
0 Likes
7,687

I would like to update vbak and set lifsk = 'x' when vbeln in (a,b,c,d)

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,781

Hi,

Please do not update any VBAK table directly.

But you can use FM SD_SALESDOCUMENT_CHANGE to update VBAK-LIFSK.

Just pass the order number and set ORDER_HEADER_IN-DLV_BLOCK to your new value and ORDER_HEADER_INX-DLV_BLOCK to 'X'. Also set ORDER_HEADER_INX-UPDATEFLAG to 'U'.


PARAMETERS: p_order LIKE vbak-vbeln.

DATA: ord_in  LIKE bapisdhd1,
      ord_inx LIKE bapisdhd1x,
      t_ret   LIKE bapiret2 occurs 0 with header line.
 
ord_in-dlv_block = '01'.
ord_inx-dlv_block = 'X'.
ord_inx-updateflag = 'U'.
 
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
  EXPORTING
    SALESDOCUMENT               = p_order
    ORDER_HEADER_IN             = ord_in
    ORDER_HEADER_INX            = ord_inx
  TABLES
    RETURN                      = t_ret

Regards,

Ferry Lianto

I would like to update vbak and set lifsk = 'x' when vbeln in (a,b,c,d)

5 REPLIES 5
Read only

Former Member
0 Likes
2,781

Hi Megan,

You should not update the database directly from a program.

Do a BDC for VA02 or use the BAPI: BAPI_SALESORDER_CHANGEto update the sales tables.

Regards,

Ravi

Read only

Former Member
0 Likes
2,781

Hi Megan

Doing direct table updates on SAP tables is extremely poor programming practice, and can cause untold chaos and pain. Try to use a SAP standard function module or BAPI, or a BDC if this is not available.

In your case, you'll probably be able to do these changes with BAPI_SALESORDER_CHANGE.

Cheers

Lyal

Read only

Former Member
0 Likes
2,781

I have never run the BAPI

How do I implement it?

Do I just include the syntax in a custom report ?

Read only

0 Likes
2,781

I have to admit that I have not used this BAPI before, either. So I can't help you with the fields that are required to be populated for it to run. But, if you do a search on the forum for that BAPI, you'll get loads of hits.

To insert it into your program, it is very handy to use the Pattern button, and then put BAPI_SALESORDER_CHANGE into the CALL FUNCTION field. This will import the BAPI's structure.

Cheers

Lyal

Read only

Former Member
0 Likes
2,782

Hi,

Please do not update any VBAK table directly.

But you can use FM SD_SALESDOCUMENT_CHANGE to update VBAK-LIFSK.

Just pass the order number and set ORDER_HEADER_IN-DLV_BLOCK to your new value and ORDER_HEADER_INX-DLV_BLOCK to 'X'. Also set ORDER_HEADER_INX-UPDATEFLAG to 'U'.


PARAMETERS: p_order LIKE vbak-vbeln.

DATA: ord_in  LIKE bapisdhd1,
      ord_inx LIKE bapisdhd1x,
      t_ret   LIKE bapiret2 occurs 0 with header line.
 
ord_in-dlv_block = '01'.
ord_inx-dlv_block = 'X'.
ord_inx-updateflag = 'U'.
 
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
  EXPORTING
    SALESDOCUMENT               = p_order
    ORDER_HEADER_IN             = ord_in
    ORDER_HEADER_INX            = ord_inx
  TABLES
    RETURN                      = t_ret

Regards,

Ferry Lianto