‎2010 Aug 10 6:04 AM
Hi,
I want to make editing to the fields of the table control based on some logic.
e.g. some fields/columns have to output only and some both I/O. further, some fields need to mandatory based on some condition .
this logic has to be written in the PBO ?
I have created the table control from the TC wizard so it generates the code autmatically.
Thanks,
Ravish
‎2010 Aug 10 8:51 AM
Hello ravish.ojha
You can change edit / obligatory etc. properties of table control *_cell by cell_*,
Go to PBO of your screen
you will see the LOOP statemet created by wizard like this :
LOOP AT ITAB "<-- your internal table
WITH CONTROL TC_DATA "<-- your table control name
CURSOR TC_DATA-CURRENT_LINE.
MODULE TC_DATA_GET_LINES.
MODULE MODULE_ZZ1. "<----
Insert a module here
*&SPWIZARD: MODULE TC_DATA_CHANGE_FIELD_ATTR
ENDLOOP.
Now insert your own module MODULE_ZZ1 inside that loop.
Than coding of module :
MODULE MODULE_ZZ.
LOOP AT SCREEN.
if screen-name = 'FIELD1'. "<-- your condiiton for field
if itab-field1 = 'ABC'. "<--- your contidion for record and value for field
screen-input = '1'.
SCREEN-REQUIRED = '1'.
MODIFY SCREEN.
endif.
endif.
ENDLOOP.
ENDMODULE.
I hope it'll be useful for u.
Bulent
Edited by: Bulent Balci on Aug 10, 2010 9:54 AM
‎2010 Aug 10 8:55 AM
Thanks for your answer.
I want to make the rows editable and uneditable based on conditions apart from the columns.
how can I set the property/attributes of the rows based on the function code values.
Also, I need to have a 'value help' or F4 help for the specific columns.
screen-value help = 'name of search help' will it work?
or is there any other way to achieve this?
I am not finding any screen attribute to set the text of a column e.g. a plant id shows as WERKS, but I want this to show 'Plant ID'.
is there any description property of the screen column?
Thanks,
Ravish
Edited by: ravish.ojha on Aug 10, 2010 9:57 AM
Edited by: ravish.ojha on Aug 10, 2010 9:58 AM
‎2010 Aug 10 9:02 AM
Hello
Just imagine your table name is itab
and If field1 of itab has value 'ABC' you want to set this row editable :
Than change the coding of module MODULE_ZZ in previous example like this :
MODULE MODULE_ZZ.
LOOP AT SCREEN.
if itab-field1 = 'ABC'. "<--- your contidion for row selection
screen-input = '1'.
else.
screen-input = '0'.
endif.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE.
Edited by: Bulent Balci on Aug 10, 2010 10:03 AM
‎2010 Aug 10 9:07 AM
Please let me know regarding these points:
Also, I need to have a 'value help' or F4 help for the specific columns.
screen-value help = 'name of search help' will it work?
or is there any other way to achieve this?
I am not finding any screen attribute to set the text of a column e.g. a plant id shows as WERKS, but I want this to show 'Plant ID'.
is there any description property of the screen column?
Thanks,
Ravish
‎2010 Aug 10 9:19 AM
Hi ravish
No .. you can not set the f4 help with field screen-value_help dynamically,
But you can set it statically on screen painter.
Open your screen in screen painter,
double click on a field in a row
go to "Dict" tab on the right screen and fill "Search Help" field.
I think it's not meaningful to change the search help of a field
dynamically depending of row.
Edited by: Bulent Balci on Aug 10, 2010 10:21 AM
‎2010 Aug 10 12:15 PM
‎2010 Aug 10 12:55 PM
thanks Ram for posting ur articles!
but my problem is very specific.
I want a new record to the table control.
scenario is the only the top row should be editable and not all other rows.
case: user is displayed with the whole set of data in the TC, now he clicks on the 'add' 'insert' button and 1 row should be introduced at the top of TC and only that row should be editable and all other rows should not be editable.;
currently I am able to make the columns editable. but making specific rows editable is the one I am looking for.
please provide ur valuable inputs on the same.
Thanks,
Ravish
‎2010 Aug 10 1:02 PM
Hi Ravish,
try this way...
PROCESS BEFORE OUTPUT.
MODULE status_<screen>.
* Table control for OUTPUT
LOOP WITH CONTROL <table control>.
MODULE Screen_modify.
ENDLOOP.
MODULE Screen_modify OUTPUT.
* Table control reading values from input screen & displaying on screen
READ TABLE <table in table control > INTO <workarea>
INDEX <table control>-current_line.
* Logic for screen Display when Required Flag = 'D'
IF <workarea>-<filed>= 'XXX'. "Pass the values or field which you want to Check
LOOP AT SCREEN.
IF screen-name = <workarea>-<filed>. "if you Pass work area then total line item is in Display mode else
"if you pass workarea+field the particular field in display
screen-input = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE. "
Regards,
Prabhudas
‎2010 Aug 10 1:33 PM
Hi,
thanks for replying here.
I tried this approach, my logic is:
IF Local_variable-screen-name = 'Work_Area-Col_name".
please tell me how can I pass the work area as a whole when the check is for the work area + field name.
the screen-name always refers to the individual columns and not the work area.
or please tell me how can I get the work area assigned to the local variable?
Thanks ,
Ravish