Application Development 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: 

HR to CRM idoc BP not created when i don't send IT 0006

Emre_tr
Active Participant
0 Kudos

Hi all,

we have an integration between HR and CRM system.when we send all required infotypes from HR to CRM system,then business partner is created succesfully in CRM system.Everyday a job is running read change pointers and send all infotypes to CRM system.

My problem is when hire a person in HR we don't create address infotype (0006) at first, so in CRM system business partners doesn't create. they don't want create address when hire a new person, so i locked.

I tried to insert a initial address infotype for a person into idoc_data inbound badi in CRM. but business partner isn't created.

I insert the segments E1PITYP and E1P0006 in idoc data but don't create.

how can i solve this problem, any ideas?

in inbound badi my code is like this;

add 1 to lv_segnum.

CLEAR ls_e1pityp.CLEAR wa_idoc_data.

ls_e1pityp-plvar = '01'.

ls_e1pityp-otype = 'P'.

ls_e1pityp-objid = s_pernr-pernr.

ls_e1pityp-infty = '0006'.

ls_e1pityp-subty = '1'.

ls_e1pityp-begda = '18000101'.

ls_e1pityp-endda = '99991231'.

wa_idoc_data-segnam = 'E1PITYP'.

wa_idoc_data-sdata = ls_e1pityp.

wa_idoc_data-mandt = s_pernr-mandt.

wa_idoc_data-docnum = s_pernr-docnum.

wa_idoc_data-segnum = lv_segnum.

wa_idoc_data-hlevel = 3.

wa_idoc_data-DTINT2 = s_pernr-DTINT2.

wa_idoc_data-psgnum = 1.

APPEND wa_idoc_data TO idoc_data.

add 1 to lv_segnum.

CLEAR ls_e1p0006.CLEAR wa_idoc_data.

ls_e1p0006-pernr = s_pernr-pernr.

ls_e1p0006-infty = '0006'.

ls_e1p0006-subty = '1'.

ls_e1p0006-endda = '99991231'.

ls_e1p0006-begda = sy-datum.

ls_e1p0006-aedtm = sy-datum.

ls_e1p0006-uname = sy-uname.

ls_e1p0006-anssa = '1'.

ls_e1p0006-LAND1 = 'EN'.

wa_idoc_data-mandt = s_pernr-mandt.

wa_idoc_data-docnum = s_pernr-docnum.

wa_idoc_data-segnam = 'E1P0006'.

wa_idoc_data-sdata = ls_e1p0006.

wa_idoc_data-segnum = lv_segnum.

wa_idoc_data-hlevel = '4'.

wa_idoc_data-DTINT2 = s_pernr-DTINT2.

wa_idoc_data-psgnum = lv_psgnum.

APPEND wa_idoc_data to idoc_data.

Thanks

1 ACCEPTED SOLUTION

Emre_tr
Active Participant
0 Kudos

i solved.

insert E1PITYP and E1P0006 line after that personnel's E1PLOGI line in inbound badi and business partners are created succesfully.

7 REPLIES 7

Emre_tr
Active Participant
0 Kudos

i solved.

insert E1PITYP and E1P0006 line after that personnel's E1PLOGI line in inbound badi and business partners are created succesfully.

Former Member
0 Kudos

Hi Emre,

We have a similar kind of requirement in SRM.Can you please let me know the inbound badi name which you have used will just check if it matches with SRM.

Thanks.

Regards,

Kalyani

Emre_tr
Active Participant
0 Kudos

Hi, i copied IDOC_INPUT_HRMD  and created Z_IDOC_INPUT_HRMD function module and write my codes.

Former Member
0 Kudos

Hi Emre,

Thanks.Solution provided by you gave me a hint to fix my issue.

But unfortunately even i got struck in the idoc sequence.With my code the segments E1PITYP and E1P0006 are being added at the end hence Business partner is not getting created in SRM. As you  mentioned i tried several ways to insert E1PITYP and E1P0006 after personnel's E1PLOGI line but it didn't worked.The idoc node sequence is missing.

As am very much new to this concept can you please provide me the sample code you have used to set the sequence which is very helpful for me to fix the issue.

Thanks in advance.

Thanks.

Regards,

Kalyani

Emre_tr
Active Participant
0 Kudos

Here is my code, hope it helps you.

***** Adres sorunu için eklendi. 08.11.2008

  TYPES : BEGIN OF t_pernr ,

           pernr(8),

           mandt like edidd-mandt,

           docnum like edidd-docnum,

           DTINT2 like edidd-DTINT2,

         END OF t_pernr.

  DATA gt_pernr TYPE TABLE OF t_pernr.

  DATA s_pernr TYPE t_pernr.

  DATA : wa_idoc_data  TYPE edidd,

         ls_e1p0000       TYPE e1p0000,

         ls_e1p0006       TYPE e1p0006,

         l_partner(10),

         ls_but020 TYPE but020.

    DATA  ls_e1pityp    TYPE e1pityp.

data lv_segnum type i.

data lv_PSGNUM type i.

  LOOP AT idoc_data INTO wa_idoc_data.

    if wa_idoc_data-segnam = 'E1P0000' or

       wa_idoc_data-segnam = 'E1P0001' or

       wa_idoc_data-segnam = 'E1P0002' .

      ls_e1p0000 = wa_idoc_data-sdata.

      s_pernr-pernr = ls_e1p0000-pernr.

      s_pernr-mandt = wa_idoc_data-mandt.

      s_pernr-docnum = wa_idoc_data-docnum.

      s_pernr-DTINT2 = wa_idoc_data-DTINT2.

      APPEND s_pernr to gt_pernr.

    endif.

    lv_segnum = wa_idoc_data-segnum.

    if lv_psgnum < wa_idoc_data-psgnum.

    lv_psgnum = wa_idoc_data-psgnum.

    endif.

  ENDLOOP.

  SORT gt_pernr by pernr.

  DELETE ADJACENT DUPLICATES FROM gt_pernr comparing pernr.

  DATA l_cnt TYPE i.

add 1 to lv_psgnum.

  LOOP AT gt_pernr INTO s_pernr.

    CLEAR l_cnt.

    LOOP AT idoc_data INTO wa_idoc_data WHERE segnam = 'E1P0006'.

      ls_e1p0006 = wa_idoc_data-sdata.

      IF ls_e1p0006-pernr = s_pernr-pernr.

        l_cnt = 1.EXIT.

      ENDIF.

    ENDLOOP.

    IF l_cnt = 0.

      add 1 to lv_segnum.

      CLEAR ls_e1pityp.CLEAR wa_idoc_data.

      ls_e1pityp-plvar  = '01'.

      ls_e1pityp-otype = 'P'.

      ls_e1pityp-objid = s_pernr-pernr.

      ls_e1pityp-infty = '0006'.

      ls_e1pityp-subty = '1'.

      ls_e1pityp-begda = '18000101'.

      ls_e1pityp-endda = '99991231'.

      wa_idoc_data-segnam = 'E1PITYP'.

      wa_idoc_data-sdata = ls_e1pityp.

      wa_idoc_data-mandt = s_pernr-mandt.

      wa_idoc_data-docnum = s_pernr-docnum.

      wa_idoc_data-segnum = lv_segnum.

      wa_idoc_data-hlevel = 3.

      wa_idoc_data-DTINT2 = s_pernr-DTINT2.

      wa_idoc_data-psgnum = 1.

      APPEND wa_idoc_data TO idoc_data.

      add 1 to lv_segnum.

      CLEAR ls_e1p0006.CLEAR wa_idoc_data.

      ls_e1p0006-pernr = s_pernr-pernr.

      ls_e1p0006-infty = '0006'.

      ls_e1p0006-subty = '1'.

      ls_e1p0006-endda = '99991231'.

      ls_e1p0006-begda = sy-datum.

      ls_e1p0006-aedtm = sy-datum.

      ls_e1p0006-uname = sy-uname.

      ls_e1p0006-anssa = '1'.

      ls_e1p0006-LAND1 = 'TR'.

      wa_idoc_data-mandt = s_pernr-mandt.

      wa_idoc_data-docnum = s_pernr-docnum.

      wa_idoc_data-segnam = 'E1P0006'.

      wa_idoc_data-sdata = ls_e1p0006.

      wa_idoc_data-segnum = lv_segnum.

      wa_idoc_data-hlevel = '4'.

      wa_idoc_data-DTINT2 = s_pernr-DTINT2.

      wa_idoc_data-psgnum = lv_psgnum.

      APPEND wa_idoc_data to idoc_data.

    ENDIF.

  ENDLOOP.

*******************************************

  CALL FUNCTION 'IDOC_INPUT_HRMD'

    EXPORTING

      input_method          = input_method

      mass_processing       = mass_processing

    IMPORTING

      in_update_task        = in_update_task

      call_transaction_done = call_transaction_done

      workflow_result       = workflow_result

      application_variable  = application_variable

    TABLES

      idoc_contrl           = idoc_contrl

      idoc_data             = idoc_data

      idoc_status           = idoc_status

      return_variables      = return_variables

      serialization_info    = serialization_info

    EXCEPTIONS

      wrong_function_called = 1

      OTHERS                = 2.

Former Member
0 Kudos

Hi Emre,

Infotype 0006 is really necessary in this interface. You may find a way to change the BADI but honestly I don't think it should be done.

If you schedule the report HRALXSYNC to run periodically then the BP will be created by the moment the IT0006 is created in your HR system (even if the employee and its CP was created one moment in past).


BR,

Anaer

0 Kudos

Hi Anaer,

In a normal way you're right but in our scenario we had to transfer personel without address info to CRM  system at that moment.