Inserire/modificare l’indirizzo dell’equipment nel Tab Locazione in ABAP
Allego il programma per modificare l’indirizzo:
*&---------------------------------------------------------------------*
*& Report
Z_CHANGE_ADDRESS_EQUI
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_change_address_equi.
TABLES: addr1_data.
TYPES: BEGIN OF ty_equi,
equnr TYPE
equi-equnr,
begru TYPE
equi-begru,
eqtyp TYPE
equi-eqtyp,
objnr TYPE
equi-objnr,
iloan TYPE
equz-iloan,
adrnri TYPE
iloa-adrnri,
adrnr TYPE
iloa-adrnr,
country TYPE adrc-country,
END OF ty_equi.
PARAMETERS: p_equi TYPE
equnr,
p_name1 TYPE addr1_data-name1,
p_name2 TYPE addr1_data-name2,
p_name3 TYPE addr1_data-name3,
p_name4 TYPE addr1_data-name4,
p_count TYPE addr1_data-country.
DATA: lt_return
TYPE bapiret2_t,
lt_bapicusadr TYPE STANDARD TABLE OF bapicusadr,
lwa_bapicusadr TYPE
bapicusadr,
lv_abort TYPE c,
lwa_itob_rec TYPE itob,
lwa_equipment TYPE ty_equi,
equipment_attributes TYPE itob.
CONSTANTS: gc_dt_din TYPE datbi
VALUE '99991231'.
START-OF-SELECTION.
SELECT SINGLE
a~equnr a~begru
a~eqtyp a~objnr
b~iloan c~adrnri c~adrnr
g~country
FROM equi AS a
INNER JOIN equz AS
b ON ( a~equnr = b~equnr AND
b~datbi = gc_dt_din )
INNER JOIN iloa AS
c ON ( b~iloan = c~iloan )
LEFT OUTER JOIN adrc
AS g ON ( c~adrnr = g~addrnumber )
INTO lwa_equipment
WHERE a~equnr = p_equi.
IF sy-subrc = 0.
FREE: lt_return[], lt_bapicusadr[].
CLEAR: lwa_bapicusadr.
lwa_bapicusadr-name =
p_name1.
lwa_bapicusadr-name_2 = p_name2.
lwa_bapicusadr-name_3 = p_name3.
lwa_bapicusadr-name_4 = p_name4.
lwa_bapicusadr-country
= p_count.
APPEND lwa_bapicusadr TO
lt_bapicusadr.
MOVE-CORRESPONDING lwa_equipment TO lwa_itob_rec.
* FM per gestire l'indirizzo
(crea/modifica)
CALL FUNCTION 'CRM_ADDRESS_CHANGE_OS'
IMPORTING
et_bapiret2 =
lt_return
TABLES
it_bapicusadr = lt_bapicusadr
* it_bapicustel =
* it_bapicusfax =
* it_bapiadsmtp =
CHANGING
ev_abort = lv_abort
cs_itob = lwa_itob_rec.
CHECK lv_abort IS
INITIAL.
*Associamo l'indirizzo
all'equipmeno
CALL FUNCTION 'ITOB_EQUIPMENT_READ_SINGLE'
EXPORTING
i_objnr = lwa_equipment-equnr
* IMPORTING
* e_object_rec = lwa_itob_rec
EXCEPTIONS
not_successful = 1
OTHERS = 2.
.
IF sy-subrc
<> 0.
* Implement suitable error
handling here
ENDIF.
MOVE-CORRESPONDING lwa_itob_rec TO equipment_attributes.
CALL FUNCTION 'ITOB_EQUIPMENT_MODIFY_SINGLE'
EXPORTING
i_filter_data =
abap_off
i_write_buffer = abap_true
i_post_buffer =
abap_true
i_object_rec =
equipment_attributes
* IMPORTING
* e_object_rec = lwa_itob_rec
EXCEPTIONS
not_successful = 1
OTHERS = 2.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
.
ENDIF.
ENDIF.
END-OF-SELECTION.
Eseguiamo il programma inserendo i seguenti parametri di input
Otteniamo il seguente risultato
1. SAP EWM (Extended Warehouse Management)
3. SAP VIM (Vendor Invoice Management)
>>> RECENSIONI DEI LIBRI su Amazon Kindle <<<
Ebook: SAP MM: https://www.amazon.it/dp/B0C3MKD9BR#customerReviews
Ebook: SAP MII: https://www.amazon.it/dp/B0C4392MY9#customerReviews
Ebook: SAP VIM: https://www.amazon.it/dp/B0C6FBK8QN#customerReviews
Nessun commento:
Posta un commento