Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 14th, 2018 78 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.     DATA:
  2.       lt_filters     TYPE                   /iwbep/t_mgw_select_option,
  3.       ls_filter      TYPE                   /iwbep/s_mgw_select_option,
  4.       ls_entity      like LINE OF           et_entityset,
  5.       lv_begda1      TYPE                   begda,
  6.       lv_endda1      TYPE                   endda,
  7.       lv_pernr       TYPE                   pernr_d,
  8.       lv_etext       TYPE                   string,
  9.       lv_atext       TYPE                   string,
  10.       lt_range_atext TYPE RANGE OF          atext,
  11.       ls_range_atext LIKE LINE OF           lt_range_atext,
  12.       ls_so          TYPE                   /iwbep/s_cod_select_option,
  13.       lt_order       TYPE                   /iwbep/t_mgw_tech_order,
  14.       ls_order       TYPE                   /iwbep/s_mgw_tech_order,
  15.       lt_objects     TYPE TABLE OF          hrwpc_s_keyobjec,
  16.       lt_pernr       TYPE TABLE OF          pernr_d,
  17.       lt_pernr_uname TYPE TABLE OF          pernr_d,
  18.       lt_pernr_0105  TYPE TABLE OF          pernr_d,
  19.       lt_pernr_0001  TYPE TABLE OF          pernr_d,
  20.       lv_index       TYPE                   i,
  21.       lv_text        TYPE string,
  22.       wa_indx        TYPE                   indx,
  23.       lv_id          TYPE                   c LENGTH 25,
  24.       lt_t528t       TYPE TABLE OF          t528t,
  25.       lt_t554t       TYPE TABLE OF          t554t,
  26.       ls_t528t       TYPE          t528t,
  27.       ls_t554t       TYPE          t554t,
  28.       ls_hrp1000     TYPE hrp1000,
  29.       lt_hrp1000     TYPE TABLE OF hrp1000.
  30.  
  31.     FIELD-SYMBOLS:
  32.       <lt_filters>   TYPE /iwbep/t_mgw_select_option,
  33.       <ls_entityset> LIKE LINE OF et_entityset,
  34.       <ls_data>      TYPE any,
  35.       <ls_field>     TYPE any.
  36.  
  37.     SELECT * FROM t528t INTO TABLE lt_t528t
  38.       WHERE sprsl = sy-langu
  39.         AND otype = 'S'
  40.         AND begda <= sy-datum
  41.         AND endda >= sy-datum.
  42.  
  43. *    SELECT * FROM t554t INTO TABLE lt_t554t
  44. *      WHERE sprsl = sy-langu
  45. *        AND moabw = '50'.
  46.  
  47.     SELECT * FROM hrp1000 INTO TABLE lt_hrp1000
  48.       WHERE plvar = '01'
  49.         AND otype = 'O'
  50.         AND begda <= sy-datum
  51.         AND endda >= sy-datum
  52.         AND langu = sy-langu.
  53.  
  54.     " get all filters from query
  55.     lt_filters = io_tech_request_context->get_filter( )->get_filter_select_options( ).
  56.     lt_order = io_tech_request_context->get_orderby( ).
  57.  
  58.     READ TABLE lt_order INTO ls_order INDEX 1.
  59.  
  60.  
  61.     READ TABLE lt_filters WITH TABLE KEY property = 'ATEXT' INTO ls_filter.
  62.     IF sy-subrc EQ 0.
  63.       LOOP AT ls_filter-select_options INTO ls_so.
  64.         MOVE-CORRESPONDING ls_so TO ls_range_atext.
  65.         DATA(lv_length) = strlen( ls_range_atext ).
  66.         INSERT ls_range_atext INTO TABLE lt_range_atext.
  67.       ENDLOOP.
  68.     ENDIF.
  69.  
  70. *    IF lv_pernr IS INITIAL.
  71. *      lv_pernr = zhrxs_cl_pcr_util=>uname_to_pernr( sy-uname ).
  72. *    ENDIF.
  73.  
  74.     lt_pernr_uname = zhrxs_cl_pcr_util=>get_all_pernr_from_uname( sy-uname ).
  75.  
  76.     LOOP AT lt_pernr_uname INTO lv_pernr.
  77.  
  78.       CLEAR: wa_indx, lv_id.
  79.       wa_indx-aedat = sy-datum.
  80.       wa_indx-usera = sy-uname.
  81.       wa_indx-pgmid = sy-repid.
  82.       CONCATENATE 'ZHR_PP_OADP_' sy-uname INTO lv_id.
  83.       EXPORT p1 = lv_pernr TO DATABASE indx(hk) ID lv_id FROM wa_indx.
  84.  
  85. *-get filter for begda
  86.       READ TABLE lt_filters WITH TABLE KEY property = 'BEGDA' INTO ls_filter.
  87.       IF sy-subrc EQ 0.
  88.         READ TABLE ls_filter-select_options INDEX 1 INTO ls_so.
  89.         IF sy-subrc EQ 0.
  90.           lv_begda1 = |{ ls_so-low(4) }{ ls_so-low+5(2) }{ ls_so-low+8(2) }|.
  91.         ENDIF.
  92.       ELSE.
  93.         lv_begda1 = '18000101'.
  94.       ENDIF.
  95.  
  96. *-get filter for endda
  97.       READ TABLE lt_filters WITH TABLE KEY property = 'ENDDA' INTO ls_filter.
  98.       IF sy-subrc EQ 0.
  99.         READ TABLE ls_filter-select_options INDEX 1 INTO ls_so.
  100.         IF sy-subrc EQ 0.
  101.           lv_endda1 = |{ ls_so-low(4) }{ ls_so-low+5(2) }{ ls_so-low+8(2) }|.
  102.         ENDIF.
  103.       ELSE.
  104.         lv_endda1 = '99991231'.
  105.       ENDIF.
  106.  
  107. *-get filter for employee type
  108.       READ TABLE lt_filters WITH TABLE KEY property = 'ETEXT' INTO ls_filter.
  109.       IF sy-subrc EQ 0.
  110.         READ TABLE ls_filter-select_options INDEX 1 INTO ls_so.
  111.         IF sy-subrc EQ 0.
  112.           lv_etext = ls_so-low.
  113.           REPLACE ALL OCCURRENCES OF '*' IN lv_etext WITH ''.
  114.         ENDIF.
  115.       ELSE.
  116.         lv_etext = 'ZMSS_EE_DIR'.
  117.       ENDIF.
  118.  
  119.       DATA lv_objsel TYPE HRWPC_OBJSEL.
  120.       lv_objsel = lv_etext.
  121.  
  122.       CALL FUNCTION 'HRWPC_RFC_OADP_GET_OBJECTS'
  123.         EXPORTING
  124.           objsel                  = lv_objsel "'ZMSS_EE_DIR'
  125.           begda                   = sy-datum
  126.           endda                   = sy-datum
  127.           user                    = sy-uname
  128.         TABLES
  129.           t_objects               = lt_objects
  130.         EXCEPTIONS
  131.           objsel_not_found        = 1
  132.           objectselection_invalid = 2
  133.           OTHERS                  = 3.
  134.       IF sy-subrc <> 0.
  135. * Implement suitable error handling here
  136.       ENDIF.
  137. *
  138.       LOOP AT lt_objects ASSIGNING FIELD-SYMBOL(<line>).
  139.         APPEND INITIAL LINE TO lt_pernr ASSIGNING FIELD-SYMBOL(<lv_pernr>).
  140.         <lv_pernr> = <line>-objid.
  141.       ENDLOOP.
  142.  
  143.       SELECT pernr FROM pa0105 INTO TABLE lt_pernr_0105
  144.         WHERE begda <= sy-datum
  145.           AND endda >= sy-datum
  146.           AND subty = '0015'
  147.           AND usrid = lv_pernr.
  148.  
  149.       SELECT pernr FROM pa0001 INTO TABLE lt_pernr_0001
  150.         WHERE begda <= sy-datum
  151.           AND endda >= sy-datum
  152.           AND zzbpe = lv_pernr.
  153.  
  154.       APPEND LINES OF lt_pernr_0105 TO lt_pernr.
  155.       APPEND LINES OF lt_pernr_0001 TO lt_pernr.
  156.       CLEAR: lt_objects, lt_pernr_0105, lt_pernr_0001.
  157.     ENDLOOP.
  158.  
  159.     SORT lt_pernr ASCENDING.
  160.     DELETE ADJACENT DUPLICATES FROM lt_pernr.
  161.  
  162.     IF lines( lt_pernr ) = 0.
  163.       RETURN.
  164.     ENDIF.
  165.  
  166.     SELECT * FROM t554t INTO TABLE lt_t554t
  167.       WHERE t554t~sprsl = sy-langu
  168.         AND t554t~moabw = '50'
  169.         AND t554t~atext IN lt_range_atext.
  170. .
  171.  
  172.     SELECT pa0002~pernr, pa0002~vorna, pa0002~nachn, pa2001~awart, pa2001~abwtg, pa2001~begda, pa2001~endda, pa0001~orgeh, pa0001~plans, pa0000~stat2
  173.       FROM pa0002
  174.       JOIN pa2001 ON pa0002~pernr EQ pa2001~pernr
  175.       JOIN pa0001 ON pa0001~pernr EQ pa0002~pernr
  176.       JOIN pa0000 ON pa0000~pernr EQ pa0002~pernr
  177.       INTO TABLE @DATA(lt_report)
  178.       FOR ALL ENTRIES IN @lt_pernr
  179.  
  180.       WHERE pa2001~begda LE @lv_endda1
  181.       AND pa2001~endda GE @lv_begda1
  182.       AND pa0002~begda LE @sy-datum
  183.       AND pa0002~endda GE @sy-datum
  184.       AND pa0001~begda LE @sy-datum
  185.       AND pa0001~endda GE @sy-datum
  186.       AND pa0000~stat2 EQ 3
  187.       AND pa0002~pernr EQ @lt_pernr-table_line.
  188.  
  189.     lv_id = 1.
  190.     LOOP AT lt_report ASSIGNING <ls_data>.
  191.       MOVE-CORRESPONDING <ls_data> TO ls_entity.
  192.       lv_text = '<ls_data>-plans'.
  193.       ASSIGN (lv_text) TO <ls_field>.
  194.       IF <ls_field> IS ASSIGNED.
  195.         READ TABLE lt_t528t INTO ls_t528t WITH KEY plans = <ls_field>.
  196.         ls_entity-plstx = ls_t528t-plstx.
  197.       ENDIF.
  198.       lv_text = '<ls_data>-awart'.
  199.       ASSIGN (lv_text) TO <ls_field>.
  200.       IF <ls_field> IS ASSIGNED.
  201.         READ TABLE lt_t554t INTO ls_t554t WITH KEY awart = <ls_field>.
  202.         IF sy-subrc = 0.
  203.           ls_entity-atext = ls_t554t-atext.
  204.         ENDIF.
  205.       ENDIF.
  206.       lv_text = '<ls_data>-orgeh'.
  207.       ASSIGN (lv_text) TO <ls_field>.
  208.       IF <ls_field> IS ASSIGNED.
  209.         READ TABLE lt_hrp1000 INTO ls_hrp1000 WITH KEY objid = <ls_field>.
  210.         ls_entity-orgeh = ls_hrp1000-stext.
  211.       ENDIF.
  212.       ls_entity-id = lv_id.
  213.       ADD 1 TO lv_id.
  214.       IF ls_entity-atext IS NOT INITIAL.
  215.         APPEND ls_entity TO et_entityset.
  216.       ENDIF.
  217.       CLEAR: ls_entity, ls_t554t, ls_hrp1000, ls_t528t.
  218.       UNASSIGN <ls_field>.
  219.     ENDLOOP.
  220.  
  221.     "sorting
  222.     IF ls_order-order EQ 'asc'.
  223.       SORT et_entityset ASCENDING BY (ls_order-property).
  224.     ELSEIF ls_order-order EQ 'desc'.
  225.       SORT et_entityset DESCENDING BY (ls_order-property).
  226.     ELSE.
  227.       SORT et_entityset ASCENDING BY begda pernr.
  228.     ENDIF.
  229.  
  230.     LOOP AT et_entityset ASSIGNING <ls_entityset>.
  231.       <ls_entityset>-begda = |{ <ls_entityset>-begda+6(2) }.{ <ls_entityset>-begda+4(2) }.{ <ls_entityset>-begda(4) }|." && '000000'.
  232.       <ls_entityset>-endda = |{ <ls_entityset>-endda+6(2) }.{ <ls_entityset>-endda+4(2) }.{ <ls_entityset>-endda(4) }|.
  233.       SHIFT <ls_entityset>-pernr LEFT DELETING LEADING '0'.
  234.     ENDLOOP.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top