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: 

BADI's

Former Member
0 Kudos

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,

9 REPLIES 9

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

what is the transaction and badi name?

Former Member
0 Kudos

Hi,

Try using the following statement when you press continue,

LEAVE TO CURRENT TRANSACTION.

(or)

LEAVE TO TRANSACTION <t-code>

Regs

Venkat Ramanan

Former Member
0 Kudos

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,

0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

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