Tag Archive SAPSCRIPT

Sapscript – Local class to easily manage data in performs

Local class :


TYPES : ti_itcsy TYPE STANDARD TABLE OF itcsy WITH DEFAULT KEY.

CLASS lcl_sapscript DEFINITION.
*------------------------------
* Public section
*------------------------------
  PUBLIC SECTION.
    CLASS-METHODS init_tables IMPORTING input_table  TYPE ti_itcsy
                                        output_table TYPE ti_itcsy.
    CLASS-METHODS get_input_value IMPORTING iv_field        TYPE tdtprgname
                                  RETURNING VALUE(rv_value) TYPE tdsymvalue.
    CLASS-METHODS get_output_table RETURNING VALUE(rt_output) TYPE ti_itcsy.
    CLASS-METHODS set_output_value IMPORTING iv_field         TYPE tdtprgname
                                             iv_value         TYPE tdsymvalue
                                   RETURNING VALUE(rt_output) TYPE ti_itcsy.
  PRIVATE SECTION.
    CLASS-DATA : it_static_tbl_input  TYPE ti_itcsy,
                 it_static_tbl_output TYPE ti_itcsy.
ENDCLASS.

CLASS lcl_sapscript IMPLEMENTATION.
  METHOD init_tables.
    CLEAR : it_static_tbl_input, it_static_tbl_output.
    it_static_tbl_input = input_table.
    it_static_tbl_output = output_table.
  ENDMETHOD.
  METHOD get_input_value.
    READ TABLE it_static_tbl_input INTO DATA(ls_table) WITH KEY name = iv_field.
    IF sy-subrc = 0.
      rv_value = ls_table-value.
    ENDIF.
  ENDMETHOD.
  METHOD set_output_value.
    READ TABLE it_static_tbl_output ASSIGNING FIELD-SYMBOL(<fs_output>) WITH KEY name = iv_field.
    IF sy-subrc = 0.
      <fs_output>-value = iv_value.
    ENDIF.
    rt_output = it_static_tbl_output.
  ENDMETHOD.
  METHOD get_output_table.
    rt_output = it_static_tbl_output.
  ENDMETHOD.
ENDCLASS.

Example of use :

Read More

Sapscript – Copy a SAPSCRIPT

In transaction SE71 on an existing SAPSCRIPT :

Import/Export SAP-SCRIPT objects

Use program : RSTXSCRP.