Skip to Content

Transport Orders Report Renewed

As Alvaro Tejada said in his blog  (The specified item was not found.), I was waiting for a transport to Productive system..killing the time surfing in SDN, I founded his great idea of a report that displays the status of several transport orders in one shot.  I’ve read his post, taken his report, upped it into my development system and…no details for Productive system. Why? Didn’t know until this morning: the report is fantastic with a TMS configuration that includes systems in the same group of the Domain Controller, but what about more complex TMS configurations? For example, imagine to have a standard landscape, on three systems: ** QAS – Quality ** PRD – Production These systems are grouped into the domain DOMAIN_DEV, controlled by development system DEV. But the domain contains several groups, just like: 0.1. GROUP_DEV – Containing DEV/QAS 0.2. GROUP_PRD – Containing PRD The first group shares the same trans directory, the second has its own, not shared with the other group. How we can get necessary cofiles? So I made something (a little)different and here is my solution, ABAP explains better than words:  +(the report contains three local classes: CL_REQUEST, CL_CUSTOMIZING_REQUEST, CL_WORKBENCH_REQUEST. CL_REQUEST is the superclass for the others. Only the superclass is needed for the report, the others are scratches for another program I’m working on… 😉 ).+  h5. Report Main report  zbc_transport_request_check.  tables: e07t.  include zbc_class_definitions. include zbc_class_implementations.  selection-screen begin of block corr with frame title text-000. select-options: selcorr for e07t-trkorr no intervals. selection-screen end of block corr.  include zbc_cr_data. include zbc_cr_forms.  start-of-selection.  * Get transport group for local system:   perform get_system_tms_group using sy-sysid changing g_group. * Searches transport requests   loop at selcorr into corrnum.     if cl_request=>get_request_type( corrnum-low ) eq ‘SYST’.       create object classobject type cl_workbench_request exporting im_tkorr = corrnum-low.     elseif cl_request=>get_request_type( corrnum-low ) eq ‘CUST’.       create object classobject type cl_customizing_request exporting im_tkorr = corrnum-low.     endif. * Read request cofiles     classobject->read_request_status( ). * Save     append classobject to oo_requests.   endloop. * Fill output looking at cofiles   loop at oo_requests into classobject.     output-trkorr = classobject->change_request.     output-descr  = classobject->description.     case classobject->request_type.       when ‘SYST’.         output-type   = ‘Workbench’.       when ‘CUST’.         output-type   = ‘Customizing’.       when others.         output-type   = ‘Sconosciuto’.     endcase. * Imported?     read table classobject->request_details into request_detail          with key trkorr = classobject->change_request.     if sy-subrc eq 0.       output-imported = request_detail-cofile-imported.     endif. * HRC     perform getsystemrc using     classobject ‘HRC’                         changing  output-hrc. * HRR     perform getsystemrc using     classobject ‘HRR’                         changing  output-hrr. * HRP     perform getsystemrc using     classobject ‘HRP’                         changing  output-hrp.     append output. clear output.   endloop.  end-of-selection.  * Display:   perform display_alv. h5. Report Global Data *&——————————————————————– * *&  Include           ZBC_CR_DATA *&——————————————————————– * *——————————————————————– * *       CLASS grid_handler DEFINITION *——————————————————————– * class grid_handler definition.   public section.     methods: on_link_click for event link_click of cl_salv_events_table                            importing row column. endclass.                    “grid_handler DEFINITION *——————————————————————– * *       CLASS grid_handler IMPLEMENTATION *——————————————————————– * class grid_handler implementation.   method on_link_click.     case column.       when ‘TRKORR’.         perform show_request using row.       when others.         cl_gui_cfw=>set_new_ok_code( ‘REFR’ ).     endcase.   endmethod.                    “on_link_click endclass.                    “grid_handler IMPLEMENTATION  data: corrnum like line of selcorr. data: req_type type e070-korrdev. data: classobject type ref to cl_request. data: request_detail type cl_request=>t_request_detail.  data: begin of output occurs 0,        trkorr   type e07t-trkorr,        descr    type e07t-as4text,        type     type c length 15,        imported type xfeld,        hrc      type c length 4,        hrr      type c length 4,        hrp      type c length 4,       end of output.  data: oo_requests type standard table of ref to cl_request.  data: lr_grid type ref to cl_salv_table,       lr_func type ref to cl_salv_functions,       lr_disp type ref to cl_salv_display_settings,       lr_cols type ref to cl_salv_columns_table,       lr_col  type ref to cl_salv_column_table,       lr_handler type ref to grid_handler,       lr_event type ref to cl_salv_events_table,       lr_headtype ref to cl_salv_form_element.  data: tms_systems type tmscsyslst_typ with header line,       g_group   type tmscsys-nfsgrp. h5. Report Subroutines *&——————————————————————– * *&  Include           ZBC_CR_FORMS *&——————————————————————– * *&——————————————————————– * *&      Form  getSystemRc *&——————————————————————– * form getsystemrc  using    pr_object type ref to cl_request                            value(systemid)                   changing value(rc).    data: ls_system type ctslg_system.   data: request_detail type cl_request=>t_request_detail.   data: ls_step   type ctslg_step.   data: l_stepid  type tstrfcofil-function.   data: ls_cofi_header type tstrfcofih.   data: cofi_lines     type tr_cofilines.   data: l_group        type tmscsys-nfsgrp.  * If the system is into another transport group, cofile must be read * in that system, not in global trans directory:   perform get_system_tms_group using systemid changing l_group. * Check equality of group   if l_group ne g_group. * Get remote cofile     call function ‘TMS_MGR_GET_COFILE’       exporting         iv_sysname     = systemid         iv_dirtype     = ‘T’         iv_trkorr      = pr_object->change_request         iv_read_header = ‘X’       importing         es_cofi_header = ls_cofi_header       tables         tt_cofi_lines  = cofi_lines. * Evaluate it     call function ‘TR_EVALUATE_COFILE_LINES’       exporting         iv_trkorr        = pr_object->change_request         is_cofile_header = ls_cofi_header       changing         cs_cofile        = request_detail-cofile         ct_cofile_lines  = cofi_lines.   else.     read table pr_object->request_details into request_detail                with key trkorr = pr_object->change_request.   endif. * Check   if sy-subrc ne 0.     rc = ‘@B0@’.   else.     read table request_detail-cofile-systems into ls_system                with key systemid = systemid.     if sy-subrc ne 0.       rc = ‘@B0@’.     else.       case pr_object->request_type.         when ‘SYST’.           l_stepid = ‘G’.  “Generation         when ‘CUST’.           l_stepid = ‘I’.  “Import         when others.           rc = ‘@B0@’.       endcase.       read table ls_system-steps into ls_step with key stepid = l_stepid.       if sy-subrc ne 0.         rc = ‘@B0@’.       else.         case ls_step-rc.           when 0.             rc = ‘@08@’.           when 4.             rc = ‘@09@’.           when 8.             rc = ‘@0A@’.           when 12.             rc = ‘@JM@’.           when others.             rc = ‘@B0@’.         endcase.       endif.     endif.   endif. endform.                    ” getSystemRc  *&——————————————————————- * *&      Form  show_request *&——————————————————————- * form show_request using im_row type i.   field-symbols: -trkorr       i_operation = ‘DISPLAY’.  endform.                    “show_request  *&——————————————————————- * *&      Form  build_header *&——————————————————————- * *       text *——————————————————————– * *      –>HEADER     text *——————————————————————– * form build_header  changing header type ref to cl_salv_form_element.    data: lr_grid   type ref to cl_salv_form_layout_grid,         lr_grid_1 type ref to cl_salv_form_layout_grid,         lr_label  type ref to cl_salv_form_label,         lr_text   type ref to cl_salv_form_text,         l_text    type string.  * Creates the main grid   create object lr_grid.  * Create the main header   l_text = text-i99.   lr_grid->create_header_information( row      = 1                                       column   = 1                                       text     = l_text                                       tooltip  = l_text ).   lr_grid->add_row( ).   lr_grid->add_row( ).  * Into this, build an another little grid:   lr_grid_1 = lr_grid->create_grid( row    = 3                                     column = 1 ).  * On the left of the grid, create a label   l_text = text-f00.   lr_label = lr_grid_1->create_label( row     = 1                                       column  = 1                                       text    = l_text                                       tooltip = l_text ).   l_text = ‘Click sul codice CR per i dettagli’.    lr_text  =     lr_grid_1->create_text(  row     = 1                              column  = 2                              text    = l_text                              tooltip = l_text ).            “#EC NOTEXT  * Bind label and text togheter   lr_label->set_label_for( lr_text ).  * The content is the top grid   header = lr_grid.  endform.                    ” build_header *&——————————————————————– * *&      Form  get_system_tms_group *&——————————————————————– * form get_system_tms_group  using    l_system type sy-sysid                            changing l_group  type tmscsys-nfsgrp.    data: lcl_system type tmscsys-sysnam,         lcl_group  type tmscsys-nfsgrp.    lcl_system = l_system.   call function ‘TMS_CI_GET_SYSTEMLIST’     exporting       iv_system = lcl_system     tables       tt_syslst = tms_systems[]. * Get domain for local system:   read table tms_systems with key sysnam = sy-sysid.   if sy-subrc eq 0. * Get groups     select single nfsgrp from tmscsys into lcl_group                                       where sysnam = lcl_system                                       and   domnam = tms_systems-domnam                                       and   limbo  = space.     l_group = lcl_group.   endif.  endform.                    ” get_system_tms_group *&——————————————————————– * *&      Form  display_alv *&——————————————————————– * form display_alv .    cl_salv_table=>factory( exporting list_display = ‘ ‘                           importing r_salv_table = lr_grid                           changing  t_table      = output[] ).    lr_func = lr_grid->get_functions( ).   lr_disp = lr_grid->get_display_settings( ).   lr_cols = lr_grid->get_columns( ).   lr_event = lr_grid->get_event( ).    create object lr_handler.   set handler lr_handler->on_link_click for lr_event.    lr_func->set_all( ‘X’ ).   lr_disp->set_striped_pattern( ‘X’ ).   lr_disp->set_list_header( ‘Lista CR’ ).    lr_col ?= lr_cols->get_column( ‘TRKORR’ ).   lr_col->set_cell_type( if_salv_c_cell_type=>hotspot ).    lr_col ?= lr_cols->get_column( ‘HRC’ ).   lr_col->set_icon( ‘X’ ).   lr_col->set_medium_text( ‘Sistema HRC’ ).   lr_col->set_alignment( if_salv_c_alignment=>centered ).    lr_col ?= lr_cols->get_column( ‘HRR’ ).   lr_col->set_icon( ‘X’ ).   lr_col->set_medium_text( ‘Sistema HRR’ ).   lr_col->set_alignment( if_salv_c_alignment=>centered ).    lr_col ?= lr_cols->get_column( ‘HRP’ ).   lr_col->set_icon( ‘X’ ).   lr_col->set_medium_text( ‘Sistema HRP’ ).   lr_col->set_alignment( if_salv_c_alignment=>centered ).    lr_col ?= lr_cols->get_column( ‘IMPORTED’ ).   lr_col->set_visible( ‘ ‘ ).    lr_col ?= lr_cols->get_column( ‘TYPE’ ).   lr_col->set_medium_text( ‘Tipologia’ ).   lr_col->set_alignment( if_salv_c_alignment=>centered ).    lr_cols->set_optimize( ‘X’ ).    perform build_header changing lr_head.   lr_grid->set_top_of_list( lr_head ).    lr_grid->display( ).  endform.                    ” display_alv h5. Report Classes  *&——————————————————————– * *&  Include           ZBC_CLASS_DEFINITIONS *&——————————————————————– *  * Local Classes   *——————————————————————– * *       CLASS cl_request DEFINITION *——————————————————————– * * *——————————————————————– * class cl_request definition create public abstract.    public section.      type-pools: ctslg.      types: begin of t_request_detail,              trkorr type e071-trkorr,              cofile type ctslg_cofile,            end of t_request_detail.     types: t_request_details type standard table of t_request_detail.      class-methods: get_request_type importing im_tkorr     type e07t-trkorr                                     returning value(type)  type e070-korrdev.      data: change_request type e07t-trkorr,           description    type e07t-as4text.      methods: constructor importing im_tkorr type e07t-trkorr.     methods read_request_status.      data:   request_type  type trcateg.  “CUST/SYST     data:   request_contents type standard table of e071.      data:   request_details type t_request_details.    protected section.    private section.  endclass.                    “cl_request DEFINITION  *——————————————————————– * *       CLASS cl_workbench_request DEFINITION *——————————————————————– * * *——————————————————————– * class cl_workbench_request definition inheriting from cl_request.    public section.      methods: constructor importing im_tkorr type e07t-trkorr.     methods: read_request_status final redefinition.    protected section.    private section.      data: object_details  type  standard table of tadir.  endclass.                    “cl_workbench_request DEFINITION   *——————————————————————– * *       CLASS cl_customizing_request DEFINITION *——————————————————————– * * *——————————————————————– * class cl_customizing_request definition inheriting from cl_request.    public section.      methods: constructor importing im_tkorr type e07t-trkorr.     methods: read_request_status final redefinition.    protected section.    private section.      data: table_ref type ref to data.  endclass.                    “cl_customizing_request DEFINITION  *&——————————————————————– * *&  Include           ZBC_CLASS_IMPLEMENTATIONS *&——————————————————————– *  * Local classes   *——————————————————————– * *       CLASS cl_request IMPLEMENTATION *——————————————————————– * * *——————————————————————– * class cl_request implementation.    method get_request_type.      select single korrdev into  type from e070                           where trkorr eq im_tkorr.    endmethod.                    “get_request_type    method constructor.      select single trkorr as4text from e07t into (change_request, description)                   where  trkorr = im_tkorr.    endmethod.                    “constructor    method read_request_status.      field-symbols: -trkorr. * Get cofile for request         call function ‘TR_READ_GLOBAL_INFO_OF_REQUEST’           exporting             iv_trkorr = -trkorr           importing             es_cofile = ls_cofile. * Save cofile:         l_request_det-trkorr = -trkorr.         move-corresponding ls_cofile to l_request_det-cofile.         append l_request_det to request_details.       endif.     endloop.    endmethod.                    “read_request  endclass.                    “cl_request IMPLEMENTATION   *——————————————————————– * *       CLASS cl_workbench_request IMPLEMENTATION *——————————————————————– * * *——————————————————————– * class cl_workbench_request implementation.    method constructor.      super->constructor( im_tkorr ).      me->request_type = ‘SYST’.    endmethod.                    “constructor    method read_request_status.      super->read_request_status( ).    endmethod.                    “read_request  endclass.                    “cl_workbench_request IMPLEMENTATION  *——————————————————————– * *       CLASS cl_customizing_request IMPLEMENTATION *——————————————————————– * * *——————————————————————– * class cl_customizing_request implementation.    method constructor.      super->constructor( im_tkorr ).      me->request_type = ‘CUST’.    endmethod.                    “constructor    method read_request_status.      super->read_request_status( ).    endmethod.                    “read_request  endclass.                    “cl_customizing_request IMPLEMENTATION     Sorry for not translated text elements, most of them are still in Italian.. 🙂 And here’s the output. “Request” column is clickable, and send directly to “Request Details” screen of transaction SE01.Output
You must be Logged on to comment or reply to a post.
  • Hi Roberto:

    I’m so glad that my humble blog give you an idea for your blog…You have taken things to the next level -;) Congratulations for this great blog! -:D



    • You simply don’t know how much this mean to me, I’m really honored to read a comment by you!

      Thank you very much, I’ll try to keep it up!

      Thanks again,

  • Hi Roberto,
    I’m still on 6.20 and the CL_SALV… classes do not exist yet. Maybe you should mention that in your blog. Will try to replace them with availabe classes to make it work here.
    • Hi Thomas,
      yeah, you’re right, I missed that point.
      Thank you for your input, I’ll modify the report to work on CL_GUI_ALV_GRID class.