2013 Mar 11 4:40 PM
Hi
I am currently working on a SD requirement, in VA01 after giving sold to party details on enter it should raise a warning message comparing few conditions.
Yes it is pretty easy, i am using user exit MV45AFZZ and routine USEREXIT_MOVE_FIELD_TO_VBAK.
While testing the warning message is displaying again and again like after enter sold to party, its displaying the warning message.
again if we give any line item again the code is executed and displaying the warning message.
If we miss any header data along with that message first warning message is displayed and then missing data message is displaying.
Can some one tell me how to display this only once.
PS: I can do this using EXPORT and IMPORT a flag to memory, but is there any other better way?
Regards,
NK
Hi
I am currently working on a SD requirement, in VA01 after giving sold to party details on enter it should raise a warning message comparing few conditions.
Yes it is pretty easy, i am using user exit MV45AFZZ and routine USEREXIT_MOVE_FIELD_TO_VBAK.
While testing the warning message is displaying again and again like after enter sold to party, its displaying the warning message.
again if we give any line item again the code is executed and displaying the warning message.
If we miss any header data along with that message first warning message is displayed and then missing data message is displaying.
Can some one tell me how to display this only once.
PS: I can do this using EXPORT and IMPORT a flag to memory, but is there any other better way?
Regards,
NK
2013 Mar 11 5:13 PM
2013 Mar 12 4:11 PM
2013 Mar 12 6:22 PM
Hello.
Do the validation at the moment to save the document. So the message will be showed one time.
Regards
2013 Mar 14 7:21 PM
Hi Miguel,
I need this on ENTER, after entering material and quantity at item level
2013 Mar 15 3:21 AM
Hi NK,
I don't like to use memory either but in this case I think it will be the most easy (maybe the only) way to.
But use IMPORT/EXPORT instead, this flag checking will be done in same session.
Regards,
Edgar
2013 Mar 16 9:25 PM
Hi Edgar,
I have created a structure with sold to party and a flag, first time after displaying the message i am exporting this to memory when it comes second time checking the flag is initial or not and also the customer is same or not. If not( for different customer) it should raise the warning message.
This was working perfectly, but in a case say, i have given the sold to party and got the warning message, instead taking a new screen went back(va01 main screen) and came in. This time again giving the same details, but message is not coming. Because the message was already raised and same customer. The session was not cleared. Though this is rare case, anyway to overcome this,
Regards,
NK
2013 Mar 18 4:13 PM
Hi NK,
Sorry for delay in reply, I guess we're in opposite time zones.
Okay, so whenever you move back to VA01 main screen (to start over new document?) your logic becomes to not work, right? If yes, what you would need to do is to put an initialization routine for your flag in memory and make it "marked" once again. You can do it by adding a routine to MV45AOZZ (but would also need to change screen 8309).
Regards,
Edgar
2013 Mar 18 9:11 PM
Hi Edgar,
right, i will try that and let you know. yeah i am in CST zone.
regards,
NK
2013 Mar 19 7:03 AM
Hi A N,
you don't need to add a new form or to modify screen 8309.
There is already a USER-EXIT wich is called befor each new PO: USEREXIT_REFRESH_DOCUMENT
As I already written: Instead using the IMPORT/EXPORT TO MEMORY just define a globale variable in INCLUDE MV45ATZZ. This variable should start with ZZ so you will be save, that there is no varibale defined by SAP with the name.
So your coding could look like:
INCLUDE MV45ATZZ:
* New flag, to store the information on
DATA: zz_message_soldto TYPE kunnr.
FORM USEREXIT_REFRESH_DOCUMENT
*a new PO is oppend, clear the flag here
CLEAR zz_message_soldto.
ENDFORM
FORM MOVE_FIELDS_TO_VBAK.
* Check if message needs to be raised
IF zz_message_soldto <> vbak-kunnr.
* Check your conditions here:
IF condition are full filled:
* remeber the sold-to
zz_message_soldto = vbak-kunnr.
* Raise the message
MESSAGE 'My Message' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
ENDIF.
ENDFORM.
Regards Hendrik
2013 Mar 19 8:46 PM
Yep, I guess my approach was not the best one, sorry for that...
Did a quick checking in system I have and saw same kind of development there but, indeed, was not the best way to do it.
Hendrik's approach is better.
Regards,
Edgar
2013 Mar 26 3:51 AM
Hi Edgar & Hendrik,
Thank you for your replies, i have managed with import/export as of now. busy with other objects now, will do the suggested changes soon. thank you.
Regards,
NK
2013 Mar 15 4:40 AM
Hi N K,
As Edgar said the only option is to set a flag, import and export is the only option. You may check for any counter if you find any but the best option is to set a flag and check it.
2013 Mar 15 8:30 AM
You could define a global variable in INCLUDE MV45ATZZ (pls. remeber the name space for gloable variable: they need to start with ZZ).
The globale variable need to be cleared within user-exit: USEREXIT_REFRESH_DOCUMENT in case of a new order.
Regards Hendrik
2013 Mar 15 10:07 AM
Hi,
Fetch all sold to party details that you are entering from the import parameter of exit and use those details in if condition stating not initial and after that write your validations and check and let me know .
Regards,
Suman
2013 Mar 15 11:45 AM
Hi,
In this case you can also use a static variable and use it as a flag.The psuedo code could be like:
check l_flag is initial
...
Warning message.
BR
Nitin
2013 Mar 15 11:59 AM
Hi nitin,
if you use a static variable, it should not be only a flag.
When will the flag be cleared if the user save the first order and starts to work on a new order, without leaving the transaction?
You would need to store the sold-to no. in a static variable and check if the sold to no. is changed. This would give you a bit of security, but what will happen if the user work on two orders with the same sold to?
Regards Hendrik
2013 Mar 15 12:05 PM
Hi,
If this does not work, then there is one more way out.You can display the warning message as a status message.I think that will be displayed only once.
BR
NItin Kacker
2013 Mar 16 9:26 PM
Hi Nitin,
Could you let me know how to use status message to my scenario. many thanks.
Regards,
NK
2013 Mar 18 5:54 AM
Hi,
The idea is that you trigger a usual status message in the code , like;
message s001.
I think the message is similar in all the cases, so,in this case, the system will display it only once.This I have seen in one of the objects.
Even, if this does not work, then you can collect all the messages in a memory and then display it in the ALV_POP_UP_DISPLAY, like you get in the enjoy transactions like PO etc.You can collect all the messages and trigger the ALV at the time of save.Please try this out and let me know, if you still face any problem.
BR
Nitin
BR
NItin Kacker
2013 Mar 18 11:29 AM
2013 Mar 26 5:26 AM
Hello, if you are sure that you cannot achieve this in any other exit, why not try STATICS parameter?
2013 Mar 26 6:10 AM
Hi NK
Just use the below code
FORM USEREXIT_MOVE_FIELD_TO_VBAK.
statics static type i.
static = static + 1.
if static = 1.
message 'Check Region Code of the Customer' type 'I'. """""enter your required message
endif.
ENDFORM.
Regards,
Madhumahesh.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |