podczas tworzenia zlecenia w IW31 musze dokonac modyfikacji wpisow zwiazanych z operacjami (afvgtab (operations) ). do tego celu chcialem wykorzystac FM BAPI_ALM_ORDER_MAINTAIN - kod mojego programu widoczny jest ponizej:
Kod: Zaznacz cały
* it_methods - header
clear ls_methods.
ls_methods-refnumber = '000001'.
ls_methods-objecttype = 'HEADER'.
ls_methods-method = 'CREATE'.
ls_methods-objectkey = '%00000000001'.
append ls_methods to lt_methods. clear ls_methods.
* IT_HEADER
clear ls_header.
ls_header-orderid = '%00000000001'.
ls_header-order_type = 'OB01'.
ls_header-planplant = caufvd_new-iwerk.
* ls_header-maintplant = caufvd_new-werks.
ls_header-mn_wk_ctr = caufvd_new-vaplz.
ls_header-start_date = caufvd_new-gstrp.
* ls_header-basicstart = sy-uzeit.
ls_header-short_text = caufvd_new-ktext.
* ls_header-FUNCT_LOC =
* ls_header-EQUIPMENT =
* ls_header-pmacttype = .
append ls_header to lt_header. clear ls_header.
** it_methods - PARTNER
* ls_methods-refnumber = '000001'.
* ls_methods-objecttype = 'PARTNER'.
* ls_methods-method = 'CREATE'.
* ls_methods-objectkey = '%00000000001'.
* APPEND ls_methods TO lt_methods. CLEAR ls_methods.
* CLEAR ls_partner.
* ls_partner-orderid = '%00000000001'.
** LS_partner-partn_role = . "'ZC'. "'VW'. "'AG'.
** LS_partner-partner = . " '57734'. "'C6130'.
* APPEND ls_partner TO lt_partner. CLEAR ls_partner.
* nadanie statusu uzytkownika
xstatus-user_st_text = 'GIS '.
xstatus-langu = sy-langu.
xstatus-inactive = ' '.
xstatus-change_event = '01'.
append xstatus to lt_userstat. clear xstatus.
* licznik = licznik + 1.
ls_methods-refnumber = '000001'.
ls_methods-objecttype = 'USERSTATUS'.
ls_methods-method = 'CREATE'.
ls_methods-objectkey(12) = '%00000000001'.
append ls_methods to lt_methods. clear ls_methods.
* LS_METHODS - informacja o pozycjach ktore bedziemy zmieniali
loop at afvgtab_new.
clear objectkey.
clear: ls_methods, ls_operation, ls_operation_up, pozycja.
licznik = licznik + 1.
pozycja = 10 * afvgtab_new-aplzl.
gc_aufnrd = afvgtab_new-aufnrd.
* CONCATENATE afvgtab_new-aufnrd pozycja INTO objectkey.
concatenate '%00000000001' pozycja into objectkey.
ls_methods-objectkey = objectkey.
ls_methods-refnumber = licznik.
ls_methods-objecttype = 'OPERATION'.
ls_methods-method = 'CREATE'.
append ls_methods to lt_methods. clear ls_methods.
* IT_OPERATION - przypisanie wartosci
ls_operation-activity = '0010'.
ls_operation-control_key = 'PM01'.
ls_operation-description = caufvd_new-ktext.
ls_operation-usr00 = afvgtab_new-usr00.
ls_operation-usr04 = afvgtab_new-usr04.
ls_operation-use04 = afvgtab_new-use04.
append ls_operation to lt_operation. clear ls_operation.
** IT_OPERATION_UP - informacja ktore pola sa zmieniane
* ls_operation_up-usr00 = 'X'.
* ls_operation_up-usr04 = 'X'.
* ls_operation_up-use04 = 'X'.
*
* APPEND ls_operation_up TO lt_operation_up. CLEAR ls_operation_up.
endloop.
* IT_METHODS - SAVE
ls_methods-refnumber = '000001'.
ls_methods-objecttype = ''.
ls_methods-method = 'SAVE'.
ls_methods-objectkey = '%00000000001'.
append ls_methods to lt_methods. clear ls_methods.
call function 'BAPI_ALM_ORDER_MAINTAIN'
tables
it_header = lt_header
it_methods = lt_methods
it_userstatus = lt_userstat
it_operation = lt_operation
it_operation_up = lt_operation_up
return = lt_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
call function 'DEQUEUE_ALL'
exporting
_synchron = 'X'.
commit work and wait.
Kod: Zaznacz cały
1 *----------------------------------------------------------------------*
2 ***INCLUDE LCOBHFIH .
3 *----------------------------------------------------------------------*
4
5 *&---------------------------------------------------------------------*
6 *& Form caufv_upd_IH
7 *&---------------------------------------------------------------------*
8 * text
9 *----------------------------------------------------------------------*
10 * -->P_CAUFVD_UPD text
11 *----------------------------------------------------------------------*
12 FORM caufv_upd_IH USING CAUFVD_UPD structure CAUFVD .
13
14 DATA: FLG_NO_VBKZ.
15 DATA: FLG_OCM.
16
17
18 read table caufv_bt index caufvd_upd-indbt transporting flg_enq.
19 if sy-subrc = 0.
20 * Order is locked --> normal Update
21 if not caufv_bt-flg_enq is initial.
22 INCLUDE LCOBHIC2.
23 else.
24 * Order is not locked --> Update without Updateflag ! ==> CO888
25 CALL FUNCTION 'CO_BT_CAUFV_UPD'
26 EXPORTING
27 CAUFVD_UPD = caufvd_upd
28 FLG_NO_VBKZ = yx.
29 endif.
30 else.
>>>>> message x888 with text-kop.
32 endif.
33
34 ENDFORM. " caufv_upd_IH
1. co robie zle?
2. czy mozna wykorzystac jakis standardowy user-exit, w ktorym bedzie mozliwosc dokonania modyfikacji dla operacji i modyfikacje te zostana zapamietane przez system?
wielkie dzieki za pomoc.
pozdrowienia dla Was wszystkich.