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: 

To get messages after executing an FM

Former Member
0 Kudos

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.

7 REPLIES 7

Former Member
0 Kudos

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.

saravanan_narayanan
Active Contributor
0 Kudos

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

0 Kudos

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?

Former Member
0 Kudos

Hi Maansi,

After the sucess message form the FM,

Select the data from the table using 'cut_p1000' in where condition.

BR

Dep

0 Kudos

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..

shahid
Product and Topic Expert
Product and Topic Expert
0 Kudos
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.

Former Member
0 Kudos

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