09-24-2015 9:59 AM
Hi Experts,
My requirement is to make a field Mandatory in standard screen based on validation.
Whenever notification is been Rejected, Subject Long Text should be Mandatory before Saving the Notification.
Kindly let me know the solution with steps to acheive this scenario.
Note: I've tried with different Enhancements, but in those I'm getting the Rejection SY-UCOMM, but not the long text field.
Find the below attachment picture.
With Regards,
Sudhir.
09-24-2015 11:44 AM
Hello Sudhir,
I think a I have arrived at a working solution.
User-exit : QQMA0014
Include: ZXQQMU20
Put this code in the above include:
IF i_viqmel-qmart = 'M2'.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = i_viqmel-objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'E0004' AND i_viqmel-indtx IS INITIAL.
MESSAGE: 'Long text can not be empty for Rejected notifications'
TYPE 'E' DISPLAY LIKE 'I'.
ENDIF.
ENDLOOP.
ENDIF.
User will get the following error when trying to Save notification (M2 type) with REJE user status and Blank Longtext
Notes:
1. Lines 01 and 19 are to confine your code to a particular Notification type (Here it is M2).
2. In line 34 the value 'E0002', you will replace with yours. This is the code for your user-status REJE. This code you will get from table TJ02T by passing the Status profile value in STSMA field and REJE in TXT04 field.
3. I have tested this and working fine.
4. fm STATUS_TEXT_EDIT will not work here, so we have to use fm STATUS_READ only
5. You must be knowing that the user-exit must be assigned to a project created through CMOD.
Good luck
KJogeswaraRao
09-24-2015 10:54 AM
09-24-2015 11:13 AM
Hi Roberto Vacca,
Thank you for your reply. Using NOTIF_EVENT_SAVE BADI, I'm getting the Rejection SY_UCOMM, but I'm exactly looking for Subject Long Text.
Kindly let me know.
With Regards,
Sudhir.
09-24-2015 11:11 AM
Hello Sudhir,
Prima facie this looks very much possible through user-exit QQMA0014, by using fm STATUS_READ or STATUS_TEXT_EDIT to check the user status. Things would have been very easy if it is filed. In your case it is the Long text. But I feel this too can be managed. Let me find sometime to post the solution in detail, if possible with the code.
Regards
KJogeswaraRao
09-24-2015 11:42 AM
Dear Jogeswara Rao Kavala,
Even I've tried with the same user-exit QQMA0014.
Here I'm getting all the Notification details including Rejection SY_UCOMM.
But unable to find the Long Text here.
As you said, If its is a normal filed like Description QMTXT, it would have been different.
Kindly let me know the solution.
With Regards,
Sudhir.
09-24-2015 11:44 AM
Hello Sudhir,
I think a I have arrived at a working solution.
User-exit : QQMA0014
Include: ZXQQMU20
Put this code in the above include:
IF i_viqmel-qmart = 'M2'.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = i_viqmel-objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'E0004' AND i_viqmel-indtx IS INITIAL.
MESSAGE: 'Long text can not be empty for Rejected notifications'
TYPE 'E' DISPLAY LIKE 'I'.
ENDIF.
ENDLOOP.
ENDIF.
User will get the following error when trying to Save notification (M2 type) with REJE user status and Blank Longtext
Notes:
1. Lines 01 and 19 are to confine your code to a particular Notification type (Here it is M2).
2. In line 34 the value 'E0002', you will replace with yours. This is the code for your user-status REJE. This code you will get from table TJ02T by passing the Status profile value in STSMA field and REJE in TXT04 field.
3. I have tested this and working fine.
4. fm STATUS_TEXT_EDIT will not work here, so we have to use fm STATUS_READ only
5. You must be knowing that the user-exit must be assigned to a project created through CMOD.
Good luck
KJogeswaraRao
09-24-2015 12:42 PM
Dear Jogeswara Rao Kavala,
Thank you so much for your valuable solution and approach. My requirement is done and closed.
So the field which im looking for is in VIQMEL-INDTX ( Object Long Text Available).
With Regards,
Sudhir.
09-24-2015 12:56 PM
Yes,
I'm impressed the way (speed) you are able to implement my solutions.
Regards
KJogeswaraRao
09-25-2015 5:42 AM
Thank You.
In my case, its E0003 for Rejection.
With Regards,
Sudhir.