Skip to Content
0
Former Member
Oct 23, 2006 at 02:35 AM

HR_INFOTYPE_OPERATION not working when called from Dynamic action

173 Views

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