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 handling in Dialog programming

Former Member
0 Likes
1,301

Hi Experts,

When error is thrown in Module pool programming for a field, its corresponding Text field must be highlighted with bold & with different color. Can any one provide a suggestion to solve this problem?

Kavitha.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
897

Use CHAIN...END CHAIN to group the fields together .

CHAIN.
    FIELD:
           w_werks,
           w_con_pt,
           w_date_low,
           w_date_high MODULE field_validation ON CHAIN-INPUT.
  ENDCHAIN.

If there is error in any of the above 4 fields, all these fields will be open and the rest of the fields on the screen will be disabled.

regards,

Jinson

4 REPLIES 4
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
897

Hi Kavitha,

Use this code, its working:-

If you enter an invalid value, then an error message will be displayed and the field value entered will be coloured as red.

At screen logic:-


PROCESS AFTER INPUT.
  FIELD ebeln MODULE get_data. "for field PO#

In PAI,


*&---------------------------------------------------------------------*
*&      Module  GET_DATA  INPUT
*&---------------------------------------------------------------------*
MODULE get_data INPUT.
  IF ( ebeln <> ' ' ).
    SELECT
      ebeln
      ebelp
      matnr
      werks
      menge
      netpr
    INTO TABLE it_ekpo
    FROM zekpo
    WHERE
      ebeln = ebeln.
    IF sy-subrc <> 0.
      MESSAGE e000. " invalid PO# with field value as red colored
    ENDIF.
  ELSE.
    MESSAGE e005. "if no value entered
  ENDIF.
ENDMODULE.                 " GET_DATA  INPUT 

Using the line as mentioned at screen logic, only field EBELN will be enabled when error message is encountered, and rest fields will be greyed-out.

To keep a set of field values on screen enabled when error message is encountered, you can use the concept of CHAIN...ENDCHAIN.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
898

Use CHAIN...END CHAIN to group the fields together .

CHAIN.
    FIELD:
           w_werks,
           w_con_pt,
           w_date_low,
           w_date_high MODULE field_validation ON CHAIN-INPUT.
  ENDCHAIN.

If there is error in any of the above 4 fields, all these fields will be open and the rest of the fields on the screen will be disabled.

regards,

Jinson

Read only

0 Likes
897

There won't be a way to make the field BOLD, and to change the color, the only option is to set the

SCREEN-INTESIFIED = 1 in the PBO routine. This will give you the color of RED.

Unfortunetly, when you use MESSAGE to do the error, you do not get back to the PAI routine to

make the adjustments.

You could keep a list of the fields with errors instead of using the MESSAGE verb then handle the

coloring in the PAI routine.. but then.. where/when do you display the message?

Read only

Former Member
0 Likes
897

Making Bold the text is not possible