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: 

Update Function Module

rbharathi123
Explorer
0 Kudos

Hi Experts,

I'm having Scenario like,

there are two database table like one for vehicle details and one more is for sample Sales Order table.

Have to create a insert a entry using update function module.

The Condition is, if sales order entry is not inserted then vehicle details should not insert into database table but vehicle details getting inserted though sales order is not created.

Source Code :

DATA : itab TYPE TABLE OF ysdmm_mp_vehicle,
wa TYPE ysdmm_mp_vehicle,
itb2 TYPE TABLE OF ysdmm_mp_so,
wa2 TYPE ysdmm_mp_so.


wa-vehicle_number = 'HELL'.
wa-driver_name = 'JBH'.
wa-entry_date = '20230520'.
wa-entry_time = SY-uzeit.
wa-mobile_number = 9620207328.
wa-order_type = 'PO'.
wa-vehicle_type = 'LOADED'..
APPEND wa TO itab.
CLEAR wa.

wa2-item_number = 'ITM-OO1'.
wa2-net_value = 1000.
wa2-material_number = 'MAT-001'.
wa2-created_on = SY-DATUM.
wa2-so_number = 'SO-001'.
wa2-net_price = '1000'.
wa2-material_description = 'MOBILE'.
wa2-created_by = sy-uzeit.
APPEND wa2 TO itb2.
CLEAR wa2.

CALL FUNCTION 'YSDMM_UPDATE_FG'
TABLES
tb_im = itab
EXCEPTIONS
inserted = 1
not_inserted = 2
initial = 3
OTHERS = 4.
IF sy-subrc EQ 1.
MESSAGE 'SUCCESS2' TYPE 'S'.
ENDIF.

CALL FUNCTION 'YSDMM_UPDATE_FG_SO'
TABLES
tb_im = itb2
EXCEPTIONS
inserted = 1
not_inserted = 2
initial = 3
OTHERS = 4.
IF sy-subrc EQ 1.
MESSAGE 'SUCCESS1' TYPE 'S'.
ELSEIF SY-SUBRC = 2.
MESSAGE 'NOT INSERTED' TYPE 'E'.
ENDIF.

COMMIT WORK.

  • SAP Managed Tags:
0 REPLIES 0