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

Error message in event table maintenance

Former Member
0 Likes
8,243

Hi

I have a specific table for which I want to have mandatory fields filled in by my users.

The table have the following fields

Maintenance plant (data element IWERK)

Article (MATNR)

Plant (WERKS_D)

Stor loc (LGORT_D)

Maintenance plant and article are the table keys.

Transaction SM30 is used to fill in the data.

I put the following code for event 05 (new_entry).

form new_entry.

if zcs_div_mag_art-division is initial.

   message e900(sv) with zcs_div_mag_art-article.

endif.

if zcs_div_mag_art-magasin is initial.

   message e901(sv) with zcs_div_mag_art-article.

endif.

endform.

When filling the data I got the right error message, but the fields plant and storage location are grey so that I can't fill in and correct the entry.

I tried also to use the event 01 when saving but the issue is the same.

I tried with message type w, but a warning is not enough as the user can pass it.

Any idea?

Regards

Olivier

1 ACCEPTED SOLUTION
Read only

former_member210770
Active Participant
0 Likes
3,913

Hi Joseph,

Don't write Event code for this functionlity. You can directly make any field mandatory by screen painter . Just go to Screen painter of this TMG screen and make it mandatory.

Regards,

Sagar

Hi

I have a specific table for which I want to have mandatory fields filled in by my users.

The table have the following fields

Maintenance plant (data element IWERK)

Article (MATNR)

Plant (WERKS_D)

Stor loc (LGORT_D)

Maintenance plant and article are the table keys.

Transaction SM30 is used to fill in the data.

I put the following code for event 05 (new_entry).

form new_entry.

if zcs_div_mag_art-division is initial.

   message e900(sv) with zcs_div_mag_art-article.

endif.

if zcs_div_mag_art-magasin is initial.

   message e901(sv) with zcs_div_mag_art-article.

endif.

endform.

When filling the data I got the right error message, but the fields plant and storage location are grey so that I can't fill in and correct the entry.

I tried also to use the event 01 when saving but the issue is the same.

I tried with message type w, but a warning is not enough as the user can pass it.

Any idea?

Regards

Olivier

6 REPLIES 6
Read only

fcorodriguezl
Contributor
0 Likes
3,913
Read only

0 Likes
3,913

Thanks Fransisco

That's a very usefull doc.

Regards

Olivier

Read only

Former Member
0 Likes
3,913

Hi Josheph,

Please try using below message type :

MESSAGE ID 'SV' TYPE 'S' NUMBER 900 DISPLAY LIKE 'E'.


or


MESSAGE ID lc_msv TYPE 'E'

   number 900    DISPLAY LIKE 'S'.

Hope this helps.

Thanks

Sri

Read only

Former Member
0 Likes
3,913

In the flow logic of your screen PAI event try to put the chan-endchain. Do the checks inside the module.


Something like this -

PROCESS AFTER INPUT.

chain.
  field sflight-carrid.
  field sflight-connid.
  field sflight-fldate.
  module check_flight.
endchain.

here any errors in module check_flight will ensure that after error is displayed all the three fields are still enabled.

Best regards,

Saurabh

Read only

Former Member
0 Likes
3,913

Please display the message as:

MESSAGE s900(sv) WITH zcs_div_mag_art-article DISPLAY LIKE 'E'.

When the system encounters sy-msgty as 'E', it stops further processing of the program, not allowing us to modify existing screen. However, in order to ensure that after giving sy-msgty as 'S', our field is not left empty by the end-user, we can do so by programming as you have done.

Read only

former_member210770
Active Participant
0 Likes
3,914

Hi Joseph,

Don't write Event code for this functionlity. You can directly make any field mandatory by screen painter . Just go to Screen painter of this TMG screen and make it mandatory.

Regards,

Sagar