Application Development and Automation 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: 
Read only

call transaction

Former Member
0 Likes
1,528

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
Read only

Former Member
0 Likes
1,480

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
Read only

Former Member
0 Likes
1,481

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.

Read only

0 Likes
1,480

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

Read only

Former Member
0 Likes
1,480

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.

Read only

Former Member
0 Likes
1,480

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.

Read only

0 Likes
1,480

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

Read only

0 Likes
1,480

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

Read only

0 Likes
1,480

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

Read only

0 Likes
1,480

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

Read only

Former Member
0 Likes
1,480

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.

Read only

0 Likes
1,480

should I put this code in the calling program ?

Read only

0 Likes
1,480

Use after Call Transaction statement