Monday, 19 January 2015

Part3 : FPM OVP Application -Integrating Search UIBB and List UIBB: Message Display

--------------------------------------------------------------------------------------------------------------------------------------------
Step1. Here we have the previously created FPM OVP application with Search & List UIBB.

Step2. Provide some search values and Search it.


Step3. Based on the search value we have below records are displayed.



Step4. Now change the search field value and click Search. Nothing is displayed. Here we want to display a message if the search is unsuccessful so that the user can change the search criteria and request for records.



Step5. Something like this. To Achieve this we need a small code.



Step6. Create a message text in the message class.




Step7. In the PROCESS_EVENT method of the list feeder class add  the below high lighted code.
-----------------------------------------------------------------------------------------------------------------------------------------
  METHOD if_fpm_guibb_list~process_event.

    DATA : lt_fpm_search_criteria TYPE         fpmgb_t_search_criteria,
                   lv_max_number          TYPE         i,
                   ls_rsds                TYPE         rsdsselopt,
                   lt_vbeln_range         TYPE         ztest_t_vbeln_range,
                   ls_vbeln_range         LIKE LINE OF lt_vbeln_range,
                   lt_vkorg_range         TYPE         ztest_t_vkorg_range,
                   ls_vkorg_range         LIKE LINE OF lt_vkorg_range,
                   lt_vtweg_range         TYPE         ztest_t_vtweg_range,
                  ls_vtweg_range         LIKE LINE OF lt_vtweg_range,
                  lv_index               TYPE         sy-tabix,
           l      r_fpm                 TYPE REF TO  if_fpm,
                  lr_navigate            TYPE REF TO  if_fpm_navigate_to,
                 ls_trans               TYPE         fpm_s_launch_transaction,
                 ls_tr_param            TYPE         apb_lpd_s_add_trans_parameters,
                 ls_para                TYPE         wdy_key_value.

    FIELD-SYMBOLS: <fs_params_search>  TYPE         fpmgb_s_search_criteria,
                   <fs_ui_billing_doc> LIKE LINE OF gt_ui_billing_doc.
    CASE io_event->mv_event_id .
*     Search Event
      WHEN 'DISP_BILL_DOC'. " Open Tx- VF03 TO Display the billing doc           
        io_event->mo_event_data->get_value(
         EXPORTING
           iv_key   = if_fpm_guibb_list=>gc_event_par_row
         IMPORTING
           ev_value = lv_index ). " get the line number on the list on whcih user clicked the link
        READ TABLE gt_ui_billing_doc ASSIGNING <fs_ui_billing_doc> INDEX lv_index. 

        ls_trans-tcode        = 'VF03'.
        ls_trans-gui_type     = 'WEB_GUI'.

        ls_para-key = 'VBELN'.
        ls_para-value = <fs_ui_billing_doc>-vbeln. " billing dcoument number
        INSERT ls_para INTO TABLE ls_trans-parameter.

        ls_tr_param-navigation_mode      = 'EXTERNAL'.
        ls_tr_param-skip_init_screen_if_possible = abap_true.

        lr_fpm         = cl_fpm_factory=>get_instance( ).
        lr_navigate    = lr_fpm->get_navigate_to( ).

        lr_navigate->launch_transaction(                   " Opens tcode- vf03
          EXPORTING is_transaction_fields    = ls_trans
                    is_additional_parameters = ls_tr_param ).


      WHEN if_fpm_guibb_list~gc_event_list_filter.
*       Get fpm parameters
        io_event->mo_event_data->get_value(
          EXPORTING iv_key   = 'SEL_TAB'
          IMPORTING ev_value = lt_fpm_search_criteria ).

        io_event->mo_event_data->get_value(
          EXPORTING iv_key   = 'MAX_NUM'
          IMPORTING ev_value = lv_max_number ).

        IF lt_fpm_search_criteria IS NOT INITIAL.
          LOOP AT lt_fpm_search_criteria ASSIGNING <fs_params_search>.
            CASE <fs_params_search>-search_attribute.
              WHEN 'VBELN'.
                TRY.
                    cl_fpm_guibb_search_conversion=>to_abap_select_option(
                      EXPORTING
                        is_fpm_search_row  = <fs_params_search>
                      RECEIVING
                        rs_abap_sel_option = ls_rsds ) .
                    MOVE-CORRESPONDING ls_rsds TO ls_vbeln_range.
                    INSERT ls_vbeln_range INTO TABLE lt_vbeln_range.
                  CATCH cx_fpmgb.
                ENDTRY.
              WHEN 'VKORG'.
                TRY.
                    cl_fpm_guibb_search_conversion=>to_abap_select_option(
                      EXPORTING
                        is_fpm_search_row  = <fs_params_search>
                      RECEIVING
                        rs_abap_sel_option = ls_rsds ) .
                    MOVE-CORRESPONDING ls_rsds TO ls_vkorg_range.
                    INSERT ls_vkorg_range INTO TABLE lt_vkorg_range.
                  CATCH cx_fpmgb.
                ENDTRY.
              WHEN 'VTWEG'.
                TRY.
                    cl_fpm_guibb_search_conversion=>to_abap_select_option(
                      EXPORTING
                        is_fpm_search_row  = <fs_params_search>
                      RECEIVING
                        rs_abap_sel_option = ls_rsds ) .
                    MOVE-CORRESPONDING ls_rsds TO ls_vtweg_range.
                    INSERT ls_vtweg_range INTO TABLE lt_vtweg_range.
                  CATCH cx_fpmgb.
                ENDTRY.
            ENDCASE.
          ENDLOOP.

          SELECT * FROM vbrk UP TO lv_max_number
          ROWS INTO CORRESPONDING FIELDS OF TABLE gt_ui_billing_doc
                                                                WHERE vbeln IN lt_vbeln_range
                                                                  AND vkorg IN lt_vkorg_range
                                                                  AND vtweg IN lt_vtweg_range.
        ELSE.
          SELECT * FROM vbrk UP TO lv_max_number 
          ROWS INTO CORRESPONDING FIELDS OF TABLE gt_ui_billing_doc.
        ENDIF.

        FIELD-SYMBOLS : <fs_message> LIKE LINE OF et_messages.
        IF gt_ui_billing_doc IS INITIAL.
          APPEND INITIAL LINE TO et_messages ASSIGNING <fs_message>.
          <fs_message>-msgid = 'ZMSG_EXP'.
          <fs_message>-severity = 'S'.
          <fs_message>-msgno = '000'.
        ENDIF.

      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.


-----------------------------------------------------------------------------------------------------------------------------------------
The method ZCL_TEST_BILL_FEEDER_LIST-PROCESS_EVENT having an exporting parameter ET_MESSAGES which should be filled to display any message on UI.



--------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Comments system

Disqus Shortname