Hello,
I like to update PDS Activity Setup grounp/Key in BADI: /SAPAPO/CURTO_CREATE
*==========Coding sample===================
method /SAPAPO/IF_EX_CURTO_CREATE~CIF_IMPORT.
CONSTANTS:
lc_PM_A01 TYPE /sapapo/cres_name VALUE 'WPM_A01_1000_001',
lc_PM_B01 TYPE /sapapo/cres_name VALUE 'WPM_B01_1000_001',
lc_PM_C01 TYPE /sapapo/cres_name VALUE 'WPM_C01_1000_001',
lc_PM_D01 TYPE /sapapo/cres_name VALUE 'WPM_D01_1000_001'.
.
DATA: lv_matnr TYPE /sapapo/matnr
, lv_ext_matnr TYPE matnr ">>721073
, lv_matid TYPE /sapapo/matid
, ls_locmap TYPE /sapapo/locmap
, lv_103 TYPE /sapapo/mat_char10
, lv_resname TYPE /sapapo/cres_name
, lv_pos TYPE i
, lv_len TYPE i
, lv_res TYPE /sapapo/cdps_setup_item
, lv_set TYPE /sapapo/cdps_setup_item
.
FIELD-SYMBOLS: <fs_trprod> TYPE /sapapo/cif_curto_trprod
, <fs_cif_mode> TYPE /sapapo/cif_curto_mode
, <fs_cif_planopr> TYPE /sapapo/cif_curto_planopr
, <fs_cif_activity> TYPE /sapapo/cif_curto_activity
.
*include zapo2a_ZXCIFUSERU16_1100.
BREAK-POINT 'SCM_800'.
LOOP AT ct_trprod ASSIGNING <fs_trprod>
WHERE ext_locnoto ='1000'.
LOOP AT ct_modes ASSIGNING <fs_cif_mode>.
SELECT SINGLE name FROM /sapapo/reskey INTO lv_resname WHERE NAME IN ('WPM_A01_1000_001', 'WPM_B01_1000_001' , 'WPM_C01_1000_001', 'WPM_D01_1000_001').
CHECK sy-subrc = 0.
LOOP AT ct_activities ASSIGNING <fs_cif_activity> WHERE ext_plannr = <fs_cif_mode>-ext_plannr AND vornr = <fs_cif_mode>-vornr.
CLEAR: lv_res, lv_len, lv_pos, lv_matnr, lv_matid, ls_locmap, lv_103.
lv_matnr = <fs_trprod>-ext_matnr.
* ... get internal Material ID
CALL FUNCTION '/SAPAPO/DM_MATERIAL_GET_MATID'
EXPORTING
iv_matnr = lv_matnr
IMPORTING
ev_matid = lv_matid
EXCEPTIONS
matid_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ... get internal Location ID
CALL FUNCTION '/SAPAPO/LOC_GET_LOCMAP'
EXPORTING
iv_extlocno = <fs_trprod>-ext_locnoto
IMPORTING
es_locmap = ls_locmap.
TRY.
CASE lv_resname.
* ... W13 Resource
WHEN lc_PM_A01.
* ... Retrive additional fields for Setup Key
SELECT SINGLE at103 FROM /sapapo/matloc INTO lv_103
WHERE matid = lv_matid
AND locid = ls_locmap-locid.
CHECK lv_103 IS NOT INITIAL.
MOVE lv_103 TO lv_res.
WHEN OTHERS.
* Ersten 2 Stellen weg
lv_res = lv_ext_matnr+2(10).
ENDCASE.
<fs_cif_activity>-SETUP_KEY = lv_res.
** ... finally check the Key
* CALL FUNCTION '/SAPAPO/DM_SETUP_ITEM_GET_ID'
* EXPORTING
* i_locid = ls_locmap-locid
* i_setup_item = lv_res
* EXCEPTIONS
* not_qualified = 1
* not_found = 2
* OTHERS = 3.
* IF sy-subrc <> 0.
* CONTINUE.
* ELSE.
* <fs_cif_activity>-SETUP_KEY = lv_res.
* ENDIF.
<fs_cif_activity>-SETUP_KEY = 'dd'.
<fs_cif_activity>-r3_rfgrp = 'ccdd'.
CATCH cx_root.
CONTINUE.
ENDTRY.
ENDLOOP.
ENDLOOP.
<fs_cif_activity>-SETUP_KEY = 'AD'.
ENDLOOP.
<fs_cif_activity>-SETUP_KEY = 'dd'.
<fs_cif_activity>-r3_rfgrp = 'ccdd'.
ENDMETHOD.
*==========Coding Sample end================
Debugged and saw value will update CT_activities, but after open PDS, can NOT found any values on PDS.
detail as attached screen showing.
whether anyone know the issue, thanks for your helping.
Regards, Allen Wang