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

changing alv source table

Former Member
0 Likes
1,294

Hi,

I have a screen with a I/O textfield and a custom container.

It's supposed to list in alv the table that's in the textfield.

I'm using the cl_salv_table class to display the alv, it works fine the first time but when I change the name at the textfield it just do nothing.

the t_table parameter is always correct when it reaches the method factory.

I'm kinda lost, I've tried many things but nothing seems to work.

here's my source code:

  DATA: CC_1400_REG type ref to cl_gui_custom_container.
  data: gr_table2     type ref to cl_salv_table.

  check not io_tabname is initial.

  IF not gr_table2 IS initial.
    gr_table2->refresh( ).
  else.

  create object CC_1400_REG
    exporting
      container_name = 'CC_1400_REG'.

  TRY.
    CALL METHOD cl_salv_table=>factory
      exporting
        r_container      = CC_1400_REG
        container_name   = 'CC_1400_REG'
      importing
        r_salv_table     = gr_table2
      changing
        t_table          = <TABLE>.
  CATCH CX_SALV_MSG.
  ENDTRY.
  gr_table2->display( ).
endif.

is a fs pointing to a dinamicly created internal table.

i've already tried to free the container and the cl_salv_table each time PBO is executed but nothing works...

those anybody knows how can I solve this?

best regards,

André Costa

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
950

You are going to want to destroy all of the objects every time the PBO is fired. It is the easiest way to rebuild the ALV. Make sure that you are clearing(CLEAR) the reference variables as well as freeing(FREE) them.

Regards,

Rich Heilman

5 REPLIES 5
Read only

Former Member
0 Likes
950

Hi,

Refresh the container and dynamic internal table.

Your code for generating the new ALV list should be in PBO.

I think the dynamic internal table is not regenerated.You can check this in debugging mode.

Reward if helpful.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
951

You are going to want to destroy all of the objects every time the PBO is fired. It is the easiest way to rebuild the ALV. Make sure that you are clearing(CLEAR) the reference variables as well as freeing(FREE) them.

Regards,

Rich Heilman

Read only

0 Likes
950

Uma sankar . S : Could you tell me how to refresh the container?

Rich Heilman : Still not working... here's my code with "your" changes:

  DATA: CC_1400_REG type ref to cl_gui_custom_container.
  data: gr_table2     type ref to cl_salv_table.

  check not io_1400_nome is initial.


 FREE gr_table2.
 FREE CC_1400_REG.
  create object CC_1400_REG
    exporting
      container_name = 'CC_1400_REG'.

  TRY.
    CALL METHOD cl_salv_table=>factory
      exporting
        r_container      = CC_1400_REG
        container_name   = 'CC_1400_REG'
      importing
        r_salv_table     = gr_table2
      changing
        t_table          = <TABLE>.
  CATCH CX_SALV_MSG.
  ENDTRY.
  gr_table2->display( ).

The internal table <table> is reaching this point properly...

Message was edited by:

Andr Costa

Read only

0 Likes
950

Try this.....




  DATA: CC_1400_REG type ref to cl_gui_custom_container.
  data: gr_table2     type ref to cl_salv_table.
 

CLEAR gr_table2.            FREE gr_table2.
CLEAR CC_1400_REG.   FREE CC_1400_REG.


check not io_1400_nome is initial.

* move clear and free before this CHECK statement.
  




Or are these defined directly in the module of the PBO?

Regards,

Rich Heilman

Read only

0 Likes
950

no... still not working...

and no, this is from a FORM called at PBO.

and btw, the check statement is just to avoid the shortdump at the first call of the screen (because there is no name at that field...)