How to Display Text on Sap Smart Forms
SAP Smartform developers can easily display Invoice header text or item text objects as well as Sales Order Confirmation documents item/header texts, etc by using the standart text control of the SAP Smart Forms.
Using Text control with Include Text type, it is simple to add a header or item text of a SAP document without detailed knowledge of the Text ID.
Sometimes knowing the Text ID of a text entered and displayed on the Sales document like order confirmation, invoice, etc might be difficult.
Here in this SAP tutorial, I'll show how to find Text ID of a text object and how to display text using Include Text object on a SAP Smart Forms output documents.
Open the SAP document in Change mode.
For example for an invoice, call transaction VF02 and provide a sample invoice document number.
Go to Header of the sales document.
Choose Header Text tab.
For example, if you want to display Billing Text on the SAP Smart Forms output, double click on the text entry area when Billing Text is selected.
This action will open a text editor to change the Billing Text.
Then follow the menu options : Goto > Header
The Text Header dialog screen will be displayed on the user screen.
There are information about ABAP developers and SAP Smartform developers to display this text entry easily on an output document.
As you can see on the above Text Header screenshot of the Billing Text object, SAP Smartform developers can display the Billing Text using the following information on an output document :
Text name (document number, like here in this case the invoice number)
Language (here the Billing Text is entered in English language)
Text ID (Z003, to determine which Text ID will be used is difficult if this Header Text screen is not used)
Text Object (VBBK is used for Sales documents Header texts)
The below screenshot from a SAP Smartform document is showing how Header Text information is used to display billing text on an output document.
Text Name is provided dynamically using the "&IS_BIL_INVOICE-HD_GEN-BIL_NUMBER&" variable which stores invoice number.
Text Object, Text ID and Language information is carried from the Header Text screen manually to display Billing Text.
You can mark the "No error if no text exists" checkbox to prevent a runtime error that might occur during creation of the output.
Of course this solution also applies for the Item Texts of the sales documents.
For example, if you want to display a specific item text object for each invoiced item on the invoice output, you can again add an Include Text type text control on your SAP Smart Form document.
And then configure the Text Name, Text Object and Text ID parameters shown as on the Header Text screen of the item text.
Here is an example:
Please note that this time for invoice items, the Text Object is VBBP
And the Text Name is concatenation of the document number and the item number like "1817000015" + "000010"
Of course ABAP developers can also retrieve Billing Text or Sales Material Text, etc using ABAP Function Module READ_TEXT like shown in below ABAP codes.
" HEADER Billing Text
ls_lines LIKE TLINE,
lt_lines LIKE TABLE OF TLINE,
lv_name LIKE THEAD-TDNAME,
lv_textid LIKE THEAD-TDID.
lv_name = IS_BIL_INVOICE-HD_GEN-BIL_NUMBER.
lv_textid = 'Z003'. " Text ID of Billing Text, customizable
CALL FUNCTION 'READ_TEXT'
* CLIENT = SY-MANDT
id = lv_textid
language = 'E'
name = lv_name " Invoice number
object = 'VBBK' " for Billing
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* HEADER =
lines = lt_lines " Text is stored in this internal table
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Smartform developers can use either of the above methods to display text on SAP Smart Forms output documents.