2012 Feb 11 9:11 AM
HI,
while hiring in pa40. infotype 0001
if company code is 7000. i need gsber to be default 'TTT1'. so i worte this coding. but it is not working.
if sy-tcode = 'PA40'.
IF INNNN-INFTY EQ '0001'.
DATA: wa_P0001 like P0001.
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN
EXPORTING
PRELP = INNNN
IMPORTING
PNNNN = wa_P0001.
After this coding if i keep debug wa_p0001 is not filling. it is empty.
CASE wa_P0001-BUKRS .
WHEN '7000'.
wa_P0001-GSBER = 'TTT1'.
*WHEN '0002'.
*wa_P0001-GSBER = 'B002'.
ENDCASE.
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PNNNN_TO_PRELP
EXPORTING
PNNNN = wa_P0001
IMPORTING
PRELP = INNNN.
endif.
endif.
can any one give better option for this.
Thank you
Rajesh.
2012 Feb 11 1:36 PM
Hi,
I think you are writing this code in 'ZXPADU01' , which is PBO event.
By this time company code data is not entered on 0001 screen for hiring.
Below WA_P0001 is not filled ..
if sy-tcode = 'PA40'.
IF INNNN-INFTY EQ '0001'.
DATA: wa_P0001 like P0001.
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN
EXPORTING
PRELP = INNNN
IMPORTING
PNNNN = wa_P0001.
.
.
.
try writing the code in PAI event .( Include ZXPADU02)
Regards,
Srini.