Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Memory ID Problem

Former Member
0 Likes
777

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.....

3 REPLIES 3
Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
671

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

Read only

Former Member
0 Likes
671

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'.

Read only

Former Member
0 Likes
671

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.