Refreshing alv container
I have editable alv container in a module pool which runs through transaction code.the problem is each time the editabale alv is displayed the old values remain....How can i refresh my alv container?
Hi Priya,
you can try with --
CALL METHOD grid->refresh_table_display.
CLEAR: gh_index.
Thanks,
Venkat
Similar Messages
-
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 -
Capture ALV container event and change data in screen header
Hi,
I have a REPORT calling a custom screen with a header section and an ALV container displaying ITEMS.
<b>Situation:</b>
If I use the FILTER button on the ALV container, it works fine but I wish to capture the details, so that I can change my header data accordingly.
<b>Example</b>
e.g : Suppose the ALV container on the screen displays 4 lines of data.
So my header area displays '4' as the no of items displayed
Now when I use FILTER button on the ALV container, it then dispalys only '2' lines of data as per the filter criteria. Now how do I capture this details so that my header now displays 2 instead of 4.
Basically I want my HEADER data to get refreshed whenever I use the filter button to change the number of data lines dispalyed.
Hope I make some sense with the example.
Appreciate if you gurus could help ..
Thanks and Regards
RKCan you post your code.
Regards,
Rich Heilman -
Hi,
how to refresh an ALV LIST display?
Thanks.Hi,
Content and Structure Change
Use
You are able to change the internal data table in various ways. Depending on which type of change you use, you have to proceed differently to make the change visible on the front end in the ALV output as well.
You are able to make the following changes:
· You change content or the sequence of the individual data records
Afterwards you need to refresh the ALV output
· You replace the entire data table
Refresh Display of the ALV Output
If you have changed single values, added rows or deleted rows in the data table of list-type ALV outputs, you need to complete these changes in the ALV output as well by refreshing the ALV display.
For Changes in the Tree Structure you do not have to refresh the display. In the other ALV tools, you do not have to refresh the ALV output when you make the following changes:
§ Changes to the Display of Columns
§ Changes Sequence of Columns in the ALV display
§ Changes to the DDIC Reference of Columns
By default, the ALV output automatically scrolls to the beginning. However, you are able to determine that the current display (position on the screen) not be changed.
You are able to refresh the ALV output in two ways:
· All settings for filters and sorting remain.
This setting can lead to newly inserted data records not being displayed because the filter setting hid exactly these data records.
· All settings for filters and sorting remain.
Features
For changes to content and structure, you are able to make the following settings:
· Refresh ALV output
· Swap the data table of the ALV output
Refresh ALV output
With the refresh, you ensure that the changed values are available on the front end as well.
Display type
ALV Tool
Classic ABAP list
Full screen
In the Container
Simple, two-dimensional table
Yes
Yes
Yes
Hierarchical-sequential list
Yes
Tree structure
No
No
Methods
Function
Class
Method
Refresh ALV output without deleting filter and sort settings
CL_SALV_TABLE
CL_SALV_HIERSEQ_TABLE
REFRESH
(Parameter REFRESH_MODE: SOFT)
Refresh ALV output and delete filter and sort settings
REFRESH
(Parameter REFRESH_MODE: FULL)
Change the Structure of the Data Table with SET_DATA
Depending on which ALV tool you are using, the parameters of the SET_DATA method are different:
If you assign a new structure with SET_DATA, all objects that referred to the previous structure will be deleted such as all sort objects in list-type ALV outputs or all node objects in tree structures.
Methods
Function
Class
Method
Change structure and data table
CL_SALV_TABLE
CL_SALV_HIERSEQ_TABLE
CL_SALV_TREE
CL_SALV_HIERSEQ_LEVEL
SET_DATA
Change the Structure of the Data Table with the SET_DATA Method
ALV Tool
Parameter
Remarks
Simple, two-dimensional table
T_TABLE
Table for structure and contents of the ALV output
Hierarchical-sequential list
(in CL_SALV_HIERSEQ_TABLE)
LEVEL
Hierarchy level whose structure you wish to change
T_TABLE
New table of hierarchy level
T_BINDING
List of up to five foreign-key relationships
(in CL_SALV_HIERSEQ_LEVEL)
VALUE
New table of hierarchy level
T_BINDING
List of up to five foreign-key relationships
Tree structure
T_TABLE
Initial table
Empty table, only sets the structure -
Hi ,
I am trying to print the contents from the ALV Container,This is a pop-up screen
displaying details of the line selected in the ALV report.
Standard tool bar print button is available, and it works, but I also have the print icon in bottom of the screen , which should print the container contents.
Not sure what custom code shd go in for printing,
Looked into the std BCALV * programs, but no luck so far.
Appreciate any help.
Thank you
LalithaHi Joseph,
in my case these are the settings...
Just change your spool settings also ..
in my case
SAP Cover Page System Administrator: Default Settings
OS Covert Sheet System Administrator: Default Settings
ALV statastics NO
i think for your case ALV statastics is markes as YES is it true.
Can you change the settings.
Regards
Vijay -
Creat icon to display no of entries in ALV container
HI,
I have to display no of records on push button type icon,
it should directly display no of entries like'50 hits'.Need not to give any function code,we need not to click push button,it should display like text on button,
button should be added in alv container tool bar.
I am giving output in alv on subscreenHANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE.
define gloabal variable to populate the no of records.and use the variable
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
* append a separator to normal toolbar
CLEAR LS_TOOLBAR.
MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
* append an icon to to save data
CLEAR LS_TOOLBAR.
MOVE 'TOTAL' TO LS_TOOLBAR-FUNCTION.
<b> MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON. "Choose your Icon</b>
MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
<b> MOVE V_VAR TO LS_TOOLBAR-TEXT.</b>
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR LS_TOOLBAR.
* append a separator to normal toolbar
CLEAR LS_TOOLBAR.
MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "handle_toolbar
Before creating the ALV GRID object try to populate the variable V_VAR with no of records.
obvious you need to set the handler to appear in the toolbar.
Regards
vijay -
HI
I WANT TO REFREAH ALV AFTER I PRES ON BUTTON.
WHEN I USE REUSE_ALV_GRID_DISPLAY
IN USER-COMMAND I USE
FORM USER_COMMAND USING P_UCOMM TYPE SYUCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
P_SELFIELD-REFRESH = 'X'
how can i refresh when i use class
CL_SALV_TABLE?
thanks
have nice dayhi yossi,
check these links..
Refresh in ALV.
Alv Grid and Refresh Button
ALV grid Refresh.
http://www.sap-img.com/abap/how-to-refresh-alv-list-grid-once-it-is-displayed.htm
http://sap.ittoolbox.com/groups/career/SAP-CAREER/refresh-alv-report-421919
Re: Refresh ALV with a new value
Re: Update/refresh ALV grid -
Refreshing ALV when action is triggered using button
Hello Friends,
I have a drop down list having 3 values "Last 30 Days", "Last 60 Days" and "Last 90 Days". If I select Last 30 Days and click on button "Search" it gives me record for the last 30 days. But, if I click again on "Last 60 Days" it duplicates the record that was already in. So it does not refresh the previous result. I have added the code as below to refresh ALV but, it refresh the table but not the ALV. My View name is "MY PO INVOICES" and the context node name is 'MY_PO_INV' .
DATA ln_node type REF TO if_wd_context_node.
ln_node = wd_context->get_child_node( 'MY_PO_INV' ).
ln_node->invalidate( ).
Please let me know how do I refresth the result in the ALV display when I trigger the event.
Thks & Rgds,
HemalHello All,
Thanks very much for your responses. I tried to bind the alv table. But, I think I am doing some thing wrong here. Below is my code. Please let me know where I am doing wrong. Appreciate your help.
lv_thirtydays = 'LAST 30 DAYS'.
lv_sixtydays = 'LAST 60 DAYS'.
lv_ninetydays = 'LAST 90 DAYS'.
if ZDAYS = lv_thirtydays.
lv_zpostingdate = sy-datum - 30.
ENDIF.
lv_zpostingdate_to = sy-datum.
if ZDAYS = lv_sixtydays.
lv_zpostingdate = sy-datum - 60.
ENDIF.
if ZDAYS = lv_ninetydays.
lv_zpostingdate = sy-datum - 90.
ENDIF.
ln_node = wd_context->get_child_node( 'MY_PO_INV' ).
ln_node->invalidate( ).
LOOP AT lt_context_value_set INTO cocd_context_value_set.
lv_zcompany = cocd_context_value_set-text.
lv_zusername = username.
lv_zdays = ZDAYS.
CALL FUNCTION 'ZEBP_MY_PO_INV_SEARCH'
EXPORTING
bldat = lv_zpostingdate
bldat_to = lv_zpostingdate_to
bukrs = lv_zcompany
usnam = lv_zusername
ZDAYS = lv_zdays
tables
invsrch = zsearch.
ln_node->bind_table( zsearch ) .
SORT zsearch BY zcompany.
DATA lo_nd_get_po_inv TYPE REF TO if_wd_context_node.
lo_nd_get_po_inv = wd_context->get_child_node( name = wd_this->wdctx_my_po_inv ).
CALL METHOD lo_nd_get_po_inv->bind_table
EXPORTING
new_items = zsearch.
ENDLOOP.
Thks & Rgds,
Hemal -
Dear experts,
I have used REUSE_ALV_GRID_DISPLAY to display some data of an internal table. I modified it and I need to display the refreshed data again.
How can I do that?
Thank you...
RoxaniHi,
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 :-
<b>call method grid (name of grid )->refresh_table_display
exporting
IS_STABLE = <STRUCT OF TYPE LVC_S_STBL> (THIS IS FOR DATA REFRESHING)</b>
<b>I_SOFT_REFRESH = <VARIABLE OF CHAR 01> (THIS IS FOR ICON REFRESHING).</b>
<b>Refresh grid display</b>
Use the grid method REFRESH_TABLE_DISPLAY
<b>Sample code:-</b>
http://www.erpgenie.com/sap/abap/controls/alvgrid.htm#Refresh%20grid%20display
TO refresh the ALV Lsit :
http://www.sap-basis-abap.com/abap/auto-refresh-alv-list.htm
Regards
Sudheer -
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 -
How to refresh data contained in CachedRowSet
Hi all,
I need to refresh data contained in CachedRowSet. I hope I don't have to call populate or execute again since I'm afraid this will need a big overhead. All I want is to be updated when other user add or delete any records.
Any advice would be greatly appreciated.
Setyaessentially you want a live and sensitive cursor. perhaps you are missing the point of a cache. you can't have your cake and eat it too.
in summary you need to refresh the whole thing. -
Hi All,
Please anyone suggest me, how can I use text-editor in ALV container?
Means when i execute the program, i want to see editor screen.
Thanks
Amitsee
Custom Controls
A custom control is an area on a screen. You create them in the Screen Painter, and, like all other screen objects, they have a unique name. You use custom controls to embed controls. Controls are software components of the presentation server. Depending on the used SAP GUI, these are either ActiveX Controls or JavaBeans. They allow you to perform tasks, such as editing texts, locally on the presentation server. The control is driven by the application logic, which still runs on the application server.
The SAP Control Framework
The controls on the presentation server and the ABAP application programs on the application server communicate using the SAP Control Framework. The SAP Control Framework is programmed in ABAP Objects . It contains global classes that can be found in the class library under Basis ® Frontend Services. These classes encapsulate the communication between the application server and presentation server, which is implemented using Remote Function Call.
All application controls are encapsulated in a global class. You can find the SAP Basis controls in the Class Browser under Basis ® Frontend Services or Basis ® Component Integration. Programs that use controls on a screen work with the methods and events of the global classes that encapsulates them.
Container Controls
Before you can work with a custom control on a screen, you must assign a SAP Container Control to it. Container controls are instances of special global classes from the SAP Control Framework. The global class for custom controls is called CL_GUI_CUSTOM_CONTAINER. To link a custom control to a container control, pass the custom control name to the constructor of the container control when you instantiate it using CREATE OBJECT.
As well as using custom containers, you can link controls to a screen using a SAP Docking Container. This is encapsulated in the global class CL_GUI_DOCKING_CONTAINER. The SAP Docking Container does not place the control within a screen. Instead, it attaches it to one of the four edges. You can nest containers. For example, you can use the SAP Splitter Container (classes CL_GUI_EASY_SPLITTER_CONTAINER or CL_GUI_SPLITTER_CONTAINER) within other containers. This allows you to split a custom control or docking control into more than one area, allowing you to embed more than one control.
Application Controls
You must also create instances for the application controls that you want to place within your container - for example, a SAP Textedit Control (class CL_GUI_TEXTEDIT) or a SAP Tree Control (for which there is more than one global class - an example is CL_GUI_SIMPLE_TREE). When you instantiate the control, you pass a reference to the container in which you want to place it to the PARENT parameter of its constructor method. The container may be an instance of the class CL_GUI_CUSTOM_CONTAINER, but can also be an instance of one of the other SAP Container controls.
Control Methods
For information about control methods and their documentation, refer to the class definitions in the Class Builder or the SAP Library documentation. To minimize the network load between the application and presentation servers, method calls are buffered in the automation queue before being sent to the presentation server at defined synchronization points. One of the automatic synchronization points is the end of PBO processing. You can force a synchronization point in your program by calling a method that is not buffered, or by calling the static method FLUSH.
Control Events
Unlike screens, on which user interaction triggers the PAI event and control returns to the application server, user interaction on controls is not automatically passed back to the application server. If you want an event to be passed back to the application server, you must register it in your program using the special method SET_REGISTERED_EVENTS. For a list of the events that you can register for each control, refer to its wrapper class in the Class Builder. You can register two kinds of event handling using SET_REGISTERED_EVENTS:
System Events (Default)
The event is passed to the application server, but does not trigger the PAI. If you have registered an event handler method in your ABAP program for the event (using the SET HANDLER statement), this method is executed on the application server.
Within the event handler method, you can use the static method SET_NEW_OK_CODE of the global class CL_GUI_CFW to set a function code and trigger the PAI event yourself. After the PAI has been processed, the PBO event of the next screen is triggered.
The advantage of using this technique is that the event handler method is executed automatically and there are no conflicts with the automatic input checks associated with the screen. The disadvantage is that the contents of the screen fields are not transported to the program, which means that obsolete values could appear on the next screen. You can work around this by using the SET_NEW_OK_CODE method to trigger field transport and the PAI event after the event handler has finished.
Application Events
The event is passed to the application server, and triggers the PAI. The function code that you pass contains an internal identifier. You do not have to evaluate this in your ABAP program. Instead, if you want to handle the event, you must include a method call in a PAI dialog module for the static method DISPATCH of the global class CL_GUI_CFW. If you have defined an event handler method in your ABAP program for the event (using the SET HANDLER statement), the DISPATCH method calls it. After the event handler has been processed, control returns to the PAI event after the DISPATCH statement and PAI processing continues.
The advantage of this is that you can specify yourself the point at which the event is handled, and the contents of the screen fields are transported to the application server beforehand. The disadvantage is that this kind of event handling can lead to conflicts with the automatic input checks on the screen, causing events to be lost.
Related Information
For further information about controls, and in particular, help on troubleshooting and optimizing synchronization, refer to BC Controls Tutorial and BC SAP Control Framework.
Example
The following example shows the difference between system and application events.
REPORT demo_custom_control .
Declarations *****************************************************
CLASS event_handler DEFINITION.
PUBLIC SECTION.
METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit
IMPORTING sender,
handle_f4 FOR EVENT f4 OF cl_gui_textedit
IMPORTING sender.
ENDCLASS.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
DATA: init,
container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit.
DATA: event_tab TYPE cntl_simple_events,
event TYPE cntl_simple_event.
DATA: line(256) TYPE c,
text_tab LIKE STANDARD TABLE OF line,
field LIKE line.
DATA handle TYPE REF TO event_handler.
Reporting Events ***************************************************
START-OF-SELECTION.
line = 'First line in TextEditControl'.
APPEND line TO text_tab.
line = '----
APPEND line TO text_tab.
line = '...'.
APPEND line TO text_tab.
CALL SCREEN 100.
Dialog Modules *****************************************************
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
IF init is initial.
init = 'X'.
CREATE OBJECT:
container EXPORTING container_name = 'TEXTEDIT',
editor EXPORTING parent = container,
handle.
event-eventid = cl_gui_textedit=>event_f1.
event-appl_event = ' '. "system event
APPEND event TO event_tab.
event-eventid = cl_gui_textedit=>event_f4.
event-appl_event = 'X'. "application event
APPEND event TO event_tab.
CALL METHOD: editor->set_registered_events
EXPORTING events = event_tab.
SET HANDLER handle->handle_f1
handle->handle_f4 FOR editor.
ENDIF.
CALL METHOD editor->set_text_as_stream
EXPORTING text = text_tab.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'INSERT'.
CALL METHOD editor->get_text_as_stream
IMPORTING text = text_tab.
WHEN 'F1'.
MESSAGE i888(sabapdocu) WITH text-001.
WHEN OTHERS.
MESSAGE i888(sabapdocu) WITH text-002.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
SET SCREEN 100.
ENDMODULE.
Class Implementations **********************************************
CLASS event_handler IMPLEMENTATION.
METHOD handle_f1.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-003.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING new_code = 'F1'.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
METHOD handle_f4.
DATA row TYPE i.
MESSAGE i888(sabapdocu) WITH text-004.
CALL METHOD sender->get_selection_pos
IMPORTING from_line = row.
CALL METHOD sender->get_line_text
EXPORTING line_number = row
IMPORTING text = field.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD.
ENDCLASS.
The layout of screen 100 is:
The screen contains an output field field and a custom control called textedit.
The flow logic of screen 100 is:
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
MODULE user_command_0100.
The GUI status SCREEN_100 has the functions BACK, EXIT, and CANCEL (all with type E) and the function INSERT (normal function).
There is a local class event_handler defined in the program. It contains event handler methods for the F1 and F4 events of global class CL_GUI_TEXTEDIT. When you run the program, the classes CL_GUI_CUSTOM_CONTROL, CL_GUI_TEXTEDIT, and event_handler are instantiated in the PBO of screen 100.
The container control is linked to the custom control on the screen, and the instance of the textedit control is linked to this container. The F1 and F4 events of the textedit control are registered using the SET_REGISTERED_EVENTS method to ensure that they are passed to the application server when they occur. F1 is defined as a system event, F4 as an application event. The event handler methods of the handle instance of the class event_handler are registered as handlers for the events.
Before screen 100 is displayed, the program fills the textedit control with the contents of table text_tab . The user can edit the text while the screen is displayed. If the user chooses INSERT, the PAI event is triggered and the current text from the textedit control is copied into table text_tab.
If the user chooses F1 on the textedit control, the handle_f1 method is executed. This assigns the contents of the line to the field field: The method SET_NEW_OK_CODE triggers the PAI event. It is this that ensures that the PBO is processed, and the contents of field are sent to the screen.
If the user chooses F4 on the textedit control, the PAI event is triggered. The DISPATCH method is called, and this triggers the method handle_f4. This assigns the contents of the line to the field field: Since the PAI processing continues after the event, the PBO event follows, and the field contents are transferred to the screen.
The contents of the textedit control are not passed to the internal table text_tab either after F1 or after F4. The contents of the textedit control are therefore overwritten in the PBO event with the previous contents of text_tab.
http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/755b94ca5911d299af5c9604c10e27/content.htm -
Problem in refreshing ALV data in container (OOALV)
Hello Experts, Good Day.
I am developing a Modulepool program which is having two screens, one (101) is for Entering data (used TC with wizard) then saves it in database table and another screen (102) is to display saved data. Now I am facing problem in second screen (102).
The problem I am facing is when I am displaying/calling 102 screen for multiple times, the internal table is getting updated but the previous ALV data is not getting updated/modified.
I have searched the forum and found some methods/procedures for refreshing the data but I am not able to achieve this.
Methods I found and Problems with them:
1. FREE the Container and Grid objects usng FREE( ) method.
If I free boht the Container and Grid objects data getting updated but another all the columns are getting displayed twice for second time, thrice for third time and so on... I have coded for this in PBO of 102 Screen.
If I Free only Grid object, totally the table is getting disappeared when I display ALV Second time.
2. When I use Refresh the table using CALL METHOD LR_GRID->REFRESH_TABLE_DISPLAY( ) then only second time the ALV is getting refreshed but if I display further it is displaying 2nd ALV data from 3rd time onwards (not getting updated from 3rd time).
Coded as below in PBO OF 102 Screen:
IF LR_GRID IS BOUND.
CALL METHOD LR_GRID->REFRESH_TABLE_DISPLAY( ).
ENDIF.
CREATE OBJECT LR_GRID
EXPORTING
I_PARENT = LR_CONT
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.
3. When I use FLUSH method: this is not at all working out, I have called this after displaying ALV in PBO.
CALL METHOD CL_GUI_CFW=>FLUSH( ).
CALL METHOD CL_GUI_CFW=>DISPATCH( ).
My code to display ALV which is written in PBO of 102 is attached, please find the attachment.
Experts, please let me know where I am going wrong. I wish to know the solution in all the above ways. Please help me.
Thanks & Regards,
VijayLR_GRID->SET_TABLE_FOR_FIRST_DISPLAY(
* EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER = 'X'
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME = 'ZGVK_MP_DEMO'
* IS_VARIANT =
* I_SAVE = 'X'
* I_DEFAULT = 'X'
* IS_LAYOUT =
CHANGING
IT_OUTTAB = GT_DATA[]
IT_FIELDCATALOG = LT_FCAT
* 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.
ENDIF. -
HI,
I am displaying my ALV grid in subscreen,i am using CALL METHOD g_alv_grid->set_table_for_first_display,it is working fine for first time but when user is changing input in first subscreen ,and click push button to call ALV grid in 2nd subscreen it is displaying previous records.how to clear the container ,I tried CALL METHOD g_alv_grid->refresh_table_display.but no result,Hi,
that means the problem is not with the REFRESH. since you are editing the grid the values are not updated to frontend. did you call this method in the PAI of the screen if not call this and try.
MODULE PAI INPUT.
CALL METHOD G_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
CALL METHOD CL_GUI_CFW=>FLUSH.
CALL METHOD CL_GUI_CFW=>DISPATCH.
okcode hadnlings here...
CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
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.
ENDMODULE. "pai INPUT
Regards
vijay -
Hi Experts,
I am using CL_GUI_ALV_GRID class to show ALV output in via docking container.
I am setting my ALV titlebar like following.
if gv_titlebar = 'CHANGE'.
ls_layout-grid_title = 'Change history'.
elseif gv_titlebar = 'DELETE'.
ls_layout-grid_title = 'History of deleted entries'.
endif.
ls_layout is the layout structure of ALV grid. Firstly it show 'Changed history'. Then when I check for delete, second title is set.
but 'change history' only is displayed. Value is correctly assigned. I checked in debugging. But it is not refreshed in ALV display.
refresh_table_display method is also called. Still it is not updated in output. Kindly help me out.
Thanks and regards,
Venkat.Hi Venkat,
In the User Command, populate the Layout Structure with new Title and call the method SET_FRONTEND_LAYOUT as follows.
ls_layout-grid_title = 'History of deleted entries'.
CALL METHOD o_grid->set_frontend_layout
EXPORTING
is_layout = ls_layout.
Thanks and Regards,
Rathish R Nair
Edited by: Rathish R Nair on Mar 25, 2011 7:56 AM
Maybe you are looking for
-
Losing network connection in 10.5.4
I have a recent problem with my internet connection. I have used the same computer (macbook) for 18 months in same address without other major problems; only change i can see have been the updates in the os X. I'm writing to these forums only because
-
Dynamic Column width for a report
Will the width property of a column be able to be set at run-time (i.e. ability to set the width of a column to an expression) in SQL Reporting Services 2008? One problem I have seen is the inability to set the width of columns in a report when you y
-
MAM Not Working After Applying Support Package
We have been lived with MAM 2.5 with SP16 for almost a year now. We recently applied support package 19 for ABAP and J2EE stacks but MAM stopped working right after that. To fix the problem we had to do the following steps: 1. Disable all SyncBO 2
-
Hi! I need to create a Web Service that can cache data in between multiple Web Service calls. If I'm not misstaken then stateful sessions keep data but still separate clients from each other. I need all clients to be able to access the same synchroni
-
Failed to run TS: SAP GUI 720 EN x64
We have several machines failed to run TS: SAP GUI 720 EN x64 Here's the smsts.log Failed to run the action: TaskSequence Failed. The operation completed successfully. (Error: 00000000; Source: Windows) TSManager 12/9/2013 12:33:50 PM 5020 (0x139C) S