2011 Aug 23 7:39 AM
Hello All,
I've created a screen through screen painter. I've created a table in which I need to put a validation that if 1st field is not empty all other fields in the row should not be blank.
I've out all the fields in chain endchain. The issue , which I am facing is that every time 'ENTER' is pressed on the screen , it always shows only the first field mentioned in chain endchain as RED for error even if it has values . It does not consider the other fields.
CHAIN.
FIELD : p_bin01MODULE check_data.
FIELD : p_frm01 MODULE check_data.
FIELD : p_qty01 MODULE check_data.
endchain.
Please suggest.
Thanks.
2011 Aug 23 7:57 AM
Hi,
check below code..
you have list of fields in the table : field1, field2, field3, field4, field5....
CHAIN.
FIELDS: itab-field2,
itab-field3,
itab-field4,
itab-field5 MODULE check_data ON CHAIN-INPUT.
ENDCHAIN.
MODULE check_data ON INPUT.
IF NOT itab-field1 IS INITIAL AND .
( itab-field2 IS INITIAL OR
itab-field3 IS INITIAL OR
itab-field4 IS INITIAL OR
itab-field5 IS INITIAL ).
give a message..........
ENDIF.
ENDMODULE.
2011 Aug 23 8:42 AM
Hello Venkat,
I've written the code in a similar manner only .. the problem is whenever there is error in any of the fields , the first field in chain endchain is highlighted rather than the one with the error.
Thanks
2011 Aug 23 11:22 AM
Hi,
in that case, between MODULE ....... ENDMODULE. set the cursor.
MODULE check_data ON INPUT.
IF itab-field2 IS INITIAL.
set cursor on field - > field2.
ELSEIF itab-field3 IS INITIAL.
set cursor on field - > field3.
ELSEIF itab-field4 IS INITIAL.
set cursor on field - > field4.
ELSEIF itab-field5 IS INITIAL.
set cursor on field - > field5.
ENDIF.
ENDMODULE
2011 Aug 23 11:01 AM
Hi ,
Just use below code
CHAIN.
FIELD : p_bin01.
FIELD : p_frm01.
FIELD : p_qty01.
endchain.
IN PAI ...
it will check the field and get the cursor on empty field ...write ur logic accordingly
regards
Deepak.
2011 Aug 23 11:22 AM
Hello Deepak,
I've tried this. This brings the cursor on the first field in chain endchain every time 'ENTER' is pressed. Even if some other field is empty in that row.
Thanks
2011 Aug 23 11:37 AM
Then use Simple Logic of FLAG i.e
IN PAI ....
Perform Validate .
in driving program .
form validate .
if p_bin01 is initial .
flag = 'B' .
elseif p_bin01 is not initial and p_frm01 is initial .
FLAG = 'F' .
elseif p_bin01 is not initial and p_frm01 is not initial and p_qty01 is initial.
FLAG = 'Q' .
endif.
endform .
accoring to flag you can set messages and also set cursor .
OR check CASE SY-UCOMM .
WHEN OTHERS .
Because ENTER is ConSIdered in OTHERS .
regards
Deepak
2011 Sep 06 6:51 AM