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®
Similar Messages
-
Problem in cell content of alv grid ...
hi all,
i want to get the cell content of alv grid in the handle method of event data_changed of cl_gui_alv_grid,
i using the following code ...
METHOD on_data_changed.
DATA : lv_value(30) TYPE c.
CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = 3
I_TABIX =
I_FIELDNAME = 'cname' "" my column table
IMPORTING
E_VALUE = lv_value.
MESSAGE lv_value TYPE 'I'.
ENDMETHOD.
endclass.
but i cant get the value of cell content
Edited by: parashuram on Oct 21, 2011 3:49 PMTry this way
method handle_data_changed.
perform handle_data_changed using er_data_changed.
endmethod.
form handle_data_changed using p_data_changed type ref to
cl_alv_changed_data_protocol.
data: ls_mod_cell type lvc_s_modi,
lv_value_dni type lvc_value.
loop at p_data_changed->mt_mod_cells into ls_mod_cell.
call method p_data_changed->get_cell_value
exporting
i_row_id = ls_mod_cell-row_id
i_fieldname = 'FINI_SUST' <== Your field
importing
e_value = lv_value_dni .
endloop.
endform. -
Exporting content of ALV grid in Web Dynpro for ABAP
Hello Experts
I have a following request which seems to be giving some headaches.
I need to export results from one of the Web Dynpro reports (ABAP) I have developed to the Excel spreadsheet. Results are stored on ALV component. Request is to add header to export file with additional information like report title, selection criteria, date when report has been executed. By default export file contains only column names and data. I have set the header for ALV grid with all extra information I need to be passed to Excel file but it does not seem to be transferred at all.
At the moment I see 2 possible solutions: 1) write my own Excel export 2) use PDF export where it is possible to set header/footer text. None of these solutions are ideal, I'd rather set header in standard Excel export. Is that even possible? Please help.
Regards
Michael
Edited by: Soltuion Manager on Apr 20, 2009 10:08 AM
Edited by: Soltuion Manager on Apr 20, 2009 10:26 AMHello Michael,
I haven't tried using the builtin functionality of ALV to achieve a similar fnctionality as yours but can suggest you a workaround for that. As how you might be already knowing you can try using the CL_WD_RUNTIME_SERVICES=>attach_file_to_response to download the contents into Excel/notepad/word. So just can modify the internal table to contain the extra information that you need. You can use the approach below for using the attach_file_to_response method:
1) First read the table's data into an internal table.
2) Convert the internal table data to STRING format.
3) Now convert it into tab separated format as how desired.
4) Convert this STRING format to XSTRING format
5) Make use of the attach_file_to_response method.
Regards,
Uday
METHOD onactionon_submit .
DATA: lv_node TYPE REF TO if_wd_context_node,
lt_mara TYPE if_main=>elements_mara,
wa_mara TYPE if_main=>element_mara,
lead_selection_index TYPE i,
mara_string TYPE string,
mara_xstring TYPE xstring.
lv_node = wd_context->get_child_node( name = 'MARA' ).
CALL METHOD lv_node->get_static_attributes_table
IMPORTING
table = lt_mara.
LOOP AT lt_mara INTO wa_mara.
CONCATENATE mara_string
wa_mara-matnr
wa_mara-ersda
wa_mara-ernam
wa_mara-matkl
wa_mara-meins
cl_abap_char_utilities=>cr_lf INTO mara_string
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
ENDLOOP.
** Now you need to add the column headers & the desired extra information through coding to
** mara_string
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = mara_string
IMPORTING
buffer = mara_xstring.
CL_WD_RUNTIME_SERVICES=>attach_file_to_response( i_filename = 'TEMP.XLS'
i_content = mara_xstring
i_mime_type = 'EXCEL' ).
ENDMETHOD. -
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 -
REGARDING READING THE SCREEN CONTENTS IN ALV GRID
HI ALL,
i have to transfer contents from one grid display to another grid.
internal table has :
internal- table name: itab
chkbx
v_lights
matnr
maktx
dline(longtext of the material)
alv grid is having following contents:
1. chkbx which will get the user command.
2. v_lights to display the different colors of light according to the contents of the longtext which i am fetching using the read_text function.
3. matnr
4. maktx
5. longtext of the material.
after the display of the first grid display.
if user changes contents of the check box .. i have to read the screen and and modify my internal table(itab) so that i can fetch data from the internal table to another internal table which i can use for the next screen.
can anyone of you tell me how can i do this.
and some help contents so that i can understand the whole concept.
regards
vamsiHi vamsi,
Do this way:
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'
FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
P_SELFLD TYPE SLIS_SELFIELD.
case p_ucomm.
when 'SAVE'.
Data ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
Now your internal table will have the latest values.
loop at itab where check = 'X'. "Assuming the first fieldname for the check box is 'CHECK'.
move-corresponding itab to itab2.
append itab2.
clear itab2.
endcase.
Build anothe r field catalog
Display another grid.
ENDFORM.
Regards,
Ravi -
Hi Experts,
In ALV report i have to apply custom functionality when user clicks on 'REFRESH' button.Please suggest me how to catch
this event.I have used the event 'AFTER_REFRESH' OF CLASS CL_GUI_ALV_GRID.But it is not the right event.Please sugget me.
regards,
pavan t.hi,
I'm currently not able to test, but have you tried teh events user_command and after_usercommand?
regards,
Hans Hohenfeld -
Problem refreshing fieldcatalog in ALV grid classic
Hi gurus,
I´m really having problems with the column titles that are display in my ALV report and I cannot figure out why. I want to be able to print the text either in Spanish or in English, depending on the company code in the selection criteria screen. I refresh and populate the fieldcatalog with EN texts and I can see that changes are taken and pass to FM REUSE_ALV_GRID_DISPLAY but when I execute it they still show the Spanish text.
Please help me with things. Points will be rewarded.
I show here part of the code.
FORM make_field_catalog.
DATA: l_repid LIKE sy-repid.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: pos TYPE i VALUE 1.
l_repid = sy-repid.
CLEAR ls_fieldcat.
REFRESH i_fieldcat.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = l_repid
i_internal_tabname = 'GT_OUTPUT'
i_inclname = l_repid
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = i_fieldcat.
Fields to output in the ALV.
Show different languages, depending on the company code.
IF is_es EQ 'X'.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CUSTOMER'.
ls_fieldcat-seltext_l = text-002.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DOC_NO'.
ls_fieldcat-seltext_l = text-003.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DOC_DATE'.
ls_fieldcat-seltext_l = text-004.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'NET_AMOUNT'.
ls_fieldcat-seltext_l = text-005.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 15.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-datatype = 'QUAN'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ELSE.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'CUSTOMER'.
ls_fieldcat-seltext_l = text-012.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-key = ' '.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DOC_NO'.
ls_fieldcat-seltext_l = text-013.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DOC_DATE'.
ls_fieldcat-seltext_l = text-014.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'NET_AMOUNT'.
ls_fieldcat-seltext_l = text-015.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-outputlen = 15.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-datatype = 'QUAN'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ENDIF.
ENDFORM.
And later i make the call like follows:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = g_alv_buffer
i_callback_program = l_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_callback_html_top_of_page = 'TOP_OF_PAGE'
is_layout = g_layout
it_fieldcat = i_fieldcat
it_special_groups = g_fieldgroups_tab[]
it_sort = g_sortfields_tab[]
i_default = c_n
i_save = c_a
is_variant = g_variant
it_events = g_events_tab[]
it_event_exit = g_event_exit_tab[]
is_print = g_print
i_screen_start_column = g_screen_start_column
i_screen_start_line = g_screen_start_line
i_screen_end_column = g_screen_end_column
i_screen_end_line = g_screen_end_line
TABLES
t_outtab = gt_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
Does anybody knows what am I missing?
Thanks! Elenahi ..
Ensure Field catalog is Refreshed every time before it is buid.
Code:
<b>REFRESH i_fieldcat.</b>
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = l_repid
i_internal_tabname = 'GT_OUTPUT'
i_inclname = l_repid
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = i_fieldcat.
<b>Reward if Helpful.</b> -
ECATT SAPGUI method to capture ALV grid contents
Dear All,
I am using eCATT SAPGUI method to record the transaction VF04. The problem here is I am unable to capture the contents of the ALV grid present in the transaction.
Were any one of you able to capture the contents of ALV grid using SAPGUI method, if so, please do help me to solve this problem.
Thanks in advance,
SidharthHi Sidharth,
Did u find any solution for this problem .
Iam facing same problem for MRIS,MRRL alv reports.Iam recording through SAP GUI but I want One out put field in log. If U find any solution for this plz forward to me.
Thanks in advance
Raju.K -
Dear all,
I would like to do a refresh of the ALV GRID table display in event "handle_data_changed_finished".
"refresh_table_display" is NOT working.
I obviously need to go through PAI & PBO to refresh the table display.
Is there something to syncronize the data?
There must be an easy solution...
bye
Niko
Niko Prindesis
Itelligence AGDear Andreas,
thank you!
If I call "SAPGUI_SET_FUNCTIONCODE" in "handle_data_changed_finished", I can trigger the PAI/PBO.
So this solves my problem!
But ...
... isn't there a solution without going through PAI/PBO???
I want to stay in the ALVGrid control!
bye
Niko -
Re: ALV Grid Application Tool Bar
Dear Experts,
I am displaying a report in ALV grid. In the application tool bar. 'save layout' and 'change layout' icons were missing.if i want to put those icons on application tool bar where i have to change? if anybody knows pls. help on this.
Thanks in advance.
Thanks and regards,
Harish babuHello Harish
The parameter I_SAVE (of method SET_TABLE_FOR_FIRST_DISPLAY) can have several setting(<a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/bf/3bd1369f2d280ee10000009b38f889/content.htm">ALV Grid Control</a>):
I_SAVE
Determines the options available to the user for saving a layout:
'X': global saving only
'U': user-specific saving only
'A': corresponds to 'X' and 'U'
SPACE: no saving
In addition, you have to provide parameter IS_VARIANT:
IS_VARIANT
Determines the layout to be used for displaying the output table. If you use this parameter, you must at least fill field REPORT of the structure of type DISVARIANT
Regards
Uwe -
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 -
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 -
ALV grid refresh while fcat and internal table change
Hi,
I am displaying an ALV output using OOPS ALV grid. It is displaying data from internal table t1.
Later I am changing fieldcat table content and I want to display with internal table t2. how can I do this.
It is not refreshing the fieldcat values in the ALV.
Which method I should call to refresh the ALV.
Thanks and regards,
Venkat.hi,
to refresh the alv display.
you can use the method refresh_table_display
of the class cl_gui_alv_grid.
regards. -
Capturing the current ALV grid contents. How?
Hi forum,
After lots of searching, I still can't find out how I can get the current contents of the ALV grid. I need this for an editable ALV grid to keep track of the data changes.
By the way, I am using the traditional ALV, not OO ALV.
Let me share the steps I already did but still failed.
1
I used the FM GET_GLOBALS_FROM_SLVC_FULLSCR to have access to the CL_GUI_ALV_GRID object. I tried using some of the methods inside that class, all to no avail.
Some methods I tried were set_selected_columns and set_selected_rows and then call the method get_selected_cells. Basically, the idea is to simulate highlighting of cells, and select them using get_selected_cells. But the problem is that get_selected_cells is not returning the value (although it correctly returns the row and column that I set -- but not the value in that cell coordinates).
2
I also saw the protected method get_changed_data -- but the problem is that it is protected, so I created a subclass of CL_GUI_ALV_GRID to ZCL_GUI_ALV_GRID and copied the private attributes and methods that get_changed_data depends on. I was able to do this but GET_GLOBALS_FROM_SLVC_FULLSCR strictly returns CL_GUI_ALV_GRID. The upcast from CL_GUI_ALV_GRID to ZCL_GUI_ALV_GRID fails. So I still can't use/test get_changed_data.
3
I also saw some code regarding events. Here's a sample but this doesn't work:
REFRESH lt_events.
lwa_event-name = 'DATA_CHECK'. "Event name
lwa_event-form = 'HANDLE_DATA_CHANGED'.
APPEND lwa_event TO lt_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
it_fieldcat_lvc = it_fieldcat
is_layout_lvc = ls_layout
it_events = lt_events
FORM handle_data_changed using ref_data_changed
type ref to cl_alv_changed_data_protocol.
BREAK-POINT.
ENDFORM.
I would really appreciate it (and I know a lot of other ABAPers will, too) if you could point me to how I can get the ALV grid contents. Thanks.
KyleHi Keshav,
sure I will check those tomorrow when I get back to work.
All,
Here's the code if it helps:
*& Report Z_ALV_EDITABLE
REPORT Z_ALV_EDITABLE.
TYPE-POOLS:
slis
DATA:
BEGIN OF i_out OCCURS 0,
operand1 TYPE i,
operand2 TYPE i,
operator TYPE c,
result TYPE i,
END OF i_out
START-OF-SELECTION.
PERFORM prepareData.
PERFORM refreshResults.
PERFORM createALV_LVC.
FORM prepareData.
REFRESH i_out.
DO 10 TIMES.
i_out-operand1 = 1.
i_out-operand2 = 2.
i_out-operator = '+'.
APPEND i_out.
ENDDO.
ENDFORM.
FORM refreshResults.
LOOP AT i_out.
CASE i_out-operator.
WHEN '+'.
i_out-result = i_out-operand1 + i_out-operand2.
WHEN '-'.
i_out-result = i_out-operand1 - i_out-operand2.
WHEN '*'.
i_out-result = i_out-operand1 * i_out-operand2.
WHEN '/'.
IF i_out-operand2 NE 0.
i_out-result = i_out-operand1 - i_out-operand2.
ENDIF.
WHEN OTHERS.
i_out-result = ''.
ENDCASE.
MODIFY i_out.
ENDLOOP.
ENDFORM.
FORM createALV_LVC.
DATA:
it_fieldcat TYPE lvc_t_fcat,
ls_layout TYPE lvc_s_layo,
lt_events TYPE slis_t_event,
lwa_event TYPE slis_alv_event
" Field Catalog
PERFORM createFieldcat CHANGING it_fieldcat.
" Sorting
PERFORM createSort.
" Layout
ls_layout-cwidth_opt = 'X'.
" Events
REFRESH lt_events.
lwa_event-name = 'DATA_CHECK'. "Event name
lwa_event-form = 'HANDLE_DATA_CHANGED'.
APPEND lwa_event TO lt_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
it_fieldcat_lvc = it_fieldcat
is_layout_lvc = ls_layout
* it_sort =
it_events = lt_events
i_callback_program = 'Z_ALV_EDITABLE'
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS_SET'
i_save = 'X'
TABLES
t_outtab = i_out
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.
FORM createFieldcat CHANGING it_fieldcat TYPE lvc_t_fcat.
DATA:
wa_fcat LIKE LINE OF it_fieldcat
REFRESH it_fieldcat.
DEFINE m_append_fieldcat.
CLEAR wa_fcat.
wa_fcat-edit = &1.
wa_fcat-fieldname = &2.
wa_fcat-scrtext_m = &3.
APPEND wa_fcat TO it_fieldcat.
END-OF-DEFINITION.
m_append_fieldcat '' 'OPERAND1' 'Operand 1'.
m_append_fieldcat '' 'OPERAND2' 'Operand 2'.
m_append_fieldcat 'X' 'OPERATOR' 'Operator'.
m_append_fieldcat '' 'RESULT' 'Result'.
ENDFORM.
FORM createSort.
ENDFORM.
FORM PF_STATUS_SET USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'Z_ALV_STATUS' EXCLUDING P_EXTAB.
ENDFORM. "PF_STATUS_SET
FORM user_command
USING
r_ucomm TYPE sy-ucomm
ls_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'REFRESH'.
" CHECK i_out HERE IF IT CHANGED ALONG WITH THE EDITS
BREAK-POINT.
* PERFORM refreshALV.
ENDCASE.
ENDFORM.
FORM handle_data_changed using ref_data_changed
type ref to cl_alv_changed_data_protocol.
BREAK-POINT.
ENDFORM. -
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.
Maybe you are looking for
-
How to find out who create a data record
Hello expert, is it possible to find out who created a special data record on the cube, even if this is not cosidered by the data model? We do not save sy-uname on cube. Thanks Johannes
-
I have been considering buying Aperture 3 but the numerous, negative reviews are making me wary. Should I buy the first version - Aperture 2.1.1 instead? I have a 2009 MacBook Pro running Snow Leopard. I do not think I will upgrade to Lion because
-
Zen micro photo OTG photo trans
Can anyone please tell me wether pc free photo transfer (from digital camera), is possible with the zen micro photo or vision:m Regards & thanks in advance
-
Dear all, I have created a formula which counts number of working days. This formula then has been modified to subtract Bank holidays. When I use a array formula of bank holidays dates, it works fine however when I use a holidays table within a datab
-
System info for editing?
Tired of Window PCs, looking to buy an Apple System. I would like to do some video editing but want to make sure I get a powerful enough system from the start. How does the iMac handle HD video editing or should I look a better, faster computer?