Quantcast
Channel: SCN: Message List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 3125

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 3125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>