Skip to Content

Refreshing a classic ALV-List

Hi everybody out there,

I have a problem refreshing a Classic ALV list after a user action adding a new entry to the output table. The coding is similar to the following :

*  ---   Display Table   ---
   CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
             i_callback_program       = g_repid
             is_variant               = g_variant
             i_save                   = 'A'
             it_fieldcat              = g_fldcat
             is_layout                = g_layout
             it_events                = g_event
        TABLES
             t_outtab                 = cust_tab.
...
*  ---  Treatment of ALV actions   ---
FORM user_command_alv
     USING ucomm    LIKE sy-ucomm
           selfield TYPE slis_selfield.

  CASE ucomm.
       when 'NKUN'.          "New customer
             perform create_new_cust.
             selfield-refresh    = 'X'.   
             ucomm = '&REFRESH'.        
             exit.
...
ENDFORM.
...
FORM create_new_cust.
DATA: newcust like cust_tab.
*  ---   Populate new customer   ---
   newcust-kunnr = '123456'.
   ...
   append newcust to cust_tab.
ENDFORM.

The problem with this coding is, that the internal table is correctly populated but not shown on the list. The statement ucomm = '&REFRESH', which I found here in a posting, did not change anything.

Thanx for any help

Rabanus

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 12:55 PM

    Hi

    delete the following rows of code

    CASE ucomm.

    when 'NKUN'. "New customer

    perform create_new_cust.

    selfield-refresh = 'X'.

    ***-----> ucomm = '&REFRESH'.

    ****-----> exit.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2005 at 01:22 PM

    Hi Max,

    thanx for the quick response, but your recommendations did not help. The &REFRESH was introduced only for test purposes and the exit shortens only down the way to the end of the form where nothing relevant happens.

    As I read in a previous posting this refresh behaviour might sometimes happen whereas on test programs everything seems to work correctly. My question is : What was the difference and how it was found ?

    Ciononostante grazie

    Rabanus

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      I don't know this posting (you could give me the link), but I often use the REFRESH and I've never note a bad behaviour.

      Only difference it's I always had updated or deleted (not added) a record of my output table.

      Max

  • Posted on Sep 27, 2005 at 02:43 PM

    One intersting point is a different behaviour with debugging and without it. Setting a break point where the line is inserted in the table will give a correct outcome. Whereas running it without debugging will not show the inserted line on the list.

    Strange ! Isn't it ?

    I think this worth making an OSS-Call.

    Thanx for your contribution

    Rabanus

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2005 at 03:35 PM

    I have the answer. Sorry for occupying your attention.

    The problem comes from the call of XD01 to create the new customer master and the asynchronous update of the database. When the program returns from XD01 I try to select the new customer data, which at this point of time is not on the database (and could thus not be inserted into the table).

    So I introduced a

          wait up to 1 seconds.
    

    which solved the problem. ANyway I think this experience might be helpful for others facing the same problem.

    Thanx to all

    Rabanus

    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.