Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 

Step by step guide to create a new custom report symbols in GLM:

1. Go to 'SPRO -> SAP Reference IMG ( Press F5 ) -> Environment, Health and Safety -> Basic Data and Tools -> Report Definition -> Report Symbols -> Check and Specify Report Symbols' as shown in the below screenshot. 'Specify Report Symbol Groups' can be used to define the new report symbol groups.

2. Clicking on the clock near 'Check and Specify Report Symbols' will take us to the below screen. Then click on the 'New Entries' button as shown below to create a new report symbol. Here you can create, change, copy or delete the existing report symbols.

3. Fill the values as shown in the below screenshot:

  • Z_HUNUM is the name of the new report symbol.
  • ZGLM_HU is the report symbol group name
  • ZCUST_REP is the table name
  • HUNUM is the field name to which the report symbol is mapped

4. Save this entry.

5. The structure ZCUST_REP is as shown below:

6. The report symbol group 'ZGLM_HU' is as shown below:

7. With this we have completed the basic customization for creating a new report symbol. Now we will need to build the custom function module 'ZREP_HANDL_UNIT' defined above to populate the data in our newly created report symbol 'Z_HUNUM'.

8. Code below shows how to populate the data in the report symbol 'Z_HUNUM'. Please note that the logic of this function module has been restricted to fetching of the data for only on report symbol. You can extend this FM as per your requirements.

*******************************************************************************************************************************************************************************

FUNCTION zrep_handl_unit.

*======================================================================*
* The interface of this custom FM can be copied from any of the standard
* EHS Library Parameter FMs
* I have copied this Interface from the standard EHS FM
* 'CBGL_LB60_PAR_DET_ADDR_SHIP_TO'
* Once we have the interface we can manipulate and populate the data
* for the report symbols belonging to same Report Symbol Group inside
* this Function Module
*======================================================================*
* FUNCTION MODULE ZREP_HANDL_UNIT                                      *
* DESCRIPTION ... Fetching data for report symbol group ZGLM_HU        *
* AUTHOR ........ Vaibhav Shetkar                                      *
*======================================================================*
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_FLG_OUT_VALUES) TYPE  ESP1_BOOLEAN DEFAULT ESP1_TRUE
*"     VALUE(I_FLG_IN_VALUES) TYPE  ESP1_BOOLEAN DEFAULT ESP1_TRUE
*"     VALUE(I_VALDAT) TYPE  SY-DATUM DEFAULT SY-DATUM
*"  TABLES
*"      I_CVDDP_TAB STRUCTURE  CVDDP
*"      I_SYMBOL_TAB STRUCTURE  RCGLSTRUCTSYM OPTIONAL
*"      I_SYMBOL_RG_TAB STRUCTURE  RCGLSTRUCTSYM OPTIONAL
*"      I_CVDDP_VALUES_TAB STRUCTURE  CVDDP OPTIONAL
*"      I_CVDDP_VALUES_RG_TAB STRUCTURE  CVDDP OPTIONAL
*"      I_LANGU_TAB TYPE  ESP5_LANGUTAB_TYPE OPTIONAL
*"      E_CVDDP_TAB STRUCTURE  CVDDP
*"      E_CVDDP_RG_TAB STRUCTURE  CVDDP OPTIONAL
*"      E_MESSAGES_TAB STRUCTURE  BALMI OPTIONAL
*"  EXCEPTIONS
*"      INTERNAL_ERROR
*"      OTHERS
*"----------------------------------------------------------------------

* Local Field Symbol declaration
  FIELD-SYMBOLS:
    <ls_symbol>   TYPE rcglstructsym.

* Local Work Area Declaration
  DATA  :   lws_cvddp_tab TYPE  cvddp.

* 'I_SYMBOL_TAB' will have all the data for report symbols belonging
* to the same report symbol group
* In our example it will contain all the report symbols belonging
* to report symbol group 'ZGLM_HU'

* Data reorganisation of symbols and languages
  SORT i_symbol_tab BY lsyid tabname fieldname lsyrpar.
  DELETE ADJACENT DUPLICATES FROM i_symbol_tab
  COMPARING lsyid tabname fieldname lsyrpar.
  DELETE i_langu_tab WHERE langu = '  '.

* Determine data of Handling Unit

* Search for your report symbol here
* I have restricted this looping only for our example
* report symbol 'Z_HUNUM'.
* But we can make use of this loop to populate the data for
* all the report symbols belonging to the same report
* symbol group by modifying the below loop as per your requirement
  LOOP AT i_symbol_tab ASSIGNING <ls_symbol>
    WHERE lsytype EQ '02'                                                  "Report Symbol Type
      AND lsygrp  EQ 'ZGLM_HU'                                           "Report Symbol Group
      AND tabname EQ 'ZCUST_REP'.                                   "Table Name

    CLEAR e_cvddp_tab.

*** If fieldname is 'HUNUM' then we will populate the value
*** in the internal table for report symbol 'Z_HUNUM'
*** Please note that report symbol 'Z_HUNUM' is assigned to the
*** field 'HUNUM' of structure 'ZCUST_REP' in the SPRO settings

    IF <ls_symbol>-fieldname EQ 'HUNUM'.

***   We need to fetch the required value for our
***   report symbol from the available data
***   In my case I have used the already available data to fetch
***   the HU Number value. You might need to write your own logic
***   to fetch the required data as per your requirement.
***   Fetch that necessary data before this loop and use this
***   loop just to populate the data into report symbols
      READ TABLE i_cvddp_tab
          WITH KEY object = '/TDAG/GFS_SYMBOL'
                   attrib = 'HANDLINGUNIT'.
      IF sy-subrc EQ 0.
***     You need to populate the structure name here
***     It should be same as that of 'Table Name' in the SPRO settings
***     for the report symbol
        lws_cvddp_tab-object     = 'ZCUST_REP'.

***     Populate the fieldname here
***     Same as that of 'Field Name' in the SPRO settings
        lws_cvddp_tab-attrib     = 'HUNUM'.

***     Mark this field as 'X'
***     It indicates that this parameter value will be used in the report
        lws_cvddp_tab-repparaflg = 'X'.

***     Assign this as '1' representing the value 'String'
        lws_cvddp_tab-valuetype  = '1'.

***     You need to assign the actual value here in this field
***     This value will be displayed on the label where this
***     report symbol will be used
        lws_cvddp_tab-value      = i_cvddp_tab-value.

***     This field is used to assign the sort sequence
        lws_cvddp_tab-ord        = sy-tabix.

        APPEND lws_cvddp_tab TO e_cvddp_tab.
        CLEAR: lws_cvddp_tab.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFUNCTION.

*******************************************************************************************************************************************************************************

4 Comments