REPORT zpwtest .
*&---------------------------------------------------------------------*
*& Types and Data
*&---------------------------------------------------------------------*
DATA: l_log_handle TYPE balloghndl,
l_s_log TYPE bal_s_log ,
l_s_msg TYPE bal_s_msg ,
l_msgno TYPE symsgno ,
l_s_display_profile TYPE bal_s_prof.
DATA : i_t100 TYPE TABLE OF t100 ,
ls_t100 TYPE t100 .
*&---------------------------------------------------------------------*
*& Selection Screen
*&---------------------------------------------------------------------*
PARAMETERS : p_arbgb TYPE t100-arbgb OBLIGATORY DEFAULT 'SD' .
*&---------------------------------------------------------------------*
*& Start of Selection
*&---------------------------------------------------------------------*
START-OF-SELECTION .
SELECT *
INTO TABLE i_t100
FROM t100
WHERE sprsl = sy-langu
AND arbgb = p_arbgb .
*&---------------------------------------------------------------------*
*& End of Selection
*&---------------------------------------------------------------------*
END-OF-SELECTION .
* Create an initial log file ------------------------------------------*
l_s_log-extnumber = 'Messages'.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = l_s_log
IMPORTING
e_log_handle = l_log_handle
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
ENDIF.
DATA lv_int TYPE sy-tabix .
* Fill up corresponding error messages to log --------------------------*
LOOP AT i_t100 INTO ls_t100.
CLEAR l_s_msg .
lv_int = sy-tabix MOD 3 .
IF lv_int = 0 .
l_s_msg-msgty = 'S' .
ELSEIF lv_int = 1 .
l_s_msg-msgty = 'E' .
ELSE.
l_s_msg-msgty = 'W' .
ENDIF.
l_s_msg-msgid = ls_t100-arbgb .
l_s_msg-msgno = ls_t100-msgnr .
l_s_msg-msgv1 = '&' .
l_s_msg-msgv2 = '&' .
l_s_msg-msgv3 = '&' .
l_s_msg-msgv4 = '&' .
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle = l_log_handle
i_s_msg = l_s_msg
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 .
ENDIF .
ENDLOOP.
* Prepare to display the error log -------------------------------------*
CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
IMPORTING
e_s_display_profile = l_s_display_profile.
* l_s_display_profile-use_grid = 'X' .
l_s_display_profile-disvariant-report = sy-repid.
l_s_display_profile-disvariant-handle = 'LOG'.
* Display error messages in grid ---------------------------------------*
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
ENDIF.
* Delete the messages inserted to application log ----------------------*
CALL FUNCTION 'BAL_LOG_MSG_DELETE_ALL'
EXPORTING
i_log_handle = l_log_handle
EXCEPTIONS
log_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
List of All Blogs
-
►
2008
(39)
-
►
July
(9)
- Display ListBox in Parameter of Selection Screen
- Important EDI Transactions and Programs
- Hide F8 Button on Selection Screen
- Find Obsolete Function Module
- Sample RS_COVERPAGE_SELECTIONS
- SAP ABAP Dynamic Internal table and Processing 02
- SAP ABAP Dynamic Internal table and Processing 01
- Smartform/Sapscript Page Counter - Mode
- SAP SD Pricing Overview
-
►
June
(12)
- Transporting Table Entry
- Sample/Demo code availble in SAP
- SELECT-OPTION in Module Pool Screen
- Add your own pattern in SE38
- Call Transaction in New Window
- Minimum Code Required to Send SAP Mail
- Calculate Tax of Purchase order Line Item
- Send report as attachment in background
- Button on Selection-Screen
- Displaying Two ALV Grid on Screen
- Function Module for getting information of Diction...
- HR ABAP 02 - Getting Started - LDB PNP
-
►
July
(9)
Useful Links
Categories
Abap Objects
ALV List
Config
Dynamic
EDI
Excel
Formatting
HR ABAP
MD04
Module Pool
OLE Automation
Open Dialog Box
Quick Reference
Report
Sample Code
SAP ABAP
SAP FI
SAP Mail
SAP MM
SAP Notes
SAP SD
Sapscript
Selection-Screen
Smartforms
Standard Text
Translation
Tutorial
Upload Download
Utility
Web service
xml to ABAP
XSLT
You are most welcome to use any information available in this blog. Any usage of the information or sample code is at your own risk. I do take care of accuracy and relevance of blog before publishing. However, I do not guarantee that information and code are accurate and bug free, their can be alternate and better way of doing same thing so please use information as reference only. Relevance of code and instructions can possibly change with time, check the blog post date before using this information. This is my personal blog, recommendation and opinions expressed in this blog are mine and not of any company of any of my employer.
I do moderate comments and publish as soon as I check them. You can post questions as well, which I will try best to solve. I will anyway publish your questions in case others readers might have answer.
Thanks for coming here and reading the blogs :)
I do moderate comments and publish as soon as I check them. You can post questions as well, which I will try best to solve. I will anyway publish your questions in case others readers might have answer.
Thanks for coming here and reading the blogs :)
Thursday, May 21, 2009
Use of Application Log FMs to display Message List/Log
Labels:
ALV List,
Sample Code,
SAP ABAP
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment