cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate System logs for inbound proxy program

former_member859847
Active Contributor
0 Kudos

Hi Experts,

Can any one help me, how to generate system logs in

t.code SM21 when we run the inbound proxy.

I designed a test-scenario for inbound proxy by

writing a set of ABAP-code under a method.

whenever the interface runs, any system related

errors has to generate in t.code SM21.

can any one suggest me,is it possible or not?

otherwise share some of your ideas regarding System log.

warm regards

mahesh.

Accepted Solutions (0)

Answers (1)

Answers (1)

turmoll
Active Contributor
0 Kudos

Hi,

Do you really want to send inbound proxy logs to system logs? Do you want to allow users to access system logs in order to monitor proxy processing?

I would recommend you to use the application log instead:

SLG0 - Objects

SLG1 - Analyse Application Log

SLG2 - Application Log: Delete Expired Logs

You just need to create object log and sub-object via SLG0. In inbound proxy call FM: BAL_LOG_CREATE to create log and e.g. FML BAL_LOG_MSG_ADD to add message and BAL_DB_SAVE FM to save log. Nexy you might monitor logs via SLG1.

For more details take a look here: [Application Log |http://help.sap.com/saphelp_erp2005/helpdata/EN/24/95d204fe2c11d2962300a0c930660b/frameset.htm].

Regards,

Jakub

former_member859847
Active Contributor
0 Kudos

Hi Jakub,

Thanks for your respone.

1.could you please confirm inbound proxy logs means application logs?

if so, let us consider small example as below.

assume file to proxy scenario, the length of particular fieldxxx is 5 in proxy structure.

the data coming to that field has a length is 8.

i hope that, it will throw an exception as follows

ID>PARSE_APPLICATION_DATA</ID>

<P1>Request Message</P1>

<P2>CX_ST_DESERIALIZATION_ERROR</P2>

<P3>/1SAI/TXS00000000000000000021</P3>

<P4>XML Bytepos.: 41238 XML Path: ns0:MTI_PRFINB001(1)RS(1)DATA(86)SAP_0012(12) Error Text: Data loss occurred when converting Too Kernel ErrorId: CONVT_DATA_LOSS

could please let me know, these type of errors are system or application type?

if so,where it will store and display.

i am unable to saw those exceptions in SLG1.

2.i heared from my collegues, they are unable to implement application logs for inbound proxy program.

if you sucessfully implemented, please send a sample code.

3.can u provide test-case which will generate the systemlog in SM21 for inbound proxy?

points are awarded, if your answer really help ful.

regards

mahesh.

turmoll
Active Contributor
0 Kudos

Hi,

> 1.could you please confirm inbound proxy logs means application logs?

No, application log is not the same as inbound proxy logs. Application logs are more or less associated with business application processing, but you might also want to append some other information.

ID>PARSE_APPLICATION_DATA</ID> 
<P1>Request Message</P1> 
<P2>CX_ST_DESERIALIZATION_ERROR</P2> 
<P3>/1SAI/TXS00000000000000000021</P3> 
<P4>XML Bytepos.: 41238 XML Path: ns0:MTI_PRFINB001(1)RS(1)DATA(86)SAP_0012(12) Error Text: Data loss occurred when converting Too Kernel ErrorId: CONVT_DATA_LOSS

If it comes to errors that occurs during parsing xml and converting to ABAP type you will not be able make us of application log unless you want to change sap standard. Method EXECUTE_(A)SYNCHROUNOUS wasn’t being called yet. You will get error message in message monitor and I guess it is enough.

> could please let me know, these type of errors are system or applicatin type?

These errors occur while XML doc is parsed.

> 2.i heared from my collegues, they are unable to implement application logs for inbound proxy program.

I was able to implement application log for inbound proxy. In previous post I have provided FM that could be utilized in order to create application log. You need to remember to save application log at the end via FM: BAL_DB_SAVE and COMMIT.

Regards,

Jakub

former_member859847
Active Contributor
0 Kudos

Hi Jakub,

Thanks for your response.

If you already implemeted the application log for inbound proxy,

could you please update that sample one.

Points wil be awarded, if it really helpful to me.

regards

mahesh.

turmoll
Active Contributor
0 Kudos

The simplest example might be like this one underneath. Not sure if it will compile but at least it is a starting point.

Regards,

Jakub


METHOD zii_mi_test~execute_asynchronous.

  DATA:
    l_dummy,
    ls_log_header TYPE  bal_s_log,
    l_log_handle TYPE balloghndl,
    lt_log_handle TYPE bal_t_logh,
    l_s_msg TYPE bal_s_msg.

* prepare application log header
  ls_log_header-object    = 'ZOBJ'.
  ls_log_header-subobject = 'ZSUBOBJ'.
  ls_log_header-aldate    = sy-datum.
  ls_log_header-altime    = sy-uzeit.
  ls_log_header-aluser    = sy-uname.
  ls_log_header-altcode   = sy-tcode.
  ls_log_header-alprog    = sy-repid.

* create log
  CALL FUNCTION 'BAL_LOG_CREATE'
    EXPORTING
      i_s_log      = ls_log_header
    IMPORTING
      e_log_handle = l_log_handle
    EXCEPTIONS
      OTHERS       = 1.

* create message
 MESSAGE i023(zclass) INTO l_dummy.

* define data of message for log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = '4'.

* add message
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
            i_s_msg       = l_s_msg
            I_LOG_HANDLE  = l_log_handle.


  INSERT l_log_handle INTO TABLE lt_log_handle.

* save log
  CALL FUNCTION 'BAL_DB_SAVE'
    EXPORTING
      i_t_log_handle = lt_log_handle
    EXCEPTIONS
      OTHERS         = 1.

   COMMIT WORK.
ENDMETHOD.

former_member859847
Active Contributor
0 Kudos

HI Jakub,

Thanks for sample code regarding application log.

when i include the code which is given by you,

then ECC(R/3) will generate the application log when inbound proxy executed sucessfully.

if any error in the data,it will throw an exception with the following classs.

- <CX_XMS_SYSTEM_ERROR>

<ID>PARSE_APPLICATION_DATA</ID>

<P1>Request Message</P1>

<P2>CX_ST_MATCH_ELEMENT</P2>

<P3>/1SAI/TXS00000000000000000021</P3>

these type of errors not appeared in SLG1,

then in which way it will helpful for us.

i hope that, these errors are system error's.

is it possible to route those to 'SM21(system log)' t.code.

if so, could you please let me know to proceed further.

otherwise, where these errors will store and display.

regards

mahesh.

turmoll
Active Contributor
0 Kudos

> when i include the code which is given by you,

> then ECC(R/3) will generate the application log when inbound proxy executed sucessfully.

Not exactly, you can generate application log also when inbound proxy fails in the same way.

> if any error in the data,it will throw an exception with the following classs.

>

> - <CX_XMS_SYSTEM_ERROR>

> <ID>PARSE_APPLICATION_DATA</ID>

> <P1>Request Message</P1>

> <P2>CX_ST_MATCH_ELEMENT</P2>

> <P3>/1SAI/TXS00000000000000000021</P3>

>

> these type of errors not appeared in SLG1,

That's right. Furthermore, this exception is thrown while parsing XML. Notice, that your method EXECUTE_(A) SYNCHRONOUS has not been called yet so you can't make a use of this kind of log.

> i hope that, these errors are system error's.

> is it possible to route those to 'SM21(system log)' t.code.

I guess it should be possible to sent thes log to SM21 but the question is: do you really want to do that? I don't think that system log is appropriate place for a xml parsing logs. Anyway, are you aware of that you will probably need to do a system modification? To get the names of FMs that post to system log you might want to post to either ABAP forum or BASIS form.

Regards,

Jakub

former_member859847
Active Contributor
0 Kudos

Hi Jakub,

Thanks for your respone.

i am unable to deviate which is system log and application log.

because of exception caught by class cx_xms_system_error, i felt that this is a system error.

could you please let me know, what are the system errors and application errors.

>>>do you really want to do that .

yes, i want the system logs in SM21 when the inbound proxy program executed (if it has system error) .

or where these system logs will store when we executed inbound proxy('SPROXY).

>>.are you aware of that you will probably need to do a system modification

no,.

regards

mahesh.

turmoll
Active Contributor
0 Kudos

> because of exception caught by class cx_xms_system_error, i felt that this is a system error.

That's right.

> could you please let me know, what are the system errors and application errors.

I believe that this will give you the best overview about the system vs. application errors and error handling in proxies. I encourage you to get familiar with it: [Error Handling |http://help.sap.com/saphelp_nw04/helpdata/en/25/a45c3cff8ca92be10000000a114084/content.htm]

> or where these system logs will store when we executed inbound proxy('SPROXY).

You will get the message in status "system error" in SXI_MONITOR.

Regards,

Jakub