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: 

PM Module: How to make a field Mandatory in Standard Screen based on a Validation

yarnagula_sudhir
Active Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor
0 Kudos

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

8 REPLIES 8

roberto_vacca2
Active Contributor
0 Kudos

Hi.

Did you try NOTIF_EVENT_SAVE badi?

Hope to help.

0 Kudos

Hi

jogeswararao_kavala
Active Contributor
0 Kudos

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

0 Kudos


Dear

jogeswararao_kavala
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

Yes,

I'm impressed the way (speed) you are able to implement my solutions.

Regards

KJogeswaraRao

0 Kudos

Thank You.

In my case, its E0003 for Rejection.

With Regards,

Sudhir.