Skip to Content
author's profile photo
Former Member

Table control Validation

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Posted on Aug 22, 2007 at 06:37 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 07:09 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 22, 2007 at 07:47 AM

    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

    Add comment
    10|10000 characters needed characters exceeded