Refresh alv grid
i have an alv grid with 4 rows
i mark 1 line and click on button and now i have 3 lines and i see it in debug
but when i get back to screen i see 4
i try refresh-table_display
any idea....,
If line is deleted from internal table and you call refresh_table_display, it should refresh the table.
Please check you are not reselecting data in PBO.
Regards,
Mohaiyuddin
Similar Messages
-
Refresh alv grid after user clicks f4( value-request)
Hello Experts,
I am currently developing a module pool program wherein after the user selects a value via f4(value request),
my ALV grid(using custom control) should be refreshed to show the new records selected based
on the f4 value. How can this be achieved?
thank you guys and take care!Did you try a CALL METHOD [cl_gui_cfw=>set_new_ok_code|http://help.sap.com/saphelp_sm32/helpdata/en/06/3fa1b79f2811d2bd68080009b4534c/frameset.htm] and [=>flush|http://help.sap.com/saphelp_sm32/helpdata/EN/06/3fa1879f2811d2bd68080009b4534c/content.htm] in the POV section or in event onF4 handler method to force execution of PAI (either it works either it dumps)
Regards,
Raymond -
Hi gurues...
How come my output internal table isn't being updated (ceckbox for example) at the user-commannd even when I'm activating REFRESH_TABLE_DISPLAY.
How can I make my internal table update itself within the user-command module??
Thanks,
Rebekayou need to call method CHECK_CHANGED_DATA method in your pai in the beginning.
module user_command input.
call method grid->check_changed_data.
"this method will update the checkbox changes to internal table
endmodule. -
ALV grid container toolbar refresh problem
Hi All,
I use OO to display alv (set_table_for_first_display).
I use
it_toolbar_excluding = lt_exclude parameters to hide some buttons.
but when I tried to show up a button in toolbar (when screen comes CHANGE MODE From DISPLAY MODE)
I can not refresh the toolbar.
here is the code.
thanks in advance
IF r_container IS INITIAL .
**ALV Grid
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container.
CREATE OBJECT :
v_event_receiver.
CALL METHOD r_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
**ALV Grid
*passing the layout structure, fieldcatalog and output table for display
CALL FUNCTION 'API_RE_CN_GET_DETAIL'
EXPORTING
io_object = lo_busobj
IMPORTING
es_contract = ls_contract
et_object_rel = lt_object_rel
EXCEPTIONS
OTHERS = 0.
IF ld_activity NE '01'.
REFRESH t_itab.
SELECT * FROM zrecn_sp_cond INTO CORRESPONDING FIELDS OF TABLE t_itab
WHERE intreno = ls_contract-intreno.
ENDIF.
gs_fieldcat-fieldname = 'Z_DESC'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '50'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'Z_VALIDFROM'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'Z_VALIDTO'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'INTRENO'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
gs_fieldcat-no_out = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
REFRESH :lt_exclude.
PERFORM exclude_tb_functions USING 'LST1' activity CHANGING lt_exclude ."decde to hide or not
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZRECN_SP_COND_STR'
it_toolbar_excluding = lt_exclude
is_layout = fs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = t_itab[].
SET HANDLER v_event_receiver->handle_user_command FOR r_grid.
SET HANDLER v_event_receiver->handle_data_changed FOR r_grid.
SET HANDLER v_event_receiver->handle_hotspot_click FOR r_grid.
SET HANDLER v_event_receiver->handle_toolbar FOR r_grid.
SET HANDLER v_event_receiver->handle_data_changed_finished FOR r_grid.
CALL METHOD r_grid->set_toolbar_interactive.
ELSE .
ls_stable-row = 'X' .
ls_stable-col = 'X' .
CALL METHOD r_grid->refresh_table_display
EXPORTING
is_stable = ls_stable.
ENDIF.Hi
Try this.
if o_grid is initial.
create object <container>
exporting
container_name = 'container1'.
create object o_grid
exporting
i_parent = container_name.
perform fieldcatalog.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_variant = gs_variant
i_save = 'A'
i_default = 'X'
it_toolbar_excluding = i_exclude
is_layout = wa_layout
CHANGING
it_fieldcatalog = i_fieldcat[]
it_outtab = i_final_act[].
( after that I think you need to call the method for selecting rows.
like what I did in my code is below:
create object event.
set handler event->handle_double_click for o_grid.
else.
call method o_grid->refresh_table_display. )
*Refreshing ALV Grid display
CALL METHOD o_grid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc 0.
--Exception handling
ENDIF.
endif.
In this code if your o_grid is intial then it will process all the coding before refresh method else if your o_grid is not intial it will refresh the table which is going to be displayed.
I hope this will work for you
Thanks
Lalit Guptaa -
Refresh ALV ( Internal Table Will Be Change)
Hi friends
I am using 2 internal table. And they have their own field catalog. I can refresh alv grid.
If my refresh data have stuation 1 I am using Inta another stuation I am using Intb.
How can I refresh my ALV grid with different catalog and internal table?Hi,
yes you can do that,
Check this sample code, in your case you have to use two performs for display. with the help of SELFIELD-EXIT = 'X'. you can get what you want.
REPORT ZTEST_ALV.
type-pools:slis.
DATA: GT_SFLIGHT TYPE TABLE OF SFLIGHT.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT type SLIS_FIELDCAT_ALV.
data: l_layout type SLIS_LAYOUT_ALV.
SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_STRUCTURE_NAME = 'SFLIGHT'
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = gt_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform alv_display.
*& Form status
* text
form status USING P_EXTAB TYPE SLIS_T_EXTAB .
set pf-status 'AAA' excluding p_extab.
endform. "status
*& Form USER_COMMAND
* text
* -->P_UCOMM text
* -->P_SELFIELD text
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
case p_ucomm.
when 'TEST'.
fieldcat-no_out = 'X'.
modify gt_fieldcat from fieldcat
transporting no_out where fieldname = 'PRICE'.
p_selfield-exit = 'X'.
perform alv_display.
endcase.
ENDFORM. "USER_COMMAND
*& Form alv_display
* text
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = l_layout
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'SFLIGHT'
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = GT_FIELDCAT[]
TABLES
T_OUTTAB = GT_SFLIGHT.
ENDFORM. " alv_display
Regards
vijay -
Hi all,
Can anyone help me in making checkbox editable after an event.
In my application, there is a checkbox for every record . And there is an update button. when i check a checkbox ,the entire row gets into editable mode, i made changes and then updated using update button. But when i again tried to check checkbox ,its not getting checked. can anyone help me out to solve this issue.
Thanks in Advance,
G.PushpaAs per my understanding your requirement is that you want to make a row editable when the user checked a check box corresponding to row. So except to that checkbox column you entire alv is non editable. I am not sure that update button is on alv grid or it is seperatly in a dynpro scree. I am giving you a solution when it is not at your alv screen
So when the user check particular check box use get selected rows method of alv and find out the row id. Now the user
click upon the button for update(make a subroutine for your logic) use the row id and make this row ready for input using ready for input metod of alv.
After user make the modification implement you logic for updating the database/internal table as per you requiremnt. Also
refresh yor alv grid here. You can use refresh table display for refreshing alv grid. Now you can again modify your
check box for other row.
In your fieldcatalog only make check box field editable.
<request removed by moderator>
Edited by: Thomas Zloch on Jan 20, 2011 11:25 PM - do not ask for ... -
Back from ALV Grid with multiple refresh
I have a report that from a selection screen shows an editable ALV Grid, and after I save it, it will refresh the grid.
My problem is when I hit the BACK button it returns to the "previous grid" instead of the selection screen
I am using the following:
WHEN 'BACK_C'.
LEAVE to SCREEN '0'.
How can I force it to go back to the selection screen?
sidenote: I have tried using call
selection-screen '1000'
but it adds a new problem as in the selection screen hitting back will return to the grid and I can never exit the report.Neither solution works.
If it helps, I'm refreshing the grid with:
DATA : ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
CALL METHOD ref_grid->refresh_table_display( ).
It seems when I refresh the grid it generates a completely independent grid screen and there's no way to skip them all and return to the selection screen. -
Refreshing contents of ALV grid
I am displaying 2 ALV grids in a splitter container on screen 100. There is an option for refresh on this screen to refresh the entries in both the grids (if any change). This refresh works fine using method REFRESH_TABLE_DISPLAY for both top and bottom grid contents.
After processing the contents in screen 100, the user can navigate to screen 200 to view results of the current run. This screen also holds an ALV grid display of results on a custom container. When returning to screen 100 from 200, the results in top grid of screen 100 are fixed. The refresh option now only works with the grid on bottom container and not the top. I have tried using both REFRESH_TABLE_DISPLAY and SET_TABLE_FOR_FIRST_DISPLAY options and neither worked.
How do I refresh the ALV to use the contents from the new dataset?
Regards,
Suri.Are you used refresh in PBO of 100 ?
Like
call method g_grid->refresh_table_display. " Top grid
call method g_grid1->refresh_table_display. " bottom grid
a® -
REFRESH FUNCTIONALITy in ALV GRID
Hi Experts,
I have added two custom buttons (CO40 and REFRESH) in ALV GRID .
WHEN CO40 button is clicked it will go the CO40 transaction.
here the problem is when clicking the REFRESH , the REFRESH fuctionality is not working.
(here i went to CO40 transaction by clicking CO40 button and deleted one planned order and come back and clicked REFRESH button but the planned order still showing in the output but the planned oreder is deleted in the table ) please help me rgarding this
pls see my code and pls send me the code with modifications
Thanks
Nagendra
REPORT zpp_plannedorder_conv LINE-SIZE 200.
TYPE-POOLS: slis.
TABLES: plaf, vbak.
PLANNED ORDER TABLE
CONSTANTS: c_e TYPE c LENGTH 01 VALUE 'E'.
TYPES: BEGIN OF ty_plaf,
kdauf TYPE kdauf,
kdpos TYPE kdpos,
plnum TYPE plnum,
dispo TYPE dispo,
matnr TYPE matnr,
maktx TYPE maktx,
pwwrk TYPE pwwrk,
paart TYPE paart,
beskz TYPE beskz,
gsmng TYPE gsmng,
END OF ty_plaf.
SALES FIELDS
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbeln,
posnr TYPE posnr,
kunnr TYPE kunnr,
grkor TYPE grkor,
autlf TYPE autlf,
mvgr2 TYPE mvgr2,
fixmg TYPE fixmg,
bstdk TYPE bstdk,
edatu TYPE edatu,
posex TYPE posex,
END OF ty_vbak.
output table.
TYPES: BEGIN OF ty_out,
plnum TYPE plnum,
dispo TYPE dispo,
matnr TYPE matnr,
maktx TYPE maktx,
pwwrk TYPE pwwrk,
paart TYPE paart,
beskz TYPE beskz,
gsmng TYPE gsmng,
kdauf TYPE kdauf,
kdpos TYPE kdpos,
kunnr TYPE kunnr,
grkor TYPE grkor,
autlf TYPE autlf,
mvgr2 TYPE mvgr2,
fixmg TYPE fixmg,
bstdk TYPE bstdk,
edatu TYPE edatu,
posex TYPE posex,
END OF ty_out.
DATA: tb_plaf TYPE STANDARD TABLE OF ty_plaf,
tb_vbak TYPE STANDARD TABLE OF ty_vbak,
tb_out TYPE STANDARD TABLE OF ty_out.
DATA: lv_plaf TYPE ty_plaf,
lv_vbak TYPE ty_vbak,
lv_out TYPE ty_out.
TYPES: BEGIN OF ty_vbep,
vbeln TYPE vbeln,
posnr TYPE posnr,
etenr TYPE etenr,
edatu TYPE edatu,
END OF ty_vbep.
DATA: tb_vbep TYPE STANDARD TABLE OF ty_vbep.
DATA: lv_flag(1) TYPE c.
**Start changes RFS: SANN - 0856
DATA: w_repid TYPE sy-repid.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv, "field catalog table
gs_layout TYPE slis_layout_alv, "struct data type
it_sort TYPE slis_t_sortinfo_alv,
it_events TYPE slis_t_event,
gt_event_exit TYPE slis_t_event_exit.
**End changes RFS: SANN - 0856
SELECT OPTIONS.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: sel_pln FOR plaf-plnum,
sel_pww FOR plaf-pwwrk OBLIGATORY,
sel_dis FOR plaf-dispo,
sel_kun FOR vbak-kunnr,
sel_paa FOR plaf-paart,
sel_kda FOR plaf-kdauf.
SELECTION-SCREEN END OF BLOCK a1.
START-OF-SELECTION.
REFRESH: tb_plaf ,tb_vbak.
SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
FROM plaf AS p JOIN makt AS m
ON pmatnr EQ mmatnr
WHERE p~plnum IN sel_pln
AND p~pwwrk IN sel_pww
AND p~dispo IN sel_dis
AND p~paart IN sel_paa
AND p~kdauf IN sel_kda
AND m~spras EQ c_e.
IF NOT tb_plaf[] IS INITIAL.
SORT tb_plaf BY kdauf DESCENDING.
SELECT kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg
kbstdk vedatu p~posex INTO TABLE tb_vbak
FROM vbak AS k JOIN vbap AS p
ON kvbeln EQ pvbeln
INNER JOIN vbep AS v
ON pvbeln EQ vvbeln
AND pposnr EQ vposnr
FOR ALL ENTRIES IN tb_plaf
WHERE k~vbeln EQ tb_plaf-kdauf
AND p~posnr EQ tb_plaf-kdpos
AND k~kunnr IN sel_kun
AND v~etenr EQ '0001'.
IF NOT tb_vbak[] IS INITIAL.
LOOP AT tb_plaf INTO lv_plaf.
CLEAR lv_out.
MOVE-CORRESPONDING lv_plaf TO lv_out.
IF NOT lv_plaf-kdauf IS INITIAL.
READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
posnr = lv_plaf-kdpos.
MOVE-CORRESPONDING lv_vbak TO lv_out.
ENDIF.
APPEND lv_out TO tb_out.
ENDLOOP.
ENDIF.
ENDIF.
END-OF-SELECTION.
PERFORM f_build_fcat.
PERFORM f_get_display.
*& Form F_BUILD_FCAT
FORM f_build_fcat .
CLEAR: w_repid.
PERFORM fill_fieldcat " TABLES it_fieldcat
USING:
text-f01 'TB_OUT' text-k01 text-k01 '10' ,
text-f02 'TB_OUT' text-k02 text-k02 '10' ,
text-f03 'TB_OUT' text-k03 text-k03 '06' ,
text-f04 'TB_OUT' text-k04 text-k04 '18' ,
text-f05 'TB_OUT' text-k05 text-k05 '06' ,
text-f06 'TB_OUT' text-k06 text-k06 '08' ,
text-f07 'TB_OUT' text-k07 text-k07 '05' ,
text-f08 'TB_OUT' text-k08 text-k08 '05' ,
text-f09 'TB_OUT' text-k09 text-k09 '15' ,
text-f10 'TB_OUT' text-k10 text-k10 '05' ,
text-f11 'TB_OUT' text-k11 text-k11 '05' ,
text-f12 'TB_OUT' text-k12 text-k12 '10' ,
text-f13 'TB_OUT' text-k13 text-k13 '10' ,
text-f14 'TB_OUT' text-k14 text-k14 '10' ,
text-f15 'TB_OUT' text-t15 text-k15 '10' ,
text-f16 'TB_OUT' text-k16 text-k16 '10' ,
text-f17 'TB_OUT' text-k17 text-k17 '10' .
ENDFORM. " F_BUILD_FCAT
*& Form fill_fieldcat
FORM fill_fieldcat " TABLES l_catalog TYPE slis_t_fieldcat_alv "#EC *
USING p_field "#EC *
p_table "#EC *
p_desc "#EC *
p_desc_l "#EC *
p_len. "#EC *
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = p_field.
ls_fieldcat-tabname = p_table.
ls_fieldcat-seltext_l = p_desc_l.
ls_fieldcat-reptext_ddic = p_desc.
ls_fieldcat-outputlen = p_len.
APPEND ls_fieldcat TO it_fieldcat.
CLEAR ls_fieldcat.
ENDFORM. " fill_fieldcat
*& FORM F_GET_DISPLAY
text
FORM f_get_display .
CLEAR w_repid.
MOVE sy-repid TO w_repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = it_fieldcat
it_sort = it_sort
i_save = 'X'
TABLES
t_outtab = tb_out
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc EQ 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F_GET_DISPLAY
*& Form PF_STATUS
text
FORM pf_status USING rt_extab TYPE slis_t_extab.
DATA: wa_extab LIKE LINE OF rt_extab.
REFRESH: rt_extab.
wa_extab-fcode = '&REFRESH'.
APPEND wa_extab TO rt_extab.
SET PF-STATUS '0001' EXCLUDING rt_extab.
ENDFORM. "PF_STATUS
-->COMMAND text
-->SELFIELD text
FORM user_command USING command LIKE sy-ucomm selfield TYPE slis_selfield."#EC CALLED
CLEAR : lv_out-plnum,lv_out-kdauf,lv_out-paart,lv_out-kdauf.
CASE command.
WHEN '&IC1'. "doubleclick
CASE selfield-fieldname.
WHEN 'PLNUM'.
READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'PAF' FIELD lv_out-plnum.
CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'KDAUF'.
READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'AUN' FIELD lv_out-kdauf.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
WHEN 'CO40'.
READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'PAF' FIELD lv_out-plnum.
CALL TRANSACTION 'CO40' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'REFRESH'.
PERFORM select_data.
ENDCASE.
ENDFORM. "user_command
*End changes RFS: SANN - 0856
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
commit work and wait.
REFRESH:tb_plaf[],tb_vbak[],tb_out[].
SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
FROM plaf AS p JOIN makt AS m
ON pmatnr EQ mmatnr
WHERE p~plnum IN sel_pln
AND p~pwwrk IN sel_pww
AND p~dispo IN sel_dis
AND p~paart IN sel_paa
AND p~kdauf IN sel_kda
AND m~spras EQ c_e.
IF NOT tb_plaf[] IS INITIAL.
SORT tb_plaf BY kdauf DESCENDING.
SELECT kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg
kbstdk vedatu p~posex INTO TABLE tb_vbak
FROM vbak AS k JOIN vbap AS p
ON kvbeln EQ pvbeln
INNER JOIN vbep AS v
ON pvbeln EQ vvbeln
AND pposnr EQ vposnr
FOR ALL ENTRIES IN tb_plaf
WHERE k~vbeln EQ tb_plaf-kdauf
AND p~posnr EQ tb_plaf-kdpos
AND k~kunnr IN sel_kun
AND v~etenr EQ '0001'.
IF NOT tb_vbak[] IS INITIAL.
LOOP AT tb_plaf INTO lv_plaf.
CLEAR lv_out.
MOVE-CORRESPONDING lv_plaf TO lv_out.
IF NOT lv_plaf-kdauf IS INITIAL.
READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
posnr = lv_plaf-kdpos.
MOVE-CORRESPONDING lv_vbak TO lv_out.
ENDIF.
APPEND lv_out TO tb_out.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " SELECT_DATAHi,
Gothrough the following link,
Handle Refresh button on ALV
Regards,
Harish -
Reg : ALV Grid Refresh - Output not appearing
Hi All ,
Am calling a screen 100 at 3 different places.
Though i use refresh_table_display , The value in the output table, say i_final changes, but while displaying the output , the whole screen is blank , even the container is not appearing in the output .
Can you please help me with your inputs .
Regards,
Chitrayes it is good ...see the example...for your requirement..
REPORT yztest .
TYPE-POOLS: slis.
Tables
TABLES: mara.
TYPES: BEGIN OF ty_name,
name TYPE char10,
age TYPE i,
END OF ty_name.
TYPES: BEGIN OF ty_marks,
sub1 TYPE i,
sub2 TYPE i,
total TYPE i,
END OF ty_marks.
TYPES: BEGIN OF ty_phone,
phnum TYPE char10,
END OF ty_phone.
TYPES: BEGIN OF ty_addr,
address TYPE char20,
END OF ty_addr .
Output internal table
DATA: itab TYPE TABLE OF ty_name,
wa TYPE ty_name,
itab1 TYPE TABLE OF ty_marks,
wa1 TYPE ty_marks,
itab2 TYPE TABLE OF ty_phone,
wa2 TYPE ty_phone,
itab3 TYPE TABLE OF ty_addr,
wa3 TYPE ty_addr.
ALV Grid
DATA: r_grid TYPE REF TO cl_gui_alv_grid,
r_grid1 TYPE REF TO cl_gui_alv_grid,
r_grid2 TYPE REF TO cl_gui_alv_grid,
r_grid3 TYPE REF TO cl_gui_alv_grid,
g_dock TYPE REF TO cl_gui_docking_container,
g_dock1 TYPE REF TO cl_gui_docking_container,
g_dock2 TYPE REF TO cl_gui_docking_container,
g_dock3 TYPE REF TO cl_gui_docking_container,
g_dock4 TYPE REF TO cl_gui_docking_container,
it_fieldcat TYPE lvc_t_fcat,
it_fieldcat1 TYPE lvc_t_fcat,
it_fieldcat2 TYPE lvc_t_fcat,
it_fieldcat3 TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
DATA picture TYPE REF TO cl_gui_picture.
DATA url(255).
CLEAR url.
DATA init.
START-OF-SELECTION.
wa-name = 'test01'.
wa-age = '1'.
APPEND wa TO itab.
wa-name = 'test02'.
wa-age = '2'.
APPEND wa TO itab.
wa-name = 'test03'.
wa-age = '3'.
APPEND wa TO itab.
wa1-sub1 = '11'.
wa1-sub2 = '22'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.
wa1-sub1 = '22'.
wa1-sub2 = '33'.
wa1-total = wa1-sub1 + wa1-sub2.
APPEND wa1 TO itab1.
wa2-phnum = '99999999999'.
APPEND wa2 TO itab2.
wa2-phnum = '888888888888'.
APPEND wa2 TO itab2.
wa2-phnum = '777777777777'.
APPEND wa2 TO itab2.
wa3-address = 'HItech City'.
APPEND wa3 TO itab3.
wa3-address = 'Secunderabad'.
APPEND wa3 TO itab3.
wa3-address = 'Hyderabad'.
APPEND wa3 TO itab3.
PERFORM display_image.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'LISTOUT1'.
SET TITLEBAR 'LIST1'.
wa_fieldcat-fieldname = 'NAME'.
wa_fieldcat-seltext = 'NAME OF THE STUDENT'.
wa_fieldcat-coltext = 'NAME OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AGE'.
wa_fieldcat-seltext = 'AGE OF THE STUDENT'.
wa_fieldcat-coltext = 'AGE OF THE STUDENT'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'SUB1'.
wa_fieldcat-seltext = 'SUBJECT1'.
wa_fieldcat-coltext = 'SUBJECT1'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'SUB2'.
wa_fieldcat-seltext = 'SUBJECT2'.
wa_fieldcat-coltext = 'SUBJECT2'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'TOTAL'.
wa_fieldcat-seltext = 'TOTAL'.
wa_fieldcat-coltext = 'TOTAL'.
APPEND wa_fieldcat TO it_fieldcat1.
wa_fieldcat-fieldname = 'PHNUM'.
wa_fieldcat-seltext = 'PHONE NO'.
wa_fieldcat-coltext = 'PHONE NO'.
APPEND wa_fieldcat TO it_fieldcat2.
wa_fieldcat-fieldname = 'ADDRESS'.
wa_fieldcat-seltext = 'ADDRESS'.
wa_fieldcat-coltext = 'ADDRESS'.
APPEND wa_fieldcat TO it_fieldcat3.
IF g_dock IS INITIAL.
CREATE OBJECT g_dock
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock->dock_at_left
extension = 300.
CREATE OBJECT r_grid
EXPORTING
i_parent = g_dock.
ENDIF.
IF g_dock1 IS INITIAL.
CREATE OBJECT g_dock1
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock1->dock_at_right
extension = 300.
CREATE OBJECT r_grid1
EXPORTING
i_parent = g_dock1.
ENDIF.
IF g_dock2 IS INITIAL.
CREATE OBJECT g_dock2
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock2->dock_at_top
extension = 100.
CREATE OBJECT r_grid2
EXPORTING
i_parent = g_dock2.
IF g_dock3 IS INITIAL.
CREATE OBJECT g_dock3
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock3->dock_at_top
extension = 100.
CREATE OBJECT r_grid3
EXPORTING
i_parent = g_dock3.
ENDIF.
IF NOT itab[] IS INITIAL.
CALL METHOD r_grid->set_table_for_first_display
CHANGING
it_outtab = itab
it_fieldcatalog = it_fieldcat.
ENDIF.
IF NOT itab1[] IS INITIAL.
CALL METHOD r_grid1->set_table_for_first_display
CHANGING
it_outtab = itab1
it_fieldcatalog = it_fieldcat1.
ENDIF.
IF NOT itab2[] IS INITIAL.
CALL METHOD r_grid2->set_table_for_first_display
CHANGING
it_outtab = itab2
it_fieldcatalog = it_fieldcat2.
ENDIF.
IF NOT itab3[] IS INITIAL.
CALL METHOD r_grid3->set_table_for_first_display
CHANGING
it_outtab = itab3
it_fieldcatalog = it_fieldcat3.
ENDIF.
if g_dock4 is initial.
CREATE OBJECT g_dock4
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = g_dock4->dock_at_bottom
extension = 100.
CREATE OBJECT picture
EXPORTING parent = g_dock4.
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
init = 'X'.
endif.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form display_image
FORM display_image .
DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
DATA html_table LIKE w3html OCCURS 1.
DATA return_code LIKE w3param-ret_code.
DATA content_type LIKE w3param-cont_type.
DATA content_length LIKE w3param-cont_len.
DATA pic_data LIKE w3mime OCCURS 0.
DATA pic_size TYPE i.
REFRESH query_table.
query_table-name = '_OBJECT_ID'.
query_table-value = 'ENJOYSAP_LOGO'.
APPEND query_table.
CALL FUNCTION 'WWW_GET_MIME_OBJECT'
TABLES
query_string = query_table
html = html_table
mime = pic_data
CHANGING
return_code = return_code
content_type = content_type
content_length = content_length
EXCEPTIONS
object_not_found = 1
parameter_not_found = 2
OTHERS = 3.
IF sy-subrc = 0.
pic_size = content_length.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
TABLES
data = pic_data
CHANGING
url = url
EXCEPTIONS
OTHERS = 1.
ENDFORM. " display_image
*& Module EXIT INPUT
text
MODULE exit INPUT.
CALL METHOD g_dock->free.
CALL METHOD g_dock1->free.
CALL METHOD g_dock2->free.
CALL METHOD g_dock3->free.
ENDMODULE. " EXIT INPUT -
ALV OO and refreshing the ALV grid
Hi,
i have some problems with my ALV 00 program.
On screen 1 i have to fill in a material number.
For that material i'm getting some data and show in screen 2 in a ALV grid.
Via BACK-button i'm getting back to screen 1 and can fill in another material number.
But the 2nd (and 3rd, etc) time i fill a material, the ALV grid data from material 1 is shown. Even if the internal table I_ALV where the data is, is changed.
What should i do ?
I have initialized the customer container and the grid, but that didn't solved the problem.
regards,
HansHi,
Try clearing and refreshing the alv grid data table in screen 2.
Check with this code. this code is working fine. If we go back and change the input, it is showing the output corresponding to the second input only.
Have you use this method?
<b> GR_ALVGRID->REFRESH_TABLE_DISPLAY</b>
TYPE-POOLS : SLIS.
* Tables *
TABLES:
VBRK,
VBRP.
* Parameters and select options OR SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
S_VBELN FOR VBRK-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
* Internal Tables *
* work areas
DATA: BEGIN OF IT_VBRP OCCURS 0,
VBELN LIKE VBRK-VBELN,
POSNR LIKE VBRP-POSNR,
UEPOS LIKE VBRP-UEPOS,
FKIMG LIKE VBRP-FKIMG,
NETWR LIKE VBRP-NETWR,
MEINS LIKE VBRP-MEINS.
DATA : END OF IT_VBRP.
* Variables *
DATA : GR_ALVGRID TYPE REF TO CL_GUI_ALV_GRID,
GC_CUSTOM_CONTROL_NAME TYPE SCRFNAME VALUE 'CC_ALV',
GR_CCONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
GT_FIELDCAT TYPE LVC_T_FCAT,
GS_LAYOUT TYPE LVC_S_LAYO,
V_FLAG VALUE 'X'.
* Start of Program *
* INITIALIZATION. *
INITIALIZATION.
S_VBELN-LOW = 1.
S_VBELN-HIGH = 1000000000.
S_VBELN-OPTION = 'EQ'.
S_VBELN-SIGN = 'I'.
APPEND S_VBELN.
* SELECTION-SCREEN *
AT SELECTION-SCREEN.
PERFORM VALIDATION.
* START-OF-SELECTION *
START-OF-SELECTION.
PERFORM GET_DATA.
CALL SCREEN 0100.
* END-OF-SELECTION *
END-OF-SELECTION.
* TOP-OF-PAGE *
TOP-OF-PAGE.
* END-OF-PAGE *
END-OF-PAGE.
* AT USER-COMMAND *
*& Form VALIDATION
* text
* --> p1 text
* <-- p2 text
FORM VALIDATION .
SELECT SINGLE VBELN
FROM VBRK
INTO VBRK-VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'no billing documents found'.
ENDIF.
ENDFORM. " VALIDATION
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA .
SELECT VBELN
POSNR
UEPOS
FKIMG
NETWR
MEINS
FROM VBRP
INTO TABLE IT_VBRP
WHERE VBELN IN S_VBELN.
ENDFORM. " GET_DATA
*& Module DISPLAY_ALV OUTPUT
* text
MODULE DISPLAY_ALV OUTPUT.
IF V_FLAG = 'X'.
PERFORM DISPLAY_ALV.
PERFORM PREPARE_FIELD_CATALOG CHANGING GT_FIELDCAT.
PERFORM PREPARE_LAYOUT CHANGING GS_LAYOUT.
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME = 'VBRP'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBRP[]
IT_FIELDCATALOG = GT_FIELDCAT
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ELSE.
<b>CALL METHOD GR_ALVGRID->REFRESH_TABLE_DISPLAY
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.</b>
ENDIF.
CLEAR V_FLAG.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
*& Form DISPLAY_ALV
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_ALV .
IF GR_ALVGRID IS INITIAL.
CREATE OBJECT GR_ALVGRID
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = GR_CCONTAINER
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDFORM. " DISPLAY_ALV
*& Form PREPARE_FIELD_CATALOG
* text
* <--P_GT_FIELDCAT text
FORM PREPARE_FIELD_CATALOG CHANGING P_GT_FIELDCAT TYPE LVC_T_FCAT.
DATA : LS_FCAT TYPE LVC_S_FCAT,
L_POS TYPE I.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'VBELN'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Billing Document'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'POSNR'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Billing Item'.
LS_FCAT-OUTPUTLEN = '6'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'UEPOS'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Higher Level Item'.
LS_FCAT-OUTPUTLEN = '6'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'FKIMG'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Invoice Quantity'.
LS_FCAT-OUTPUTLEN = '13'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'NETWR'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Net Value'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'MEINS'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Unit of Measure'.
LS_FCAT-OUTPUTLEN = '3'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form PREPARE_LAYOUT
* text
* <--P_GS_LAYOUT text
FORM PREPARE_LAYOUT CHANGING P_GS_LAYOUT TYPE LVC_S_LAYO.
P_GS_LAYOUT-ZEBRA = 'X'.
P_GS_LAYOUT-GRID_TITLE = 'INVOICE DETAILS'.
P_GS_LAYOUT-SMALLTITLE = 'X'.
P_GS_LAYOUT-EDIT = 'X'.
ENDFORM. " PREPARE_LAYOUT
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'CANCEL'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
CALL TRANSACTION 'SE38'.
WHEN 'CHANGE'.
IF GR_ALVGRID->IS_READY_FOR_INPUT( ) = 0.
CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ELSE.
CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 0.
ENDIF.
ENDCASE.
Regards,
Aswin -
Refreshing the container in ALV grid
hi,
I am working on ALV GRID display (reports with ALV OOPS).
I hav created it, but now i need to refresh the container...........i.e when the user presses back and he is giving the new selection criteria , it shd pick the values based on the new selection criteria....
So, how do it refresh the container???????Hi,
In ALV, to refresh the table you have to call the method "refresh_table_display".
It has the syntax very similar to creating the table.
It has two parameters. In the first one, you can mention if you want to refresh only the data (the icons are not refreshed)
or
if you want to refresh only the icons around the grid (the data is not refreshed - this option is mostly not used in day to day applications).
the synatx is :-
call method grid (name of grid )->refresh_table_display
exporting
IS_STABLE = <STRUCT OF TYPE LVC_S_STBL> (THIS IS FOR DATA REFRESHING)
I_SOFT_REFRESH = <VARIABLE OF CHAR 01> (THIS IS FOR ICON REFRESHING).
Regards,
Bhaskar -
Problems with ALV grid refresh
Hello,
I am writing a relatively simple wd application, I enter a few values in the select-options and display the data in an ALV grid. My problem seems to be that the grid values do not refresh if I change the selection conditions.
On going through the forum I saw a few posts which ask me to call the Node->Invalidate( ) method, but on using that my grid refreshes completely and data does not appear again, even on changing the input values.
I have pasted the ALV portion of the code from my onAction method - could you suggest what I could do to correct this? I realise this is a relatively stupid question, but I am very new to this technology and am trying to learn. Thanks in advance.
***Database selection (this works fine, tested in debug)
Bind the data to the context
dyn_node = wd_context->get_child_node( name = 'TIME_ENTRY' ).
dyn_node->bind_table( icatsdb ).
Connect to the component Usage of the ALV
l_ref_cmp_usage = wd_this->wd_cpuse_display_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
Through the interface controller of the ALV Component set the DATA node dynamically
l_ref_interfacecontroller = wd_this->wd_cpifc_display_alv( ).
l_ref_interfacecontroller->set_data( r_node_data = dyn_node ).
SudhaHi,
Did you change the statement <b>SET PF-STATUS 'ZIMP'</b> to <b>SET PF-STATUS 'ZLIQ'</b> ? If not, please do that, and run the program after activation.
Reward points if the asnwer is helpful.
Regards,
Mukul -
Automatic refresh in alv grids
Hi!
I've three containers with three alv grids on my screen.
I've a self made save-button on the toolbar of the first grid.
Now i insert data in grid2 and grid3 ...
When i press now the save-button from grid1 there's no data in the internal tables from grid2 and grid3.
When i first press the refresh-buttons on the toolbars from grid2 and grid3 and then the save-button from grid1 the internal tables from grid2 and grid3 are filled.
Is it possible to simulate first the pressed refresh-buttons from grid2/grid3 when pressing the save-button from grid1?
I've tried to set a "call method grid2->refresh_table_display" and "call method grid2->refresh_table_display" before the code for the save-button but this doesn't work.
Is there any help for me?
Thanks a lot in advance!
IngoHello Ingo
It is important to realise that pushing a toolbar button does <b>NOT </b>trigger PAI of the dynpro where the ALV list is displayed.
In order to refresh the display of the other two ALV grids you need to pass PAI (followed by PBO). How to do that? There are at least two possible ways:
(1) You handle the SAVE command in your method HANDLE_USER_COMMAND. Within this method you update the internal tables for grid2 and grid3 depending on the contents of grid1. At the end of this method you call method CL_GUI_CFW=>set_new_ok_code( 'REFRESH' ). This will trigger PAI of the dynpro. In the PAI module (e.g. USER_COMMAND_0100) you could write the following coding:
CASE gd_okcode.
WHEN 'REFRESH'.
go_grid2->refresh_table_display( ).
go_grid3->refresh_table_display( ).
ENDCASE.
(2) You handle the SAVE command in your method HANDLE_USER_COMMAND and call method CL_GUI_CFW=>set_new_ok_code( 'REFRESH' ) without updating the itab2 and itab3 here. The updating of these itabs occurs in the PAI module.
The following sample report shows you the second approach. On the first ALV grid customers are displayed. If you double-click on a single customer its sales areas (if any) are displayed in the second ALV list.
*& Report ZUS_SDN_TWO_ALV_GRIDS
REPORT zus_sdn_two_alv_grids.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Display data
gs_layout-grid_title = 'Customers'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
is_layout = gs_layout
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
gs_layout-grid_title = 'Customers Details (Sales Areas)'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout
CHANGING
it_outtab = gt_knvv " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM knvv INTO TABLE gt_knvv
WHERE kunnr = ls_knb1-kunnr.
ENDFORM. " ENTRY_SHOW_DETAILS
Regards
Uwe -
Splitter Problem - ALV Grid not refreshed when selected another item
Hi Experts!!
I have a container on screen 100 which has to be split into 3 areas. Left area ->tree, Right top area -alv grid and bottom also alv grid. I created the program without splitter and it was working fine. After I added this splitter, I see that in ALV grid, the data is not being refreshed. When double clicked on an item in tree struct, ALV grid (CL_SALV_TABLE) to be shown.. Firstly it's fine but when I double click on another item, it's not refreshing the data but is showing the same previous data.
I have searched existing posts and implemented, but no luck.
PFB my code:
* In PBO of screen 100
CREATE OBJECT go_cc_area1
EXPORTING
container_name = 'CC_AREA1'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE e025 WITH sy-subrc.
ENDIF.
CREATE OBJECT go_splitter
EXPORTING
parent = go_cc_area1
orientation = 1 "Vertical split
sash_position = 40
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
ENDIF.
go_container_tree = go_splitter->top_left_container.
go_container_2 = go_splitter->bottom_right_container.
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_container_2
orientation = 0 "Horizontal split
sash_position = 40
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
ENDIF.
go_cc_area2 = go_splitter_2->top_left_container.
go_cc_area3 = go_splitter_2->bottom_right_container.
CREATE OBJECT go_tree
EXPORTING
i_parent = go_container_tree
i_node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
i_item_selection = gc_x
i_no_html_header = gc_x
i_no_toolbar = space
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
CALL METHOD go_tree->set_table_for_first_display
EXPORTING
i_background_id = space
is_layout = gs_layout
CHANGING
it_sort = gt_sort
it_outtab = gt_tree_output
it_fieldcatalog = gt_fieldcat_tree.
CALL METHOD go_tree->expand_tree
EXPORTING
i_level = 2.
* End - PBO 100
* CLASS lcl_tree_event_receiver DEFINITION
CLASS lcl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: handle_item_double_click
FOR EVENT item_double_click OF cl_gui_alv_tree_simple
IMPORTING fieldname
index_outtab
grouplevel.
ENDCLASS. "lcl_tree_event_receiver DEFINITION
* CLASS lcl_tree_event_receiver IMPLEMENTATION
CLASS lcl_tree_event_receiver IMPLEMENTATION.
METHOD handle_item_double_click.
IF go_alv_area2 IS BOUND.
go_alv_area2->refresh( ).
ENDIF.
cl_salv_table=>factory(
EXPORTING
list_display = space
r_container = go_cc_area2
IMPORTING
r_salv_table = go_alv_area2
CHANGING
t_table = gt_table ).
go_alv_area2->display( ).
ENDMETHOD. "handle_item_double_click
ENDCLASS. "lcl_tree_event_receiver IMPLEMENTATION
I am facing the same problem with area 3 as well. Can somebody please help me out.
Thanks a lot!!
Edited by: Srinivas Kalluri on Jan 28, 2012 1:39 PMHi All,
I am still facing this problem. Can somebody please help me out?
I created a test program wth sflight and spfli tables. Can somebody look into this and tell me where I am going wrong?
On screen 100 i have one cust container named CC.
When I test it, it's showing the same refresh problem. But in this test program refresh is atleast happening once.
REPORT ztest.
PARAMETERS: p_carrid TYPE sflight-carrid.
CLASS lcl_tree_event_receiver DEFINITION DEFERRED.
CONSTANTS: gc_x VALUE 'X'.
DATA: go_cc_area1 TYPE REF TO cl_gui_custom_container,
go_tree TYPE REF TO cl_gui_alv_tree_simple,
go_tree_event_receiver TYPE REF TO lcl_tree_event_receiver,
go_cc_area2 TYPE REF TO cl_gui_container,
go_alv_area2 TYPE REF TO cl_salv_table,
go_cc_area3 TYPE REF TO cl_gui_container,
go_columns TYPE REF TO cl_salv_columns_table,
go_cc_editor TYPE REF TO cl_gui_custom_container,
go_editor TYPE REF TO cl_gui_textedit,
go_content TYPE REF TO cl_salv_form_element,
go_container_tree TYPE REF TO cl_gui_container,
go_container_2 TYPE REF TO cl_gui_container,
go_splitter TYPE REF TO cl_gui_easy_splitter_container,
go_splitter_2 TYPE REF TO cl_gui_easy_splitter_container,
go_cc_comp TYPE REF TO cl_gui_custom_container,
go_alv_comp TYPE REF TO cl_salv_table.
DATA: gt_sflight TYPE TABLE OF sflight,
gt_data TYPE TABLE OF spfli,
gt_fieldcat TYPE lvc_t_fcat,
gt_sort TYPE lvc_t_sort,
gs_sflight TYPE sflight,
gs_layout TYPE lvc_s_layo.
* CLASS lcl_tree_event_receiver DEFINITION
CLASS lcl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: handle_item_double_click
FOR EVENT item_double_click OF cl_gui_alv_tree_simple
IMPORTING fieldname
index_outtab
grouplevel.
ENDCLASS. "lcl_tree_event_receiver DEFINITION
* CLASS lcl_tree_event_receiver IMPLEMENTATION
CLASS lcl_tree_event_receiver IMPLEMENTATION.
METHOD handle_item_double_click.
READ TABLE gt_sflight INTO gs_sflight INDEX index_outtab.
IF sy-subrc EQ 0.
SELECT * FROM spfli INTO TABLE gt_data WHERE connid = gs_sflight-connid.
IF go_alv_area2 IS BOUND.
go_alv_area2->refresh( ).
cl_gui_cfw=>flush( ).
ENDIF.
cl_salv_table=>factory(
EXPORTING
r_container = go_cc_area2
IMPORTING
r_salv_table = go_alv_area2
CHANGING
t_table = gt_data ).
go_alv_area2->display( ).
ENDIF.
ENDMETHOD. "handle_item_double_click
ENDCLASS. "lcl_tree_event_receiver IMPLEMENTATION
START-OF-SELECTION.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
* SET TITLEBAR 'xxx'.
CREATE OBJECT go_cc_area1
EXPORTING
container_name = 'CC'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
* MESSAGE e025 WITH sy-subrc text-e01.
ENDIF.
CREATE OBJECT go_splitter
EXPORTING
parent = go_cc_area1
orientation = 1 "Vertical split
sash_position = 25
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE e025 WITH sy-subrc text-e02.
ENDIF.
go_container_tree = go_splitter->top_left_container.
go_container_2 = go_splitter->bottom_right_container.
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_container_2
orientation = 0 "Horizontal split
sash_position = 40
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE e025 WITH sy-subrc text-e02.
ENDIF.
go_cc_area2 = go_splitter_2->top_left_container.
CREATE OBJECT go_tree
EXPORTING
i_parent = go_container_tree
i_node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
i_item_selection = gc_x
i_no_html_header = gc_x
i_no_toolbar = space
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
* MESSAGE e025 WITH sy-subrc text-e03.
ENDIF.
SELECT * FROM sflight INTO TABLE gt_sflight WHERE carrid EQ p_carrid.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
i_bypassing_buffer = gc_x
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE e025 WITH sy-subrc text-e05.
ENDIF.
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcat INTO ls_fieldcatalog.
ls_fieldcatalog-col_opt = gc_x.
CASE ls_fieldcatalog-fieldname.
WHEN 'CARRID'.
ls_fieldcatalog-no_out = gc_x.
WHEN 'CONNID'.
ls_fieldcatalog-no_out = gc_x.
ENDCASE.
MODIFY gt_fieldcat FROM ls_fieldcatalog.
CLEAR ls_fieldcatalog.
ENDLOOP.
DATA: ls_sort TYPE lvc_s_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'CARRID'.
ls_sort-up = gc_x.
APPEND ls_sort TO gt_sort.
ls_sort-spos = 2.
ls_sort-fieldname = 'CONNID'.
ls_sort-up = gc_x.
APPEND ls_sort TO gt_sort.
DATA: lt_events TYPE cntl_simple_events,
lo_l_event TYPE cntl_simple_event.
lo_l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
APPEND lo_l_event TO lt_events.
lo_l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
APPEND lo_l_event TO lt_events.
lo_l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
APPEND lo_l_event TO lt_events.
lo_l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
APPEND lo_l_event TO lt_events.
lo_l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
APPEND lo_l_event TO lt_events.
lo_l_event-eventid = cl_gui_column_tree=>eventid_button_click.
APPEND lo_l_event TO lt_events.
lo_l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
APPEND lo_l_event TO lt_events.
CALL METHOD go_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
* Set Handler
CREATE OBJECT go_tree_event_receiver.
SET HANDLER go_tree_event_receiver->handle_item_double_click FOR go_tree.
CALL METHOD go_tree->set_table_for_first_display
EXPORTING
i_background_id = space
is_layout = gs_layout
CHANGING
it_sort = gt_sort
it_outtab = gt_sflight
it_fieldcatalog = gt_fieldcat.
CALL METHOD go_tree->expand_tree
EXPORTING
i_level = 2.
IF NOT gt_sflight[] IS INITIAL.
CALL METHOD go_tree->set_top_node
EXPORTING
i_index_outtab = 0.
ENDIF.
* Send data to frontend.
CALL METHOD go_tree->frontend_update.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Edited by: Srinivas Kalluri on Jan 31, 2012 4:49 PM
Maybe you are looking for
-
Unable to find master data in R3
Hi all I am not able to find the follwing master data components in R3 but they are present in BI content.. I am not sure how to go about it ... Could you pls help.. Thanks Account Assignment Category (0BBP_ACCCAT_TEXT) Account type (0ACCT_TYPE_ATTR)
-
Dear All Do we have a standard report where I could get the report for document is parked but not posted plant wise not Company code wise. Or if any other option do generate this report. Regards Manoj
-
OS X Printer Interface needs fixing
I have multiple printers connected to my mac. 2 of them are local, and 1 is remote through a shared printer connection through my LAN. Whenever I change the settings of 1 printer through a given application, say where I go to File/Page Size and selec
-
Problem in LookAndFeel(..JTree..)
Hi All, i have a small problem in LookAndFeel for my Tree. in our project we are using JDK1.1.7B and Swing1.0..It is a client requirement..Is it possible to cretae my tree like windows Explorer..i am not geting tree structure..just i am geting bullet
-
How to localize Photoshop layer names
I'm trying to get the default layer names for background, group, etc used by Photoshop depending on users local language. As I haven't found a direct way I decided to use javascript instead: I have a jsx code like function GetBackground() var message