Issue in opening Notepad attachment using class CL_FITV_GOS=>GET_CONTENT


You have a GOS notepad attachment in your business object (for this post let us assume your business object is BUS1001006 i.e. Material). You decided to use the class method CL_FITV_GOS=>GET_CONTENT to read the content of the attachment and use the class method CL_WD_RUNTIME_SERVICES => ATTACH_FILE_TO_RESPONSE to open the file in the web browser.


To your surprise, when you open the notepad text file, it is shown empty. Even though the notepad has text in it (see figure below).


But, the more complex files like PDF, JPG opens correctly. 🙂


So what went wrong? 

Seems, SAP missed to put the logic to read notepad data (which are attached directly using t-code in case MM02 or OAER). We found that the notepad which were attached using the class method SAVE, would open correctly with this class. Issue is only with notepad which were NOT loaded with the class method SAVE.


Debugging inside the class method cl_fitv_gos=>get_content reveals that for notepad, the hexadecimal output is not populated (as shown in above figure).

Root Cause:
In the method of the class, object type of text file is ‘EXT’ but it is not handled correctly.

Work Around for this issue:
If ev_content_hex is blank, use standard FM ‘SO_DOCUMENT_READ_API1‘ to get the content of the text file. Convert the text content to hexadecimal using FM ‘SCMS_TEXT_TO_XSTRING‘ and display it.


Assumption: The class method does not work for notepad file only if you upload the notepad text file using MM01/MM02 or OAER directly (not using class CL_FITV_GOS=>SAVE).

Please find the real time working code for your reference in the this link Open Notepad Attachments

You might like to check our other posts on GOS Attachments, GOS Program and GOS Table.

Please let us know, if you face any issue in any of the steps. We would be glad to elaborate them.


Image source: via Free Stock Photos


Please enter your comment!
Please enter your name here