PM Partner Update
Mevcut muhataplar PM_PARTNER_GET fonksiyonu ile alınır,
Değiştiirlmek istenen muhatap türü daha önceden var ise güncellenir, yok ise eklenir.
Hazırlanan muhatap listesi PM_PARTNER_UPDATE fonksiyonuna verilir.
Commit ŞART....
Dikkat edilmesi gereken hususlar :
- PARVW Conversion, AŞ=>AG
- counter = ls_ihpa_FULL-counter + 1 ya da 1(yeni muhatap)
REPORT ZMEHO_TEST_003.
constants: updkz_old(1) TYPE C VALUE ` `, "Keine Veraenderung
updkz_new(1) TYPE C VALUE `I`, "Neue Position
updkz_update(1) TYPE C VALUE `U`, "Geaenderte Position
updkz_delete(1) TYPE C VALUE `D`, "Löschen
updkz_inher(1) TYPE C VALUE `E`, "Vererbt
updkz_delphy(1) TYPE C VALUE `L`. "Physisch löschen
types: begin of ty_return ,
MSG_TYPE Type c , "İşlem Durumu ( S-Success E-Error)
MSG_TXT Type BAPI_MSG, " İleti metni
end of ty_return.
TYPES: begin of TY_equi,
equnr TYPE equnr,
OBJNR Type J_OBJNR,
PARVW_INPUT Type PARVW,
PARVW_OUTPUT Type PARVW,
parnr Type parnr,
end of TY_equi.
parameters: p_equnr type equnr,
p_newvw type PARVW,
p_newpr type parnr.
start-of-selection.
perform f_process.
end-of-selection.
form f_process.
data: ls_equi type equi.
data: ls_ekipman type TY_equi.
data: ls_return type ty_return.
clear ls_equi.
select single * into ls_equi
from equi where equnr = p_equnr.
check sy-subrc eq 0.
ls_ekipman-equnr = ls_equi-equnr.
ls_ekipman-objnr = ls_equi-objnr.
ls_ekipman-parvw_input = p_newvw.
ls_ekipman-parnr = p_newpr.
perform f_change_partner using ls_ekipman changing ls_return .
if ls_return-msg_type = `S`.
call function `BAPI_TRANSACTION_COMMIT`
exporting
wait = `X`.
endif.
write: ls_return-msg_type , `-` ,ls_return-msg_txt.
endform.
form f_change_partner using p_rm_edit type ty_equi
changing c_hn_sonuc type ysfr_s_return.
data: lt_ihpa_time type eam_t_ihpa_time.
data: lt_ihpa_tab type standard table of ihpavb.
data: lt_ihpa_FULL type standard table of ihpavb.
data: ls_ihpa_tab type ihpavb.
data: ls_ihpa_FULL type ihpavb.
data: ls_xihpa type ihpavb.
data: lt_xihpa type standard table of ihpavb.
* call function `CONVERSION_EXIT_PARVW_INPUT`
* exporting
* input = p_rm_edit-parvw_output
* IMPORTING
* OUTPUT = p_rm_edit-parvw_input
* .
call function `PM_PARTNER_GET`
exporting
objnr = p_rm_edit-objnr
I_FROM_DB = `X`
importing
* DIADR_WA =
et_ihpa_time = lt_ihpa_time
tables
ihpa_tab = lt_ihpa_tab
* IHPA_TAB_BEFORE =
.
lt_ihpa_FULL[] = lt_ihpa_tab[].
delete lt_ihpa_tab where kzloesch = `X`.
sort lt_ihpa_tab by parvw.
sort lt_ihpa_FULL by parvw counter.
read table lt_ihpa_tab into ls_ihpa_tab with key parvw = p_rm_edit-parvw_input BINARY SEARCH.
if sy-subrc eq 0."Kayıt var Update olacak
ls_xihpa = ls_ihpa_tab.
ls_xihpa-updkz = updkz_update.
ls_xihpa-counter = ls_ihpa_tab-counter.
else."Kayıt yoh, Insert olacak
ls_xihpa-updkz = updkz_new.
read table lt_ihpa_FULL into ls_ihpa_FULL with key parvw = p_rm_edit-parvw_input BINARY SEARCH.
if sy-subrc eq 0.
ls_xihpa-counter = ls_ihpa_FULL-counter + 1.
else.
ls_xihpa-counter = 1.
endif.
endif.
ls_xihpa-mandt = sy-mandt.
ls_xihpa-objnr = p_rm_edit-objnr.
ls_xihpa-parvw = p_rm_edit-parvw_input. "
* ls_xihpa-parvw_ext = `AŞ`.
ls_xihpa-erdat = sy-datum.
ls_xihpa-erzeit = sy-uzeit.
ls_xihpa-ernam = sy-uname.
ls_xihpa-aedat = sy-datum.
ls_xihpa-aezeit = sy-uzeit.
ls_xihpa-aenam = sy-uname.
call function `CONVERSION_EXIT_ALPHA_INPUT`
exporting
input = p_rm_edit-parnr
importing
output = ls_xihpa-parnr.
append ls_xihpa to lt_xihpa.
if not lt_xihpa[] is initial.
call function `PM_PARTNER_UPDATE`
tables
fxihpa = lt_xihpa.
case sy-subrc.
when 0.
c_hn_sonuc-msg_type = `S`.
c_hn_sonuc-msg_txt = `success`.
when others.
c_hn_sonuc-msg_type = `E`.
c_hn_sonuc-msg_txt = `errorrrr`.
endcase.
endif.
endform.