Form Level Filling
You can use the static method FILL of class CL_LSO_CRP_RENDER_READER to fill a form level. The method expects as import parameter a correspondence request header of the correspondence tool, and as change parameter the form level you want to fill. This example illustrates how to fill a customer form level of the structure ZLSOTXTVAR.
FORM fill_corresp_zlsotxtvar
USING
x_corresp TYPE g_type_str_corresp
y_lsoppvarc TYPE g_type_str_zlsotxtvar.
CLEAR y_ zlsotxtvar.
DATA: lr_exception TYPE REF TO cx_lso_crp_exception.
TRY.
CALL METHOD cl_lso_crp_render_reader=>fill
EXPORTING
dfkkcoh = x_corresp
CHANGING
data = y_ zlsotxtvar.
CATCH cx_lso_crp_exception INTO lr_exception.
lr_exception->to_bapiret2( ).
mac_print_cancel sy-msgty sy-msgno sy-msgid
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDTRY.
ENDFORM.
As you see from the example, filling a form level is a generic operation. No knowledge of the data dictionary (DDIC) type of the form level is required.
For the purpose of error handling, the class-based exception CX_LSO_CRP_EXCEPTION, which is generated in the read class CL_LSO_CRP_RENDER_READER, must be caught. Calling the method TO_BAPIRET2( )for the exception supplies the SY fields that are used for the print workbench macro.