Archived discussions are read-only. Learn more about SAP Q&A

Change of email in customer master

I want to make all the email address for customer in customer master as blank.I am using an bapi sd_customer_maintain_all to make email blank.While running the report it returns with error message for sy-subrc as 22 for camerror any idea what exactly it all about.

REPORT zvr000_stlcustomer_emailchange.

TABLES: kna1,adr6.

TYPES: BEGIN OF addr,

addrnumber TYPE adr6-addrnumber,

smtp_addr TYPE adr6-smtp_addr,

persnumber TYPE adr6-persnumber,

END OF addr,

BEGIN OF cust,

kunnr TYPE kna1-kunnr,

land1 TYPE land1_gp,

adrnr TYPE kna1-adrnr,

smtp_addr TYPE adr6-smtp_addr,

END OF cust.

data lv_charr type c value 50.

data lv_kna1 type kna1.

data lv_kna2 type kna1-kunnr.

DATA: git_adr11 TYPE STANDARD TABLE OF addr,

gwa_addrr2 LIKE LINE OF git_adr11.

DATA: git_kna11 TYPE STANDARD TABLE OF cust,

gwa_addondata type cust_add_on_data,

gwa_kna1 LIKE LINE OF git_kna11.

data gwa_addr type bapiaddr1.

data gwa_addr2 type bapiaddr2.

select-OPTIONS: s_kunnr FOR kna1-kunnr.

*----


Select the customers and address# from kna1

SELECT kunnr land1 adrnr FROM kna1 INTO TABLE git_kna11

WHERE kunnr IN s_kunnr.

IF git_kna11 IS NOT INITIAL.

LOOP AT git_kna11 INTO gwa_kna1.

lv_kna1-kunnr = gwa_kna1-kunnr.

gwa_addr-e_mail = ''.

gwa_addr2-e_mail = ''.

gwa_addondata-changed = 'X'.

gwa_addondata-kunnr = gwa_kna1-kunnr.

gwa_addr-addr_no = gwa_kna1-adrnr.

gwa_addr2-addr_no = gwa_kna1-adrnr.

lv_kna1-land1 = gwa_kna1-land1.

lv_kna1-adrnr = gwa_kna1-adrnr.

CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'

EXPORTING

i_kna1 = lv_kna1

i_bapiaddr1 = gwa_addr

i_bapiaddr2 = gwa_addr2

i_customer_is_consumer = 'X'

pi_postflag = 'X'

pi_cam_changed = 'X'

pi_add_on_data = gwa_addondata

IMPORTING

e_kunnr = lv_kna2

  • o_kna1 = kna1

  • TABLES

EXCEPTIONS

client_error = 1

kna1_incomplete = 2

knb1_incomplete = 3

knb5_incomplete = 4

knvv_incomplete = 5

kunnr_not_unique = 6

sales_area_not_unique = 7

sales_area_not_valid = 8

insert_update_conflict = 9

number_assignment_error = 10

number_not_in_range = 11

number_range_not_extern = 12

number_range_not_intern = 13

account_group_not_valid = 14

parnr_invalid = 15

bank_address_invalid = 16

tax_data_not_valid = 17

no_authority = 18

company_code_not_unique = 19

dunning_data_not_valid = 20

knb1_reference_invalid = 21

cam_error = 22

OTHERS = 23.

.

if sy-subrc = 0.

concatenate 'Following' gwa_kna1-kunnr 'have been changed to blank' into lv_charr separated by space.

write :/ lv_charr.

endif.

ENDLOOP.

ENDIF.

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question