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: 

call transaction

Former Member
0 Kudos

HI All,

I have a question about call transaction. I am calling transaction MIR4. Now I want to know if user clicked on save before they left the transaction.

My current program is .

Call transacation MIR4 skip first screen.

Now I when I return in my main program, I want to know if user saved teh document or not ?

Any bright ideas please ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Check the relevant parameter ID to see if it is populated with a document number. You may then need to read the creation date/time of this document number.

Or you could clear the parameter ID value before the call trans.

11 REPLIES 11

Former Member
0 Kudos

Check the relevant parameter ID to see if it is populated with a document number. You may then need to read the creation date/time of this document number.

Or you could clear the parameter ID value before the call trans.

0 Kudos

are there any standard parameters existing or will I have to create one ?

Former Member
0 Kudos

HI,

I think we cannot know whether the user has saved the document or not.

But i think, when he saves the document we will get a ssuccess message stating that " Document successfully changed ".

You can capture this by FORMAT_MESSAGE - FM.

Try this.

Regards,

Venkatesh.

Former Member
0 Kudos

The easiest way is to check for the message generated at the end of the transaction and capture it using the Function Module FORMAT_MESSAGE and proceed further based on the message type received.

0 Kudos

but that would mean I have to tweak the sap code, dont I ?

0 Kudos

You don't have to tweak the standard code. The messages raised can be captured from your program using the FM.

0 Kudos

hi

check this:

data: i_msg like bdcmsgcoll occurs 1 with header line.

 LOOP AT I_MSG.

    CALL FUNCTION 'FORMAT_MESSAGE'
     EXPORTING
       ID              = I_MSG-MSGID
       LANG            = SY-LANGU
       NO              = I_MSG-MSGNR
       V1              = I_MSG-MSGV1
       V2              = I_MSG-MSGV2
       V3              = I_MSG-MSGV3
       V4              = I_MSG-MSGV4
     IMPORTING
       MSG             = W_STR
*  EXCEPTIONS
*    NOT_FOUND       = 1
*    OTHERS          = 2
              .
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    WRITE:/ i_msg-msgnr,w_str.




  endloop.

Regards,

Vishwa.

Edited by: vishwa sri hari on Sep 30, 2008 12:48 PM

0 Kudos

Try like this

loop at itab.

*--- Filling Screen data

perform fill_bdc_Data.

call transaction 'XK01' using i_bdcdata

mode 'N'

update 'S'

messages into i_bdcmsgcoll.

if sy-subrc <> 0.

perform get_error.

write:/ itab , v_text.

endif.

refresh i_bdcdata.

endloop.

*************************************************************

form get_error.

loop at i_bdcmsgcoll.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = i_bdcmsgcoll-MSGID

LANG = sy-langu

NO = i_bdcmsgcoll-MSGNr

V1 = i_bdcmsgcoll-MSGV1

  • V2 = SY-MSGV2

  • V3 = SY-MSGV3

  • V4 = SY-MSGV4

IMPORTING

MSG = v_text

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endloop.

endform. " get_error

Former Member
0 Kudos

Hi reena Sharma,

You can use both of the function modules :

MESSAGE_TEXT_BUILD

FORMAT_MESSAGE

call function 'MESSAGE_TEXT_BUILD'

exporting

msgid = sy-msgid

msgnr = sy-msgno

msgv1 = sy-msgv1

msgv2 = sy-msgv2

msgv3 = sy-msgv3

msgv4 = sy-msgv4

importing

message_text_output = w_message

exceptions

others = 1.

call transaction v_tcode using it_bdcdata

mode p_mode

update p_update

messages into it_message.

read table it_message into wa_message with key msgtyp = 'E'.

call function 'FORMAT_MESSAGE'

exporting

id = sy-msgid

no = wa_message-msgnr

v1 = wa_message-msgv1

v2 = wa_message-msgv2

v3 = wa_message-msgv3

v4 = wa_message-msgv4

importing

msg = wa_error-message

exceptions

not_found = 1

others = 2.

Thanks & Regards,

Shiva vs.

0 Kudos

should I put this code in the calling program ?

0 Kudos

Use after Call Transaction statement