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: 

Application Log & Backup files

Former Member
0 Kudos

Hi everybody,

I have two quaries..

1. In my program whenever errors occurs i am writing that error message in internal table and the same will be stored in application log.. here my query is how can we write error message in application log... can you explain the functionality of application log... do we need to define any internal table for application log.. please help me in tis regard.

2. I am creating four different named files in application server..... the same files will be taken backup in different backup folder.. how can i acheive this ....can anybody gone through this earlier...give me clear solution...

Thanks & Regards

R Nittala

5 REPLIES 5

Former Member
0 Kudos

Hi Rajesh,

The Application Log functionality can be realized by using the function modules in the function group SBAL. Go To SE80 and look at the Function Modules in this Function Group. They are all very well documented.

You can also go to SE38 and Execute the program SBAL_DOCUMENTATION.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Hi,

SLG1 is the transaction to view application logs.

To add messages or create a new one, you will need to refer to the Function group SLG0.

Some FMs are:

Create

APPL_LOG_INIT_MESSAGES Application Log: (Partially) Initialize log in local memory

APPL_LOG_SET_OBJECT Appplication log: Set current object and subobject

APPL_LOG_WRITE_DB Application log: Copy local memory data into DB tables

APPL_LOG_WRITE_HEADER Application log: Enter log header data

APPL_LOG_WRITE_MESSAGES Application log: Enter messages without parameter

APPL_LOG_WRITE_SINGLE_MESSAGE Application log: Enter single message without parameters.

Let me know if this does answer ur question.

Former Member
0 Kudos

Thank you Anand & Prasanth...

I will go through the given solutions...

can you look at my second query please...I need your help in this regad also

Former Member
0 Kudos

Hi Rajesh,

I am afraid there r no standard way to do this.

You might have to write a report to do this. Which ofcourse you can schedule it as a background job.

What u cud do is, read the contents fo the file on the application server, and write it to another file and save it. u can have a routine to also generate appropriate names for backup files.

P.S:

If ur Q is solved, kindly reward the answers that helped you solve your problem.

Prashanth.

Former Member
0 Kudos

Hi,

What is an Application Log?

The Application Log is a tool for collecting messages, saving, reading and deleting logs in the database and displaying logs.

Use of Application Log:

You can analyze the logs and their messages, and get more information about them, in the Display log dialog box. The log display is used in many SAP system applications, and has a slightly different format depending on the number of messages and the data structure.

Features of Application Log:

In applications with a (potentially) large number of messages, the display is divided into areas. A navigation tree provides an overview and allows navigation among the messages, and either all or a selection of messages are displayed in a list (ABAP List Viewer). The navigation tree can be either above or to the left of the list. Applications with little data have no navigation tree.

Function module used to create Application Log

BAL_LOG_CREATE --> Create log with header data

BAL_LOG_MSG_ADD --> Put message in log

BAL_DB_SAVE --> Save logs in the database

Transaction Codes:

SLG0: Creation of Object and Sub object

SLG1: Display Application Logs

Step by Step procedure for Creation of Application Log:

Step 1: Open the transaction code SLG0. This transaction code is used to create Object and Sub object.

Step 2: Check for the Object which is already in created and in use by your company/team/project. Else, Create a New Entry starting with Z or Y.

Step 3: After creating (if not exist) the object, select the object and go to its sub-objects.

Step 4: If corresponding sub-objects doesn¡¦t exists, create a sub object.

Step 5: Now the ¡¥Object¡¦ and ¡¥Sub Object¡¦ are used in creation of Application Log.

Step 6: Three function modules are basically used to create the application log

Step 7: 'BAL_LOG_CREATE' „³ this function module creates the log handle

Step 8: 'BAL_LOG_MSG_ADD' „³ this function module is used to populate the messages into the created application log. If we have more than one message to be passed into the same log, then we can loop at the messages and pass them through this function module.

Step 9: 'BAL_DB_SAVE' „³ this function module is used to save the log. The creation of log and addition of messages into the log are performed in the first two function modules mentioned. This function module saves the log so that the user can view the log in SAP.Transaction Code the view the log: SLG1.

SAMPLE CODE

data: ls_log TYPE bal_s_log,

ls_log_handle TYPE balloghndl,

ls_log_handle TYPE balloghndl,

ls_msg TYPE bal_s_msg,

lt_new_lognumbers TYPE bal_t_lgnm.

clear: ls_log, ls_log_handle.

ls_log-aluser = sy-uname.

ls_log-alprog = sy-repid.

ls_log-object = .

CALL FUNCTION 'BAL_LOG_MSG_ADD'

EXPORTING

i_log_handle = ls_log_handle

i_s_msg = ls_msg

EXCEPTIONS

log_not_found = 1

msg_inconsistent = 2

log_is_full = 3

OTHERS = 4.

CALL FUNCTION 'BAL_DB_SAVE'

EXPORTING

i_t_log_handle = lt_log_handle

IMPORTING

e_new_lognumbers = lt_new_lognumbers

EXCEPTIONS

log_not_found = 1

save_not_allowed = 2

numbering_error = 3

OTHERS = 4.

How to view Application Logs?

1. Choose the transaction SLG1. You go to the Analyze Application Log dialog box.

2. Enter Object, Subobject and Ext. number.

3. Choose a Time restriction.

4. Specify Log caused by.

5. Choose the Log class and Log creation.

6. Choose Execute.

You go to the Display log dialog box.

FURTHER REFERENCES

Help URL:

http://help.sap.com/saphelp_47x200/helpdata/en/d6/5d7f38f52f923ae10000009b38f8cf/fr ameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/EN/d6/5d7f38f52f923ae10000009b38f8cf/ frameset.htm

reward points if it usefull to u