Example: Document Title
In the standard SAP system, the title of a document in the print worbench is identical to the name of the application form. For example, if the name of the application form you want to send by e-mail is Confirmation of request, the reference text of the e-mail will also be Confirmation of request.
In the case of generic application forms, the title is not sufficiently intuitive for the correspondence you are sending. You can change the title in the following ways:
· By implementing an exit in the print workbench
You must
implement an exit in the print workbench. The exit gives you access to the
control variable C of the
print workbench. You only change the title of an application form. For
detailed information about the control variable C, see
the documentation for the
print
workbench.
· By implementing the Business Add-In (BAdI) LSO Correspondence: Change Output Control Options (LSO_CORRESPONDENCE43)
This option enables you to change the title regardless of what application form you are using. Parts of the solution used in the first option are also used in the following example.
You can change the output parameters in the method CHANGE_PRINTPARAMS. The output parameters are transferred as change parameters in the structure PRINTPARAMS. The title is stored in the field TDTITLE. In this example, the text variable PARTACTYTXT should be used to fill the title:
METHOD if_ex_lso_correspondence43~change_printparams.
DATA: BEGIN OF ls_data,
partactytxt TYPE lsoppvar-partactytxt,
END OF ls_data.
TRY.
CALL METHOD cl_lso_crp_render_reader=>fill
EXPORTING
task_id = task_id
CHANGING
data = ls_data.
printparams-tdtitle = ls_data-partactytxt.
CATCH cx_lso_crp_exception.
ENDTRY.
ENDMETHOD.
The text variables are filled in the same way as text variables at the level of forms. First, a structure is declared that lists the required text variables. This can be a local structure, as in the example. As at form level, it is important that the name of the field corresponds to the name of a text variable and that the DDIC type matches the DDIC of the text variable.
Then, the text variable must be filled. This is done by the class CL_LSO_CRP_RENDER_READER. Unlike form level filling, the correspondence request header of the correspondence tool is not transferred here, but the ID of the correspondence request that was transferred in the field TASK_ID.
After the static method FILL_BY_TASK_ID is called, all text variables of the local structure LS_DATA are filled and only the field TDTITLE of the output parameter structure needs to be filled with the value of the text variable PARTACTYTXT.
For detailed information about the BAdI, see the Customizing documentation for SAP Learning Solution. You access this by choosing Training Management ® Day-to-Day Activities ® Correspondence ® Request-Based Correspondence ® Correspondence Output ® BAdI: Change Output Control Options.