This link explains how to use the document Text IDs and how to use them in forms.
Customizing Document Text-IDs:-
You can define Text IDs for document header and line items.
For document header, use customization transaction OBT8 (SPRO > Financial Accounting (New) > Financial Accounting Basic Settings (New) > Document > Texts and Text Identifiers for Documents > Define Text IDs for Documents)
Here maintain the four characters Text ID, e.g. ZADD “Addendum”:-
For document Line Items, use customization transaction OBT10 (SPRO > Financial Accounting (New) > Financial Accounting Basic Settings (New) > Document > Texts and Text Identifiers for Documents > Define Text Identifications for Line Items)
Here maintain the four characters Text ID, e.g. ZCGD “Line Item Supplement”:-
Entering values in Document Text-IDs while entering the document:-
You can then enter the values of document text ids while entering the documents. E.g. while processing FB60, you can enter the document text ID values as below:-
Then the below screen will appear for all the text ids configured in OBT8 as above:-
Enter the value here and it will get saved against that text id.
Similarly, at line item also text ids appear in long text button. Click on “Long Text” button in line item:-
Enter the value here and it will get saved against that text id in line item.
Showing values in Document Text-IDs while creating correspondence like invoice of the document etc.:-
In the SAP form script definition, use the following coding code:-
/: DEFINE &TEXTNAME& := '&BKPF-BUKRS(*)&&BKPF-BELNR(*RF0)&&BKPF-GJAHR&'
/: INCLUDE &TEXTNAME& OBJECT XXXX ID YYYY LANGUAGE &RF140-SPRAS&
(In above, XXXX is the object ID which is BELEG for header and DOC_ITEM for line item and YYYY is the four character text ID. )
Then the text corresponding to text id passed in above code, will get displayed in the form output.
You can also use the function module READ_TEXT to fetch the text stored against a particular text id. For this you need to pass the data in function module READ_TEXT in the below format:-
Object is BELEG for document header and DOC_ITEM for line items. In Name field, give the concatenate of company code, document number and fiscal year. Rest fields are self explanatory.