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

Table Control data gets lost on hitting enter

Former Member
0 Likes
1,952

Hi ppl,

I am facing an issue with table controls.

I have created a table control on my selection screen of a report.

But, when I enter data in the table control and hit enter key, the data vanishes.

Please let me know if I have missed out on coding something or let me know of the resources available online which can be referred for help.

The code written so far is:


PROCESS BEFORE OUTPUT.
  LOOP AT t_tbcl WITH CONTROL tbcl CURSOR tbcl-current_line.
  ENDLOOP.

PROCESS AFTER INPUT.
  LOOP AT t_tbcl.
    CHAIN.
      FIELD: t_tbcl-kostl,
             t_tbcl-posnr,
             t_tbcl-ebeln.
      MODULE modify_t_tbcl ON CHAIN-REQUEST.
    ENDCHAIN.
  ENDLOOP.

MODULE modify_t_tbcl INPUT.

  t_tbcl-mark = 'X'.
  MODIFY t_tbcl INDEX tbcl-current_line.

ENDMODULE.                 " modify_t_tbcl  INPUT

Thanks,

David.

4 REPLIES 4
Read only

Former Member
0 Likes
1,025

Hi,

This happens because every time you hit ENTER, the PAI is triggered and then your PBO of the screen where you havent populated your table control with values from the internal table.

Try this.

-> Repopulate your data in the internal table in the PBO as well.


PROCESS BEFORE OUTPUT.
  LOOP AT t_tbcl WITH CONTROL tbcl CURSOR tbcl-current_line.
    module display_data.  "Populate your table control with data from the internal table t_tbcl.
 ENDLOOP.

-> To avoid further problems, clear your internal table in the PAI in a module before the LOOP...ENDLOOP



PROCESS AFTER INPUT.
module cleartable.
  LOOP AT t_tbcl.
    CHAIN.
      FIELD: t_tbcl-kostl,
             t_tbcl-posnr,
             t_tbcl-ebeln.
      MODULE modify_t_tbcl ON CHAIN-REQUEST.
    ENDCHAIN.
  ENDLOOP.

 MODULE modify_t_tbcl INPUT.
  t_tbcl-mark = 'X'.
  MODIFY t_tbcl INDEX tbcl-current_line TRANSPORTING mark.  "try including the TRANSPORTING addition as well
ENDMODULE.     
  
module cleartable.
 clear t_tbcl.
 clear t_tbcl[].
endmodule.

Read only

Former Member
0 Likes
1,025

Hi David,

In This module you need to append the data first in table.

MODULE modify_t_tbcl INPUT.
 
  t_tbcl-mark = 'X'.
  
  MODIFY t_tbcl INDEX tbcl-current_line transporting fields.
 
ENDMODULE.                 " modify_t_tbcl  INPUT

Regards,

Nilesh

Read only

former_member404244
Active Contributor
0 Likes
1,025

HI,

try this

LOOP AT t_tbcl.

CHAIN.

FIELD: t_tbcl-kostl,

t_tbcl-posnr,

t_tbcl-ebeln.

ENDCHAIN.

MODULE modify_t_tbcl .

ENDLOOP.

MODULE modify_t_tbcl INPUT.

IF t_tbcl-mark = 'X'.

CLEAR :<fields> which are holding the data.

MODIFY t_tbcl INDEX tbcl-current_line Transporting <fields>

else.

MODIFY t_tbcl INDEX tbcl-current_line Transporting <fields>

endif.

ENDMODULE.

Regards,

Nagaraj

Read only

swaroop_g2
Explorer
0 Likes
1,025

Hi,

Modify your internal in PBO, only then the content will display