Skip to Content
-1

Table control field validation in SAP ABAP

Hi experts! I need to validate a particular input field in the table control.

The scenario is something like: When the user click gives some inputs in table control and click on save certain validation to be done by comparing loaded quantity with balance quantity and throw an error if it exceeds.

*Issue happening is: 

Process After Input. 
Module user_command_500.

loop at gt_item. 
chain. 
field wa_item-loadqty module valiadte_loadqty. 
endchain. 
endloop. 

"Here in my above code, the gate pass is created when user click on SAVE, so the input in table control has to be validated before the Gatepass is generated. My Sy-ucomm is in useer_command_500 where the logic for validations needs to be written but the system captures the loaded qty (Input given in table control) only within loop endloop. So it's like a gatepass is generated and validation is beinh done. 
Add a comment
10|10000 characters needed characters exceeded

  • Hi sidda sairam please don't close a question without getting the right answer. If you have figured out the correct answer, please add it as an answer to your question. Afterwards, you can accept it as the best answer and close the question afterwards. This tutorial can help you to get more information about asking a question: https://developers.sap.com/tutorials/community-qa.html

    I have reopened the question to give the community the chance to re-act on your question and provide the correct answer.

    Regards, Svea

    SAP Community Moderator

  • You code doesn't use Best Practices, PAI should look like

    PROCESS AFTER INPUT.
      MODULE user_command AT EXIT-COMMAND. " Exit/Cancel
      LOOP AT itab.
        CHAIN.
          FIELD record-field1 MODULE check_field1.
          FIELD record-field2.
          MODULE check_record.
        ENDCHAIN.
      ENDLOOP.
      MODULE user_command. "Enter/Save

Related questions

1 Answer

  • Posted on Aug 26 at 02:23 PM

    If you want to save only if the loop did not produce any error, then call user_command_500 after the loop:

    Process After Input. 
      loop at gt_item. 
        chain. 
          field wa_item-loadqty module valiadte_loadqty. 
        endchain. 
      endloop. 
      Module user_command_500.                            " <=== moved after the loop
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.