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: 

Table control Validation

Former Member
0 Kudos

Hi All,

I want to make the validation on a table control when the 'SAVE' function code is encountered.

Can anyon please let me know how to use 'FIELD' or anyother validation statement w.r.t the table control.

regards,

Rupesh R Nair.

7 REPLIES 7

0 Kudos

Hi,

In your flow logic you need to code like this.


PROCESS AFTER INPUT.
  LOOP AT ITAB.
    CHAIN.
      FIELD ITAB-CARRID.
      FIELD ITAB-CONNID.
      FIELD ITAB-COUNTRYFR.
      FIELD ITAB-CITYFROM.
      FIELD ITAB-AIRPFROM.
      FIELD ITAB-COUNTRYTO.
      FIELD ITAB-CITYTO.
      FIELD ITAB-AIRPTO.
      MODULE TAB_SPFLI_MODIFY ON CHAIN-REQUEST.
    ENDCHAIN.
  ENDLOOP.

You have to use FIELD statement between LOOP and ENDLOOP over the itab of the table control.

Regards,

Sesh

0 Kudos

Hi Sesh,

Thanks for the reply.

But the table control is not filled then the control will not go in to the loop, right?

My requirement is to check whether the table is initial or not.

Regards,

Rupesh R Nair.

0 Kudos

Hi,

You can always know that by checking the ITAB itself.

If the ITAB is changed after it is shown to the user you will get into this loop.

If you dont get into this LOOP then you always know that nothing is changed on the screen.

So just set some global flag in the LOOP ENDLOOP' s module and check that flag outside this loop for knowing if the data is changed after it is shown to the user.

Regards,

Sesh

0 Kudos

Hi Sesh,

That can be checked, whether the internal table is initial or not and based on that the error message can be show.

But after the error message is shown the screen is in 'DISABLE' mode.

So some field statement should be used with this ereor message on that table control.

So how to code for this.

Regards,

Rupesh

0 Kudos

Hi,

In this case you may not be able to use Error message, you might have to use either Warning or Status message.

Since you are not calling the module on any FIELD and even if you give FIELD it will not get called as nothing would have changed on this field and module will not get called.

So for this you cannot use error message, as error message will open only those fields for edit which are mentioned in FIELD and CHAIN ENDCHAIN.

Easy thing is to do a warning instead of error message which when shown on some user action will open the screen for edit again.

Regards,

Sesh

Former Member
0 Kudos

Hi,

Let me make the Conclusion so you have any field other than this Table control. If SO,you can use this logic...

Suppose you are creating 9001-text1 field then in PAI event.

CHAIN.

FIELD : P9001-TEXT1.

MODULE validation ON CHAIN-REQUEST.

ENDCHAIN.

This Validation module is used to check the Content in the Table control...

The itab is the internal table connected to the Table control....

Validation Module.

Select single * from PA0001 into table itab where pernr = p9001-pernr.

if itab[] is initial.

Message 'No DATA' type 'E'.

Endif.

Reward point if it is useful...

Thanks

Yogesh

gopi_narendra
Active Contributor
0 Kudos

Hi Rupesh,

In dialog programming you are not supposed to issue any error messages in the USER_COMMAND module. If you use any error msgs you will face the same issue which you are getting now.

To avoid this, just before the USER_COMMAND Module write a module. in that module write the validation. Make sure you write the fields for the moduel within chain endchain.

case sy-ucomm.
  when 'SAVE'.
    if itab[] is initial.
      message E000(ZCL) with 'No records found'
    endif.
endcase.

Regards

Gopi