Advertisement
Guest User

Untitled

a guest
May 29th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 4.47 KB | None | 0 0
  1.   METHOD cats_2010.
  2.  
  3.     DATA: lo_catch    TYPE REF TO cx_root,
  4.           lt_messages TYPE bapiret2_t,
  5.           lv_text     TYPE string,
  6.           ls_log      TYPE zmd_api_log,
  7.           mapped      TYPE p2010,
  8.           p2010       TYPE p2010,
  9.           lt_remspec  TYPE TABLE OF bapi7012_2,
  10.           ls_remspec  TYPE bapi7012_2.
  11.  
  12.     CREATE OBJECT message_handler.
  13.  
  14.     me->collect_custom_message(
  15.       EXPORTING
  16.         message_type       = 'S'
  17.         msgtext            = '<<START UPDATE|' && record-infty && '|' && record-subty && '|' && record-begda && '|' && record-endda && '>>'
  18.       CHANGING
  19.         message_handler_to =  me->a_message_handler_all
  20.   ).
  21.  
  22.     me->additional_change_cats(
  23.       CHANGING
  24.         control    = control
  25.         additional = additional
  26.     ).
  27.  
  28.     ls_log-method       = get_stack_event_by_depth( 2 ). "2 means this method
  29.     ls_log-umode        = control-umode.
  30.     ls_log-infty        = record-infty.
  31.     ls_log-epernr       = record-pernr.
  32.     ls_log-data         = get_log_data_from_raw( record ).
  33.     ls_log-data_add     = get_log_data_from_raw( additional ).
  34.     ls_log-reference_id = control-reference_id.
  35.  
  36.     APPEND ls_log TO a_log.
  37.  
  38.     TRY.
  39.  
  40.         me->map_all(
  41.           EXPORTING
  42.             control         = control
  43.             record_in       = record
  44.           IMPORTING
  45.             record_out      = p2010
  46.             CHANGING
  47.             ok              = ok
  48.             message_handler = message_handler
  49.         ).
  50.  
  51.       CATCH cx_root INTO lo_catch.
  52.         lv_text = lo_catch->get_text( ).
  53.         a_ok_all = ''.
  54.         ok = ''.
  55.  
  56.         me->collect_custom_message(
  57.           EXPORTING
  58.             message_type       = 'E'
  59.             msgtext            =  lv_text
  60.           CHANGING
  61.             message_handler_to =  me->a_message_handler_all
  62.         ).
  63.  
  64.     ENDTRY.
  65.  
  66.     IF a_ok_all = 'X'.
  67.       a_ok_all = ok.
  68.     ENDIF.
  69.  
  70.     me->a_pernr = p2010-pernr.
  71.  
  72.     CLEAR: ls_remspec.
  73.     REFRESH: lt_remspec.
  74.  
  75. *map p2010 to ls_remspec
  76.     ls_remspec-extsystem      = additional-extsystem.
  77.     ls_remspec-extapplication = additional-extapplication.
  78.     ls_remspec-extdocumentno  = additional-extdocumentno.
  79.     ls_remspec-reversed       = additional-reversed.
  80.     ls_remspec-customer_field = additional-customer_field.
  81.     ls_remspec-costcenter     = additional-costcenter.
  82.     ls_remspec-employeenumber = p2010-pernr.
  83.     ls_remspec-validitydate   = p2010-endda.
  84.     ls_remspec-wagetype       = p2010-lgart.
  85.     ls_remspec-no_of_hours    = p2010-stdaz.
  86.     ls_remspec-number         = p2010-anzhl.
  87.     ls_remspec-time_unit      = p2010-zeinh.
  88.  
  89.     APPEND ls_remspec TO lt_remspec.
  90.  
  91.     me->collect_custom_message(
  92.       EXPORTING
  93.         message_type       = 'S'
  94.         msgtext            = '<<START CATS|' && record-infty && '|' && record-subty && '|' && record-begda && '|' && record-endda && '>>'
  95.       CHANGING
  96.         message_handler_to =  me->a_message_handler_all
  97.   ).
  98.  
  99.     CALL FUNCTION 'BAPI_PTMGREXTREMSPEC_INSWCOST'
  100.       TABLES
  101.         remuneration_specification = lt_remspec
  102.         return                     = lt_messages.
  103.  
  104.     READ TABLE lt_messages TRANSPORTING NO FIELDS WITH KEY type = 'E'.
  105.  
  106.     IF sy-subrc = 0.
  107.       a_ok_all = ''.
  108.       ok = ''.
  109.     ENDIF.
  110.  
  111.     LOOP AT lt_messages INTO DATA(lw_messages).
  112.  
  113.       CLEAR: lv_text.
  114.  
  115.       MESSAGE ID lw_messages-id TYPE lw_messages-type NUMBER lw_messages-number
  116.               INTO lv_text
  117.               WITH lw_messages-message_v1 lw_messages-message_v2 lw_messages-message_v3 lw_messages-message_v4.
  118.  
  119.       me->collect_custom_message(
  120.         EXPORTING
  121.           message_type       = lw_messages-type
  122.           msgtext            = lv_text
  123.         CHANGING
  124.           message_handler_to =  me->a_message_handler_all
  125.       ).
  126.  
  127.     ENDLOOP.
  128.  
  129.     IF a_ok_all = 'X'.
  130.       a_ok_all = ok.
  131.     ENDIF.
  132.  
  133.     me->collect_custom_message(
  134.       EXPORTING
  135.         message_type       = 'S'
  136.         msgtext            = '<<END CATS|' && record-infty && '|' && record-subty && '|' && record-begda && '|' && record-endda && '>>'
  137.       CHANGING
  138.         message_handler_to =  me->a_message_handler_all
  139.   ).
  140.  
  141.     me->collect_custom_message(
  142.       EXPORTING
  143.         message_type       = 'S'
  144.         msgtext            = '<<END UPDATE|' && record-infty && '|' && record-subty && '|' && record-begda && '|' && record-endda && '>>'
  145.       CHANGING
  146.         message_handler_to =  me->a_message_handler_all
  147.   ).
  148.  
  149.   ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement