Monday, August 29, 2005

Using the SAP logging features

Very quick instructions:

1) create a log object and subobject in SLG0
2) initialize the log object/subobject (g_loghandle is a global variable)


DATA: l_loghead TYPE bal_s_log.

IF w_loghandle IS INITIAL.
l_loghead-object = 'ZMYOBJ'.
l_loghead-subobject = 'MYSUBOBJ'.
l_loghead-aldate_del = sy-datum + 90. "expires in 90 days

CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = l_loghead
IMPORTING
e_log_handle = g_loghandle
EXCEPTIONS
OTHERS = 1.
ENDIF.


3) add the messages to the log


DATA: ls_logmsg TYPE bal_s_msg.

ls_logmsg-msgty = msg_type.
ls_logmsg-msgid = msg_id.
ls_logmsg-msgno = msg_number.
ls_logmsg-msgv1 = msg_v1.
ls_logmsg-msgv2 = msg_v2.
ls_logmsg-msgv3 = msg_v3.
ls_logmsg-msgv4 = msg_v4.


CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle = g_loghandle
i_s_msg = ls_logmsg
EXCEPTIONS
OTHERS = 1.



4) save the log

DATA: lt_log_handle TYPE bal_t_logh,
ls_log_handle LIKE LINE OF lt_log_handle.

ls_log_handle = w_loghandle.
APPEND ls_log_handle TO lt_log_handle.

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

COMMIT WORK.


5) see the results with SLG1

Labels:

Thursday, August 25, 2005

Hidden Configuration

I knew it was possible to configure stop-offs costs in APO TP/VS. But I could not find where. Damm! It was in the cost profile, but I had to open the select box. Humm ... it was hidden quite well.

Labels: ,

Tuesday, August 09, 2005

Are you doing job interviews?

From Paul Graham in Hackers and Painters (a great book, by the way):

It seems surprising to me that any employer would be reluctant to let hackers work on open source projects. At Viaweb, we would have been reluctant to hire anyone who didn't. When we interviewed programmers, the main thing we cared about was what kind of software they wrote in their spare time. You can't do anything really well unless you love it, and if you love to hack you'll inevitably be working on projects of your own.

Labels:

Tuesday, August 02, 2005

Working with optimizers - quick tips


  • Test and check that versions match with /SAPAPO/OPT_INST
  • Use /SAPAPO/OPT11 to see the optimizer trace file

Labels: