Issue in opening Notepad attachment using class CL_FITV_GOS=>GET_CONTENT

Share on Facebook0Share on LinkedIn8Tweet about this on TwitterShare on Google+0
Please Share!!

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.

[adToAppearHere]

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).

1

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

2

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.

5

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.

6

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 foter.com

Share on Facebook0Share on LinkedIn8Tweet about this on TwitterShare on Google+0
Please Share!!

About the Author

SAP Yard
SAP Yard
SAPYard is one stop page for all Technical Folks in SAP. You would find un-conventional explanations, tutorials, and tricks. Please like our Facebook Page and also join our LinkedIn Group.

Be the first to comment on "Issue in opening Notepad attachment using class CL_FITV_GOS=>GET_CONTENT"

Leave a comment

Your email address will not be published.


*