cancel
Showing results for 
Search instead for 
Did you mean: 

HR_INFOTYPE_OPERATION not working when called from Dynamic action

Former Member
0 Kudos

Hi ,

Senario : I would like to execute a form from dynamic action which

creates a record in 0015 (Additional payment IT) .

I have writen the code as shown below am using FM HR_INFOTYPE_OPERATION

. When i execute the program from se38 it is creating a record, however it is

not created when it is called from dynamic action..when i debugged the code in

inside the FM HR_INFOTYPE_OPERATION there is a FM HR_MAINTAIN_MASTERDATA where

they are using call dialog (statement) and

sy-oncom = 'N' when called from Dynamic action and

sy-oncom = 'S' when called executed directly.

I tried to change the sy-oncom to S while run from Dynamic action it created

the record.

So Can anyone explain me abt sy-oncom and how can i resolve the issue..

code..

REPORT ZHRPYENH01 .

perFORM TERMIATION_9000.

INCLUDE DBPNPMAC.

----


  • FORM Termiation_9000 *

----


  • ........ *

----


FORM TERMIATION_9000.

INFOTYPES : 0015.

*data : i .

*i ='c'.

*

*break-point.

*message i000(000) with i.

*

TABLES : PRELP.

DATA : P9000 TYPE PA9000." with header line.

DATA : P0000 TYPE STANDARD TABLE OF P0000 WITH HEADER LINE.

  • DATA : P0015 TYPE STANDARD TABLE OF P0015 WITH HEADER LINE.

DATA : HIRE_DATE LIKE SY-DATUM,

TERM_DATE LIKE SY-DATUM.

DATA : MOLGA LIKE T500L-MOLGA VALUE '25',

SEQNR LIKE PC261-SEQNR.

DATA : RGDIR TYPE STANDARD TABLE OF PC261 WITH HEADER LINE.

DATA : ACTUAL_PERIOD LIKE PA9000-RETENTION.

DATA : PNP-SW-FOUND TYPE SY-SUBRC ,

PNP-SY-TABIX TYPE SY-TABIX.

DATA : TER_PERNR LIKE PA0001-PERNR.

DATA : REF_PERNR LIKE PA0001-PERNR.

data : key type BAPIPAKEY.

data : payed_amount type p0015-BETRG.

  • data : future_payment_amount type p0015-BETRG.

data : p0002 like pa0002.

types : begin of t_deduction ,

deducation_date like p0015-begda,

future_payment_amount type p0015-BETRG.

types : end of t_deduction.

  • data : future_deduction type standard table of t_deduction with

*header line.

data : future_deduction type t_deduction .

data : RETURN type BAPIRETURN1.

*data : deduction_p0015 like standard table of p0015 with header line.

data : deduction_p0015 like p0015 .

xxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxx

****Prepare 0015 data for deduction

*deduction for payed amount

clear deduction_p0015.

*refresh deduction_p0015.

deduction_p0015-pernr = REF_PERNR.

*deduction_p0015-pernr = TER_PERNR.

deduction_p0015-lgart = 'M120'.

deduction_p0015-begda = sy-datum + 1 .

deduction_p0015-endda = sy-datum + 1 .

deduction_p0015-BETRG = payed_amount.

deduction_p0015-WAERS = 'SGD'.

deduction_p0015-ZUORD = TER_PERNR.

*append deduction_p0015.

**deduction for future payment amount

*

*loop at future_deduction.

*clear deduction_p0015.

*deduction_p0015-pernr = REF_PERNR.

**deduction_p0015-pernr = TER_PERNR.

*deduction_p0015-lgart = 'M120'.

*deduction_p0015-begda = FUTURE_DEDUCTION-DEDUCATION_DATE.

*deduction_p0015-endda = FUTURE_DEDUCTION-DEDUCATION_DATE.

*deduction_p0015-BETRG = future_deduction-future_payment_amount.

*deduction_p0015-WAERS = 'SGD'.

*deduction_p0015-ZUORD = TER_PERNR.

*append deduction_p0015.

*

*endloop.

          • Create a deduction wage type in 0015 for the employee

break-point.

CLEAR RETURN.

CALL FUNCTION 'BAPI_EMPLOYEET_ENQUEUE'

EXPORTING

NUMBER = REF_PERNR

VALIDITYBEGIN = '18000101'

IMPORTING

RETURN = return

.

if not return is initial.

message E000(000) with

'Referred Employee could not be locked for referal payment deducation,

please try after some time'.

endif.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

INFTY = '0015'

NUMBER = REF_PERNR

  • SUBTYPE = 'M120'

  • OBJECTID =

  • LOCKINDICATOR =

VALIDITYEND = SY-DATUM

VALIDITYBEGIN = SY-DATUM

  • RECORDNUMBER =

RECORD = deduction_p0015

OPERATION = 'COPY'

  • TCLAS = 'A'

DIALOG_MODE = '2'

  • NOCOMMIT =

  • VIEW_IDENTIFIER =

  • SECONDARY_RECORD =

IMPORTING

RETURN = return

KEY = key

.

break-point.

COMMIT WORK.

if not return is initial.

*return-TYPE

*ID

*NUMBER

*MESSAGE

message I000(000) with return-MESSAGE.

endif.

CALL FUNCTION 'BAPI_EMPLOYEET_DEQUEUE'

EXPORTING

NUMBER = REF_PERNR

VALIDITYBEGIN = '18000101'

IMPORTING

RETURN = return

.

xxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxx

Thanks and regards

-Senthil Bala

Message was edited by: senthil bala

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Senthil

Why at all U want a subroutine to create a record in IT0015 through Dynamic action.There are some standard codes available to update infotypes.

Let me give U an example

14 9CON BETRG 4 2 I INS,0015 This will create a record in IT0015 when IT0014 is updated with Wagetype 9CON

14 9CON BETRG 4 3 W P0015-LGART='5400' Set wagetype for IT0015(Here U can use a subroutine call to set the wagetype)

14 9CON BETRG 4 4 W P0015-BETRG=P0014-BETRG set amount for IT0015(Here U can use a subroutine call to get the amount)

14 9CON BETRG 4 5 W P0015-BEGDA=P0014-ENDDA set the dates(Here U can use a subroutine call to set the dates)

Hope this will help U.

Please award points if helpful

suresh_datti
Active Contributor
0 Kudos

If you HAVE to use this function module via Dynamic Action, there is a work around.. put the entire code in a separate Report & SUBMIT that Report from the subroutine that gets invoked in the Dynamic Action. This will isolate the two work processes & eliminate the COMMIT WORK conflict.

~Suresh

Answers (0)