12-23-2014 11:10 AM
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.
12-23-2014 11:19 AM
Hi Kiran,
Move this piece of code v_alvgd->check_changed_data( ). to bottom.
regards,
Archer
12-23-2014 11:36 AM
12-23-2014 3: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.
12-24-2014 4:06 AM
12-23-2014 4: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.
12-24-2014 3:59 AM
i checked it values are coming into final internal table , I am passing the same internal table to ALV but in display it is not showing
12-23-2014 4:17 PM
12-24-2014 3:57 AM
12-24-2014 5: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.
12-24-2014 5:33 AM
12-24-2014 5:41 AM
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.
12-24-2014 6: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.
12-24-2014 6:55 AM
Hi Praveen,
No problem with the code its working fine here problem with refresh.
suppose in output i got one line.
first i selected the row and copied it is coping and displaying the 2 rows with the above code you mentioned.
again i am selecting and coping the row this time that copied row is not displaying . Actually it should display 3 row but displaying only 2 rows.
even in final internal table also showing 3 rows while displaying only 2 rows.
12-24-2014 6:57 AM
Hi Praveen,
Can you try with your code by coping 2 or 3 times weather it is displaying correctly or not.
12-24-2014 7:01 AM
Hi,
Problem with Refresh, I am not clear with this, how it could be problem with Refresh, it's a standard Program / Method. And if it's working 1st time, then it should work second and time also.
The code, what I have provided, I have executed same as your scenario, and I am able to get the same output, what exist in internal table.
Regards.
Praveer.
12-24-2014 7:04 AM
12-24-2014 7:11 AM
Hi,
You can reach me on <any contact details that are set to public in my profile as I won't share contact details in posts any more>
Regards.
Praveer.
Message was edited by: Gareth Ryan - Please don't share contact details in posts.
12-24-2014 7:18 AM
Can you provide me your contact details so that i will call you
Hi,
You can reach me on ipra**** @gmail.com
We are not suppose to discuss anything on your personal mailing address using SCN. Please next time onwards don't ask and share personal mailing address.
12-24-2014 8:38 AM
Hi,
Use the below code to refresh and copy the records in internal table.
And in PBO of screen.
Regards.
Praveer.
12-24-2014 6: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.