Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i decode the bal-log context-data that is in raw format

andreas_greiff
Explorer
0 Kudos

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

7 REPLIES 7

raymond_giuseppi
Active Contributor

Context should start with a structure name (subfield tabname) followed by values (subfield value)

  • You have to assign subfield (component) value of bal log context to your structure the same way it was used to create the application log.

0 Kudos

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.

0 Kudos

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 ?

Sandra_Rossi
Active Contributor
0 Kudos

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"

andreas_greiff
Explorer

Thank you very much,

it its my first question and i didnt knew it. I have updated my post.

Thanks and regards,

Andreas

Sandra_Rossi
Active Contributor
0 Kudos

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

andreas_greiff
Explorer
0 Kudos

Thanks for the tip. Can you name me the current api?