08-10-2011 11:22 AM
Hi All,
I am using the Function Module RH_CUT_OBJECt in my program. I need to maintain an application Log on whetehr there was an error or sucess and a message text for each Object ID . As you casn see below from the FM, there is no way that i get the Messages of each objid that i have passed. How do i get the messages from the below Fm so tat i can store it in application log?
call function 'RH_CUT_OBJECT'
exporting
gdate = del_date
histo = space
gstat = '1'
vtask = 'B'
tables
i1000 = cut_p1000
exceptions
error_during_cut = 1
no_authorization = 2
gdate_before_begda = 3
corr_exit = 4
others = 5.
08-10-2011 11:28 AM
hi,
Did u try using MESSAGE statement after the FM call?
After the FM call, put a statement like below.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
INTO lv_string.
You can use this lv_string to update application log.
08-10-2011 11:31 AM
Hello Maansi,
After the function call, you retrieve the message details like this
DATA mtext TYPE string.
"function call 'RH_CUT_OBJECT'
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
INTO mtext
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
.
BR, Saravanan
08-10-2011 11:37 AM
Hi Saravanan and Vinraj,
SY-MSGID , MSGNO etc.. all these contain only one message line whether the FM execution was successfull or not, But i need a message on what has happend to each object in internal table 'cut_p1000' . Whther the object was deleted, or did it encounter an error . How can i get that?
08-10-2011 11:44 AM
Hi Maansi,
After the sucess message form the FM,
Select the data from the table using 'cut_p1000' in where condition.
BR
Dep
08-10-2011 11:55 AM
Hi Deepak,
I would like to get a log on what the FM did to each of the object. That should be stored in Application Log..
08-10-2011 12:07 PM
data: ls_message type BAPIRET2.
loop at your table...
" call function 'RH_CUT_OBJECT'
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = SY-MSGID
number = SY-MSGNO
par1 = SY-MSGV1
par2 = SY-MSGV2
par3 = SY-MSGV3
par4 = SY-MSGV4
IMPORTING
return = ls_message.
ls_message-message will have the message, concatenate to your object or prepare a format like the way you want.
Append to some other internal table.
08-10-2011 12:49 PM
thanks ssm .. i didnt wnat to do tat initially because it would hit the database for evey record in teh internal tabe, but then i found that the changes can be made in buffer by using parameter VTASK = 'B' and later the changes can be updated in the DB b using another FM.
Thanks