Technical Articles
Accessing long text of SAP Master data Objects or fields in S4 Hana through a CDS View
Hi All,
This blog post provides how to read a long text of SAP Master data objects/fields like
Material – PO Long text
Material – Sales Long text
Equipment/Notification long text etc.,in S4 HANA through a CDS view.
Introduction:
Long texts of a material master or any master data objects are stored in an encrypted format in tables STXH and STXL , where STXH stores the header information of the long text like MATERIAL, PO, Sales etc., which indicates which Text Object the long text belongs to, TDID which indicates the various types of texts related to a text object, and TDNAME which is the actual name of the long text (in the case of MATERIAL should be the material number)
As these texts are stored in an encrypted format, the texts cannot be read using a SELECT statement. In ECC and R3 systems you will have to use the function module READ_TEXT. Through Read text we have limitation if we have maintained more than 250 chars it will truncate.
Below are some of the question’s and issues raised in SCN forum related to READ_TEXT.
https://answers.sap.com/questions/3237668/problems-with-text-with-more-than-250-characters-u.html
https://answers.sap.com/questions/10151756/create–read-text-with-more-than-255-chars.html
https://answers.sap.com/questions/7946583/in-readtext-fm-the-data-after-256-characters-gets-.html
https://answers.sap.com/questions/8926760/how-to-print-long-text-of-255-character-in-alv-gri.html
Solution:
In S4 Hana a standard CDS view I_TextObjectPlainLongText has introduced it stores all the master data related long texts. Using this you can read any long text of SAP Master data objects or fields without any limitation.With this view we can easily view and download any no of characters.
Data to this CDS view is populating or feeding through an ABAP program ESH_SR_LTXT_REPLICATE. We can Schedule or run the abap program depending on frequency of usage.
It can be accessed in SE16n or SE11.
- Text Object: Master Data object – Material, Equipment, Notification etc.
- Text ID: BEST – PO Long text , QMEL – Notification etc.
- Language: EN,FR etc.,
- Text Name: Material No(MATNR), Notification no (QMEL) etc.
- Long text : Descption of the Object
Depnding on requirement pass the values. You will see a long description in PLAINLONGTEXT/ Long Text column.
In addition, There are some standard CDS view available in S4 HANA which were created using I_TextObjectPlainLongText as source as listed below.
All these CDS views can be accessed in Eclipse, sql views in SE16n or SE11 . Depending on requirement we can use them directly either in ABAP program or a fiori app.
References:
OSS Note : 3048704 Long text (SAPScript) search enablement for CDS-based search
Note: There is a limitation with this long text cds view’s currently we can’t use them directly in analytic based modelling views – @analytic.query.true. If we try to use, we will get an error – ignored: Type g with length 000000 not supported [Analytics]
Hope this blog post helps.
Hi,
Good article.
Maintenance Order Long text data was visible but could not see any instance of PO Long Text in Table ITXTOBJPLNLTXT
Any ideas?
Regards
Hi,
As mentioned in blog data for this table was feeding or populating through an ABAP program ESH_SR_LTXT_REPLICATE. Run the abap program and see.
Thank you.
Hi Sesha,
We did ran the program and number of records went up inclusive of material, Maintenance Plans, Equipments but not for PO.
What are we missing?
Regards
Hi Javed,
Are you seeing po long text through READ_TEXT function module?
Also, make sure Text ID as BEST and Text object as material while passing the values in ITXTOBJPLNLTXT table.
Thank you
Thanks for sharing!
I had a question last year about the long texts and CDS views. Please be aware that there is a 1033 character limit for strings in ABAP CDS views in general ("unlimited" string is available in HANA CDS views). When dealing with longer texts, we did not find any other solution than to implement the OData service using classic code-based approach.
I've not heard of any changes since then but would be curious if anyone knows otherwise.
Thank you for reading the blog and providing your feedback.
In my requirement, I am extracting long text information through a CDS view via 3rd party or external tools - SQL server and displaying the values in PBI report.
I don't see any character limit's while extracting data through sql server. This blog main purpose was instead of reading long text through a function module READ_TEXT read through the standard CDS views.
Thank you
I don't remember where the information came from in my question. It could've been a typo. In documentation, I see 1333 limit for SSTRING type here