Application Development and Automation 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: 
Read only

Data disappears on enter in table control

Former Member
0 Likes
8,890

Hi All,

i am working in module pool, now i gets a problem at one point.

When i fills my data in table control in module pool and presses

enter, it disappears. i have searched various threads on scn

but still not able to solve my problem, here is my code

please sujjest me the solution.

PROCESS BEFORE OUTPUT.
MODULE DISPLAY.
MODULE SELECT_RECORDS.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TBC_ESC'
   MODULE TBC_ESC_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_COL_ATTR.
   LOOP AT   IT_FINAL
        INTO WA_FINAL
        WITH CONTROL TBC_ESC
        CURSOR TBC_ESC-CURRENT_LINE.
     MODULE TBC_ESC_GET_LINES.
*&SPWIZARD:   MODULE TBC_ESC_CHANGE_FIELD_ATTR
   ENDLOOP.

  MODULE STATUS_9000.

PROCESS AFTER INPUT.

CHAIN.
MODULE EXIT.

ENDCHAIN.


*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TBC_ESC'
   LOOP AT IT_FINAL.
     CHAIN.
       FIELD WA_FINAL-DES.
       FIELD WA_FINAL-MATERIAL.
       FIELD WA_FINAL-CODE.
      
       MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
     endchain.
     FIELD WA_FINAL-WERKS
*      MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
       MODULE TBC_ESC_MARK ON REQUEST.
   ENDLOOP.
   MODULE TBC_ESC_USER_COMMAND.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_COL_ATTR.

  MODULE USER_COMMAND_9000.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,048

Hi All,

got my problem at some extent, let me explain.

In user_command input

i have declared like this

WHEN 'ENTER'.
       PERFORM DISP_DATA.


in form disp_data, i have written my code as shown below


FORM DISP_DATA .

    SELECT MANDT SNO MATERIAL
     FROM ZESC_MATERIAL
     INTO  TABLE  IT_FINAL.

ENDFORM.    


Thats why, it was showing only material and sno on pressing enter.


Now if i am taking weightedge also, into consideration, still it is showing blank on enter (when no data

for weightedge).


Now, please sujjest me, what can i do when i puts data in weightedge, and press enter

it should not gets disappeared.

Hi All,

got my problem at some extent, let me explain.

In user_command input

i have declared like this

WHEN 'ENTER'.
       PERFORM DISP_DATA.


in form disp_data, i have written my code as shown below


FORM DISP_DATA .

    SELECT MANDT SNO MATERIAL
     FROM ZESC_MATERIAL
     INTO  TABLE  IT_FINAL.

ENDFORM.    


Thats why, it was showing only material and sno on pressing enter.


Now if i am taking weightedge also, into consideration, still it is showing blank on enter (when no data

for weightedge).


Now, please sujjest me, what can i do when i puts data in weightedge, and press enter

it should not gets disappeared.

33 REPLIES 33
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
6,048

Hello Shweta.

     Why have you commented this? This module updates the table control data into internal table which will ultimately displayed back via table control.


*      MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.         

Regards.

Read only

0 Likes
6,048

Hi Arun,

i have already put it into chain..endchain

so commented outside it.

Is it wrong ?

Read only

0 Likes
6,048

Ok. Didn't see it properly.

* Have you set Input field attribute for that field?

*  Have you declared that field name correctly?

* If that data which you are entering is new data to be inserted into internal table,

  then you have write code inside the module MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST to APPEND data.

For instance,

     MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.

          MODIFY IT_FINAL from WA_FINAL INDEX TBC_ESC-CURRENT_LINE.

          if sy-subrc <> 0.

               "Write the logic to APPEND DATA to internal table IT_FINAL.

          endif.

     ENDMODULE.

Regards.

Read only

0 Likes
6,048

Hi Arun,

when i have written according to you as shown below, it is giving me error as

"MODIFY is only allowed with LOOP AT <database table> and in PAI.  "

When i puts it inside loop , it gives again error

PROCESS AFTER INPUT.

   LOOP AT IT_FINAL.
     CHAIN.
       FIELD WA_FINAL-SNO.
       FIELD WA_FINAL-DESCRIPTION.
       FIELD WA_FINAL-WERKS.
       FIELD WA_FINAL-WEIGHTEDGE.
       MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
        
         MODIFY IT_FINAL FROM WA_FINAL  INDEX TBC_ESC-CURRENT_LINE.
         IF SY-SUBRC <> 0.
           APPEND WA_FINAL TO IT_FINAL.

         ENDIF.
     
     endchain.
     FIELD WA_FINAL-SEL
       MODULE TBC_ESC_MARK ON REQUEST.
   ENDLOOP.
   MODULE TBC_ESC_USER_COMMAND.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE T

Read only

0 Likes
6,048

Shweta,

    You have to write that code inside the module TBC_ESC_MODIFY.

      For instance,

     MODULE TBC_ESC_MODIFY INPUT.

        MODIFY IT_FINAL FROM WA_FINAL INDEX TBC_ESC-CURRENT_LINE.

        if sy-subrc <> 0.

               APPEND WA_FINAL TO IT_FINAL.

        endif.

     ENDMODULE.


Regards.

Read only

Former Member
0 Likes
6,048

Best way for solving this kind of problem is Put a break point in your PAI and debug, check where your internal table is getting cleared..

Read only

sivaganesh_krishnan
Contributor
0 Likes
6,048

Hi shweta,

Best way is to debug the program.. Try to keep break points inside PAI and PBO. In some place you would have cleared the data.

You would arrive at the solutions once you debug thoroughly.

Regards,

Sivaganesh

Read only

Former Member
0 Likes
6,048

Hi all,

i am not getting how to correct it, when i puts BREAK POINT,

it gives error.

Please tell me what can i do ?

Read only

0 Likes
6,048

save and activate your program and then place a break point..

Read only

Former Member
0 Likes
6,048

hi,

Inside module TBC_ESC_MODIFY add below code,

  describe table it_final lines w_lines.

  if tbc-current_line > w_lines.
    append wa_final to it_final.
  else.
    modify it_final  from wa_final index tbc-current_line.
  endif.

Regards,

Praveen Savanth N

Read only

0 Likes
6,048

Hi Praveen,

i have written these code as sujjested by you, but getting error that "Statement "DESCRIBE" is not defined. Check your spelling."

MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
        
         DESCRIBE TABLE IT_FINAL LINES W_LINES.
         IF TBC-CURRENT_LINE > W_LINES.
           APPEND WA_FINAL TO IT_FINAL.
           ELSE .
             MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
           ENDIF

         ENDIF.
     endchain.
     FIELD WA_FINAL-SEL

Read only

0 Likes
6,048

Hi Shweta,

Please check I think you have not declared w_lines variable.

Regards,

Read only

0 Likes
6,048

Hi Praveen,

i am declaring w_lines as shown below, but it is giving me error as "

Statement "DATA" is not defined. Check your spelling.   "

Please tell me how could i solve this

PROCESS AFTER INPUT.
DATA : W_LINES TYPE TLINE.
   LOOP AT IT_FINAL.
     CHAIN.
       FIELD WA_FINAL-SNO.
       FIELD WA_FINAL-DESCRIPTION.
       FIELD WA_FINAL-WERKS.
       FIELD WA_FINAL-WEIGHTEDGE.
       MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.

         DESCRIBE TABLE IT_FINAL LINES W_LINES.
         IF TBC-CURRENT_LINE > W_LINES.
           APPEND WA_FINAL TO IT_FINAL.
           ELSE .
             MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
           ENDIF.

         ENDIF.
     endchain.
     FIELD WA_FINAL-SEL
       MODULE TBC_ESC_MARK ON REQUEST.
   ENDLOOP.
   MODULE TBC_ESC_USER_COMMAND.

Read only

0 Likes
6,048

Hi,

On screen logic flow , you can't use data statement. Double click on a module. Inside the module,  put data statement.

Kindly take the help of your colleagues to sort out the issue. Otherwise see the logic in Program 'DEMO_DYNPRO_TABLE_CONTROL_1' & 'DEMO_DYNPRO_TABLE_CONTROL_2' .

Also, on net you will find lot of information on module pool table control.

Regards,

DPM

Read only

0 Likes
6,048

Hi Shweta Chouhan,

You cannot declare variable like the above.. Please do declare it in top include .

Read only

0 Likes
6,048

Hi,

i don't have any colleagues to talk, so i am worried about it.

And i have seen many threads, but not able to solve it.

Read only

0 Likes
6,048

PROCESS AFTER INPUT.
DATA : W_LINES TYPE TLINE.
   LOOP AT IT_FINAL.
     CHAIN.
       FIELD WA_FINAL-SNO.
       FIELD WA_FINAL-DESCRIPTION.
       FIELD WA_FINAL-WERKS.
       FIELD WA_FINAL-WEIGHTEDGE.
       MODULE TBC_ESC_MODIFY . ON CHAIN-REQUEST.

         DESCRIBE TABLE IT_FINAL LINES W_LINES.
         IF TBC-CURRENT_LINE > W_LINES.
           APPEND WA_FINAL TO IT_FINAL.
           ELSE .
             MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
           ENDIF.

         ENDIF.
     endchain.
     FIELD WA_FINAL-SEL
       MODULE TBC_ESC_MARK ON REQUEST.
   ENDLOOP.
   MODULE TBC_ESC_USER_COMMAND.

**********Double click on Module TBC_ESC_MODIFY and insert the following code********


  MODULE TBC_ESC_MODIFY.

     MODIFY IT_FINAL  FROM WA_FINAL INDEX TBC-CURRENT_LINE.

  ENDMETHOD.

Read only

0 Likes
6,048

Hi Debopriyo,

i have done what you have shown, but still it disappears after enter.

Read only

0 Likes
6,048

HI,

I have written this inside MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.

But still it disappears after ENTER

MODULE TBC_ESC_MODIFY INPUT.
   MODIFY IT_FINAL
     FROM WA_FINAL
     INDEX TBC_ESC-CURRENT_LINE.

   DESCRIBE TABLE IT_FINAL LINES W_LINES.
   IF TBC_ESC-CURRENT_LINE > W_LINES.
     APPEND WA_FINAL TO IT_FINAL.
     ELSE.
       MODIFY IT_FINAL FROM WA_FINAL INDEX TBC_ESC-CURRENT_LINE.

   ENDIF.

ENDMODULE.

Read only

0 Likes
6,048

Don't use work area in PAI.  Replace WA_FINAL by IT_FINAL. It should work.

LOOP AT IT_FINAL.

     CHAIN.

       FIELD IT_FINAL-SNO.

       FIELD IT_FINAL-DESCRIPTION.

       FIELD IT_FINAL-WERKS.

       FIELD IT_FINAL-WEIGHTEDGE.

       MODULE TBC_ESC_MODIFY .

      endchain.

     FIELD IT_FINAL-SEL

       MODULE TBC_ESC_MARK ON REQUEST.

   ENDLOOP.


MODULE TBC_ESC_MODIFY.

     MODIFY IT_FINAL  INDEX TBC-CURRENT_LINE.

  ENDMETHOD.

Read only

0 Likes
6,048

Hi

if i will not provide work area, it is giving error, to "it_final has no header line"

if i will add a header line then, then my table control will not work.

Read only

0 Likes
6,048

LOOP AT IT_FINAL.

     CHAIN.

       FIELD WA_FINAL-SNO.

       FIELD WA_FINAL-DESCRIPTION.

       FIELD WA_FINAL-WERKS.

       FIELD IWA_FINAL-WEIGHTEDGE.

       MODULE TBC_ESC_MODIFY .

      endchain.

     FIELD IT_FINAL-SEL

       MODULE TBC_ESC_MARK ON REQUEST.

   ENDLOOP.


MODULE TBC_ESC_MODIFY.

data : wa_final like line of it_final.

  

   READ TABLE IT_FINAL INTO wa_final1 WITH KEY SNO = WA_FINAL-SNO.

   if sy-subrc = 0.

    APPEND IT_FINAL FROM WA.

    ELSE.

     MODIFY IT_FINAL  FROM WA INDEX TBC-CURRENT_LINE.

  ENDIF.

  ENDMETHOD.

Read only

Former Member
0 Likes
6,048

Hi,

It seems you are not filling the internal table in PBO. ( Use append statement to fill the itab ; loop at statement in PBO, processes each line displayed- one by one; you need to use append statement to store the displayed line in the internal table ). After filling the itab -  ( Loop at itab statement in PAI does validation on individual fields of the records sequentially ).

Also, before appending make sure that entry does not exist in itab. Otherwise it will see duplicate records.

Regards,

DPM

Read only

0 Likes
6,048

Hi

i am writing these code lines, please see whats the problem.

PROCESS BEFORE OUTPUT.
MODULE DISPLAY.
MODULE TBC_ESC_CHANGE_TC_ATTR.

   LOOP AT   IT_FINAL
        INTO WA_FINAL
        WITH CONTROL TBC_ESC
        CURSOR TBC_ESC-CURRENT_LINE.
     MODULE TBC_ESC_GET_LINES.
ENDLOOP.

  MODULE STATUS_9000.

PROCESS AFTER INPUT.

   LOOP AT IT_FINAL.
     CHAIN.
       FIELD WA_FINAL-SNO.
       FIELD WA_FINAL-DESCRIPTION.
       FIELD WA_FINAL-WERKS.
       FIELD WA_FINAL-WEIGHTEDGE.
       MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
        

     endchain.
     FIELD WA_FINAL-SEL
       MODULE TBC_ESC_MARK ON REQUEST.
   ENDLOOP.
   MODULE TBC_ESC_USER_COMMAND.

CHAIN.
  MODULE EXIT.
  MODULE USER_COMMAND_9000.
ENDCHAIN.
   

Read only

0 Likes
6,048

Hi Shweta,

put module within  CHAIN AND ENDCHAIN.

MODULE VALIDATE_DATA_1021 ON CHAIN-INPUT.
       MODULE RGPTBLCTRL_MODIFY_1021.


sample code is

PROCESS BEFORE OUTPUT.
   MODULE RGPTBL1021_CHANGE_TC_ATTR.
   LOOP AT   ITRGPDET
        INTO WARGPDET
        WITH CONTROL RGPTBL1021
        CURSOR RGPTBL1021-CURRENT_LINE.
   ENDLOOP.

  MODULE STATUS_1021.
PROCESS AFTER INPUT.
   LOOP AT ITRGPDET.
     CHAIN.
       FIELD WARGPDET-ITEMNO.
       FIELD WARGPDET-MATNR.
       FIELD WARGPDET-MAKTX.
       FIELD WARGPDET-MEINS.
       FIELD WARGPDET-QUANTITY.
       FIELD WARGPDET-WERKS.
       FIELD WARGPDET-SELECT.
       MODULE RGPTBLCTRL_MODIFY_1021.
     ENDCHAIN.
   ENDLOOP.
  MODULE USER_COMMAND_1021.





code of module RGPTBLCTRL_MODIFY_1021.


MODULE RGPTBLCTRL_MODIFY_1021 INPUT.
   MODIFY ITRGPDET
     FROM WARGPDET
     INDEX RGPTBL1021-CURRENT_LINE.
   IF SY-SUBRC <> 0.
     APPEND ITRGPDET.
   ENDIF.
ENDMODULE.                 " RGPTBLCTRL_MODIFY_1021  INPUT




Regards,

Ranjit Kumar.

Read only

Former Member
0 Likes
6,048

Hi All,

one problem i am facing also, i have created a USER_COMMAND in PAI,

but in the main program when i am using this code, my debugger didn't

get at perform disp_data on hitting enter, what may be the reason.

This is my code

CASE SY-UCOMM.

     WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
       LEAVE TO SCREEN 0..
     WHEN 'ENTER'.
       PERFORM DISP_DATA.
     WHEN 'SAVE'.
       PERFORM MATERIAL_SAVE..

   ENDCASE.
CLEAR : SY-UCOMM.

Read only

0 Likes
6,048

Shweta,,

There is no  function code as "ENTER, "

Hence  the perform is also not executed.

If you need the correct fcode,try to see the sy-ucomm value in debugger

--Lakshmi

Read only

Former Member
0 Likes
6,048

This message was moderated.

Read only

Former Member
0 Likes
6,048

Hi,

Please use modify internal table statement to retain the values.

Warm Regards

Suneesh

Read only

Former Member
0 Likes
6,049

Hi All,

got my problem at some extent, let me explain.

In user_command input

i have declared like this

WHEN 'ENTER'.
       PERFORM DISP_DATA.


in form disp_data, i have written my code as shown below


FORM DISP_DATA .

    SELECT MANDT SNO MATERIAL
     FROM ZESC_MATERIAL
     INTO  TABLE  IT_FINAL.

ENDFORM.    


Thats why, it was showing only material and sno on pressing enter.


Now if i am taking weightedge also, into consideration, still it is showing blank on enter (when no data

for weightedge).


Now, please sujjest me, what can i do when i puts data in weightedge, and press enter

it should not gets disappeared.

Read only

0 Likes
6,048

Hi All,

please  help me, how could i correct this.

Read only

0 Likes
6,048

Hi Shweta,

do one thing and see if it works for you or not, within your form disp_data,

write your code logic as shown below. (recently got a same issue, and he get his answer this way).

Still if you have trouble, then please revert.

FORM DISP_DATA .
IF IT_FINAL[] IS INITIAL.
    SELECT MANDT SNO MATERIAL
     FROM ZESC_MATERIAL
     INTO  TABLE  IT_FINAL.
ENDIF.
ENDFORM.   

Read only

Former Member
0 Likes
6,048

Hi Shweta,


I got your query.

When you press Enter, every time your PERFORM DISP_DATA will call. and it will remove all your previous data and add new data into your internal table.


Remove code from USER_COMMAND and You can write code like this.

In PAI you create a perform

PERFORM GET_DATA.

PERFORM MODIFY_DATA.

FORM GET_DATA.

if first_flag = space.    " Set flag for first time call. every time no need to all query.

    SELECT MANDT SNO MATERIAL
     FROM ZESC_MATERIAL
     INTO  TABLE  IT_FINAL.


     first_flag = 'X'.

endif.

ENDFORM.

FORM MODIFY_DATA.

        MODIFY IT_FINAL FROM WA_FINAL INDEX TC-CURRENT_LINE.

        if sy-subrc <> 0.

               APPEND WA_FINAL TO IT_FINAL.

        endif.

ENDFORM.

Kindly check this code and let me know.