‎2011 Nov 17 6:47 AM
Hi,
I am writing enhancement in BADI SD_COND_SAVE_A for VK11 and VK12.
This BADI execute when we press save button in VK11/12.
There are some condition which i am checking by this BADI. i want to stop the save processing.
Which command should i use for it to stop processing of saving. i dont want to come out from screen just stop processing.
regards
Malik
‎2011 Nov 17 6:51 AM
You can use
MESSAGE TYPE 'E' TO stop the saving process, it will not proceed further.
‎2011 Nov 17 7:27 AM
thanks for your reply.
when i stop the processing using message Type 'E' its bring me back to VK11 but in display mode
and i can not change the thing which cause exception.
How to handel it.
regards
Malik
‎2011 Nov 17 7:32 AM
Hi,
check your the code as per your condidtion. If condition fails then write 'break-point' in between. so that the cursor will stop at that point. and if you want to pass any error message you can write after that.
Ram.
‎2011 Nov 17 7:45 AM
My Code is like this but its not stopping on break-point.
CALL FUNCTION 'POPUP_TO_DECIDE'
EXPORTING
* DEFAULTOPTION = '1'
TEXTLINE1 = 'Validity Period is more than 30 Days'
TEXTLINE2 = 'Do You Want To Change Validty Period'
* TEXTLINE3 = ' '
TEXT_OPTION1 = 'Yes'
TEXT_OPTION2 = 'No'
* ICON_TEXT_OPTION1 = ' '
* ICON_TEXT_OPTION2 = ' '
TITEL = 'Validity Warning'
* START_COLUMN = 25
* START_ROW = 6
* CANCEL_DISPLAY = 'X'
IMPORTING
ANSWER = v_answer
.
if v_answer = '1'.
break-point.
*MESSAGE 'Further Processing are stopped' TYPE 'E'.
endif.
‎2011 Nov 17 8:04 AM
‎2011 Nov 17 8:07 AM
Yes. If use choose Yes but means button Number 1 it should stop the process and bring me back to vk11
screen to check and change the validty period.
If use choose NO Button (Button Number 2 ) then it should go for further processing without stopping.
Regards
Malik
‎2011 Nov 17 8:08 AM
Hi Malik,
I Just now seen the documentation of 'POPUP_TO_DECIDE' FM
SAP suggested not to use this FM, its Obsolete, instead of this FM, use FM
POPUP_TO_CONFIRM
‎2011 Nov 17 8:09 AM
Hi Malik,
Above code will triggers one POPUP Screen with YES, NO, CANCEL options.
If you press YES then only your BREAK-POINT will trigger.
Regards,
Surya
‎2011 Nov 17 8:14 AM
Also Try,..(not sure)
if v_answer = '1'.
LEAVE TO SCREEN 0.
LEAVE SCREEN.
*break-point.
*MESSAGE 'Further Processing are stopped' TYPE 'E'.
endif.
‎2011 Nov 17 8:17 AM
Dear if i put message type E statement its stopped and go to the screen.
But now the problem is its come back in display mode and if i press enter button its give me a message
$$00000001 in function Group
and program is terminated.
Regards
Malik
‎2011 Nov 17 8:23 AM
Hi,
Try using 'LEAVE to TRANSACTION vk11' statement on clicking 'Yes'.
‎2011 Nov 17 8:31 AM
Following error is comming while compiling the code.
Field "VK11" is unknown. It is neither in one of the specified tables
nor defined by a "DATA" statement . . . . . . . . . .
‎2011 Nov 17 8:31 AM
You use FM POPUP_TO_CONFIRM instead of POPUP_TO_DECIDE
and test.
For Message TYPE 'E'.. You use
MESSAGE TYPE 'S' DISPLAY LIKE 'E'..
RETURN.test..
‎2011 Nov 17 8:41 AM
‎2011 Nov 17 8:49 AM
Did you check the F1 documentation for the correct format of this statement, but still let me write it for you:-
LEAVE TO TRANSACTION 'VK11'.
‎2011 Nov 17 2:28 PM
May be this is not the right BADI to include your custom validation,
Rgds,
Antony
‎2011 Nov 17 9:09 AM
I think there is no other way to stop the processing in this case expect
"MESSAGE TYPE 'E' "You should do something after it happens. (***
or else...
you use
**WHILE v_answer NE '1'.**
**<....yOUR fm IS HERE ...>**
**ENDWHILE.**it will not stop the loop untill other than option 1 .
‎2011 Nov 17 9:24 AM
You can see this badi getting called in function SD_CONDITION_SAVE_EXIT which is a update function( Reason why the debugger is not stopping, activate update debugging). You should not raise message inside it.
when i stop the processing using message Type 'E' its bring me back to VK11 but in display mode
And i wonder how this happens to you. It should abort the screen
Kesav
‎2011 Nov 17 10:25 AM
Then where i can put validation for vk11.
while SD_COND_SAVE_A is update badi.
any help will be higly appricated.
Regards
Malik
‎2011 Nov 17 10:47 AM
Have a look into 00503305 [Dynamic Field Check in Condition Maintenance|http://help.sap.com/saphelp_470/helpdata/en/08/c81b18e83511d2ace30000e8a5bd28/content.htm]
‎2011 Nov 17 1:38 PM
Hi Malik,
After calling POPUP_TO_CONFIRM in case YES is chosen, you could use POPUP_TO_GET_ONE_VALUE in a WHILE loop and force the user to enter a valid period. Then update the data by using a field symbol reference...
Altough this is not a really glamourous solution, I'm pretty sure this should work...
Kr,
Manu.
‎2011 Nov 17 1:10 PM
Hi,
Try this.
IF sy-subrc = 0.
CALL FUNCTION 'MESSAGES_INITIALIZE'. "clear the buffer messages
CALL FUNCTION 'MESSAGE_STORE' "add your message
EXPORTING
arbgb = 'ZZZZ' "Message class
msgty = 'E' "Message type
txtnr = '094'. "Message number
CALL FUNCTION 'MESSAGES_SHOW'.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
MESSAGE ' ' TYPE 'E' RAISING error.
EXIT.
ENDIF.
Thanks,
Anitha A