Refresh problem in ALV OOPS
Hi all,
I have 3 alv screens which is developed with oops in that 2nd is the result of 1st and 3rd is the result of 2nd. First time output is coming perfectly as required. But if I come back from 2nd to 1st screen and did some changes then if execute second screen changes are not reflecting to that screen (internal tables are perfectly updating). In the 2nd screen if I click on standard refresh button the output is coming perfectly. Same thing happens to 3rd screen also.
I wrote code like this.
If grid not initial.
Create object containeru2026u2026u2026u2026..
Create object gridu2026u2026u2026..
Grid-> set_table_for_first_displayu2026u2026u2026u2026.
Else.
Grid->refresh_table_display.
Endif.
For grid I used methods for event TOOLBAR USER_COMMAN only.
Suggest me what I need to do this.
If grid not initial.
Create object containeru2026u2026u2026u2026..
Create object gridu2026u2026u2026..
Grid-> set_table_for_first_displayu2026u2026u2026u2026.
Else.
Grid->refresh_table_display.
Endif.
I think your problem is in
If grid not initial.
because your grid is not initial and your program wasn't able to pass these lines. Therefore, even if your internal tables are updated your grid or container are not updated by the program.
Similar Messages
-
Context Refreshing Problem in ALV
HI Experts
I am using the ALV DATA_CHECK event in ALV and it is called in modify view.
let say i have multiple rows.... For a single row i have three cells to paly with ,, i have to take values from two cells and calculate the value of the third cell. now if i put wrong value in one cell , WDY detects it ... now in sec row if i put the correct value , the value of the third cell is calcuted but now the wrong value in the cell gets dissappeared and its value is overwritten by previous value.
Desired scenario : Wrong value should not get overwritten and values in other row must get calculated.
Kindly propose a solution for the same.
Regards
KuldeepHi Lekha
correct Values are getting refreshed , thats not a problem.
When a filed is having a data element of type i , and if you put abcd in that field Web dynpro detects it on its own
In my case also if i put a wrong value it is detecting by Webdynpro but when i put the correct value in some other field and press enter calculations are made for correct field then also that errored value get disappeared , this should not happened . Why the errored value is getting disappeared ???
Regards
Kuldeep -
hi,
I have 2 views, input and output these two included in a MAIN views.
when user key in their input values in INPUT view and the search results will be displayed in OUTPUT view using ALV grid.
the problem i'm facing here is, when user changes search criteria once after search results displayed.. it is not displaying with new search results. every time i have to give F5(Refresh) it is certainly not comfortable to deliver it as it is.
i have tried same scenario with simple query in our local server.. where it is working very well.
i really clueless what would be the cause.. is there any with SAP patch issues.
i have tried with refresh method of ALV component.
please help me out of this, i cannot use TABLE control every time to avoid this.
thanks,
gupta.Hi Gupta,
Could you please let us know how you are filling the context node which is mapped to ALV table?
After the search criteria is changed, if you are doing it inside handler of the button or something like that, it should work.
Refer to the tutorial in the following link which shows an example similar to your scenario:
SAP List Viewer in Web Dynpro - Simple Example for Using ALV
please post the code also which you are using to fill the node in case if you still face the issue after referring to the above tutorial.
Hope this helps!
Regards.
Srilatha
Edited by: Srilatha M on Jul 19, 2010 7:57 AM -
Problem while placing a button in the Output using ALV OOPs
Hi,
I am using ALV OOPs to display report output.
In the toolbar i have to palce an update button and if i click on that update it should then call the selection screen 500 .
So,please help me to achieve this using ALV OOPs.
THANKS & REGARDS,
Kiranmai.Hi,
you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
Regards,
Siddarth -
ALV grid refresh problem - Icons briefly flashed on screen
Hi ,
I have an editable OO ALV grid which has a "New Entries" option. When the user clicks on that button a new blank row is appended at the bottom. The problem is on some monitors /screens when the user clicks on the button the ALV grid flashes for a brief moment and every cell has an image icon.
You can see this problem by going to Tcode SE16N choose a large table like VBAP and display 500 records or more. On the next screen press the page down button, you would see those icons.(the problem is as described above, except that the se16n ALV is not editable ).
Is this a buffering problem of ALV ? Or is there a way to avoid / fix this ?
Thanksyou will find a beginning of explanation here in [sap library - Using the ALV Grid Control in WANs|http://help.sap.com/saphelp_nw2004s/helpdata/en/32/d3e962f7fb11d2b48c006094192fe3/frameset.htm]
-
Hi Friends,
I have the following 2 problems in ALV report
1) Logo is not getting displayed in the report.
2) When i click on the Purchase order number in the report the interactive report is not working,i am not able to see report of First interactive level.
can you help it out friends.
Thanks and regards
Dinesh
REPORT YSDBALV1
tables: ekko , ekpo .
type-pools: slis .
Table for Display Header
data:i_header type slis_t_listheader with header line.
*Fieldcat Declaration
data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
*Table of Events
data:i_event type slis_t_event with header line .
For Layout
data:i_layout type slis_layout_alv .
data: text(30) .
*Internal Table Declaration
data: begin of it_final occurs 0 ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
chk(1) ,
light(1) ,
change like ekpo-menge ,
end of it_final .
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
selection-screen begin of block block1 .
parameters:grid radiobutton group r .
parameters:list radiobutton group r .
selection-screen end of block block1 .
at selection screen
at selection-screen .
select single * from ekko where ebeln in s_ebeln .
if sy-subrc <> 0 .
message e000(8I) WITH 'No Data Exists' .
endif .
start-of-selection .
if grid = 'X' .
perform get_data .
perform event using i_event[] .
perform field using fieldcatalog[] .
perform layout using i_layout .
perform grid_display .
endif .
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
*DATA Retrieval from tables
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
APPEND IT_FINAL.
endform. " get_data
*Getting the Event for Top of Page display.
*& Form event
text
-->P_I_event[] text
form event using p_i_event type slis_t_event.
clear p_i_event .
refresh p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_i_event
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
read table p_i_event with key name = slis_ev_top_of_page into i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE_PO' to i_event-form.
modify p_i_event from i_event index sy-tabix transporting form.
endif.
clear i_event.
endform. " event
*Display Top-of Page Details and Logo
form top_of_page_po .
clear i_header .
refresh i_header .
write sy-datum to text.
i_header-typ = 'H'.
i_header-info = 'PURCHASE OREDER DETAILS'.
append i_header.
*Logo Display
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header[]
I_LOGO = 'ENJOYSAPLOGO'.
endform .
*Field Catalog Append
*& Form field
text
-->P_fieldCATALOG[] text
form field using p_fieldcatalog type slis_t_fieldcat_alv.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'PO Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 20.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Value '.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 20.
fieldcatalog-do_sum = 'X'.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Units'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 4.
append fieldcatalog .
clear fieldcatalog.
endform. " field
*& Form layout
text
form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
i_layout-zebra = 'X'.
i_layout-lights_fieldname = 'LIGHT'.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_fieldname = 'CHK'.
i_layout-box_tabname = 'IT_FINAL'.
i_layout-edit = ' '.
endform.
*To display Buttons in the MENU BAR if needed
FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
SLIS_T_EXTAB.
SET PF-STATUS 'MENUPO'.
ENDFORM.
*Event for Interactive display of ALV report
form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
if r_ucomm = '&IC1'.
READ TABLE IT_FINAL index rs_selfield-tabindex.
write:/ IT_FINAL-ebeln.
endif.
endform .
*Parameters of FM REUSE_ALV_GRID_DISPLAY
*& Form grid_display
text
--> p1 text
<-- p2 text
form grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = I_EVENT[]
TABLES
t_outtab = IT_FINAL.
endform. " grid_display*& Report YSDBALV1
REPORT YSDBALV1.
tables: ekko , ekpo .
type-pools: slis .
Table for Display Header
data:i_header type slis_t_listheader with header line.
*Fieldcat Declaration
data:fieldcatalog type slis_T_fieldcat_alv WITH HEADER LINE.
*Table of Events
data:i_event type slis_t_event with header line ,
wa_event type line of slis_t_event.
For Layout
data:i_layout type slis_layout_alv .
data: text(30) .
*Internal Table Declaration
data: begin of it_final occurs 0 ,
ebeln like ekko-ebeln , "Purchasing Document No.
bedat like ekko-bedat , "Purchasing Document Date
matnr like ekpo-matnr , "Material No.
netwr like ekpo-netwr , "Net Order Value in PO Currancy
meins like ekpo-meins , "UOM
chk(1) ,
light(1) ,
change like ekpo-menge ,
end of it_final .
**select option Declaration
selection-screen begin of block block.
select-options: s_ebeln for ekko-ebeln .
selection-screen end of block block .
selection-screen begin of block block1 .
parameters:grid radiobutton group r .
parameters:list radiobutton group r .
selection-screen end of block block1 .
at selection screen
at selection-screen .
select single * from ekko where ebeln in s_ebeln .
if sy-subrc <> 0 .
message e000(8I) WITH 'No Data Exists' .
endif .
start-of-selection .
if grid = 'X' .
perform get_data .
perform event using i_event[] .
perform field using fieldcatalog[] .
perform layout using i_layout .
perform grid_display .
endif .
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
*DATA Retrieval from tables
SELECT EKKO~EBELN
EKKO~BEDAT
EKPO~EBELP
EKPO~MATNR
EKPO~NETWR
EKPO~MEINS
EKPO~MENGE
EKPO~BPRME
INTO CORRESPONDING FIELDS OF table IT_FINAL
FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE EKKO~EBELN IN S_EBELN.
APPEND IT_FINAL.
endform. " get_data
*Getting the Event for Top of Page display.
*& Form event
text
-->P_I_event[] text
form event using p_i_event type slis_t_event.
clear p_i_event .
refresh p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_i_event.
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
read table p_i_event with key name = slis_ev_top_of_page into wa_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE_PO' to i_event-form.
modify p_i_event from i_event index sy-tabix transporting form.
endif.
clear i_event.
endform. " event
*Display Top-of Page Details and Logo
form top_of_page_po .
clear i_header .
refresh i_header .
write sy-datum to text.
i_header-typ = 'H'.
i_header-info = 'PURCHASE OREDER DETAILS'.
append i_header.
*Logo Display
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header[]
I_LOGO = 'ENJOYSAP_LOGO'.
endform .
*Field Catalog Append
*& Form field
text
-->P_fieldCATALOG[] text
form field using p_fieldcatalog type slis_t_fieldcat_alv.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order No'.
fieldcatalog-col_pos = 1.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'BEDAT'.
fieldcatalog-seltext_m = 'PO Date'.
fieldcatalog-col_pos = 2.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
fieldcatalog-outputlen = 20.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Value '.
fieldcatalog-col_pos = 5.
fieldcatalog-outputlen = 20.
fieldcatalog-do_sum = 'X'.
append fieldcatalog .
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Units'.
fieldcatalog-col_pos = 6.
fieldcatalog-outputlen = 4.
append fieldcatalog .
clear fieldcatalog.
endform. " field
*& Form layout
text
form layout using p_i_layout TYPE SLIS_LAYOUT_ALV .
i_layout-zebra = 'X'.
i_layout-lights_fieldname = 'LIGHT'.
i_layout-lights_tabname = 'IT_FINAL'.
i_layout-box_fieldname = 'CHK'.
i_layout-box_tabname = 'IT_FINAL'.
i_layout-edit = ' '.
endform.
*To display Buttons in the MENU BAR if needed
FORM SET_PO_PF_STATUS USING P_I_EXTAB TYPE
SLIS_T_EXTAB.
SET PF-STATUS 'MENUPO'.
ENDFORM.
*Event for Interactive display of ALV report
form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
if r_ucomm = '&IC1'.
READ TABLE IT_FINAL index rs_selfield-tabindex.
set parameter id 'VL1' field it_final-ebeln.
call transaction 'ME23N'.
endif.
endform .
*Parameters of FM REUSE_ALV_GRID_DISPLAY
*& Form grid_display
text
--> p1 text
<-- p2 text
form grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EVENTS = I_EVENT[]
TABLES
t_outtab = IT_FINAL.
endform. " grid_display
Regards,
Rusidar S. -
To set HOTSPOT for a field in ALV-oops and when clecked should call transac
Hi,
I need to set HOTSPOT for a field in O/P list using ALV-oops and when clecked should take me to Transaction VA01. Please help....
Thanks,
PrabhuHi,
Please go through this code it may help u.
REPORT zcls_alv_oops MESSAGE-ID z1.
TABLES : mara.
Types Declaration..\
TYPES :
BEGIN OF t_mara,
matnr TYPE matnr,
mtart TYPE mtart,
maktx TYPE maktx,
END OF t_mara,
BEGIN OF t_marc,
matnr TYPE matnr,
werks TYPE werks_d,
mtart TYPE mtart,
maktx TYPE maktx,
END OF t_marc.
Internal Tables Declaration..\
DATA :
i_mara TYPE TABLE OF t_mara,
i_marc TYPE TABLE OF t_marc,
i_fcat1 TYPE lvc_t_fcat,
i_fcat2 TYPE lvc_t_fcat.
Constants Declaration..\
CONSTANTS :
c_cont1 TYPE scrfname VALUE 'CONT1',
c_cont2 TYPE scrfname VALUE 'CONT2'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS:
s_matnr FOR mara-matnr NO INTERVALS.
SELECTION-SCREEN SKIP 1.
PARAMETERS :
p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X',
p_bttn RADIOBUTTON GROUP r1.
SELECTION-SCREEN END OF BLOCK b1.
\* Class forward referncing.
CLASS lcl_rcvr_class DEFINITION DEFERRED.
\* Pointers Declaration..
DATA :
lp_rcvr TYPE REF TO lcl_rcvr_class,
lp_cont1 TYPE REF TO cl_gui_custom_container,
lp_cont2 TYPE REF TO cl_gui_custom_container,
lp_grid1 TYPE REF TO cl_gui_alv_grid,
lp_grid2 TYPE REF TO cl_gui_alv_grid.
\* Local Class Definiton.
CLASS lcl_rcvr_class DEFINITION.
PUBLIC SECTION.
METHODS :
hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
\* Local Class Implementation.
CLASS lcl_rcvr_class IMPLEMENTATION.
METHOD hotspot_click.
DATA :
wa_mara TYPE t_mara,
wa_marc TYPE t_marc.
DATA :
l_index TYPE sy-tabix.
READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
IF sy-subrc EQ 0.
REFRESH i_marc.
SELECT matnr
werks
INTO TABLE i_marc
FROM marc
WHERE matnr EQ wa_mara-matnr.
IF sy-subrc EQ 0.
LOOP AT i_marc INTO wa_marc.
l_index = sy-tabix.
wa_marc-mtart = wa_mara-mtart.
wa_marc-maktx = wa_mara-maktx.
MODIFY i_marc FROM wa_marc INDEX l_index
TRANSPORTING mtart maktx.
ENDLOOP.
CALL SCREEN 200.
ELSE.
MESSAGE e121 WITH text-005 wa_mara-matnr.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD handle_double_click.
DATA :
wa_mara TYPE t_mara,
wa_marc TYPE t_marc.
DATA :
l_index TYPE sy-tabix.
READ TABLE i_mara INTO wa_mara INDEX e_row-index.
IF sy-subrc EQ 0.
REFRESH i_marc.
SELECT matnr
werks
INTO TABLE i_marc
FROM marc
WHERE matnr EQ wa_mara-matnr.
IF sy-subrc EQ 0.
LOOP AT i_marc INTO wa_marc.
l_index = sy-tabix.
wa_marc-mtart = wa_mara-mtart.
wa_marc-maktx = wa_mara-maktx.
MODIFY i_marc FROM wa_marc INDEX l_index
TRANSPORTING mtart maktx.
ENDLOOP.
CALL SCREEN 200.
ELSE.
MESSAGE e121 WITH text-005 wa_mara-matnr.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
\* Start of Selection
START-OF-SELECTION.
\* Extract the Material Master data for the Input Material.
SELECT a~matnr
a~mtart
b~maktx
INTO TABLE i_mara
FROM mara AS a
INNER JOIN makt AS b
ON a~matnr EQ b~matnr
WHERE a~matnr IN s_matnr
AND b~spras EQ sy-langu.
END-OF-SELECTION.
IF NOT i_mara\[\] IS INITIAL.
\* Call Screen to display the Material Master data.
CALL SCREEN 100.
ELSE.
MESSAGE s121 WITH text-006.
ENDIF.
\*& Module DISP_GRID OUTPUT
\* text
MODULE disp_grid OUTPUT.
\* Build the Field catelog for Material Master data.
PERFORM build_fcat.
\* Display the Material Master data using ALV.
PERFORM disp_alv.
ENDMODULE. " DISP_GRID OUTPUT
\*& Module USER_COMMAND_0100 INPUT
\* text
MODULE user_command_0100 INPUT.
\*when exit or cancel is clicked program has to come out
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
\*& Form build_fcat
\* text
\* \--> p1 text
\* <-\- p2 text
FORM build_fcat.
DATA : ws_fcat TYPE lvc_s_fcat.
ws_fcat-fieldname = 'MATNR'.
ws_fcat-scrtext_m = text-001.
ws_fcat-tabname = 'I_MARA'.
IF p_hotspt EQ 'X'.
ws_fcat-hotspot = 'X'.
ENDIF.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MTART'.
ws_fcat-scrtext_m = text-002.
ws_fcat-tabname = 'I_MARA'.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MAKTX'.
ws_fcat-scrtext_m = text-003.
ws_fcat-tabname = 'I_MARA'.
APPEND ws_fcat TO i_fcat1.
CLEAR ws_fcat.
ENDFORM. " build_fcat
\*& Form disp_alv
\* text
\* \--> p1 text
\* <-\- p2 text
FORM disp_alv.
IF lp_cont1 IS INITIAL.
\* Create the Container Object of Material Master.
CREATE OBJECT lp_cont1
EXPORTING
container_name = c_cont1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6 .
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Create the Object for Grid of Material Master.
CREATE OBJECT lp_grid1
EXPORTING
i_parent = lp_cont1
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Dipslay Material Master data by calling method.
CALL METHOD lp_grid1->set_table_for_first_display
CHANGING
it_outtab = i_mara
it_fieldcatalog = i_fcat1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Set Handler for the Hot Spot Event.
CREATE OBJECT lp_rcvr.
IF p_hotspt EQ 'X'.
SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
ELSE.
SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " disp_alv
\*& Module STATUS_0100 OUTPUT
\* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN_STAT'.
SET TITLEBAR 'T_100'.
ENDMODULE. " STATUS_0100 OUTPUT
\*& Module STATUS_0200 OUTPUT
\* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'PLANT_STAT'.
SET TITLEBAR 'T_200'.
ENDMODULE. " STATUS_0200 OUTPUT
\*& Module DISP_GRID_plant OUTPUT
\* text
MODULE disp_grid_plant OUTPUT.
\* Build the Field catelog for Material Plant data.
PERFORM build_fcat_plant.
\* Display the Material Master Plant data using ALV.
PERFORM disp_alv_plant.
ENDMODULE. " DISP_GRID_plant OUTPUT
\*& Module USER_COMMAND_0200 INPUT
\* text
MODULE user_command_0200 INPUT.
\*when exit or cancel is clicked program has to come out
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
\*& Form build_fcat_plant
\* text
\* \--> p1 text
\* <-\- p2 text
FORM build_fcat_plant.
DATA : ws_fcat TYPE lvc_s_fcat.
ws_fcat-fieldname = 'MATNR'.
ws_fcat-scrtext_m = text-001.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'WERKS'.
ws_fcat-scrtext_m = text-004.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MTART'.
ws_fcat-scrtext_m = text-002.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ws_fcat-fieldname = 'MAKTX'.
ws_fcat-scrtext_m = text-003.
ws_fcat-tabname = 'I_MARC'.
APPEND ws_fcat TO i_fcat2.
CLEAR ws_fcat.
ENDFORM. " build_fcat_plant
\*& Form disp_alv_plant
\* text
\* \--> p1 text
\* <-\- p2 text
FORM disp_alv_plant.
IF lp_cont2 IS INITIAL.
\* Create the Container Object of Material Plant data.
CREATE OBJECT lp_cont2
EXPORTING
container_name = c_cont2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Create the Object for Grid of Material Plant data.
CREATE OBJECT lp_grid2
EXPORTING
i_parent = lp_cont2
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
\* Dipslay Material Plant data by calling method.
CALL METHOD lp_grid2->set_table_for_first_display
CHANGING
it_outtab = i_marc
it_fieldcatalog = i_fcat2
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ELSE.
\* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
CALL METHOD lp_grid2->refresh_table_display.
ENDIF.
ENDFORM. " disp_alv_plant -
Problem with ALV grid in edit mode
Hello, gurus!
I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell. And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
Thanks,
MikhailHi Prabhu,
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
title_of_report = text-010.
SET TITLEBAR '0100' WITH title_of_report.
DATA: g_event_receiver TYPE REF TO lcl_event_handler.
IF z_custom_container IS INITIAL .
CREATE OBJECT z_custom_container
EXPORTING
container_name = 'ALV_ZAC'.
CREATE OBJECT alv_grid
EXPORTING
i_parent = z_custom_container.
g_repid = sy-repid.
gs_variant-report = g_repid.
x_save = 'A'.
PERFORM check_alv_grid_fields.
ps_layout-cwidth_opt = 'X'.
ps_layout-edit = 'X'.
CALL METHOD alv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = '1'.
* CALL METHOD alv_grid->register_edit_event
* EXPORTING
* i_event_id = cl_gui_alv_grid=>mc_evt_enter.
APPEND s_list_rec to it_list_rec.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
is_variant = gs_variant
i_save = x_save
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = it_list_rec[].
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDIF.
FORM check_alv_grid_fields .
DATA: ls_fcat LIKE LINE OF pt_fieldcat.
REFRESH pt_fieldcat .
CLEAR: ps_layout, ls_fcat.
ls_fcat-fieldname = 'VBELN'.
ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table = 'LIPS'. " .
ls_fcat-outputlen = 9.
* ls_fcat-datatype = 'CHAR'.
* ls_fcat-inttype = 'C'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR: ls_fcat.
ls_fcat-fieldname = 'ERDAT'.
ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
ls_fcat-outputlen = 9.
* ls_fcat-f4availabl = 'X' .
* ls_fcat-datatype = 'DATS'.
* ls_fcat-inttype = 'D'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR: ls_fcat.
ENDFORM. " check_alv_grid_fields
FORM save_p .
CLEAR l_valid.
CALL METHOD alv_grid->check_changed_data
IMPORTING
e_valid = l_valid.
IF l_valid IS INITIAL.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-i01
txt1 = text-i02
txt2 = text-i03
txt3 = text-i04.
ELSE.
i_dat_reg = zrumm_prr-cdprr.
CLEAR is_temp_otc.
freshit i_prrpus_fax.
freshit i_list2_ot.
LOOP AT it_list_rec INTO s_list_rec.
MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
i_list2_ot-fgrup = 'RECE'.
i_list2_ot-prrnu = i_num_prr.
APPEND i_list2_ot.
MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
APPEND i_prrpus_fax.
ENDLOOP.
ENDIF.
Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM -
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 -
Alv oops raising error message
Hi,
iam displaying output using alv oops.
one of the char field is editable i want to give only numeric values only.i cannot change datatype to numc for that field.if user enters char value(like abc) and click on any button in alv output i want to raise a error message and i want to stop the user in alv report output.
Regards,
SureshHello Suresh
I assume that the editable field in your ALV list is defined as CHAR type in the underlying table (structure). In order to prevent non-numeric entries I would use the following approach:
Define additional column for your ALV list, e.g.:
TYPES: BEGIN OF ty_s_outtab.
INCLUDE type <name of z-table> AS data.
TYPES: numfield(4) TYPE n. " Assumption: Your editable field is CHAR4, e.g. charfld
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab. " your itab for ALV list
Build fieldcatalog automatically and add additional column for NUMFIELD:
" Call fm LVC_FIELDCATALOG_MERGE with your z-table
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = <name of editable field> ).
" Suppress this field
ls_fcat-tech = 'X'.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
" Modify LS_FCAT to reflect the additional NUMC4 field
ls_fcat-fieldname = 'NUMFIELD'.
ls_fcat-rolltype = ... " change technical details from CHAR4 -> NUMC4
ls_fcat-edit = 'X'. " Now the NUMC4 field is editable
INSERT ls_fcat INTO gt_fcat INDEX syst-tabix.
ENDLOOP.
Initial load of outtab: shuffle values from CHAR4 to NUMC4 field
REFRESH: gt_outtab.
LOOP AT gt_data INTO ls_data.
clear: ls_outtab.
ls_outtab-data = ls_data.
move ls_data-charfld TO ls_outtab-numfield.
APPEND ls_outtab TO gt_outtab.
ENDLOOP.
Regards
Uwe -
Hi All,
Greetings for the Day!!!
am using alv oops for displaying output..
BEFORE sorting my internal table looks like below in the output.....
for example
A
B
C
D
E
F
AFTER sorting the internal table in the output .display.,, the internal table shows like below
F
E
D
C
B
A
but when i call the method set_table_for_first_display ,after sorting the in the output display ....,the internal table remains as like before
A
B
C
D
E
F....
it should be lke
F
E
D
C
B
A .....
kindly suggest me the alternatives.pls
Regards
JackFor example....
DATA: lo_alv_grid TYPE REF TO cl_gui_alv_grid.
DATA: lo_form_alv_container TYPE REF TO cl_gui_custom_container.
* Create Controls
IF lo_form_alv_container IS INITIAL. "<-- Check if already created
CREATE OBJECT lo_form_alv_container
EXPORTING
container_name = 'FORMULA_CONTAINER'.
* Create control based ALV grid
CREATE OBJECT lo_alv_grid
EXPORTING
i_parent = lo_form_alv_container.
* set for first display
lo_alv_grid->set_table_for_first_display(
EXPORTING
is_layout = ls_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = lt_formulas[]
it_fieldcatalog = lt_fieldcat[] ).
ELSE.
lo_alv_grid->refresh_table_display( ). "<-- If so, just refresh
ENDIF.
Regards,
Rich Heilman -
Hi Experts,
Can any one solve my problem.
I have displayed (grid display) using ALV OOPS using method (CL_GUI_ALV_GRID=>SET_TABLE_FOR_FIRST_DISPLAY)
But I want colors should come on the list. Colors should be displayed Cell wise.
Suppose for example in the first row fifth column is RED, Then second row fifth column should be other color.
How to do this.
Can any one solve this problem.
Thanks in advance.
Regards,
Kumarhi,
you can change the properties of the cell ie colors.
Coloring Individual Cells
This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by u201Cmoreu201D is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
The structure that should be included must be of type u201CLVC_T_SCOLu201D. If you want to color the entire row, this inner table should contain only one row with field u201Cfnameu201D is set to space, some color value at field u201Ccolu201D, u201C0u201D or u201C1u201D at fields u201Cintu201D (intensified) and u201Cinvu201D (inverse).
If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field u201Cfnameu201D. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table. But, it is also obvious that, this will be more time consuming than the method at section C.6.1.
Again key field coloring will override your settings. Thatu2019s why, we have another field in this inner table called u201Cnokeycolu201D. For each field represented in the inner table, set this field to u2018Xu2019 to prevent overriding of key color settings.
DATA BEGIN OF gt_list OCCURS 0
INCLUDE STRUCTURE SFLIGHT .
DATA rowcolor(4) TYPE c .
DATA cellcolors TYPE lvc_t_scol
DATA END OF gt_list .
DATA ls_cellcolor TYPE lvc_s_scol .
READ TABLE gt_list INDEX 5 .
ls_cellcolor-fname = 'SEATSOCC' .
ls_cellcolor-color-col = '7' .
ls_cellcolor-color-int = '1' .
APPEND ls_cellcolor TO gt_list-cellcolors .
MODIFY gt_list INDEX 5 .
regards,
Veeresh -
Adding new rows at run time in alv oops
HI ALL,
I have a created an editable alv report in oops. Now i have to add a new row having similar values as the previous row at run time when a custom button is clicked in the output and after entering some values in the new row and pressing the database must be updated and also the internal table at run time itself.
for example let us suppose i have the following row in the alv output.
MATNR DESCRIPTION NAME DATE
001 TEST MATRIKS 10092001
NOW if we click the custom button added on the alv toolbar, it should a new row at the run time similar to previous row as shown below
MATNR DESCRIPTION NAME DATE
001 TEST MATRIKS 10092001
001 TEST MATRIKS 10092001 -> NEW ROW.
can we do it in alv oops? pls let me know the soln or any helpful links
thanks
johnHi John,
I dont think, you can find any method for that,
one way what I can suggest is
Get the selected row index.
Insert the blank row in your internal table at this index
Refresh the container.
Hope this will help.
Thanks,
Anmol. -
Hi
Im using ALV OOPS.o/p I have 10 records with checkbox(at user command I have to select record selected by check box). Now on the menu bar I hav a button for "SELECT ALL". If "selected all" 10 recored will be selected. If I filter upon some criteria no. of records will be 3..Now in GUI if I select SELECT all it will display 3 records r selected, but I have to process further internally ,,,but internally 10 records are selected. So how to write code for that is after filterring 3 records r selected and I "select all"..only 3 records will be selected instead of 10?
Part of my code like this..
SELECT all
CALL METHOD G_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
IF L_VALID EQ 'X'.
LOOP AT PT_OUTTAB INTO LS_OUTTAB.
DATA LS_CELLTAB TYPE LVC_S_STYL.
LOOP AT PS_OUTTAB-CELLTAB INTO LS_CELLTAB.
IF LS_CELLTAB-FIELDNAME = 'CHECKBOX'.
IF LS_CELLTAB-STYLE EQ CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
P_LOCKED = 'X'.
ELSE.
P_LOCKED = SPACE.
ENDIF.
ENDIF.
ENDLOOP.
IF L_LOCKED IS INITIAL
AND NOT LS_OUTTAB-CHECKBOX EQ '-'.
LS_OUTTAB-CHECKBOX = 'X'.
ENDIF.
MODIFY PT_OUTTAB FROM LS_OUTTAB.
ENDLOOP.
CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY.
ENDIF.Hello Kaushik
Using method go_grid->GET_FILTERED_ENTRIES you get an index list of the filtered entries.
DATA: lt_filtered TYPE lvc_t_fidx,
ld_indx LIKE LINE OF lt_filtered.
CALL METHOD go_grid->GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = lt_filtered.
LOOP AT lt_filtered INTO ld_indx.
READ TABLE gt_outtab INTO ls_outtab INDEX ld_indx.
ENDLOOP.
Regards
Uwe -
Animated gif and page refresh problem
Animated gif and page refresh problem
Hi There,
I'm trying to build a simple "Please wait......" screen using jsp and javascript.
So far all is going well except that my animatate gif keeps refreshing everything the page is refresh.
Is there a way the i can prevent the body of the page from refreshing?
below is my sample code:
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:useBean id="StatusBean" class="com1.CandidateRelease" scope="session"/>
<html>
<script LANGUAGE="JavaScript">
function refresh()
<% if (StatusBean.isRunning()) { %>
//setTimeout("refresh()", 1000);
setTimeout("location='status.jsf'", 1000);
<% }else{%>
window.location= "busStopAdmin.jsf";
<%} %>
</script>
<head>
<script LANGUAGE="JavaScript">
refresh();
</script>
</head>
<body>
<img id="myImage" src="../img/ojp_wait.gif" alt="" width="151" height="36">
</body>
</html>Animated gif and page refresh problem
Hi There,
I'm trying to build a simple "Please wait......" screen using jsp and javascript.
So far all is going well except that my animatate gif keeps refreshing everything the page is refresh.
Is there a way the i can prevent the body of the page from refreshing?
below is my sample code:
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:useBean id="StatusBean" class="com1.CandidateRelease" scope="session"/>
<html>
<script LANGUAGE="JavaScript">
function refresh()
<% if (StatusBean.isRunning()) { %>
//setTimeout("refresh()", 1000);
setTimeout("location='status.jsf'", 1000);
<% }else{%>
window.location= "busStopAdmin.jsf";
<%} %>
</script>
<head>
<script LANGUAGE="JavaScript">
refresh();
</script>
</head>
<body>
<img id="myImage" src="../img/ojp_wait.gif" alt="" width="151" height="36">
</body>
</html>
Maybe you are looking for
-
Web Camera doesn't work on Satellite L50D
Satellite L50D-B-136 Trying got get web camera to work, without success. Apparently web camera initialization failed according to Toshiba Web Camera Application.
-
How to get US calendar related data
Hi All, The standara function Calendar.getInstance(); will return Georgian calendar details . How to modify this to get US calendar details . Regards Vinay P.
-
Easy Print graphics properties
Hi, We're running a single 2012 R2 session host through a 2012 RTM RDG / RDWeb / RDCB. Clients are all Win7 SP1 running RDP 8.1. The issue is that graphics are poor quality when printing through Easy Print. I can see by testing with CutePDF locally o
-
Why do i see missing plug ins PDF Format.aip when starting my ai
why do i see missing plug ins pdf format.aip when starting my ai
-
Qualified Tables - Loop with Expression
Hi Experts, Is there any way to setup a validation to loop over qualified links and check if a specific field has a value (not being NULL)? For example I have the following qualified links of qualified table Location Data for a Main Table Record (Mat