2022 May 04 10:04 PM
Hi guys,
Im trying to do a CRUD with this function module ADDR_COM_MAINTAIN
Create worked with this code
data: lt_adrcomc type table of adrcomc,
ls_adrcomc type adrcomc.
data: ls_commtab type adsmtp,
lt_commtab like table of ls_commtab,
lv_return type ad_retcode,
lv_email type adr6-smtp_addr.
lv_email = s_email+3.
"Verifica se já existe
select single COUNT(*)
from kna1
join adr6
on adr6~addrnumber = kna1~adrnr
where adr6~addrnumber = gv_adrnr AND
kna1~kunnr in s_kunnr AND
adr6~smtp_addr = lv_email.
if sy-subrc eq 0.
perform process_data.
perform alv.
endif.
ls_commtab-smtp_addr = lv_email. "Email
ls_commtab-remark = 'SALDO DE REMESSAS (NÃO ALTERAR)'.
ls_commtab-updateflag = 'I'. "FLAG FOR INSERT
APPEND ls_commtab TO lt_commtab.
call function 'ADDR_COMM_MAINTAIN'
exporting
address_number = gv_adrnr
date_from = '00010101'
language = sy-langu
table_type = 'ADSMTP' "Constant
check_address = 'X'
iv_time_dependence = 'X'
iv_consider_adrcomc_for_insert = 'X'
importing
returncode = lv_return
tables
comm_table = lt_commtab.
if sy-subrc = 0.
call function 'ADDR_MEMORY_SAVE'.
commit work.
endif.
I thought that changing the updateflag from 'I' to 'D' for delete and 'U' for update would work, but it is not
Does someone know what im doing wrong or another way of deleting and inserting into client emails using address number
Hi guys,
Im trying to do a CRUD with this function module ADDR_COM_MAINTAIN
Create worked with this code
data: lt_adrcomc type table of adrcomc,
ls_adrcomc type adrcomc.
data: ls_commtab type adsmtp,
lt_commtab like table of ls_commtab,
lv_return type ad_retcode,
lv_email type adr6-smtp_addr.
lv_email = s_email+3.
"Verifica se já existe
select single COUNT(*)
from kna1
join adr6
on adr6~addrnumber = kna1~adrnr
where adr6~addrnumber = gv_adrnr AND
kna1~kunnr in s_kunnr AND
adr6~smtp_addr = lv_email.
if sy-subrc eq 0.
perform process_data.
perform alv.
endif.
ls_commtab-smtp_addr = lv_email. "Email
ls_commtab-remark = 'SALDO DE REMESSAS (NÃO ALTERAR)'.
ls_commtab-updateflag = 'I'. "FLAG FOR INSERT
APPEND ls_commtab TO lt_commtab.
call function 'ADDR_COMM_MAINTAIN'
exporting
address_number = gv_adrnr
date_from = '00010101'
language = sy-langu
table_type = 'ADSMTP' "Constant
check_address = 'X'
iv_time_dependence = 'X'
iv_consider_adrcomc_for_insert = 'X'
importing
returncode = lv_return
tables
comm_table = lt_commtab.
if sy-subrc = 0.
call function 'ADDR_MEMORY_SAVE'.
commit work.
endif.
I thought that changing the updateflag from 'I' to 'D' for delete and 'U' for update would work, but it is not
Does someone know what im doing wrong or another way of deleting and inserting into client emails using address number
2022 May 04 10:04 PM
Thank you for visiting SAP Community to get answers to your questions.
Since you're asking a question here for the first time, I'd like to recommend you with the following steps so you can get the most out of your community membership:
I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.
I hope you find this advice useful, and we're happy to have you as part of SAP Community!
All the best,
-Alex
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |