Saturday, July 28, 2018

Screen 100 - Selection screen

Screen No 1000 in not visible in copied programme

Defines a screen that is automatically created during the generation of an executable ABAP program. Selection screens contain screen elements for the SELECTION-SCREEN and the PARAMETERS statements of this program. If the program has a logical database connected to it, the selection screen contains screen elements that allow you to enter database selection criteria. The system sets this attribute automatically.

Open the program in SE80.
Right click on the program name and select OTHER FUNCTIONS--> Rebuild Object List.
The screen which are automatically created through SELECTION-SCREEN will not be created when you copy the whole program. Only upon doing the above step you will get it.

 

Wednesday, July 25, 2018

hotspot in ALV




ZOTC_LCBO_GROCERY_ORDERS
 ****************************************************************************
* Identification                                                           *
*   Technical Object(s)      : Report-->  ZOTC_LCBO_GROCERY_ORDERS         *
*                              Include--> ZOTC_LCBO_GROCERY_TOP            *
*                              Include--> ZOTC_LCBO_GROCERY_SEL            *
*                              Include--> ZOTC_LCBO_GROCERY_SUB            *
*   Title                    : OTC LCBO Grocery Orders Report              *
*   Description              :                                             *
*    LCBO Daily Grocery Orders Report to send to LCBO or Brewers           *
*   Technical Consultant     : Richard Gilmore                             *
*   Solutions Architect      : Sean Pereira                                *
*   Functional Consultant    : Laura Alexander                             *
*   Creation Date            : 2018.06.10                                  *
*   Project/Ticket           : BREWS                                       *
****************************************************************************
* Date           Name             Project/Defect/Change Request ID         *
****************************************************************************
* 2018.06.10     RGILMORE         BREWS Project – Phase 2 (Realization)    *
*                                 Initial Version.                         *
*                                 33035 CR64 LCBO Grocery Store Sales Orders
* 2018.06.25     AMACDONALD       BREWS Project – Phase 2 (Realization)    *
*                                 Defect #1453 - remove hardcoded file path*
*                                 and replace with selection screen        *
*                                 defaulting from Parameter                *
*                                                                          *
* 2018.07.19     QCAO             BREWS Project – Phase 2 (Realization)    *
*                                 Defect #1514  - Add the SAP customer #   *
*                                 (VBAK-KUNNR) ANDpurchase order type      *
*                                 (VBAK-BSARK) to the report.              *
*                                 Added hotspot to vbak-vbeln to call VA03 *
*                                 and skip initial screen.                 *
****************************************************************************
REPORT zotc_lcbo_grocery_orders MESSAGE-ID zotc LINE-SIZE 133.

INCLUDE zotc_lcbo_grocery_top.            "Global data declaration

INCLUDE zotc_lcbo_grocery_sel.            "Selection screen

INCLUDE zotc_lcbo_grocery_cls.            "processing class

INCLUDE zotc_lcbo_grocery_sub.            "Subroutines


INITIALIZATION.

  AUTHORITY-CHECK OBJECT 'V_KNA1_VKO' "Customer: Authorization for Sales Organizations
    ID 'VKORG'   FIELD ' ' "
    ID 'VTWEG'   FIELD '*' "(All Distribution Channels)
    ID 'SPART'   FIELD '*' "(All Divisions)
    ID  'ACTVT'  FIELD '03'. " (Display Activity)
  IF sy-subrc NE 0.
    MESSAGE e005.
  ENDIF.


* Schalter Varianten benutzerspezifisch/allgemein speicherbar setzen
  PERFORM variant_init.


  perform get_filepath.

  perform initialize_file_path .

* Get default variant
  s_var_usr = s_variant.
  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = 'A'
    CHANGING
      cs_variant = s_var_usr
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_layout =  s_var_usr-variant.
  ENDIF.

**********************************************************************
START-OF-SELECTION.
  CREATE OBJECT LO_EVENT_HANDLER .                                " Defect 1514 July 23 2018 Qcao

  CREATE OBJECT lo_process.

  CALL METHOD lo_process->process.

*---------------------------------------
    CALL METHOD lo_process->prepare_layout
      CHANGING
        p_gs_layout = gs_layout.

*   Load data into the grid and display them
    CALL METHOD go_grid->set_table_for_first_display
      EXPORTING
        is_layout       = gs_layout
        is_variant      = gs_variant
        i_save          = 'A'
      CHANGING
        it_outtab       = gt_final
        it_fieldcatalog = gt_fieldcat.
    SET HANDLER LO_EVENT_HANDLER->HANDLE_HOTSPOT_CLICK FOR GO_GRID. " Defect 1514 July 23 2018 Qcao

  ELSE.

    CALL METHOD go_grid->refresh_table_display
      EXCEPTIONS
        finished = 1
        OTHERS   = 2.
    SET HANDLER LO_EVENT_HANDLER->HANDLE_HOTSPOT_CLICK FOR GO_GRID. " Defect 1514 July 23 2018 Qcao

  ENDIF.

---------------------------------
    ls_fcat-fieldname = 'VBELN' .
    ls_fcat-coltext   = 'Sales order number' .
    ls_fcat-col_pos   = ls_fcat-col_pos + 1 .
    ls_fcat-outputlen = '18' .
    ls_fcat-hotspot   = 'X'.                                " Defect 1514 July 23 2018 QCao
    ls_fcat-ref_field  = 'VBELN'.                           " Defect 1514 July 23 2018 QCao
    ls_fcat-ref_table  = 'VBAK'.                            " Defect 1514 July 23 2018 QCao
    APPEND ls_fcat TO p_gt_fieldcat .
    CLEAR: ls_fcat.

* Begin Defect 1514
*----------------------------------------------------------------------*
*-----------------------------------
* Event Handler Class definition
*
CLASS lcl_event_handler DEFINITION.

  PUBLIC SECTION.

    METHODS:handle_hotspot_click
                  FOR EVENT hotspot_click OF cl_gui_alv_grid
      IMPORTING e_row_id e_column_id.

ENDCLASS. "lcl_event_handler DEFINITION

*----------------------------------
* Event Handler Class implimentation
*
CLASS lcl_event_handler IMPLEMENTATION.

  METHOD handle_hotspot_click.

    READ TABLE gt_final INTO gs_final INDEX e_row_id-index.

    IF sy-subrc = 0.
      SET PARAMETER ID 'AUN' FIELD gs_final-vbeln.
      CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    ENDIF.

  ENDMETHOD. "handle_hotspot_click


ENDCLASS. "lcl_event_handler IMPLEMENTATION
* End Defect 1514
DATA: lo_process TYPE REF TO lcl_process,
      lo_event_handler  TYPE REF TO lcl_event_handler.          " Defect 1514 July 23 2018 Qcao