08-25-2005 8:58 AM
Hey guys,
In table control(created by wizard)attached with to display records. i have one STATUS column to show error messages.
I want to check if STATUS <> SPACE, ie if error exists.
all the error rows should be highlighted with red color and give common error message at status bar.
how to do this..where should i write this code.
idea please.
ambichan
08-25-2005 9:20 AM
Hope making redcolor is not possible.
But u can make blue colour using screen attributes
SCREEN-INTENSIFIED = 1
modify screen in PBO
LOOP AT <itab>
WITH CONTROL <table ctrl>
CURSOR table ctrl-CURRENT_LINE.
MODULE CHANGE_FIELD_ATTR.
ENDLOOP.
MODULE CHANGE_FIELD_ATTR.
check whether current row is error row...
LOOP AT SCREEN.
SCREEN-INTENSIFIED = 1.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE.
08-25-2005 9:13 AM
You change the fields attribute of table control cells, I believe you change INTENSIFIED attribute:
IF STATUS <> SPACE.
LOOP AT SCREEN.
SCREEN-INTENSIFIED = 1.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
You put this code into LOOP/ENDLOOP of PBO.
08-25-2005 9:20 AM
Hope making redcolor is not possible.
But u can make blue colour using screen attributes
SCREEN-INTENSIFIED = 1
modify screen in PBO
LOOP AT <itab>
WITH CONTROL <table ctrl>
CURSOR table ctrl-CURRENT_LINE.
MODULE CHANGE_FIELD_ATTR.
ENDLOOP.
MODULE CHANGE_FIELD_ATTR.
check whether current row is error row...
LOOP AT SCREEN.
SCREEN-INTENSIFIED = 1.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE.
08-25-2005 12:15 PM
Hey venkatesh,
Thanks for your reply..i solved this problem.
Small doubt.
In PBO LOOP section,To make column Non editable or Editable mode, I am able to do below setting.
screen-enable = 0 or 1.
But To make Row editable, its not working.
any other alternative is there?
Loop screen check each field or column and can make changes. but to do row mask where should i do coding in table control?
advise please.
ambichan
08-25-2005 12:32 PM
You put code into LOOP/ENDLOOP of table contro in PBO.
PROCESS PBO
LOOP AT...
MODULE CHANGE_SCREEN.
ENDLOOP.
MODULE CHANGE_SCREEN.
If you want to change only some fields, check field name:
LOOP AT SCREEN.
IF SCREEN-NAME = 'MY_FIELD'.
ENDIF.
ENDLOOP.
If you want to change only some rows, check, for example, the step of loop:
IF SY-STEPL = 1.
LOOP AT SCREEN.
SCREEN-INPUT = 1.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
SCREEN-INPUT = 0.
ENDLOOP.
ENDIF.
or you can check the values of your internal table:
IF MY_FIELD = ....
LOOP AT SCREEN.
SCREEN-INPUT = 1.
ENDLOOP.
ELSE
LOOP AT SCREEN.
SCREEN-INPUT = 0.
ENDLOOP.
ENDIF.
ENDMODULE.
08-25-2005 3:13 PM
HEY MAX,
Thanks for your reply.
Yes i understood the things happening in loop.
One more doubt.
Actually if a particular record is error then i really want to highlight the record and should not allow user to
give input to another fields unless untill he corrects the error.
How to do this..
I actually tried..like this in PBO LOOP
IF TTAB-FIELD1 = 'Error'.
LOOP AT SCREEN.
SCREEN-INTENSIFIED = 1.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
But how we can avoid user to make enter to other fields..
I remember, in standard case, if error appears then status message will be appear and other rows will be disabled mode.
how to do here..in this case
ambichan
08-25-2005 3:30 PM
You have to check the value of your field in PAI, and, if an error occurs, show an error message (type e), it will block user until he'll correct the error.
In PAI use comand FIELD, it allows to update only field where error occurs while all other field will be disabled.
PROCESS PAI.
LOOP AT...
FIELD MY_FIELD MODULE CHECK_VALUE.
ENDLOOP.
MODULE CHECK_VALUE.
IF MY_FIELD = 'Error'.
message e208(00) with 'Value is wrong'.
ENDIF.
ENDMODULE.
if an error occurs and you want to allow to update several fields, you can use CHAIN/ENDCHAIN.
PROCESS PAI.
LOOP AT...
CHAIN.
FIELD: MY_FIELD,
MY_FIELD2,
MY_FIELDN MODULE CHECK_VALUE.
ENDCHAIN.
ENDLOOP.