2024 Jan 12 8:21 AM
Hello,
i am writting an programm in which it is required to read the context-data from application log message entries.
This is my code for reading the messages and trying to convert the context data:
DATA lv_number_of_logs TYPE i.
DATA lt_header_data TYPE TABLE OF balhdr.
DATA lt_header_parameters TYPE TABLE OF balhdrp.
DATA lt_messages TYPE TABLE OF balm.
DATA lt_message_parameters TYPE TABLE OF balmp.
DATA lt_context TYPE TABLE OF balc.
DATA lt_exceptions TYPE TABLE OF bal_s_exception.
CALL FUNCTION 'APPL_LOG_READ_DB'
EXPORTING
object = 'ISH_ACM'
subobject = 'DE_EAU(KIM)'
date_from = iv_date_from "00000000
time_from = '000000'
date_to = iv_date_to
time_to = '235959'
IMPORTING
number_of_logs = lv_number_of_logs
TABLES
header_data = lt_header_data
header_parameters = lt_header_parameters
messages = lt_messages
message_parameters = lt_message_parameters
contexts = lt_context
t_exceptions = lt_exceptions.
data gs_context TYPE REF TO data.
FIELD-SYMBOLS <gs_context> TYPE ANY.
FIELD-SYMBOLS <g_context_char> TYPE c.
CREATE DATA gs_context TYPE RN1TI_BAL_CTX_EAU.
ASSIGN gs_context->* TO <gs_context>.
ASSIGN <gs_context> TO <g_context_char> CASTING.
data ls_context like LINE OF lt_context.
READ TABLE lt_context INTO ls_context INDEX 1.
The Problem occures here:
<g_context_char> = ls_context-CONVALUE.<br>
Additional Informations:
The Format of ls_context is:
Does anybody now, how i can the CONVALUE Field correctly?
Thanks and regards,
Andreas
2024 Jan 12 10:26 AM
Context should start with a structure name (subfield tabname) followed by values (subfield value)
2024 Jan 12 1:27 PM
i have updated my post.
I have tryed to achive this with:
<g_context_char> = ls_context-CONVALUE
The problem is in my opinion that the data has the wrong format. -> raw. And i dont know how to convert it properly.
2024 Jan 12 2:21 PM
try a
assign l_context_value
to <ls_context> casting type (is_ldat-log-context-tabname).
Try to analyze a FM such as BAL_DB_CONVERT_CONTEXT (which convert old context format to current one when structure changed since log creation)
It would be easier to use standard BAL* FM ?
2024 Jan 12 11:55 AM
Please edit your question (Actions>Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it'll be easier for people to look at it. Thanks!
e.g.
data gs_context TYPE REF TO data.
FIELD-SYMBOLS <gs_context> TYPE ANY.
FIELD-SYMBOLS <g_context_char> TYPE c.
CREATE DATA gs_context TYPE RN1TI_BAL_CTX_EAU.
ASSIGN gs_context->* TO <gs_context>.
ASSIGN <gs_context> TO <g_context_char> CASTING.
<g_context_char> = <some_raw_data>. " <==== "it does not work"
2024 Jan 12 1:25 PM
Thank you very much,
it its my first question and i didnt knew it. I have updated my post.
Thanks and regards,
Andreas
2024 Jan 12 1:54 PM
You are using the obsolete API, hence the confusion with latest API (components tabname and value).
I don't know how this old API works...
2024 Jan 12 2:00 PM