Application Development 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: 

Required field issue in table control (module pool)

Former Member
0 Kudos

Hi

I have a table control, having 5 fields (columns) - A, B, C, D and E.

Fields A and C are Required (Mandatory Fields). Now, if I Enter 1 row and press on SAVE, I am prompted to fill in the rest of the rows in the table control as the fields A and C in the rest of the rows are also mandatory.

How do I handle this?

Regards,

abaper

13 REPLIES 13

Former Member
0 Kudos

Hi,

I think what you did in the table control screen's PBO is you inserted empty lines into the internal table.

If you need to set A and C as mandatory in the way you're using, you could not insert initial empty lines for the user input.

Please use button to insert/create new line for user to input data.

Cheers,

0 Kudos

Hi Shiliang

I have not inserted initial/blank lines to the control.

But, I have set the field TABLECONTROL-LINES to 100 , other wise the empty lines gets greyed out. Do you tink this might be an issue.

If yes, then that means that I cannot make the fields required if I increase the number of input lines and the user wants to input only one line.

regards.

0 Kudos

in PBO you have to set it as

TABLECONTROL-LINES = lines( itab ).

kesavadas_thekkillath
Active Contributor
0 Kudos

Ignore

Edited by: Keshav.T on Nov 9, 2010 8:50 PM

0 Kudos

Hi Keshav

That does not work for my purpose because the user will have to input N number of entries in the control table.

Regards.

Edited by: d sappanese on Nov 9, 2010 4:24 PM

0 Kudos

In that case you have to validate it in PAI when you modify the content to the internal table.

Just write a check if any of the fields are initial when there is a non initial field in the row.

if the complete row is initial then donot do the validation.

Remove the required option from the screen attributes.


  LOOP AT it.
      FIELD:it-a,
            it-b
      MODULE modify_int_table.
  ENDLOOP.


module modify_int_table.
"<--do the validations here
modify it index tb-CURRENT_LINE.
endmodule.

Former Member
0 Kudos

Hi

It depends on how you're inserting the new record into the internal table, here you should have just one only record

Max

0 Kudos

Hi Max

I am not sure what exactly you meant.

In my case, the user can enter multiple lines/rows and we cannot restrict him. I am NOT using any button to insert one line at a time.

So, I am assuming that as per Keshav, I will have to validate it myself, and should not be keeping the fields mandatory at the screen level.Rather I will have to code for it.

Regards.

0 Kudos

Hi Max

I am not sure what exactly you meant.

In my case, the user can enter multiple lines/rows and we cannot restrict him. I am NOT using any button to insert one line at a time.

So, I am assuming that as per Keshav, I will have to validate it myself, and should not be keeping the fields mandatory at the screen level.Rather I will have to code for it.

Regards.

0 Kudos

Hi

But how do you append the row in the internal table where the rows, to be displayed in table control, are stored

Max

0 Kudos

Hi Max

I do a Select Before the loop for the table control in flow logic.

Just fyi that No blank lines are selected. and then I increase Tablecontrol-lines so that the user can input more lines.

regrads.

0 Kudos

The error message to fill mandatary fields should be triggered only if there's a corrisponding record in internal table, so I just want to know if you have appended initial line in order to allow the user to insert new records.

Else if you have appended some records and this records have the mandatary fields with initial value, u need to delete that option from field attribute by screen-painter and do some validation manually in PAI

PROCESS PAI.

   LOOP AT ITAB.
       MODULE VALIDATION.
   ENDLOOP.

Just as some guys have suggested to you before

Max

Former Member
0 Kudos

This issue is solved.

I did not do validations.

I kept the required/Mandatory fields as it is.

The problem was, I had a mandatory field Country key, whose SET?GET Parameter were checked in the attributes, due to which the values were getting filled in the lines but were invisible in the table control(God knows why ) .

Thank you guys.