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

Need validation at customer master using Badi.

Former Member
0 Likes
2,249

hi.

I am having one requirement

i.e

before adding the customer master.

i need to validate the authorization filed (please have a look on below attached image)

if any body enter the text like 'RSV'. I need to stop it..

My badi name is :: CUSTOMER_ADD_DATA

     under this my method name is::  CHECK_ALL_DATA

i had written below code in method

IF S_KNB1-BEGRU = 'RSV'.

   MESSAGE 'TRIGGED BY BADI RSV-BAS' TYPE 'I'.

   ENDIF.

Even is firing. before adding the customer.

but i would like validate means stop that customer.

but it is firing.. and saving in data base.

i would like to stop the customer if authorization is 'RSV'.

what is the mistake i had done...

i need your valuable suggestions..

1 ACCEPTED SOLUTION
Read only

former_member195431
Participant
0 Likes
1,834

Hello,

If the BADI is getting triggered properly and checking the 'Auth' field as you mentioned in the screenshot and popping up the information - "TRIGGED BY BADI RSV-BAS".

Then to stop the customer master to be created, write "EXIT" or "LEAVE PROGRAM" after the MESSAGE.

eg: -

IF S_KNB1-BEGRU = 'RSV'.

   MESSAGE 'TRIGGED BY BADI RSV-BAS' TYPE 'I'.

    EXIT.

ENDIF.

Thanks

hi.

I am having one requirement

i.e

before adding the customer master.

i need to validate the authorization filed (please have a look on below attached image)

if any body enter the text like 'RSV'. I need to stop it..

My badi name is :: CUSTOMER_ADD_DATA

     under this my method name is::  CHECK_ALL_DATA

i had written below code in method

IF S_KNB1-BEGRU = 'RSV'.

   MESSAGE 'TRIGGED BY BADI RSV-BAS' TYPE 'I'.

   ENDIF.

Even is firing. before adding the customer.

but i would like validate means stop that customer.

but it is firing.. and saving in data base.

i would like to stop the customer if authorization is 'RSV'.

what is the mistake i had done...

i need your valuable suggestions..

7 REPLIES 7
Read only

former_member195431
Participant
0 Likes
1,835

Hello,

If the BADI is getting triggered properly and checking the 'Auth' field as you mentioned in the screenshot and popping up the information - "TRIGGED BY BADI RSV-BAS".

Then to stop the customer master to be created, write "EXIT" or "LEAVE PROGRAM" after the MESSAGE.

eg: -

IF S_KNB1-BEGRU = 'RSV'.

   MESSAGE 'TRIGGED BY BADI RSV-BAS' TYPE 'I'.

    EXIT.

ENDIF.

Thanks

Read only

0 Likes
1,834

hi,

thanks for your reply.

i will check it and i will update to u..

Read only

0 Likes
1,834

hi,

IF S_KNB1-BEGRU = 'RSV'.

   MESSAGE 'TRIGGED BY BADI RSV-BAS' TYPE 'I'.

    leave program.

ENDIF.

i used leave program.

exit is not working.

now working fine..

but what i need is if i write rsv in authorization field.

program is closing. again user has to open the same code and he has to change the field.

what i am saying screen shout not be close but  if the field is having rsv then it will be stop to save the data into db

is there any possibility....plz inform me...

Read only

0 Likes
1,834

Hello,

Try to change the message type from 'I' to 'E'.

or

"LEAVE TO SCREE 0" or if you have any screen number.

Thanks

Read only

0 Likes
1,834

Hi Srini,

IF S_KNB1-BEGRU = 'RSV'.

   MESSAGE 'TRIGGED BY BADI RSV-BAS' TYPE 'E'.

   ENDIF.

Make it an error message type.It will work.

Regards,

Kannan

Read only

0 Likes
1,834

Use the changing parameters of the method CHECK_ALL_DATA.

E_MSGID   " Give your Z message class

E_MSGNO  " Message no

E_MSGV1    " Variable if any.

E_MSGV2

E_MSGV3

E_MSGV4

Read only

0 Likes
1,834

Thanks to all.

Keep posting..