‎2009 Nov 03 8:12 AM
Hi,
I have a table control. I need to make sure at least one row of data is entered on the table control, with field 1 as the mandatory field. How do I do that?
‎2009 Nov 03 8:25 AM
i think it should work as normally as we do for any screen in LOOP in PBO
loop at screen.
case screen-name.
when screen-name = required field.
screen-required = 1.
modify screen.
endcase.
endloop,
OR
You can also check in the attributes of the table control there you can check your i/p as mandatory
Hope this helps
Bhanu
‎2009 Nov 03 8:32 AM
‎2009 Nov 03 8:36 AM
the code i have given will work here you need to add the sy-tabix value also
for the 1st loop sytabix will be 1 so when sy-tabix is 1
loop at screen.
if sy-tabix = 1.
screen-field(which you want mandatory ) = 1.
and so on....
this should work
regards
Bhanu
‎2009 Nov 03 8:51 AM
My PBO looks like this:
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TB_MATERIAL'
MODULE TB_MATERIAL_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TB_MATERIAL_CHANGE_COL_ATTR.
LOOP AT LT_ITEMS
INTO LS_ITEMS
WITH CONTROL TB_MATERIAL
CURSOR TB_MATERIAL-CURRENT_LINE.
MODULE TB_MATERIAL_GET_LINES.
*&SPWIZARD: MODULE TB_MATERIAL_CHANGE_FIELD_ATTR
ENDLOOP.
So do I put that LOOP AT SCREEN inside LOOP AT lt_items?
‎2009 Nov 03 8:56 AM
HI
In Program
MODULE TB_MATERIAL_GET_LINES-. "-> You need implement your logic here
loop at screen.
if sy-stel = 1.
if screen-name = 'YOUR_FIRST_FIELD'.
SCREEN-REQUIRED = 1.
MODIFY SCREEN.
ENDIF.
endif.
endloop.
ENDMODULECheers
Ram
Edited by: Ramchander Krishnamraju on Nov 3, 2009 9:57 AM
‎2009 Nov 03 9:14 AM
Do you mean sy-loopc instead of sy-stel? Using sy-loopc or sy-tabix doesn't seem to work. I'm almost there!
Edited by: big mug on Nov 3, 2009 10:18 AM
‎2009 Nov 03 9:32 AM
I manage to solve it by setting my own flag. Thanks for all the help. I can see the tick on the field, but when I click Save, it does not return any message like we set it Required on screen painter. Therefore, I do a checking in PAI. But problem is, the whole table control will be dimmed, and I could no longer enter data after the message returned (as i can't put the Field in table control in the CHAIN).
Edited by: big mug on Nov 3, 2009 10:43 AM
‎2009 Nov 03 8:55 AM
Hi,
In Screen painter attributes, for that field give INPUT as REQUIRED in program tab.
Regards,
Dhan
‎2009 Nov 03 9:47 AM
I could not set mandatory field in Screen Painter as it will make the whole column to be mandatory
Edited by: big mug on Nov 3, 2009 10:48 AM
‎2009 Nov 04 6:18 AM
It will only work when any of the columns (except the mandatory field) in the row is entered