07-06-2006 12:47 AM
Hello all,
When I hit 'save' button on a screen in a trasaction, it will call a BADI which has some code for validations. If a validation is failed it will bring up a popup to continue or to cancel. If the user hits 'continue' I want to stay on the same screen from where the save button is clicked.
How to do that?
Thanks,
07-06-2006 4:10 AM
Then throw a error in the BADI and that should stop executing the program further or there should be some flag in the BADI which when you set to ERROR the processing should stop.
regards,
Ravi
07-06-2006 5:28 AM
In that Case fill the Error Log CT_LOG.
like this
msg-vbeln = w_lips-vbeln.
msg-posnr = w_lips-posnr.
msg-msgty = 'E'.
msg-msgid = 'YW2'.
msg-msgno = '042'.
msg-msgv1 =
'Please Check Batch '.
* msg-msgv2 = w_lips-lfimg.
* msg-msgv3 = w_lips-meins.
msg-msgv4 = w_lips-charg.
append msg to ct_log.
Regards
Prabhu
07-06-2006 5:30 AM
07-06-2006 6:09 AM
Hi,
Try using the following statement when you press continue,
LEAVE TO CURRENT TRANSACTION.
(or)
LEAVE TO TRANSACTION <t-code>
Regs
Venkat Ramanan
07-06-2006 6:16 AM
Hi,
Try using leave to screen 'screen number', this might help,
If possible provide the details of the transaction for which you are running the BADI, this would help us to analyse the problem better,
Rgds,
07-06-2006 3:15 PM
Hello all,
Thanks for the replies.
I tried all those solutions. If I give an error message it will take me to the initial screen of that transaction.
If I try 'leave to current transaction'...then also it will take me to the initial screen of this transaction.
I dont have any flag in the BADI...I have only 'update inidcator (used for different purpose)', and other 2 structures.
What I want is I want to stay on the same screen after hitting enter on the popup. I dont want to leave that screen.
And I am working with R/3 bolt-on module so those transactions and BADI will not be available in your system.
Please ask me if anyone of you need more information.
Thanks a lot for your time.
07-06-2006 3:31 PM
1. please note down the screen number that you want the transaction to stop at.
2. use MESSAGE S(XXX) display like 'E'.
3. use statement CALL SCREEN 'Screen-number'.
This is definitely not the right way to go and might give you undesirable results, but its worth a shot. It has worked for me in one tranasction.
07-06-2006 4:04 PM
Sharath,
Thanks for your response.
1. If we use MESSAGE S(XXX) display like 'E'..it will give out a message and it will continue processing the code after that which I dont want. I am expecting the functionality of MESSAGE E(XXX)but should keep me on the same screen.
2. CALL SCREEN 'Screen-number' is not supported in BADI's.
Is there any other way to make this work. Can someone help me witht his.
Thanks,
Message was edited by: Naren Somen
07-06-2006 5:12 PM
Hi,
If your function export parameter and exceptions are like below
" EXPORTING
*" REFERENCE(Y_FIELD) LIKE GFC_PRGFLD-FELDNAME
*" EXCEPTIONS
*" INPUT_ERROR
you can do like below:
IF x_struct-fld1 IS INITIAL.
y_field = 'X_STRUCT-FLD1'.
sy-msgno = '000'.
sy-msgid = 'ES'.
sy-msgv1 = 'Value required'.
sy-msgv2 = ' '.
sy-msgv3 = ' '.
sy-msgv4 = ' '.
sy-msgty = 'E'.
RAISE input_error.
endif.
Laxman