Skip to Content
author's profile photo Former Member
Former Member

Table control field change indicator

Hello..

Let's say we have the following code in the PAI for a table control having filed f1.

FIELD f1 MODULE mod1 ON REQUEST.

Is there any way to trigger this module mod1 even though it's value is not changed? Is there any change indicator that we can set programatically?

Actually my requirement is to upload some records into the table control from a text file. After that the usual validations should take place on the table control. In this case the table control won't trigger the modules ON REQUEST. Is there any way to force this?

Thanks very much.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 29, 2004 at 11:20 AM

    Hello Abhi,

    The statement

     FIELD <f> MODULE <m> ON REQUEST 

    is a conditional module call - it gets executed when the contents of the field <f> have been altered.

    That said, you could actually choose to omit this addition. For example:

    MODULE COMPARE INPUT.
    * 1. determine the current line in the table control as per the program
    * 2. compare the above line with the value I_ITAB.
    * 3. If there's a difference in step 2, then the line was changed.
    ENDMODULE.
    
    PROCESS AFTER INPUT.
      LOOP AT I_ITAB.
        MODULE COMPARE.
      ENDLOOP.
    

    Please note that the internal table I_ITAB is the same in the program and in the screen. And that it has a header line.

    Now regarding the actual requirement, I have a few doubts.

    1. Are you uploading the file on the same screen as the table control?

    2. Does the table control have any editable fields?

    3. What is the puepose of the table control ? (are you using it only because you want some validations to be done automatically ?)

    Regards,

    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 29, 2004 at 11:43 AM

    Hi Abhi

    As Anand mentioned in his post, <b>"ON REQUEST"</b> addition is optional. <b>"FIELD"</b> statement is used for making the screen field content transfered to the program variable. You can use <b>"ON REQUEST"</b> addition to trigger the transfer if the field value is changed. The addition <b>"ON VALUE"</b> is used to transfer the field value in case the field contains some value (i.e. not space).

    For multiple field transfer, to bind multiple fields to a module, you can use <b>"CHAIN"</b> statement.

    <u><b>e.g.</b></u>

    CHAIN .
    FIELD gs_wa-field_1 .
    FIELD gs_wa-field_2 .
    ...
    FIELD gs_wa-field_n .
    
    MODULE module_1 
           [ON CHAIN-REQUEST / ON CHAIN-VALUE] .
    ...
    MODULE module_n 
           [ON CHAIN-REQUEST / ON CHAIN-VALUE] .
    
    ENDCHAIN . 
    

    In fact, these are dialog(screen) programming basics. So you can refer to the standard SAP course <b>BC410 (this is the old code, maybe changed) - Dialog Programming</b>.

    *--Serdar

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Serdar / Abhi,

      Just like to make a small correction.

      In screen flow logic, there's <b>no</b> addition called <b>ON VALUE</b>. What you are referring to here is the <u><b>ON INPUT</b></u> addition.

      FIELD <f> MODULE <m> ON INPUT.
      
      or
      CHAIN.
        FIELD: <f1>, <f 2>,... 
        MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.
        FIELD: <g1>, <g 2>,... 
        MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.
       ...
      ENDCHAIN. 

      Regards,

      Anand Mandalika.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 31, 2004 at 03:23 AM

    Thanks very much for the info guys. What I exactly need is,I want the module to be fired only when changes are made to the field (ON REQUEST).

    But I also want to know is there a way we can fire this module even though the value was not changed? (Like in my case new rows are uploaded from text file into the table control internal table)

    From the text file i upload the contents directly to the (editable)table control internal table. So after the internal table is filled, in the next PBO the uploaded contents are shown in the table control. SO, Now I need to fire all the ON REQUEST modules for the newly uploaded rows so that validations occur.

    Hope u understood my problem.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      If your program is structured in a way that in every module, you are calling a form to perform a certain task, then you can call the same forms right after you upload data from file. Its like:

      //Your flow logic
      CHAIN.
        FIELD: <f1>, <f 2>,... 
        MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.
        FIELD: <g1>, <g 2>,... 
        MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.
       ...
      ENDCHAIN
      
      //Your program logic
      MODULE <mod1> INPUT
       PERFORM <form1>.
      ENDMODULE
      
      MODULE <mod2> INPUT
       PERFORM <form2>.
      ENDMODULE
      

      So you can call <form1>, <form2>,... directly for the validations. Another way, I am not sure if it will work, need to try it out, is to check the value of system variable sy-datar. If I can recall it correctly, its value is set to 'X' as soon as a screen field is changed. As I said, I am not sure if it would work in this case as well.

      Hope it helps.

      Regards

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.