Start of Content Area

Background documentation Access to Text Variables  Locate the document in its SAP Library structure

You require access to text variables to realize the following:

·        Fill form levels in application forms of the print workbench

·        Implement exits in application forms of the print workbench

·        Implement SAP Learning Solution BADIs

·        Create new text variables from a combination of existing text variables

Filling text variables comprises the following steps:

...

       1.      You must first have a variable in a (global) structure that lists the text variables as fields that have to be filled. This structure can also be the form level of a form class of the print workbench.

  DATA: BEGIN OF ls_data,

    kbgda  TYPE ppvar-kbgda,      "begin date

    kndda  TYPE ppvar-endda,      "end date

  END OF ls_data.

Caution

You must be careful to ensure the correct typing of text variables. We recommend that you always refer to the structure that is stored for the text variable in the view V_LSOCRPTEXTVAR. Structures can also be nested.

       2.      To access text variables, you must use the static method GET of the class CL_LSO_CRP_RENDER_READER to generate an instance of the read class for text variables and bind it to a correspondence request. The correspondence request is designated as the context of the read class. The context provides data such as recipient, sender, course, dates and so on pertaining to the business process. You can specify the context using one of the following:

¡        The context itself (CONTEXT)

¡        A unique ID (TASK_ID)

¡        The correspondence request header of the correspondence tool (DFKKCOH)

¡        The ID (COKEY, COTYP) of the correspondence request header of the correspondence tool

The class CL_LSO_CRP_RENDER_READERprovides suitable methods for this purpose, such as:

DATA: lr_reader  TYPE REF TO if_lso_crp_render_reader.

lr_reader = cl_lso_crp_render_reader=>get( task_id = task_id ).

       3.      Finally, you must call the method READ_VALUE to transfer to the read class a data reference pointing to the structure you want to fill.

  DATA: lr_data       TYPE REF TO data.

  GET REFERENCE OF ls_data INTO lr_data.

      CALL METHOD lr_reader->read_value

        CHANGING

          value = lr_data.

The instance of a read class is usually used for one call only of the READ_VALUE method. The static method FILL of the class CL_LSO_CRP_RENDER_READERcombines steps 2 and 3 into one method call.

      CALL METHOD cl_lso_crp_render_reader=>fill

        EXPORTING

          task_id = task_id

        CHANGING

          data    = ls_data.

 

End of Content Area