Transfer of Tables
Tables are unknown to the interface of the read routines of T77VC text variables. Tables are simulated by a process of iteration, using a counter. Thus, a table always consists of only one column.
T77VC table columns cannot be transferred just through configuration. The read routine must be implemented anew using the technology of the Maintenance View for Text Variables V_LSOCRPTEXTVAR. For a detailed description of how to implement text variables, see Implementation of New Text Variables.
You can use one of two methods for the reimplementation of text variables. These methods can also be implemented in the class CL_LSO_CRP_RENDER_TEXTVAR.
From a performance point of view, the most favorable solution enables a complete reimplementation of text variables that do not require access to existing data collection routines in T77VC text variables. In most cases, there is already a routine available that outputs the required data in the form of a structured table. This output can be used for a text variable, but it might be necessary to remove some technical fields from the output structure. An example of this is the text variable KSCHEDULE, implemented in the method GET_KSCHEDULE of class CL_LSO_CRP_RENDER_TEXTVAR:
METHOD get_kschedule.
DATA: lt_schedule TYPE STANDARD TABLE OF lso_hrvsched.
DATA: ls_result TYPE lso_crp_kschedule.
DATA: ls_tform TYPE lso_deliverymethod_c.
FIELD-SYMBOLS: <fs_schedule> LIKE LINE OF lt_schedule.
FIELD-SYMBOLS: <ft_result> TYPE lso_crp_kschedule_tab.
CREATE DATA result TYPE lso_crp_kschedule_tab.
ASSIGN result->* TO <ft_result>.
CALL FUNCTION 'LSO_TRAINING_GET_TFORM'
EXPORTING
plvar = context-training-plvar
otype = context-training-otype
objid = context-training-objid
IMPORTING
trainingform = ls_tform
EXCEPTIONS
OTHERS = 0.
IF NOT ls_tform-schedule_dep IS INITIAL.
CALL FUNCTION 'LSO_GET_SCHEDULE'
EXPORTING
plvar = context-training-plvar
otype = context-training-otype
objid = context-training-objid
TABLES
schedule_out = lt_schedule
EXCEPTIONS
OTHERS = 0.
LOOP AT lt_schedule ASSIGNING <fs_schedule>.
MOVE-CORRESPONDING <fs_schedule> TO ls_result.
APPEND ls_result TO <ft_result>.
ENDLOOP.
ENDIF.
ENDMETHOD.
The second variant is suitable if there is a lot of program logic involved in the implementation of the T77VC text variables, which you do not want to re-implement or make redundant. In this case, the columns of the output table can be read via the class already used for the single fields CL_LSO_CRP_RENDER_T77VC. The single columns must then be combined into an overall table. Class CL_LSO_CRP_RENDER_TEXTVARrealizes an example of this technology. In the method GET_RESOURCETY, the tabular RESOURCETY text variable is made up of the columns from T77VC text variables GTOTP_T, GTOBJ_T, GTSHT_T and GTSTX_T.
METHOD GET_RESOURCETY .
DATA: lr_t77vc_wrapper TYPE REF TO cl_lso_crp_render_t77vc.
DATA: l_index TYPE sy-tabix.
DATA: ls_result TYPE lso_crp_resourcetypes.
FIELD-SYMBOLS: <ft_result> TYPE lso_crp_resourcetypes_tab.
DATA: lt_gtotp TYPE STANDARD TABLE OF ppvardat.
DATA: lt_gtobj TYPE STANDARD TABLE OF ppvardat.
DATA: lt_gtsht TYPE STANDARD TABLE OF ppvardat.
DATA: lt_gtstx TYPE STANDARD TABLE OF ppvardat.
FIELD-SYMBOLS: <fs_gtotp> LIKE LINE OF lt_gtotp.
FIELD-SYMBOLS: <fs_gtobj> LIKE LINE OF lt_gtobj.
FIELD-SYMBOLS: <fs_gtsht> LIKE LINE OF lt_gtsht.
FIELD-SYMBOLS: <fs_gtstx> LIKE LINE OF lt_gtstx.
CREATE DATA result TYPE lso_crp_resourcetypes_tab.
ASSIGN result->* TO <ft_result>.
* Create class to access T77VC forms
lr_t77vc_wrapper ?= cl_lso_crp_render_t77vc=>get_instance(
context = context
).
* Read values into vdat table
lt_gtotp = lr_t77vc_wrapper->get_vdat_for_field( 'GTOTP_T' ).
lt_gtobj = lr_t77vc_wrapper->get_vdat_for_field( 'GTOBJ_T' ).
lt_gtsht = lr_t77vc_wrapper->get_vdat_for_field( 'GTSHT_T' ).
lt_gtstx = lr_t77vc_wrapper->get_vdat_for_field( 'GTSTX_T' ).
* Finally move merge tables into one table
LOOP AT lt_gtotp ASSIGNING <fs_gtotp>.
l_index = sy-tabix.
READ TABLE lt_gtobj ASSIGNING <fs_gtobj> INDEX l_index.
IF sy-subrc <> 0. CONTINUE. ENDIF.
READ TABLE lt_gtsht ASSIGNING <fs_gtsht> INDEX l_index.
IF sy-subrc <> 0. CONTINUE. ENDIF.
READ TABLE lt_gtstx ASSIGNING <fs_gtstx> INDEX l_index.
IF sy-subrc <> 0. CONTINUE. ENDIF.
ls_result-gtotp = <fs_gtotp>-data.
ls_result-gtobj = <fs_gtobj>-data.
ls_result-gtsht = <fs_gtsht>-data.
ls_result-gtstx = <fs_gtstx>-data.
APPEND ls_result TO <ft_result>.
ENDLOOP.
ENDMETHOD.