1

Requirement: To convert SRT_MMASTER table's MESSAGE_DATA field data into readable string format or in internal table.

I have tried different function modules to convert Byte String (Blob) data stored in SRT_MMASTER table's MESSAGE_DATA field but none of it returned readable string format or at least generate an XML file in return.

I have tried Function modules like :

SCMS_BINARY_TO_STRING, 
SDIXML_XML_TO_DOM, 
SDIXML_DOM_TO_DATA,
SMUM_XML_PARSE

and methods like :

cl_soap_xml_parser=>get_data
cl_soap_xml_parser=>get_formatted_data
CALL METHOD cl_bcs_convert=>raw_to_string

and more, but none were able to convert it to correct readable format.

Can you suggest which function module or class/method can be used to solve the purpose?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Chandan Jha
  • 21
  • 1
  • 7
  • Can you describe what "SRT_MMASTER table's MESSAGE_DATA" is made of, and what it contains? And for a given example, what output do you expect? – Sandra Rossi Sep 20 '19 at 13:49
  • could you please add a minmal example record from the table? – koks der drache Sep 22 '19 at 16:00
  • @SandraRossi, SRT_MMASTER-MESSAGE_DATA field's Datatype is RAWSTRING (Byte String [BLOB]) – Chandan Jha Sep 26 '19 at 06:38
  • Based on your comments on Haojie answer (which I tested and which answers your question), it seems that you are looking for something else so can you ask a new question to tell what exactly you are looking for? (seems to be more than the field MESSAGE_DATA of database table SRT_MMASTER) – Sandra Rossi Sep 26 '19 at 08:03

1 Answers1

1

You can use IMPORT from DATA BUFFER and cl_soap_xml_helper=>xstring_to_string

DATA:
     lt_message_item        TYPE srt_persistency_item_t,
     lx_message_data TYPE xstring.

SELECT SINGLE message_data FROM srt_mmaster INTO lx_message_data.

IMPORT message_data = lt_message_item FROM DATA BUFFER lx_message_data.

DATA(lv_string) = cl_soap_xml_helper=>xstring_to_string(  lt_item[ 1 ]-value ).
Haojie
  • 5,665
  • 1
  • 15
  • 14
  • Thanks Haojie. But the value column returned is still in XSTRING format and not in readable format. – Chandan Jha Sep 26 '19 at 06:29
  • the value is in the lt_message_item. I tested and it should work. – Haojie Sep 26 '19 at 06:31
  • Yes. And the lt_message_item-value field is still in XSTRING. The other columns like URI and Name are correct. Actually am seeing the value in debugging. Do I need to check it any other way? – Chandan Jha Sep 26 '19 at 06:32
  • please try cl_soap_xml_helper=>transform_bxml_to_xml for the value field. – Haojie Sep 26 '19 at 06:36
  • please try cl_soap_xml_helper=>transform_bxml_to_xml for the value field. – Haojie Sep 26 '19 at 06:44
  • I tried this as well but in debugging it converts Xstring to Xstring which returns the same value. I am not sure if this is the problem in debugging only. My purpose is to read through the data and find the error message and use it for reporting purpose. Hence I need it to be converted into readable format. – Chandan Jha Sep 26 '19 at 06:52
  • sorry. it should be cl_soap_xml_helper=>XSTRING_TO_STRING. i just tried and it works. Thanks. – Haojie Sep 26 '19 at 07:57
  • @Haojie You were not wrong with `cl_soap_xml_helper=>transform_bxml_to_xml` because it depends what type of line is to be decoded (cf code inside method `GET_MESSAGE_PAYLOAD` of class `CL_SOAP_DB_RUNTIME`). I think that the question should indicate what means "readable format", what expects the OP? – Sandra Rossi Sep 26 '19 at 08:24
  • @SandraRossi, I have updated the title now. But my requirement was already highlighted in the details section of the question. – Chandan Jha Sep 26 '19 at 08:49
  • @Haojie, Thanks. The solution worked for me. Can you update your answer with the above suggestion about the class and method to convert the data? I will definitely mark the answer as Useful but adding the above code will help others looking for the solution. :) Cheers! CJ – Chandan Jha Sep 26 '19 at 08:51