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

mandatory row entry at table control

Former Member
0 Likes
1,424

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?

10 REPLIES 10
Read only

Former Member
0 Likes
1,124

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

Read only

0 Likes
1,124

but i only need field1 of first row to be mandatory.

Read only

0 Likes
1,124

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

Read only

0 Likes
1,124

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?

Read only

0 Likes
1,124

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.
ENDMODULE

Cheers

Ram

Edited by: Ramchander Krishnamraju on Nov 3, 2009 9:57 AM

Read only

0 Likes
1,124

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

Read only

0 Likes
1,124

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

Read only

Former Member
0 Likes
1,124

Hi,

In Screen painter attributes, for that field give INPUT as REQUIRED in program tab.

Regards,

Dhan

Read only

Former Member
0 Likes
1,124

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

Read only

Former Member
0 Likes
1,124

It will only work when any of the columns (except the mandatory field) in the row is entered