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 use FM to update the standard table LIPS?

suityan98
Explorer
0 Kudos
1,337

Hi, I am newbie on the SAP ABAP.
It is not recommended to use insert, update, modify to modify the standard table,

If I want to use FM 'WS_DELIVERY_UPDATE' to update one of the field in table LIPS, can have explanation on how to call the function? Means what should be import and what should be export, a bit confusing on it.

The following is the action that I need to be proceed:

UPDATE LIPS SET LFIMG = LT_BCODE_I-MENGE
              WHERE VGBEL = LT_BCODE_I-VGBEL
              AND VGPOS = LT_BCODE_I-VGPOS.
1 ACCEPTED SOLUTION

venkateswaran_k
Active Contributor
0 Kudos
509

Hi

Please refer to the example code.. This is just a instruction to handle. You convert it according to your requirement.

DEFINE	 internal table as lt_vbpok WITH HEADER LINE.
SELECT YOUR LIPS RECORDS FROM TABLE BASD ON YOUR CRITERIA into gt_lips

LOOP AT gt_lips INTO gs_lips.
lt_vbpok-lfimg = gs_lips-lfimg.
APPEND lt_vbpok.
ENDLOOP.

""call the function as below

        CALL FUNCTION 'WS_DELIVERY_UPDATE'
          EXPORTING
            vbkok_wa                    = ls_vbkok    <== your delivery document number
            synchron                    = 'X'
            no_messages_update          = ' '
            update_picking              = 'X'
            commit                      = 'X'
            delivery                    = l_vbeln     <== variable for delivery document number
            nicht_sperren               = 'X'
            if_error_messages_send_0    = space
          IMPORTING
            ef_error_any_0              = ef_error_any_0
            ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
            ef_error_in_pod_update_0    = ef_error_in_pod_update_0
            ef_error_in_interface_0     = ef_error_in_interface_0
            ef_error_in_goods_issue_0   = ef_error_in_goods_issue_0
            ef_error_in_final_check_0   = ef_error_in_final_check_0
          TABLES
            vbpok_tab                   = lt_vbpok     <== your table that to be changed.
            prot                        = lt_prot.

        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.

    

Regards,

Venkat

5 REPLIES 5

venkateswaran_k
Active Contributor
0 Kudos
510

Hi

Please refer to the example code.. This is just a instruction to handle. You convert it according to your requirement.

DEFINE	 internal table as lt_vbpok WITH HEADER LINE.
SELECT YOUR LIPS RECORDS FROM TABLE BASD ON YOUR CRITERIA into gt_lips

LOOP AT gt_lips INTO gs_lips.
lt_vbpok-lfimg = gs_lips-lfimg.
APPEND lt_vbpok.
ENDLOOP.

""call the function as below

        CALL FUNCTION 'WS_DELIVERY_UPDATE'
          EXPORTING
            vbkok_wa                    = ls_vbkok    <== your delivery document number
            synchron                    = 'X'
            no_messages_update          = ' '
            update_picking              = 'X'
            commit                      = 'X'
            delivery                    = l_vbeln     <== variable for delivery document number
            nicht_sperren               = 'X'
            if_error_messages_send_0    = space
          IMPORTING
            ef_error_any_0              = ef_error_any_0
            ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
            ef_error_in_pod_update_0    = ef_error_in_pod_update_0
            ef_error_in_interface_0     = ef_error_in_interface_0
            ef_error_in_goods_issue_0   = ef_error_in_goods_issue_0
            ef_error_in_final_check_0   = ef_error_in_final_check_0
          TABLES
            vbpok_tab                   = lt_vbpok     <== your table that to be changed.
            prot                        = lt_prot.

        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.

    

Regards,

Venkat

0 Kudos
509

it is helpful! thank you!!

0 Kudos
509

How to DEFINE internal table as lt_vbpok WITH HEADER LINE.?

0 Kudos
509

Please use the following statements. These are all the variables used in the BAPI.

Define the data statement as below for lt_vbpok as below

DATA lt_prot  LIKE prott  OCCURS 10 WITH HEADER LINE.
DATA lt_vbpok  LIKE vbpok OCCURS 500  WITH HEADER LINE.
DATA ls_vbkok  LIKE vbkok.

DATA: ef_error_any_0              TYPE c,
      ef_error_in_item_deletion_0 TYPE c,
      ef_error_in_pod_update_0    TYPE c,
      ef_error_in_interface_0     TYPE c,
      ef_error_in_goods_issue_0   TYPE c,
      ef_error_in_final_check_0   TYPE c.

regards,

Venka

0 Kudos
509

suityan98

Nobody should use obsolete statements like "WITH HEADER LINE" anymore. These will cause syntax error in object oriented code, which is the recommended programming style for a while now.