Skip to Content

Refresh_table display problem

Hi Experts,

I created editable ALV Program.

Ctrated copy button in tool bar.

user has to select the row and click on copy based on that i am identifying the row and inserting the internal table.

using cl_gui_alv_grid->get_selectd->rows.

First time i clicked on copy it is getting copied but in second time by selecting the row and clicking copy it is not coping and not showing row.

see below code .

WHEN 'COPY'.
v_alvgd->check_changed_data( ).
CALL METHOD v_alvgd->get_selected_rows
IMPORTING
et_index_rows = lv_row
et_row_no = lv_id.

READ TABLE lv_id into lv_id1 INDEX 1.


*Read table lv_id into lv_id1 INDEX 1.

lv_index1 = lv_id1-ROW_ID .

DESCRIBE TABLE i_final LINES lv_no.

READ TABLE i_final2 into w_final2 INDEX lv_index1.
lv_index2 = lv_index1 + lv_no.
INSERT w_final2 INTO i_final index lv_index2.
i_pbo = i_final.

CALL METHOD v_alvgd->refresh_table_display
EXPORTING
is_stable = i_re_alv
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.

Please check and let me know how to resolve it <whenever you get a chance.>

Thanks & regards

Kiran

Message was edited by: Gareth Ryan - Please don't ask for anything "urgent". People on this forum (mostly) have a day job to do, so handling your urgent issues isn't going to be an urgent problem for them.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Dec 23, 2014 at 11:19 AM

    Hi Kiran,

    Move this piece of code v_alvgd->check_changed_data( ). to bottom.

    regards,

    Archer

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2014 at 03:56 PM

    hi venkat,

    There is already a duplicaterow button. Why don't you use it?

    Anyway to get the result as per your requirement you have to replace

    lv_index2 = lv_index1 + lv_no.


    with

    lv_index2 = lv_index1 + 1.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 23, 2014 at 04:13 PM

    HI,

    Make sure you refer the inserted table again for final table once you are done with copying the row first time. Internal table is not getting refreshed, that should be the problem. If you put breakpoint and check the final internal table getting referred, you can find this.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 23, 2014 at 04:17 PM

    have you set i_re_alv-row = 'X' ?

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 24, 2014 at 05:18 AM

    Hi,

    Try the below code.

    Call method

    v_ALVgrd->check_changed_data

    importing

    e_valid = l_valid (take a local variable to check the data changed)

    changing

    c_refresh = l_refresh (take a local variable to check the refresh of alv).

    and

    Call method

    v_alvgrd->REFRESH_TABLE_DISPLAY

    exporting

    I_soft_refresh = 'X'.

    Remove the IS_TABLE parameter.

    Regards.

    Praveer.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member venkat kiran

      Hi Kiran,

      Try using FM 'GET_GLOBALS_FROM_SLVC_FULLSCR'.

      IF v_ALVgrd IS INITIAL.

      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

      IMPORTING

      E_GRID = v_ALVgrd.

      ENDIF.

      IF NOT v_ALVgrd IS INITIAL.

      CALL METHOD v_ALVgrd->check_changed_data

      ENDIF.

  • Dec 24, 2014 at 06:01 AM

    Hi,

    As per your requirement, I have made the same logic and it's working fine.

    Please find the above logic and it's working fine.

    regards.

    Praveer.


    inof.JPG (45.4 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 24, 2014 at 06:07 AM

    hi venkat,

    This is my code which is working fine.

    You can try it by changing your code as per this code:

    WHEN 'COPY'.

    DATA: lv_row TYPE LVC_T_ROW,
    LS_ROW TYPE LVC_S_ROW.
    DATA: ls_data TYPE ts_data,
    lv_no TYPE I,
    lv_index1 TYPE i,
    lv_index2 type i.


    go_grid->check_changed_data( ).
    CALL METHOD go_grid->get_selected_rows
    IMPORTING
    et_index_rows = lv_row.

    LOOP AT lv_row INTO LS_ROW .
    READ TABLE gt_data INTO ls_data INDEX LS_ROW-INDEX.

    lv_index1 = LS_ROW-INDEX .

    lv_index2 = lv_index1 + 1.
    INSERT LS_DATA INTO GT_DATA INDEX lv_index2.
    ENDLOOP.

    CALL METHOD go_grid->refresh_table_display.

    Add comment
    10|10000 characters needed characters exceeded