2009 Jun 22 8:20 AM
hi abapers,
i have a requirement to update actions(PA0000). i am using HR_MAINTAIN_MASTERDATA to update. I want to trigger dynamic actions also at the same time on infotype 0001 so that infotype 0001 can also get updated . can any body suggest the possible way since i am very new to the Dynamic action topic.
Any reply would be highly appreciated.
thanks
Sachin
Edited by: Sachin Gupta on Jun 22, 2009 3:37 PM
hi abapers,
i have a requirement to update actions(PA0000). i am using HR_MAINTAIN_MASTERDATA to update. I want to trigger dynamic actions also at the same time on infotype 0001 so that infotype 0001 can also get updated . can any body suggest the possible way since i am very new to the Dynamic action topic.
Any reply would be highly appreciated.
thanks
Sachin
Edited by: Sachin Gupta on Jun 22, 2009 3:37 PM
2009 Jun 22 11:38 AM
Hi,
You will need to maintain table T588Z for that. If a maintainace view exist for that use SM31 , if not use SE16N to add new entry. Below explanation using SM31:
- run SM31, type in T588Z and choose Find Maintenance Dialog -> choose appropriate view, mine is V_T588Z
- Maintain -> enter 0000 (as you want to maintain dynamic actions for this IT)
- New entries
- first field concerns subtypes so you fill it in only if it must be distinguished according to subtypes
- next one is field - may be left blank than used for entire infotype entry
- next field states when it must be triggered - i.e.06 - during creation/change of IT0000
- Sequence number will most likely be assinged automatically, you have to test it, don't remeber now
- next field is the most important, here yoo set an action ( what must be done when it is triggered) - type F1 so you can see available entires na syntax. What you need is to call a subroutine so enter F
- last field is the code to execute, here type MY_SUBROUTINE_NAME(CUSTOM_PROGRAM_WHERE_IT_IS_STORED)
- save the entry
- last thing you have to do is to create your custom subroutine MY_SUBROUTINE_NAME within program CUSTOM_PROGRAM_WHERE_IT_IS_STORED and do your coding here.
Regrds
Marcin
2009 Jun 22 1:03 PM
hi Marcin,
can u post ur code also as i am new in dynamic action.
thanks
Sachin
2009 Jun 22 1:25 PM
Yup,
In T588Z I have added new entry for IT2002 for subtype 9460. This looks as follows:
*Subtype-- FC -Seq noStep--Variable function part*
-9460----- 4--308
Then I created a report YPLPY_PRO_RE_QUOTAGEN1 and inside it a subroutine DYN_ACTION_GENERATE
report YPLPY_PRO_RE_QUOTAGEN1.
FORM DYN_ACTION_GENERATE.
"here I did my coding, structure P2002 is available here so you can address its components i.e.
PERNR_N = P2002-PERNR.
...
"example code to create IT0015 entry
data: p0015 like p0015.
data: ls_return TYPE bapireturn1,
ls_pskey like pskey.
"fill in the structure
P0015-PERNR = LS_PSKEY-PERNR = P2002-PERNR.
P0015-SUBTY = LS_PSKEY-SUBTY = P0015-LGART = LGART = IT_RET-FIELDVAL.
P0015-BEGDA = LS_PSKEY-BEGDA = DATUM.
P0015-ENDDA = LS_PSKEY-ENDDA = DATUM.
P0015-UNAME = UNAME.
P0015-INFTY = LS_PSKEY-INFTY = '0015'.
CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'
EXPORTING
number = ls_pskey-pernr.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = ls_pskey-infty
number = ls_pskey-pernr
subtype = ls_pskey-subty
validityend = ls_pskey-endda
validitybegin = ls_pskey-begda
record = p0015
operation = 'INS'
dialog_mode = '2'
IMPORTING
return = ls_return.
IF NOT ls_return IS INITIAL AND
ls_return-type EQ 'E'.
MESSAGE e000(38) WITH ls_return-message.
ENDIF.
"unlock the EE
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = ls_pskey-pernr.
ENDFORM.
The code will be triggered once user selects save during IT2002 entry creation (subtype 9460). My code was to create addional IT0015 entry, so inside I used FM HR_INFOTYPE_OPERATION to create new record. This is just part of code so it might not work after copy paste, but will give you an idea how to proceed with new entry creation for different infotype.
Regards
Marcin