Nuriev_ii

Example class with F4 and redefinition protect method

Dec 4th, 2020
1,022
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CLASS zcl_zpm_rmc_equi DEFINITION
  2.   PUBLIC
  3.   CREATE PUBLIC .
  4.  
  5.   PUBLIC SECTION.
  6.  
  7.     INTERFACES zif_rmc_gui_alv_grid .
  8.  
  9.     METHODS free .
  10.  
  11.     METHODS constructor
  12.       IMPORTING
  13.         !ir_cont      TYPE REF TO cl_gui_container
  14.         !ir_prot_cont TYPE REF TO cl_gui_container
  15.         !iv_qmnum     TYPE qmnum OPTIONAL
  16.         !iv_aufnr     TYPE aufnr OPTIONAL
  17.         !iv_tplnr     TYPE tplnr
  18.         !iv_equnr     TYPE equnr
  19.         !it_1         TYPE zpm_rmc_t_equi_ausbau
  20.         !it_2         TYPE zpm_rmc_t_equi_einbau .
  21.     .
  22.     METHODS refresh_protocol .
  23.     METHODS check
  24.       RETURNING
  25.         VALUE(rv) TYPE flag .
  26.     METHODS get_table
  27.       EXPORTING
  28.         it_1 TYPE zpm_rmc_t_equi_ausbau
  29.         it_2 TYPE zpm_rmc_t_equi_einbau .
  30.     CLASS-METHODS get_text_ktext
  31.       IMPORTING
  32.         iv        TYPE aufnr
  33.       RETURNING
  34.         VALUE(rv) TYPE ktext.
  35.     CLASS-METHODS get_text_qmtxt
  36.       IMPORTING
  37.         iv        TYPE zpm_rmc_s_equi_ausbau-qmnum
  38.       RETURNING
  39.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-qmtxt.
  40.     CLASS-METHODS bapiret_to_show
  41.       IMPORTING
  42.         it_return     TYPE bapiret2_t
  43.         iv_filer_type TYPE char4 .
  44.  
  45.     CLASS-METHODS get_instance
  46.       IMPORTING
  47.         !ir_cont           TYPE REF TO cl_gui_container
  48.         !ir_prot_cont      TYPE REF TO cl_gui_container
  49.         !iv_qmnum          TYPE qmnum   DEFAULT '000010000217'
  50.         !iv_aufnr          TYPE aufnr OPTIONAL
  51.         !iv_tplnr          TYPE tplnr OPTIONAL
  52.         !iv_equnr          TYPE equnr OPTIONAL
  53.         !it_1              TYPE zpm_rmc_t_equi_ausbau OPTIONAL
  54.         !it_2              TYPE zpm_rmc_t_equi_einbau OPTIONAL
  55.       RETURNING
  56.         VALUE(rr_instance) TYPE REF TO zcl_zpm_rmc_equi .
  57.     CLASS-METHODS save
  58.       IMPORTING
  59.                 !it_1     TYPE zpm_rmc_t_equi_ausbau
  60.                 !it_2     TYPE zpm_rmc_t_equi_einbau
  61.       RETURNING VALUE(rt) TYPE bapiret2_tab.
  62.   PROTECTED SECTION.
  63.   PRIVATE SECTION.
  64.  
  65.     TYPES:
  66.       BEGIN OF ts_data,
  67.         qmnum TYPE qmnum,
  68.         aufnr TYPE aufnr,
  69.         tplnr TYPE tplnr,
  70.         equnr TYPE equnr,
  71.  
  72.       END OF ts_data .
  73.  
  74.  
  75.     TYPES: BEGIN OF ts_message,
  76.              msgid     TYPE symsgid,
  77.              msgty     TYPE symsgty,
  78.              msgno     TYPE symsgno,
  79.              msgv1     TYPE string,
  80.              msgv2     TYPE string,
  81.              msgv3     TYPE string,
  82.              msgv4     TYPE string,
  83.              fieldname TYPE lvc_fname,
  84.              row_id    TYPE int4,
  85.              tabix     TYPE int4,
  86.            END OF ts_message.
  87.     TYPES: tty_values TYPE STANDARD TABLE OF ddshretval.
  88.     CLASS-DATA gr_instance TYPE REF TO zcl_zpm_rmc_equi .
  89.     DATA gr_cont_equim TYPE REF TO cl_gui_container .
  90.     DATA gt_fcat TYPE lvc_t_fcat .
  91.     DATA gs_layout TYPE lvc_s_layo .
  92.     DATA gt_data TYPE zpm_rmc_t_equi_ausbau .
  93.     DATA gt_excl TYPE ui_functions .
  94.     DATA gt_error TYPE lvc_t_err.
  95.     DATA gr_pmcs_alv TYPE REF TO cl_gui_alv_grid .
  96.     DATA gr_prot_cont_equim TYPE REF TO cl_gui_container .
  97.     DATA gr_prot TYPE REF TO cl_alv_changed_data_protocol .
  98.     CLASS-DATA gc_full_d TYPE raw4 VALUE '04100000' ##NO_TEXT.
  99.     CLASS-DATA gc_onlyf4 TYPE raw4 VALUE '00100000' ##NO_TEXT. .
  100.     CLASS-METHODS dismantle
  101.       IMPORTING
  102.         is        TYPE zpm_rmc_s_equi_ausbau
  103.         iv_commit TYPE abap_bool
  104.       RETURNING
  105.         VALUE(rt) TYPE bapiret2.
  106.     CLASS-METHODS install
  107.       IMPORTING
  108.         is              TYPE zpm_rmc_s_equi_einbau
  109.         iv_commit       TYPE abap_bool
  110.       RETURNING
  111.         VALUE(r_result) TYPE bapiret2.
  112.  
  113.  
  114.  
  115.  
  116.  
  117.     METHODS get_data
  118.       IMPORTING
  119.         !is       TYPE ts_data
  120.       RETURNING
  121.         VALUE(rt) TYPE zpm_rmc_t_equi_ausbau .
  122.  
  123.  
  124.  
  125.     METHODS set_display .
  126.     METHODS setup_alv .
  127.     METHODS conv_tplnr_input
  128.       IMPORTING
  129.         iv        TYPE zpm_rmc_s_equi_ausbau-ntplnr
  130.       RETURNING
  131.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-npltxt.
  132.     METHODS get_text_tplnr
  133.       IMPORTING
  134.         iv        TYPE zpm_rmc_s_equi_ausbau-npltxt
  135.       RETURNING
  136.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-vpltxt.
  137.     METHODS get_zpm_rmc_equmbau
  138.       IMPORTING
  139.         iv        TYPE zpm_rmc_s_equi_ausbau-vtplnr
  140.       RETURNING
  141.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-npltxt.
  142.     METHODS get_text_equnr
  143.       IMPORTING
  144.         iv        TYPE equnr
  145.       RETURNING
  146.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-eqktx.
  147.     METHODS get_superequi
  148.       IMPORTING
  149.         iv        TYPE zpm_rmc_s_equi_ausbau-equnr
  150.       RETURNING
  151.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-superequi.
  152.     METHODS f4_with_customized_params
  153.       IMPORTING
  154.         i_display_only TYPE abap_bool  DEFAULT space
  155.         i_max_records  TYPE  i  DEFAULT space
  156.         i_shlp_name    TYPE shlpname "Name of a Search Help
  157.         it_ddshifaces  TYPE ddshifaces " Complete Interface of Search Help for Screen
  158.       EXPORTING
  159.         et_values      TYPE tfw_ddshretval_tab .
  160.     METHODS get_equnr_f4
  161.       RETURNING
  162.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-equnr.
  163.     METHODS set_style
  164.       IMPORTING
  165.         iv_name  TYPE string
  166.         iv_style TYPE raw4
  167.       CHANGING
  168.         ct       TYPE lvc_t_styl.
  169.     METHODS get_tplnr
  170.       IMPORTING
  171.         iv        TYPE zpm_rmc_s_equi_ausbau-equnr
  172.       RETURNING
  173.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-vtplnr.
  174.     METHODS get_tplnr_f4
  175.       RETURNING
  176.         VALUE(rv) TYPE zpm_rmc_s_equi_ausbau-ntplnr.
  177.     METHODS set_error
  178.       IMPORTING
  179.         ism TYPE ts_message.
  180.     METHODS fill_lines_aufnr
  181.       IMPORTING
  182.         lv_aufnr  TYPE aufnr
  183.       RETURNING
  184.         VALUE(rt) TYPE zpm_rmc_t_equi_ausbau .
  185.  
  186.     METHODS fill_lines_without_aufnr
  187.       IMPORTING
  188.         is        TYPE zcl_zpm_rmc_equi=>ts_data
  189.       RETURNING
  190.         VALUE(rt) TYPE zpm_rmc_t_equi_ausbau.
  191.  
  192. ENDCLASS.
  193.  
  194.  
  195.  
  196. CLASS zcl_zpm_rmc_equi IMPLEMENTATION.
  197.  
  198.  
  199.   METHOD bapiret_to_show.
  200.     DATA: l_show(1).
  201.     CALL FUNCTION 'MESSAGES_INITIALIZE'.
  202.  
  203.     LOOP AT it_return INTO DATA(ls_msg) WHERE type CA iv_filer_type.
  204.       CALL FUNCTION 'MESSAGE_STORE'
  205.         EXPORTING
  206.           arbgb                  = ls_msg-id
  207.           msgty                  = ls_msg-type
  208.           msgv1                  = ls_msg-message_v1
  209.           msgv2                  = ls_msg-message_v2
  210.           msgv3                  = ls_msg-message_v3
  211.           msgv4                  = ls_msg-message_v4
  212.           txtnr                  = ls_msg-number
  213.         EXCEPTIONS
  214.           message_type_not_valid = 1
  215.           not_active             = 2
  216.           OTHERS                 = 3.
  217.       l_show = 'X'.
  218.     ENDLOOP.
  219.     IF l_show = 'X'.
  220.       CALL FUNCTION 'MESSAGES_STOP'
  221.         EXCEPTIONS
  222.           a_message = 1
  223.           e_message = 2
  224.           i_message = 3
  225.           w_message = 4
  226.           OTHERS    = 5.
  227.  
  228.       CALL FUNCTION 'MESSAGES_SHOW'
  229.         EXPORTING
  230.           show_linno         = ' '
  231.         EXCEPTIONS
  232.           inconsistent_range = 1
  233.           no_messages        = 2
  234.           OTHERS             = 3.
  235.  
  236.     ENDIF.
  237.  
  238.   ENDMETHOD.
  239.  
  240.  
  241.   METHOD check.
  242.     DATA: ls_install TYPE zpm_rmc_s_equi_einbau .
  243.  
  244.     DATA(lv_error) = abap_false.
  245.     me->refresh_protocol(  ).
  246.  
  247.  
  248.     LOOP AT gt_data ASSIGNING FIELD-SYMBOL(<fs>).
  249.       DATA(lv_index) = sy-tabix.
  250.  
  251.  
  252. *      IF <fs>-vtplnr IS INITIAL .
  253. *
  254. *        set_error(   VALUE #(
  255. *                   msgid = 'ZPM_RM_MSG' msgty = 'E' msgno = 060 msgv1 = <fs>-equnr fieldname = 'VTPLNR' row_id =  lv_index  ) ).
  256. *
  257. *        lv_error = 'X'.
  258. *      ENDIF.
  259.  
  260.       IF <fs>-ntplnr IS INITIAL .
  261.  
  262.         set_error(   VALUE #(
  263.                     msgid = 'ZPM_RM_MSG' msgty = 'E' msgno = 061 msgv1 = <fs>-equnr fieldname = 'NTPLNR' row_id =  lv_index  ) ).
  264.  
  265.         lv_error = 'X'.
  266.       ENDIF.
  267.       IF <fs>-equnr IS INITIAL.
  268.         set_error(   VALUE #(
  269.               msgid = 'ZPM_RM_MSG' msgty = 'E' msgno = 062 msgv1 = <fs>-equnr fieldname = 'EQUNR' row_id =  lv_index  ) ).
  270.  
  271.         lv_error = 'X'.
  272.       ENDIF.
  273.  
  274.       DATA(ls) = zcl_zpm_rmc_equi=>dismantle(
  275.             is        = <fs>
  276.             iv_commit = abap_false ).
  277.  
  278.       IF ls-type CA 'EAX'.
  279.         set_error(   VALUE #(
  280.         msgid = ls-id msgty = ls-type msgno = ls-number msgv1 = ls-message_v1  msgv2 = ls-message_v2
  281.         msgv3 = ls-message_v3 msgv4 = ls-message_v4  fieldname = 'EQUNR' row_id =  lv_index  ) ).
  282.  
  283.         me->set_style(
  284.          EXPORTING
  285.          iv_name  = 'EQUNR'
  286.          iv_style = cl_gui_alv_grid=>mc_style_disabled
  287.          CHANGING
  288.          ct = <fs>-t_style ).
  289.         lv_error = 'X'.
  290.  
  291.       ENDIF.
  292.  
  293.  
  294.     ENDLOOP.
  295.  
  296.     IF lv_error = abap_true.
  297.  
  298.       gr_prot->display_protocol( ).
  299.     ELSE.
  300.  
  301.       gr_prot->free(  ).
  302.       rv = abap_true.
  303.  
  304.     ENDIF.
  305.     me->gr_pmcs_alv->refresh_table_display( ).
  306.  
  307.  
  308.     DATA: lo TYPE REF TO lcl_for_redefine.
  309.  
  310.     IF lo IS NOT BOUND.
  311.       CREATE OBJECT lo
  312.         EXPORTING
  313.           io_grid = gr_pmcs_alv.
  314.  
  315.  
  316.     ENDIF.
  317.     lo->set_status_changed(  ).
  318.  
  319.  
  320.   ENDMETHOD.
  321.  
  322.  
  323.   METHOD constructor.
  324.  
  325.     gr_cont_equim = ir_cont.
  326.     gr_prot_cont_equim = ir_prot_cont.
  327.  
  328.     me->set_display( ).
  329.  
  330.  
  331.     IF lines( it_1 ) > 0.
  332.       MOVE-CORRESPONDING it_1 TO gt_data.
  333.     ELSE.
  334.  
  335.  
  336.       gt_data =
  337.       get_data(
  338.       is = VALUE #(
  339.         qmnum = iv_qmnum
  340.         aufnr = iv_aufnr
  341.         equnr = iv_equnr
  342.         tplnr = iv_tplnr
  343.       )  ).
  344.     ENDIF.
  345.  
  346. *** ALV Layout definieren
  347.  
  348.  
  349.  
  350.  
  351. *** ALV Events und Aufruf ALV Grid
  352.     me->setup_alv( ).
  353. *gr_prot_cont_equim->free(  ).
  354. *    me->refresh_protocol(  ).
  355.  
  356. *    me->refresh_protocol(  ).
  357. *     me->gr_pmcs_alv->refresh_table_display( ).
  358. **    BREAK-POINT.
  359.  
  360.   ENDMETHOD.
  361.  
  362.  
  363.   METHOD conv_tplnr_input.
  364.  
  365.     CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'
  366.       EXPORTING
  367.         input     = iv
  368. *       I_FLG_CHECK_INTERNAL       = 'X'
  369.       IMPORTING
  370.         output    = rv
  371.       EXCEPTIONS
  372.         not_found = 1
  373.         OTHERS    = 2.
  374.  
  375.   ENDMETHOD.
  376.  
  377.  
  378.   METHOD dismantle.
  379.     DATA: lv TYPE ilom_strno .
  380.  
  381.     CHECK is-vtplnr IS NOT INITIAL.
  382.     IF is-superequi IS NOT INITIAL.
  383.  
  384.       CALL FUNCTION 'BAPI_EQUI_DISMANTLE'
  385.         EXPORTING
  386.           equipment = is-equnr                 " Number of Equipment to be Installed
  387.           supequi   = is-superequi                 " Number of Previous Installation Location (Superior Equipment
  388.         IMPORTING
  389.           return    = rt.                  " Return Parameter
  390.     ELSE.
  391.  
  392.       CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'
  393.         EXPORTING
  394.           input     = is-vtplnr
  395.         IMPORTING
  396.           output    = lv
  397.         EXCEPTIONS
  398.           not_found = 1.
  399.  
  400.       CALL FUNCTION 'BAPI_EQUI_DISMANTLE'
  401.         EXPORTING
  402.           equipment = is-equnr                 " Number of Equipment to be Installed
  403.           funcloc   = lv               " Number of Previous Installation Location (Functional Locatio
  404.         IMPORTING
  405.           return    = rt.                  " Return Parameter
  406.     ENDIF.
  407.  
  408.  
  409.     IF iv_commit ='X'.
  410.  
  411.       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  412.         EXPORTING
  413.           wait = 'X'.                 " Use of Command `COMMIT AND WAIT`
  414.     ELSE.
  415.       CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  416.     ENDIF.
  417.  
  418.  
  419.   ENDMETHOD.
  420.  
  421.  
  422.   METHOD f4_with_customized_params.
  423.     FIELD-SYMBOLS: <iface> TYPE ddshiface,
  424.                    <sface> TYPE ddshiface.
  425.     DATA: f_shlp TYPE shlp_descr.
  426.     DATA: f_rc TYPE sy-subrc.
  427.     CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
  428.       EXPORTING
  429.         shlpname = i_shlp_name
  430.         shlptype = 'SH'
  431.       IMPORTING
  432.         shlp     = f_shlp.
  433.  
  434.     LOOP AT it_ddshifaces ASSIGNING <iface>.
  435.       READ TABLE f_shlp-interface[] WITH KEY shlpfield = <iface>-shlpfield ASSIGNING <sface>.
  436.       IF sy-subrc EQ 0.
  437.         MOVE-CORRESPONDING <iface> TO <sface>.
  438.       ENDIF.
  439.  
  440.     ENDLOOP.
  441.  
  442.     CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
  443.       EXPORTING
  444.         shlp          = f_shlp
  445.         disponly      = i_display_only
  446.         maxrecords    = i_max_records
  447.         multisel      = space
  448. *       CUCOL         = SY-CUCOL
  449. *       CUROW         = SY-CUROW
  450.       IMPORTING
  451.         rc            = f_rc
  452.       TABLES
  453.         return_values = et_values.
  454.  
  455.  
  456.   ENDMETHOD.
  457.  
  458.  
  459.   METHOD fill_lines_aufnr.
  460.     DATA: ls_header       TYPE bapi_alm_order_header_e,
  461.           ls_ret          TYPE STANDARD TABLE OF bapiret2,
  462.           ls_hier         TYPE bapi_eqhr,
  463.           lv_ntplnr_2_row TYPE tplnr.
  464.  
  465.     APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs>).
  466.  
  467.     CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
  468.       EXPORTING
  469.         number    = lv_aufnr               " Order Number
  470.       IMPORTING
  471.         es_header = ls_header               " Export Structure for ALM Order Header
  472.       TABLES
  473.         return    = ls_ret.
  474.  
  475.     <fs>-aufnr     =  lv_aufnr.
  476.     <fs>-qmnum     =  ls_header-notif_no.
  477.     <fs>-qmtxt     =  get_text_qmtxt( <fs>-qmnum ).
  478.     <fs>-equnr     =  ls_header-equipment.
  479.     <fs>-eqktx     =  get_text_equnr(  <fs>-equnr  ).
  480.     lv_ntplnr_2_row  =  ls_header-funct_loc.
  481.  
  482.  
  483.     CALL FUNCTION 'BAPI_EQMT_DETAIL'
  484.       EXPORTING
  485.         equipment     = <fs>-equnr                 " Number of equipment to be read
  486.       IMPORTING
  487.         equihierarchy = ls_hier.                 " Structure for equipment hierarchy data
  488.  
  489.     <fs>-vtplnr     =   ls_hier-funcloc.
  490.     <fs>-vpltxt     =   get_text_tplnr( conv_tplnr_input( <fs>-vtplnr ) ).
  491.     <fs>-superequi  =   ls_hier-superequi.
  492.     <fs>-supeqktx   =   <fs>-superequi.
  493.     <fs>-ntplnr     =   get_zpm_rmc_equmbau( <fs>-vtplnr )..
  494.     <fs>-npltxt     =   get_text_tplnr( conv_tplnr_input( <fs>-ntplnr ) ).
  495.  
  496.  
  497.     me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  498.     me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  499.     me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  500.     me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  501.     me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  502.     me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  503.     me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = gc_onlyf4 CHANGING ct = <fs>-t_style ).
  504.  
  505.  
  506.  
  507.  
  508.     APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs2>).
  509.  
  510.     <fs2>-ntplnr = lv_ntplnr_2_row.
  511.     <fs2>-npltxt = get_text_tplnr( conv_tplnr_input( <fs2>-ntplnr ) ).
  512.     me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = gc_onlyf4 CHANGING ct = <fs2>-t_style ).
  513.     me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = gc_onlyf4 CHANGING ct = <fs2>-t_style ).
  514.     me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  515.     me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  516.     me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  517.     me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  518.     me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = gc_onlyf4 CHANGING ct = <fs2>-t_style ).
  519.  
  520.  
  521.  
  522. *      IF is-tplnr IS NOT INITIAL.
  523. *        <fs>-vtplnr = is-tplnr.
  524. *      ENDIF.
  525.  
  526.  
  527. *      APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs2>).
  528. *      <fs2>-ntplnr = <fs>-vtplnr.
  529. *
  530. *      <fs>-vpltxt = get_text_tplnr( conv_tplnr_input( <fs>-vtplnr ) ).
  531. *      <fs2>-npltxt = get_text_tplnr( conv_tplnr_input( <fs2>-ntplnr ) ).
  532. *      <fs>-eqktx = get_text_equnr(  <fs>-equnr  ).
  533. *
  534.  
  535. *
  536. *      CASE get_zpm_rmc_equmbau( <fs>-vtplnr )..
  537. *        WHEN space.
  538. *          "! Don't have values
  539. *          me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style =  cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs>-t_style ).
  540. *        WHEN OTHERS.
  541. *          <fs>-ntplnr = get_zpm_rmc_equmbau( <fs>-vtplnr )..
  542. *          <fs>-npltxt = get_text_tplnr( conv_tplnr_input( <fs>-ntplnr ) ).
  543.  
  544. *      ENDCASE.
  545. *
  546. *      <fs>-superequi = get_superequi( <fs>-equnr ).
  547. *      <fs>-supeqktx = get_text_equnr(  <fs>-superequi  ).
  548. *
  549. *      me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs2>-t_style ).
  550. *      me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs2>-t_style ).
  551. *      me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  552. *      me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  553. *      me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  554. *      me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  555. *      me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs2>-t_style ).
  556. *
  557. *
  558. *      EXIT.
  559. *
  560. *
  561. *    ENDLOOP.
  562.  
  563.  
  564.   ENDMETHOD.
  565.  
  566.  
  567.   METHOD fill_lines_without_aufnr.
  568.  
  569.  
  570.     DATA: ls_header       TYPE bapi_alm_order_header_e,
  571.           ls_ret          TYPE STANDARD TABLE OF bapiret2,
  572.           ls_hier         TYPE bapi_eqhr,
  573.           lv_ntplnr_2_row TYPE tplnr.
  574.  
  575.     APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs>).
  576.  
  577. *    CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
  578. *      EXPORTING
  579. *        number    = lv_aufnr               " Order Number
  580. *      IMPORTING
  581. *        es_header = ls_header               " Export Structure for ALM Order Header
  582. *      TABLES
  583. *        return    = ls_ret.
  584.  
  585.  
  586.  
  587. *    <fs>-aufnr     =  lv_aufnr.
  588. *    <fs>-qmnum     =  ls_header-notif_no.
  589. *    <fs>-qmtxt     =  get_text_qmtxt( <fs>-qmnum ).
  590. *    <fs>-equnr     =  ls_header-equipment.
  591. *    <fs>-eqktx     =  get_text_equnr(  <fs>-equnr  ).
  592. *    lv_ntplnr_2_row  =  ls_header-funct_loc.
  593.  
  594.     IF is-qmnum IS NOT INITIAL.
  595. *      SELECT SINGLE
  596. *      qmnum,
  597. *      aufnr,
  598. *      tplnr AS vtplnr,
  599. *      equnr
  600. *
  601. *      FROM viaufkst_iflos
  602. *      INTO CORRESPONDING FIELDS OF  @<fs>
  603. *      WHERE
  604. *      qmnum = @is-qmnum.
  605.  
  606.       SELECT SINGLE
  607.        qmnum,
  608.        equnr
  609.  
  610.        FROM qmih
  611.        INTO CORRESPONDING FIELDS OF  @<fs>
  612.        WHERE
  613.        qmnum = @is-qmnum.
  614.  
  615.  
  616.  
  617.  
  618.  
  619.     ENDIF.
  620.  
  621.     <fs>-qmtxt     =  get_text_qmtxt( <fs>-qmnum ).
  622.     <fs>-eqktx     =  get_text_equnr(  <fs>-equnr  ).
  623.  
  624.  
  625.  
  626.  
  627.     CALL FUNCTION 'BAPI_EQMT_DETAIL'
  628.       EXPORTING
  629.         equipment     = <fs>-equnr                 " Number of equipment to be read
  630.       IMPORTING
  631.         equihierarchy = ls_hier.                 " Structure for equipment hierarchy data
  632.  
  633.     <fs>-vtplnr     =   ls_hier-funcloc.
  634.  
  635. *    IF is-tplnr IS NOT INITIAL.
  636. *
  637. *      <fs>-vtplnr =  lv_ntplnr_2_row  =  is-tplnr.
  638. *    ELSE.
  639.     lv_ntplnr_2_row = <fs>-vtplnr.
  640.  
  641. *    ENDIF.
  642.     <fs>-vpltxt     =   get_text_tplnr( conv_tplnr_input( <fs>-vtplnr ) ).
  643.     <fs>-superequi  =   ls_hier-superequi.
  644.     <fs>-supeqktx   =   <fs>-superequi.
  645.     <fs>-ntplnr     =   get_zpm_rmc_equmbau( <fs>-vtplnr )..
  646.     <fs>-npltxt     =   get_text_tplnr( conv_tplnr_input( <fs>-ntplnr ) ).
  647.  
  648.  
  649.     me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  650.     me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  651.     me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  652.     me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  653.     me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  654.     me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_full_d CHANGING ct = <fs>-t_style ).
  655.     me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = gc_onlyf4 CHANGING ct = <fs>-t_style ).
  656.  
  657.  
  658.  
  659.  
  660.     APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs2>).
  661.  
  662.     <fs2>-ntplnr = lv_ntplnr_2_row.
  663.     <fs2>-npltxt = get_text_tplnr( conv_tplnr_input( <fs2>-ntplnr ) ).
  664.     me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = gc_onlyf4 CHANGING ct = <fs2>-t_style ).
  665.     me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = gc_onlyf4 CHANGING ct = <fs2>-t_style ).
  666.     me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  667.     me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  668.     me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  669.     me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_full_d CHANGING ct = <fs2>-t_style ).
  670.     me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = gc_onlyf4 CHANGING ct = <fs2>-t_style ).
  671.  
  672.   ENDMETHOD.
  673.  
  674.  
  675.   METHOD free.
  676.  
  677.     IF gr_instance IS BOUND.
  678.       FREE: gr_instance.
  679.     ENDIF.
  680.     CLEAR:gt_data.
  681.     IF gr_pmcs_alv IS BOUND.
  682. *      gr_pmcs_alv->free(  ).
  683.       FREE gr_pmcs_alv.
  684.     ENDIF.
  685.  
  686.     IF gr_prot IS BOUND.
  687.  
  688.       gr_prot->free(  ).
  689.       CLEAR gr_prot.
  690.       FREE gr_prot.
  691.  
  692.  
  693.     ENDIF.
  694.     IF gr_cont_equim IS BOUND.
  695. *      gr_cont_equim->free(  ).
  696.       FREE gr_cont_equim.
  697.     ENDIF.
  698.  
  699.  
  700.   ENDMETHOD.
  701.  
  702.  
  703.   METHOD get_data.
  704.  
  705.  
  706. *    APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs>).
  707.  
  708.     DATA:
  709.       lr_equnr  TYPE efg_tab_ranges,
  710.       ls_ret    TYPE STANDARD TABLE OF bapiret2,
  711.       ls_header TYPE bapi_alm_order_header_e.
  712.     IF is-equnr IS NOT INITIAL  .
  713.       lr_equnr = VALUE #( ( sign = 'I' option = 'EQ' low = is-equnr   ) ).
  714.     ENDIF.
  715.  
  716.  
  717.  
  718.     IF is-aufnr IS NOT INITIAL.
  719.  
  720.       APPEND LINES OF  fill_lines_aufnr( EXPORTING lv_aufnr = is-aufnr  ) TO rt.
  721.  
  722.     ELSEIF is-qmnum IS NOT INITIAL AND is-qmnum(1) NE '&'.
  723.       SELECT SINGLE
  724.       aufnr
  725.       FROM viaufkst_iflos
  726.       INTO   @DATA(lv_aufnr)
  727.       WHERE
  728.       qmnum = @is-qmnum AND
  729.       equnr IN @lr_equnr.
  730.       IF sy-subrc = 0.
  731.         APPEND LINES OF    fill_lines_aufnr( EXPORTING lv_aufnr = lv_aufnr  ) TO rt.
  732.       ELSE.
  733.  
  734.         APPEND LINES OF    fill_lines_without_aufnr( EXPORTING is = is  ) TO rt.
  735.       ENDIF.
  736.     ELSE.
  737.       APPEND LINES OF    fill_lines_without_aufnr( EXPORTING is = is  ) TO rt.
  738.  
  739.  
  740.  
  741.     ENDIF.
  742.  
  743.  
  744.  
  745.  
  746. *    BREAK-POINT.
  747. *
  748. *    IF is-qmnum IS NOT INITIAL.
  749. *      SELECT SINGLE
  750. *      qmnum,
  751. *      aufnr,
  752. *        tplnr AS vtplnr,
  753. *      equnr
  754. *
  755. *      FROM viaufkst_iflos
  756. *      INTO CORRESPONDING FIELDS OF  @<fs>
  757. *      WHERE
  758. *      qmnum = @is-qmnum AND
  759. *      equnr IN @lr_equnr
  760. *
  761. *      .
  762. *    ELSEIF is-aufnr IS NOT INITIAL.
  763. *      SELECT SINGLE
  764. *        qmnum,
  765. *        aufnr,
  766. *        tplnr AS vtplnr,
  767. *        equnr
  768. *
  769. *        FROM viaufkst_iflos
  770. *        INTO CORRESPONDING FIELDS OF  @<fs>
  771. *        WHERE
  772. *        aufnr = @is-aufnr AND
  773. *        equnr IN @lr_equnr.
  774. *
  775. *    ELSE.
  776. *      "! ERROR
  777. *    ENDIF.
  778. *
  779. *
  780. *    LOOP AT rt ASSIGNING <fs>.
  781. *      IF is-tplnr IS NOT INITIAL.
  782. *        <fs>-vtplnr = is-tplnr.
  783. *
  784. *      ENDIF.
  785. *      APPEND INITIAL LINE TO rt ASSIGNING FIELD-SYMBOL(<fs2>).
  786. *      <fs2>-ntplnr = <fs>-vtplnr.
  787. *
  788. *      <fs>-vpltxt = get_text_tplnr( conv_tplnr_input( <fs>-vtplnr ) ).
  789. *      <fs2>-npltxt = get_text_tplnr( conv_tplnr_input( <fs2>-ntplnr ) ).
  790. *      <fs>-eqktx = get_text_equnr(  <fs>-equnr  ).
  791. *
  792. *      me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = gc_style_disabled_f4_d CHANGING ct = <fs>-t_style ).
  793. *      me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = gc_style_disabled_f4_d CHANGING ct = <fs>-t_style ).
  794. *      me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_style_disabled_f4_d CHANGING ct = <fs>-t_style ).
  795. *      me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs>-t_style ).
  796. *      me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs>-t_style ).
  797. *      me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs>-t_style ).
  798. *
  799. *
  800. *      CASE get_zpm_rmc_equmbau( <fs>-vtplnr )..
  801. *        WHEN space.
  802. *          "! Don't have values
  803. *          me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style =  cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs>-t_style ).
  804. *        WHEN OTHERS.
  805. *          <fs>-ntplnr = get_zpm_rmc_equmbau( <fs>-vtplnr )..
  806. *          <fs>-npltxt = get_text_tplnr( conv_tplnr_input( <fs>-ntplnr ) ).
  807. *          me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs>-t_style ).
  808. *      ENDCASE.
  809. *
  810. *      <fs>-superequi = get_superequi( <fs>-equnr ).
  811. *      <fs>-supeqktx = get_text_equnr(  <fs>-superequi  ).
  812. *
  813. *      me->set_style( EXPORTING  iv_name  = 'AUFNR'  iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs2>-t_style ).
  814. *      me->set_style( EXPORTING  iv_name  = 'EQUNR'  iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs2>-t_style ).
  815. *      me->set_style( EXPORTING  iv_name  = 'EQKTX'  iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  816. *      me->set_style( EXPORTING  iv_name  = 'VTPLNR' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  817. *      me->set_style( EXPORTING  iv_name  = 'VPLTXT' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  818. *      me->set_style( EXPORTING  iv_name  = 'NPLTXT' iv_style = gc_style_disabled_f4_d CHANGING ct = <fs2>-t_style ).
  819. *      me->set_style( EXPORTING  iv_name  = 'NTPLNR' iv_style = cl_gui_alv_grid=>mc_style_disabled CHANGING ct = <fs2>-t_style ).
  820. *
  821. *
  822. *      EXIT.
  823. *
  824. *
  825. *    ENDLOOP.
  826.  
  827.  
  828.  
  829.   ENDMETHOD.
  830.  
  831.  
  832.   METHOD get_equnr_f4.
  833.     DATA: lt_values TYPE tty_values.
  834.  
  835.  
  836.  
  837.     me->f4_with_customized_params(
  838.   EXPORTING
  839.     i_display_only = space
  840.     i_max_records  = space
  841.     i_shlp_name    = 'EQUI'
  842.     it_ddshifaces  = VALUE #( ( shlpfield = 'EQUNR' valfield   = 'X' value = '*'  )  )
  843.   IMPORTING
  844.     et_values      = lt_values
  845.        ).
  846.  
  847.     CHECK lines( lt_values  ) > 0.
  848.     DATA(lv) = lt_values[ 1 ]-fieldval.
  849.  
  850.     CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  851.       EXPORTING
  852.         input  = lv                " C field
  853.       IMPORTING
  854.         output = rv.                " Internal display of INPUT, any category
  855.   ENDMETHOD.
  856.  
  857.  
  858.   METHOD get_instance.
  859.  
  860.     IF gr_instance IS NOT BOUND.
  861.       CREATE OBJECT gr_instance
  862.         EXPORTING
  863.           ir_cont      = ir_cont
  864.           ir_prot_cont = ir_prot_cont
  865.           iv_aufnr     = iv_aufnr
  866.           iv_equnr     = iv_equnr
  867.           iv_qmnum     = iv_qmnum
  868.           iv_tplnr     = iv_tplnr
  869.           it_1         = it_1
  870.           it_2         = it_2.
  871.     ENDIF.
  872.  
  873.  
  874.     rr_instance = gr_instance.
  875.   ENDMETHOD.
  876.  
  877.  
  878.   METHOD get_superequi.
  879.     DATA: ls_hier TYPE bapi_eqhr.
  880.  
  881. *    SELECT MAX( datbi ) FROM equz INTO @DATA(lv_data) WHERE equnr = @iv.
  882. *
  883. *    SELECT SINGLE hequi
  884. *    INTO rv
  885. *    FROM equz
  886. *    WHERE equnr = iv AND datbi = lv_data.
  887.  
  888.     CALL FUNCTION 'BAPI_EQMT_DETAIL'
  889.       EXPORTING
  890.         equipment     = iv                 " Number of equipment to be read
  891.       IMPORTING
  892.         equihierarchy = ls_hier.                 " Structure for equipment hierarchy data
  893.  
  894.     rv     =   ls_hier-superequi.
  895.  
  896.   ENDMETHOD.
  897.  
  898.  
  899.   METHOD get_table.
  900.  
  901.     FREE: it_1, it_2.
  902.  
  903.     LOOP AT gt_data ASSIGNING FIELD-SYMBOL(<fs>).
  904.       APPEND INITIAL LINE TO it_1 ASSIGNING FIELD-SYMBOL(<fs_1>).
  905.       APPEND INITIAL LINE TO it_2 ASSIGNING FIELD-SYMBOL(<fs_2>).
  906.       MOVE-CORRESPONDING <fs> TO <fs_1>.
  907.       MOVE-CORRESPONDING <fs> TO <fs_2>.
  908.     ENDLOOP.
  909.  
  910.   ENDMETHOD.
  911.  
  912.  
  913.   METHOD get_text_equnr.
  914.  
  915.     SELECT SINGLE eqktx
  916.     FROM eqkt   INTO rv
  917.       WHERE
  918.       equnr = iv.
  919.   ENDMETHOD.
  920.  
  921.  
  922.   METHOD get_text_qmtxt.
  923.  
  924.     SELECT SINGLE
  925.         qmtxt
  926.     FROM qmel INTO rv
  927.     WHERE qmnum = iv.
  928.   ENDMETHOD.
  929.  
  930.   METHOD get_text_ktext.
  931.  
  932.     SELECT SINGLE
  933.         ktext
  934.     FROM caufv INTO rv
  935.     WHERE aufnr = iv.
  936.   ENDMETHOD.
  937.  
  938.   METHOD get_text_tplnr.
  939.  
  940.     SELECT SINGLE pltxt
  941.     FROM iflotx  INTO rv
  942.       WHERE
  943.       tplnr = iv.
  944.  
  945.   ENDMETHOD.
  946.  
  947.  
  948.   METHOD get_tplnr.
  949.     DATA: ls_hier TYPE bapi_eqhr.
  950.  
  951. *    SELECT MAX( datbi ) FROM equz INTO @DATA(lv_data) WHERE equnr = @iv..
  952. *    SELECT SINGLE
  953. *    tplnr
  954. *    FROM iloa
  955. *    INNER JOIN equz ON equz~iloan = iloa~iloan
  956. *    INTO rv
  957. *    WHERE
  958. *    equz~equnr = iv AND
  959. *    equz~datbi = lv_data.
  960.  
  961.  
  962.  
  963.     CALL FUNCTION 'BAPI_EQMT_DETAIL'
  964.       EXPORTING
  965.         equipment     = iv                 " Number of equipment to be read
  966.       IMPORTING
  967.         equihierarchy = ls_hier.                 " Structure for equipment hierarchy data
  968.  
  969.     rv     =   ls_hier-funcloc.
  970.  
  971.  
  972.  
  973.   ENDMETHOD.
  974.  
  975.  
  976.   METHOD get_tplnr_f4.
  977.  
  978.  
  979.     DATA: lt_values TYPE tty_values.
  980.  
  981.  
  982.  
  983.     me->f4_with_customized_params(
  984.   EXPORTING
  985.     i_display_only = space
  986.     i_max_records  = space
  987.     i_shlp_name    = 'IFLM'
  988.     it_ddshifaces  = VALUE #( ( shlpfield = 'TPLNR' valfield   = 'X' value = '*'  )  )
  989.   IMPORTING
  990.     et_values      = lt_values
  991.        ).
  992.  
  993.     CHECK lines( lt_values  ) > 0.
  994.     DATA(lv) = lt_values[ 1 ]-fieldval.
  995.  
  996.     CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'
  997.       EXPORTING
  998.         input  = lv                " C field
  999.       IMPORTING
  1000.         output = rv.                " Internal display of INPUT, any category
  1001.  
  1002.   ENDMETHOD.
  1003.  
  1004.  
  1005.   METHOD get_zpm_rmc_equmbau.
  1006.  
  1007.  
  1008.     DATA(lv) = conv_tplnr_input( iv ).
  1009.     SELECT SINGLE ztplnr
  1010.         FROM zpm_rmc_equmbau  INTO rv
  1011.           WHERE
  1012.           qtplnr = lv.
  1013.  
  1014.   ENDMETHOD.
  1015.  
  1016.  
  1017.   METHOD install.
  1018.     DATA: lv TYPE ilom_strno,
  1019.           ls TYPE bapi_itob_eq_install_ext.
  1020.  
  1021.  
  1022.  
  1023.     CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'
  1024.       EXPORTING
  1025.         input     = is-ntplnr
  1026.       IMPORTING
  1027.         output    = lv
  1028.       EXCEPTIONS
  1029.         not_found = 1.
  1030.  
  1031.  
  1032.     ls = VALUE #(
  1033.  
  1034.     inst_date = sy-datum
  1035.     inst_time = sy-uzeit
  1036.     funcloc = lv
  1037.      ).
  1038.  
  1039.     DATA: lv_equnr TYPE equnr .
  1040.     CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  1041.       EXPORTING
  1042.         input  = is-equnr             " C field
  1043.       IMPORTING
  1044.         output = lv_equnr.                  " Internal display of INPUT, any category
  1045.  
  1046.  
  1047.     CALL FUNCTION 'BAPI_EQUI_INSTALL'
  1048.       EXPORTING
  1049.         equipment    = lv_equnr
  1050.         data_install = ls
  1051.       IMPORTING
  1052.         return       = r_result.
  1053.  
  1054.  
  1055.     IF iv_commit ='X'.
  1056.  
  1057.       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  1058.         EXPORTING
  1059.           wait = 'X'.                 " Use of Command `COMMIT AND WAIT`
  1060.     ELSE.
  1061.       CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  1062.     ENDIF.
  1063.  
  1064.   ENDMETHOD.
  1065.  
  1066.  
  1067.   METHOD refresh_protocol.
  1068.  
  1069.     IF gr_prot IS NOT BOUND.
  1070.       gr_prot = NEW #( i_calling_alv = gr_pmcs_alv i_container = gr_prot_cont_equim  ).
  1071.       APPEND LINES OF gt_fcat TO gr_prot->mt_fieldcatalog.
  1072.     ELSE.
  1073.  
  1074.       "clear extra protocol
  1075.       gr_prot->refresh_protocol( ).
  1076.       gr_prot->free( ).
  1077.       CLEAR gr_prot.
  1078.       gr_prot = NEW #( i_calling_alv = gr_pmcs_alv i_container = gr_prot_cont_equim ).
  1079.       APPEND LINES OF gt_fcat TO gr_prot->mt_fieldcatalog.
  1080.     ENDIF.
  1081.  
  1082.   ENDMETHOD.
  1083.  
  1084.  
  1085.   METHOD save.
  1086.  
  1087.  
  1088.  
  1089.     DATA: lt_ret TYPE TABLE OF bapiret2 .
  1090.  
  1091.  
  1092.  
  1093.     LOOP AT it_1 ASSIGNING FIELD-SYMBOL(<fs_1>)."Dismantle
  1094.       APPEND  zcl_zpm_rmc_equi=>dismantle(
  1095.           is        = <fs_1>
  1096.           iv_commit = abap_false )  TO   lt_ret ASSIGNING FIELD-SYMBOL(<fs_ret>).
  1097.       DATA(lv_index) = sy-tabix.
  1098.       CHECK <fs_ret>-type IS INITIAL.
  1099.       DELETE lt_ret INDEX lv_index.
  1100.     ENDLOOP.
  1101.     IF lines( lt_ret ) > 0.
  1102.       rt = lt_ret.
  1103. *      zcl_zpm_rmc_equi=>bapiret_to_show(
  1104. *        EXPORTING
  1105. *          it_return     =  lt_ret                " Returntabelle
  1106. *          iv_filer_type = 'XAE'                 " Nicht näher def. Bereich, evtl. für Patchlevels verwendbar
  1107. *      ).
  1108.  
  1109.       EXIT.
  1110.     ELSE.
  1111.       LOOP AT it_1 ASSIGNING <fs_1>."Dismantle
  1112.         APPEND  zcl_zpm_rmc_equi=>dismantle(
  1113.             is        = <fs_1>
  1114.             iv_commit = abap_true )  TO   lt_ret ASSIGNING <fs_ret>.
  1115.         lv_index = sy-tabix.
  1116.         CHECK <fs_ret>-type IS INITIAL.
  1117.         DELETE lt_ret INDEX lv_index.
  1118.       ENDLOOP.
  1119.     ENDIF.
  1120.     IF lines( lt_ret ) > 0.
  1121.       rt = lt_ret.
  1122. *      zcl_zpm_rmc_equi=>bapiret_to_show(
  1123. *        EXPORTING
  1124. *          it_return     =  lt_ret                " Returntabelle
  1125. *          iv_filer_type = 'XAE'                 " Nicht näher def. Bereich, evtl. für Patchlevels verwendbar
  1126. *      ).
  1127.       EXIT.
  1128.     ENDIF.
  1129.     WAIT UP TO 1 SECONDS.
  1130.  
  1131.     LOOP AT it_2 ASSIGNING FIELD-SYMBOL(<fs_2>)."Install
  1132.       APPEND  zcl_zpm_rmc_equi=>install(
  1133.         is        = <fs_2>
  1134.         iv_commit = abap_false )  TO   lt_ret ASSIGNING <fs_ret>.
  1135.       lv_index = sy-tabix.
  1136.       CHECK <fs_ret>-type IS INITIAL.
  1137.       DELETE lt_ret INDEX lv_index.
  1138.     ENDLOOP.
  1139.  
  1140.  
  1141.     IF lines( lt_ret ) > 0.
  1142.       rt = lt_ret.
  1143. *      zcl_zpm_rmc_equi=>bapiret_to_show(
  1144. *        EXPORTING
  1145. *          it_return     =  lt_ret                " Returntabelle
  1146. *          iv_filer_type = 'XAE'                 " Nicht näher def. Bereich, evtl. für Patchlevels verwendbar
  1147. *      ).
  1148.       EXIT.
  1149.     ELSE.
  1150.       LOOP AT it_2 ASSIGNING <fs_2>.
  1151.  
  1152.         APPEND  zcl_zpm_rmc_equi=>install(
  1153.            is        = <fs_2>
  1154.            iv_commit = abap_true )  TO   lt_ret ASSIGNING <fs_ret>.
  1155.         lv_index = sy-tabix.
  1156.         CHECK <fs_ret>-type IS INITIAL.
  1157.         DELETE lt_ret INDEX lv_index.
  1158.       ENDLOOP.
  1159.     ENDIF.
  1160.     IF lines( lt_ret ) > 0.
  1161.       rt = lt_ret.
  1162. *      zcl_zpm_rmc_equi=>bapiret_to_show(
  1163. *        EXPORTING
  1164. *          it_return     =  lt_ret                " Returntabelle
  1165. *          iv_filer_type = 'XAE'                 " Nicht näher def. Bereich, evtl. für Patchlevels verwendbar
  1166. *      ).
  1167.       EXIT.
  1168.     ENDIF.
  1169.  
  1170.  
  1171.  
  1172.     DATA: lt_ret_positive LIKE lt_ret.
  1173.  
  1174.     LOOP AT it_1 ASSIGNING <fs_1>.
  1175.       APPEND VALUE #( type ='S' id = 'ZPM_RM_MSG' number = 63  message_v1 =  <fs_1>-equnr message_v2 = <fs_1>-vtplnr    ) TO lt_ret_positive.
  1176.  
  1177.     ENDLOOP.
  1178.     LOOP AT it_2 ASSIGNING <fs_2>.
  1179.       APPEND VALUE #( type ='S' id = 'ZPM_RM_MSG' number = 64  message_v1 =  <fs_2>-equnr message_v2 = <fs_2>-ntplnr    ) TO lt_ret_positive.
  1180.  
  1181.     ENDLOOP.
  1182.  
  1183.     rt = lt_ret_positive.
  1184. *    zcl_zpm_rmc_equi=>bapiret_to_show(
  1185. *         EXPORTING
  1186. *           it_return     =  lt_ret_positive                " Returntabelle
  1187. *           iv_filer_type = 'S'                 " Nicht näher def. Bereich, evtl. für Patchlevels verwendbar
  1188. *       ).
  1189.  
  1190.   ENDMETHOD.
  1191.  
  1192.  
  1193.   METHOD setup_alv.
  1194. *
  1195.  
  1196.     IF gr_prot_cont_equim IS INITIAL.
  1197.       gr_prot_cont_equim = NEW cl_gui_docking_container( ratio = 40 side = cl_gui_docking_container=>dock_at_bottom    ).
  1198. *      gr_prot_cont_equim = NEW cl_gui_docking_container(  ).
  1199. *      gr_prot_cont_equim = NEW cl_gui_docking_container(  side = cl_gui_docking_container=>dock_at_bottom ).
  1200.     ENDIF.
  1201.  
  1202.     IF gr_cont_equim IS INITIAL.
  1203.       gr_cont_equim = NEW cl_gui_docking_container( ratio = 20 side = cl_gui_docking_container=>dock_at_bottom ).
  1204. *      gr_cont_equim = NEW cl_gui_docking_container(  ).
  1205.     ENDIF.
  1206.  
  1207.     IF gr_pmcs_alv IS BOUND.
  1208.       gr_pmcs_alv->free( ).
  1209.     ENDIF.
  1210.     CREATE OBJECT gr_pmcs_alv
  1211.       EXPORTING
  1212.         i_parent       = gr_cont_equim
  1213.         i_applogparent = gr_prot_cont_equim
  1214.         i_appl_events  = 'X'.
  1215.  
  1216.  
  1217.  
  1218.  
  1219.     gr_pmcs_alv->set_ready_for_input( 1 ).
  1220.     gr_pmcs_alv->register_edit_event( i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
  1221.     gr_pmcs_alv->register_edit_event( i_event_id = cl_gui_alv_grid=>mc_evt_modified ).
  1222.  
  1223.     gr_pmcs_alv->register_f4_for_fields( it_f4 = VALUE #(
  1224.    (  fieldname = 'EQUNR' register = 'X' getbefore = 'X' chngeafter = 'X'  )
  1225.     (  fieldname = 'NTPLNR' register = 'X' getbefore = 'X' chngeafter = 'X'  )
  1226.  
  1227.     )  ).
  1228.  
  1229. *    SET HANDLER me->zif_rmc_gui_alv_grid~handle_hotspot_click
  1230. *      FOR gr_pmcs_alv.
  1231. *
  1232. *    SET HANDLER me->zif_rmc_gui_alv_grid~handle_data_changed
  1233. *      FOR gr_pmcs_alv.
  1234.  
  1235.     SET HANDLER me->zif_rmc_gui_alv_grid~handle_data_changed_finished
  1236.       FOR gr_pmcs_alv.
  1237. **
  1238. *    SET HANDLER me->zif_rmc_gui_alv_grid~handle_user_command
  1239. *      FOR gr_pmcs_alv.
  1240.  
  1241.  
  1242.  
  1243.     SET HANDLER me->zif_rmc_gui_alv_grid~handle_onf4
  1244.       FOR gr_pmcs_alv.
  1245.  
  1246.     CALL METHOD gr_pmcs_alv->set_table_for_first_display
  1247.       EXPORTING
  1248.         i_bypassing_buffer   = 'X'
  1249.         i_save               = 'X'
  1250.         it_toolbar_excluding = gt_excl
  1251.         is_layout            = gs_layout
  1252.       CHANGING
  1253.         it_outtab            = gt_data
  1254.         it_fieldcatalog      = gt_fcat.
  1255.  
  1256.     "Set focus on grid so user can immediately enter data in grid
  1257.     cl_gui_alv_grid=>set_focus( gr_pmcs_alv ).
  1258.  
  1259.     CALL METHOD cl_gui_cfw=>flush.
  1260.  
  1261.   ENDMETHOD.
  1262.  
  1263.  
  1264.   METHOD set_display.
  1265. *** ALV Einstellungen für Layout
  1266.     FIELD-SYMBOLS: <ls_fcat> TYPE lvc_s_fcat.
  1267.     CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
  1268.       EXPORTING
  1269.         i_structure_name   = 'ZPM_RMC_S_EQUI_AUSBAU' "ALV Ausgabestruktur
  1270.         i_bypassing_buffer = 'X'
  1271.       CHANGING
  1272.         ct_fieldcat        = gt_fcat.
  1273.  
  1274.     LOOP AT gt_fcat ASSIGNING <ls_fcat>.
  1275.       <ls_fcat>-edit = abap_true.
  1276.       CASE <ls_fcat>-fieldname.
  1277.  
  1278.         WHEN
  1279.           'QMNUM' OR
  1280.           'QMTXT' OR
  1281.           'AUFNR' OR
  1282.           'KTEXT' OR
  1283.           'VORNR' OR
  1284.           'SUPEREQUI' OR
  1285.           'SUPEQKTX'.
  1286.  
  1287.           <ls_fcat>-no_out = 'X'.
  1288.           CLEAR <ls_fcat>-edit.
  1289.         WHEN OTHERS.
  1290. *          <ls_fcat>-key = 'X'.
  1291.           <ls_fcat>-col_id = <ls_fcat>-col_pos.
  1292.           <ls_fcat>-coltext = <ls_fcat>-scrtext_l.
  1293.  
  1294.       ENDCASE.
  1295.     ENDLOOP.
  1296.  
  1297. *     gs_layout-zebra       = abap_true.
  1298.     gs_layout-cwidth_opt = 'X'.
  1299.     gs_layout-sel_mode = 'A'.
  1300.     gs_layout-no_rowmark = 'X'.
  1301.     gs_layout-stylefname = 'T_STYLE'.
  1302.  
  1303.     gs_layout-col_opt  = 'X'.
  1304.     gs_layout-no_rowins = 'X'.
  1305.     gs_layout-no_toolbar = 'X'.
  1306.  
  1307. *** Toolbar Funktionen deaktivieren
  1308. *     APPEND cl_gui_alv_grid=>mc_fg_edit TO gt_excl. "Zellen berarbeitung entfernen
  1309.     APPEND cl_gui_alv_grid=>mc_fc_print TO gt_excl. "ALV Druck entfernen
  1310.     APPEND cl_gui_alv_grid=>mc_fc_graph TO gt_excl. "Grafik entfernen
  1311.     APPEND cl_gui_alv_grid=>mc_fc_info TO gt_excl. "Info entfernen
  1312.     APPEND cl_gui_alv_grid=>mc_mb_sum TO gt_excl. "Summierung entfernen
  1313.     APPEND cl_gui_alv_grid=>mc_fc_loc_append_row        TO gt_excl.
  1314.     APPEND cl_gui_alv_grid=>mc_fc_loc_copy              TO gt_excl.
  1315.     APPEND cl_gui_alv_grid=>mc_fc_loc_copy_row          TO gt_excl.
  1316.     APPEND cl_gui_alv_grid=>mc_fc_loc_cut               TO gt_excl.
  1317.     APPEND cl_gui_alv_grid=>mc_fc_loc_delete_row        TO gt_excl.
  1318.     APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row        TO gt_excl.
  1319.     APPEND cl_gui_alv_grid=>mc_fc_loc_move_row          TO gt_excl.
  1320.     APPEND cl_gui_alv_grid=>mc_fc_loc_paste             TO gt_excl.
  1321.     APPEND cl_gui_alv_grid=>mc_fc_loc_paste_new_row     TO gt_excl.
  1322.     APPEND cl_gui_alv_grid=>mc_fc_loc_undo              TO gt_excl.
  1323.     APPEND cl_gui_alv_grid=>mc_fc_sort                  TO gt_excl.
  1324.     APPEND cl_gui_alv_grid=>mc_fc_sort_asc              TO gt_excl.
  1325.     APPEND cl_gui_alv_grid=>mc_fc_sort_dsc              TO gt_excl.
  1326.  
  1327. *    APPEND cl_gui_alv_grid=>mc_lystyle_no_delete_rows   TO gt_excl.
  1328. *    APPEND cl_gui_alv_grid=>mc_ly_no_delete_rows   TO gt_excl.
  1329. *    APPEND cl_gui_alv_grid=>mc_fc_loc_delete_row   TO gt_excl.
  1330.  
  1331.  
  1332.  
  1333.  
  1334. *    APPEND cl_gui_alv_grid=>mc_lystyle_no_insert_rows   TO gt_excl.
  1335.   ENDMETHOD.
  1336.  
  1337.  
  1338.   METHOD set_error.
  1339.  
  1340.     gr_prot->add_protocol_entry(
  1341.          EXPORTING
  1342.            i_msgid     = ism-msgid                 " Message ID
  1343.            i_msgty     = ism-msgty                  " Message Type
  1344.            i_msgno     = ism-msgno                 " Message No.
  1345.            i_msgv1     = ism-msgv1                 " Message Variable1
  1346.            i_msgv2     = ism-msgv2                 " Message Variable1
  1347.            i_msgv3     = ism-msgv3                 " Message Variable1
  1348.            i_msgv4     = ism-msgv4                 " Message Variable1
  1349.            i_fieldname = ism-fieldname                 " Field Name
  1350.            i_row_id    = ism-row_id                  " RowID
  1351.            i_tabix    = ism-tabix                  " RowID
  1352.   ).
  1353.     READ TABLE gt_fcat ASSIGNING FIELD-SYMBOL(<fs_fcat>)
  1354.                    WITH KEY   fieldname = ism-fieldname.
  1355.     APPEND VALUE #( row_id =  ism-row_id type = 0 col_id = <fs_fcat>-col_pos   ) TO gt_error.
  1356.   ENDMETHOD.
  1357.  
  1358.  
  1359.   METHOD set_style.
  1360.  
  1361.     READ TABLE ct ASSIGNING FIELD-SYMBOL(<fs>) WITH KEY fieldname = iv_name.
  1362.     IF sy-subrc = 0.
  1363.       DELETE TABLE ct WITH TABLE KEY fieldname = iv_name.
  1364.     ENDIF.
  1365.     INSERT VALUE #( fieldname = iv_name style = iv_style )  INTO TABLE ct.
  1366.   ENDMETHOD.
  1367.  
  1368.  
  1369.   METHOD zif_rmc_gui_alv_grid~handle_data_changed_finished.
  1370.  
  1371.  
  1372.     DATA: lo TYPE REF TO lcl_for_redefine.
  1373.  
  1374.     IF lo IS NOT BOUND.
  1375.       CREATE OBJECT lo
  1376.         EXPORTING
  1377.           io_grid = gr_pmcs_alv.
  1378.     ENDIF.
  1379.  
  1380.     CHECK lines( gt_error ) > 0.
  1381.  
  1382.     lo->set_error( it = gt_error ).
  1383.     FREE gt_error.
  1384.  
  1385.   ENDMETHOD.
  1386.  
  1387.  
  1388.   METHOD zif_rmc_gui_alv_grid~handle_onf4.
  1389.     DATA: lv_error      TYPE flag.
  1390.  
  1391.  
  1392.     me->refresh_protocol(  ).
  1393.  
  1394.     READ TABLE me->gt_data ASSIGNING FIELD-SYMBOL(<ls_data_chk>) INDEX es_row_no-row_id.
  1395.     CASE e_fieldname.
  1396.       WHEN 'EQUNR'.
  1397.         <ls_data_chk>-equnr = get_equnr_f4(  ).
  1398.         IF <ls_data_chk>-equnr IS NOT INITIAL.
  1399.           <ls_data_chk>-eqktx = get_text_equnr(  <ls_data_chk>-equnr  ).
  1400.           <ls_data_chk>-vtplnr = get_tplnr( <ls_data_chk>-equnr ).
  1401.  
  1402.           IF <ls_data_chk>-vtplnr IS NOT INITIAL .
  1403.  
  1404. *            set_error(   VALUE #(
  1405. *            msgid = 'ZPM_RM_MSG' msgty = 'E' msgno = 060 msgv1 = <ls_data_chk>-equnr fieldname = e_fieldname row_id =  es_row_no-row_id  ) ).
  1406. *
  1407. *            lv_error = abap_true.
  1408. *            CLEAR <ls_data_chk>-equnr.
  1409. *          ELSE.
  1410.  
  1411.  
  1412.             me->set_style(
  1413.               EXPORTING
  1414.               iv_name  = 'EQUNR'
  1415.               iv_style = gc_onlyf4
  1416.               CHANGING
  1417.               ct = <ls_data_chk>-t_style ).
  1418.  
  1419.             me->set_style(
  1420.              EXPORTING
  1421.              iv_name  = 'EQKTX'
  1422.              iv_style = gc_full_d
  1423.              CHANGING
  1424.              ct = <ls_data_chk>-t_style ).
  1425.  
  1426.             <ls_data_chk>-vpltxt = get_text_tplnr( conv_tplnr_input( <ls_data_chk>-vtplnr ) ).
  1427.             <ls_data_chk>-superequi = get_superequi( <ls_data_chk>-equnr ).
  1428.             <ls_data_chk>-supeqktx = get_text_equnr(  <ls_data_chk>-superequi  ).
  1429.           ELSE.
  1430.             CLEAR  <ls_data_chk>-vpltxt.
  1431.           ENDIF.
  1432.         ENDIF.
  1433.       WHEN 'NTPLNR'.
  1434.  
  1435.  
  1436.         DATA(lv_tplnr) =  get_tplnr_f4(  ).
  1437.  
  1438.         IF lv_tplnr IS NOT INITIAL.
  1439.           <ls_data_chk>-ntplnr = lv_tplnr.
  1440.           me->set_style(
  1441.               EXPORTING
  1442.               iv_name  = 'NTPLNR'
  1443.               iv_style = gc_onlyf4
  1444.               CHANGING
  1445.               ct = <ls_data_chk>-t_style ).
  1446.           <ls_data_chk>-npltxt = get_text_tplnr( conv_tplnr_input( <ls_data_chk>-ntplnr ) ).
  1447.         ENDIF.
  1448.         IF <ls_data_chk>-ntplnr IS INITIAL .
  1449.  
  1450.           set_error(  VALUE #(
  1451.                      msgid = 'ZPM_RM_MSG' msgty = 'E' msgno = 061  fieldname = e_fieldname row_id =  es_row_no-row_id  ) ).
  1452.  
  1453.  
  1454.         ENDIF.
  1455.       WHEN OTHERS.
  1456.  
  1457.     ENDCASE.
  1458.  
  1459.     IF lv_error = abap_true.
  1460.  
  1461.       gr_prot->display_protocol( ).
  1462.     ELSE.
  1463.  
  1464.       gr_prot->refresh_protocol(  ).
  1465.  
  1466.  
  1467.     ENDIF.
  1468.  
  1469.  
  1470.     me->gr_pmcs_alv->refresh_table_display( ).
  1471.     er_event_data->m_event_handled = abap_true.
  1472.  
  1473.   ENDMETHOD.
  1474. ENDCLASS.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×