‎2014 Jun 04 9:15 AM
Hello All,
We have developed a bdc for hiring action. In bdc we are capturing internally generated personnel no.s using import/export statements.
i have exported personnel no from badi and importing it into bdc program for display.
please find code below inside badi.
IF new_innnn-infty EQ '0001'.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = new_innnn
IMPORTING
pnnnn = i0001.
EXPORT i0001 = i0001 TO MEMORY ID 'PAR'.
ENDIF.
Please find syntax in report.
IMPORT i0001 FROM MEMORY ID 'PAR'.
The problem is when i'm executing tcode for first time pernr's are not loaded into memory id and hence displaying blank in report.
And when i'm executing second time it's working perfectly fine.
Please guide on how to resolve this error.....
‎2014 Jun 04 9:22 AM
Hello Tushar
Set a break-point and check. May be the code b/w if endif is not getting exeucted for first time
IF new_innnn-infty EQ '0001'.
break-point. " execute for first and second time .
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = new_innnn
IMPORTING
pnnnn = i0001.
EXPORT i0001 = i0001 TO MEMORY ID 'PAR'.
ENDIF.
Thanks
‎2014 Jun 04 9:26 AM
If you want the personnel number, export the personnel number to its memory ID.
EXPORT i0001-pernr TO MEMORY ID 'PER'. |
IMPORT lv_pernr FROM MEMORY ID 'PER'.
‎2014 Jun 04 9:40 AM
Instead of BDC, why dont you use HR_INFOTYPE_OPERATION or HR_MAINTAIN_MASTERDATA or HR_PAD_HIRE_EMPLOYEE to create/hire an employee?
Once employee is hired using the above FM, you could then use BDC on PA30 or HR_INFOTYPE_OPERATION for other infotypes.
For HR_MAINTAIN_MASTERDATA to create/hire a new employee, pass NO_EXISTENCE_CHECK as 'X' for internally generated employee number.