cancel
Showing results for 
Search instead for 
Did you mean: 

How can i Insert a record into table ADR6 not by direct update

Former Member
0 Kudos

Hi,

How can i Insert a record into database table ADR6 not by direct update

by using BAPI_ADDRESSORG_CHANGE or any other bapi

please guide me its very urgent

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

CALL FUNCTION 'BAPI_ADDRESSORG_GETDETAIL'

EXPORTING

obj_type = c_objtype

obj_id = gv_objkey

TABLES

bapiad1vl = gt_bapiad1vl

bapiadtel = gt_bapiadtel

bapiadpag = gt_bapiadpag

return = gt_bapiret2.

  • Pre-read Pager Numbers got by BAPI_ADDRESSORG_GET

READ TABLE gt_bapiadpag INTO gs_bapiadpag WITH KEY std_no = c_x

consnumber = ls_adr2_consnumber

BINARY SEARCH.

IF sy-subrc = 0.

*Pass Mobile number to update in ADR2

gs_bapiadpag-pager = ls_adr2_tel_number.

gs_bapiadpag-consnumber = ls_adr2_consnumber.

gs_bapiadpag-std_recip = ls_adr2_flgdefault.

gs_bapiadpag_x-updateflag = 'U'.

gs_bapiadpag_x-pager = c_x.

gs_bapiadpag_x-std_recip = c_x.

ELSE.

gs_bapiadpag-country = gs_bapiadtel-country.

gs_bapiadpag-countryiso = gs_bapiadtel-countryiso.

gs_bapiadpag-std_no = gs_bapiadtel-std_no.

gs_bapiadpag-pager_type = 'SMS'.

gs_bapiadpag-pager = gs_bapiadtel-telephone.

gs_bapiadpag-pager_no = gs_bapiadtel-tel_no.

gs_bapiadpag-caller_no = gs_bapiadtel-caller_no.

gs_bapiadpag-std_recip = ls_adr2_flgdefault.

gs_bapiadpag-r_3_user = gs_bapiadtel-r_3_user.

gs_bapiadpag-home_flag = gs_bapiadtel-home_flag.

gs_bapiadpag-consnumber = gs_bapiadtel-consnumber.

APPEND gs_bapiadpag TO gt_bapiadpag.

gs_bapiadpag_x-country = c_x.

gs_bapiadpag_x-countryiso = c_x.

gs_bapiadpag_x-std_no = c_x.

gs_bapiadpag_x-pager_type = c_x.

gs_bapiadpag_x-pager = c_x.

gs_bapiadpag_x-pager_no = c_x.

gs_bapiadpag_x-caller_no = c_x.

gs_bapiadpag_x-std_recip = c_x.

gs_bapiadpag_x-r_3_user = c_x.

gs_bapiadpag_x-home_flag = c_x.

gs_bapiadpag_x-consnumber = c_x.

gs_bapiadpag_x-updateflag = 'I'.

APPEND gs_bapiadpag_x TO gt_bapiadpag_x.

ENDIF.

CALL FUNCTION 'BAPI_ADDRESSORG_CHANGE'

EXPORTING

obj_type = c_objtype

obj_id = gv_objkey

TABLES

bapiad1vl = gt_bapiad1vl

bapiad1vl_x = gt_bapiad1vl_x

bapiadtel = gt_bapiadtel

bapiadtel_x = gt_bapiadtel_x

bapiadpag = gt_bapiadpag

bapiadpag_x = gt_bapiadpag_x

return = gt_bapiret2.

IF gt_bapiret2[] IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

REFRESH : gt_bapiadpag[],

gt_bapiadpag_x[],

gt_bapiret2[].

Former Member
0 Kudos

Babji...normally you have to maintain the e-mail address then only the record in ADR6 will automatically update, but in case some problem is there..(which i don't think is the problem you are facing right now ) then debugging is the solution for that.

Reward Points if it helps,

Regards,

N