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: 

BAPI_ADDRESSORG_CHANGE

Former Member
0 Kudos
491

Hi

I am trying to delete the contact number from ADR2 using "BAPI_ADDRESSORG_CHANGE" but this BAPI is deleting the 1st record irrespective of the contact number i am sending to it.

please have a look at my code:

LOOP AT gt_validnumber INTO gs_validnumber .

CLEAR: lt_adtel, lt_adtelx.

lv_obj_id = gs_validnumber-kunnr.

ls_adtel-telephone = gs_validnumber-tel_number.

APPEND ls_adtel TO lt_adtel .

ls_adtelx-telephone = c_x.

ls_adtelx-updateflag = gs_validnumber-action.

APPEND ls_adtelx TO lt_adtelx.

CALL FUNCTION 'BAPI_ADDRESSORG_CHANGE'

EXPORTING

obj_type = 'KNA1'

obj_id = lv_obj_id

obj_id_ext = space

context = '0001'

TABLES

bapiadtel = lt_adtel

bapiadtel_x = lt_adtelx

return = lt_return.

COMMIT WORK .

ENDLOOP.

Please suggest me on how to solve the same.

Thanks in advance.

Regards,

Rajgopal.

6 REPLIES 6

Former Member
0 Kudos
198

HI,

FYI:

Notes

To delete, e.g. a telephone number in the table of existing telephone numbers for an address, the 'UPDATEFLAG' field in the associated reference structure line must contain 'D'.

To create an entry, this field must contain 'I' and the data to be inserted must be passed.

All new lines to be inserted (I) and their reference structures must be after all entries to be changed (U) and deleted (D).

Change data key fields must always be filled, and are taken into account as far as possible. It is not significant whether, e.g. all telephone number comments are followed by fax number comments as change data, or vice versa;

only the sequence among entries with the same key is significant, unless you pass only some or no communication address or comment serial numbers, in which case the data sequence is significant .

The key fields are:

Structure | Fields

-


BAPIAD1VL | ADDR_VERS, FROM_DATE

BAPIAD_REM | ADDR_VERS, LANGU

BAPIADTEL | CONSNUMBER

... | ...

BAPIADPAG | CONSNUMBER

BAPICOMREM | COMM_TYPE, LANGU

0 Kudos
198

Hi NI SHILIANG

Thanks a lot

Regards,

Raj...

Former Member
0 Kudos
198

This message was moderated.

0 Kudos
198

Hi Hiren Chitalia

now i am trying to change the URL but i am getting error in the return table saying as

"Select a standard number in communication type URI"

Please help me to over come this error.

Thanks

Rajgopal

0 Kudos
198

Hi,

Are u marking the BAPIADURI_X with 'X' for any change in BAPIADURI.

Also please paste yur code to help u further.

Regards

Hiren K.Chitalia

0 Kudos
198

Hi

i have passed BAPIADURI_X with 'X'. its working for all the records but it is giving the error for one record only hope this is a problem with that record and one more thing it is not deleting the record whose HOME_FLAG is marked as 'X' do you have any idea why it is like that.

Regards

Rajgopal