ALV refresh problem while navigating from user command - abap

I have 2 screens 7000 and 7001, 7000 screen contains one button when we click on it it has to navigate to the 7001 screen, but it was not working as expected. SCREEN 7000 also have some details to display as an alv.
screen was navigating to screen 7001 but the data was not getting refresh.
can any one help on it. I am using alv grid container.
for both the screens i am using same alv grid
Sample code:
screen 7000 PAI:
WHEN 'DISPLAY'.
call SCREEN 7001.
screen 7001 PBO:
GET REFERENCE OF m_instance->gt_field INTO lr_output.
CREATE OBJECT gr_grid
EXPORTING
i_parent = cl_gui_container=>default_screen.
CALL FUNCTION 'ZLSO_GENERATE_GENERIC_FIELDCAT'
EXPORTING
ir_input_value = lr_output
IMPORTING
et_fieldcat_fcat = lt_fldcat
EXCEPTIONS
xc_invalid_type = 1
xc_empty_table = 2
xc_unknown_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ' Error in generating ALV' TYPE 'E'.
ENDIF.
CALL METHOD gr_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_fieldcatalog = lt_fldcat
it_outtab = m_instance->gt_field.
gr_grid->refresh_table_display( ).

1) The main issue
Probably you are experiencing the case that several UI controls are assigned to the same UI container, only the first control assigned is displayed.
To avoid that issue, you must free the extra controls so that only one control remains assigned to each container.
In your case, you have 2 ALV Grids assigned to the same dummy container DEFAULT_SCREEN; your control being an instance of the class CL_GUI_ALV_GRID, you may call the method FREE to free it.
2) There's another problem in your code
The solution above should solve your immediate issue, but that will create another one, because you will have to re-instantiate the ALV Grid when navigating back to the screen 7000, and that will reset the scroll position and so on.
You may avoid it by changing something else in your code, as I explain below.
A dynpro (ABAP screen) contains UI elements, but if you assign a control to a "dummy screen" (any of the static attributes *SCREEN* of CL_GUI_CONTAINER), this control will be displayed over the dynpro (the UI elements of the dynpro are not shown at all, except the toolbar).
Instead of using dummy screens, you should define a custom control area in your dynpro, give it a name, then in the PBO, create a custom container (class CL_GUI_CUSTOM_CONTAINER) by indicating the area name, and assign the ALV Grid to that container.
If you do that in your two screens, then you will have only one ALV Grid per container, and you won't need to free and re-instantiate the controls at each navigation step.

Related

Having trouble setting DevExpress CheckEdit.EditValue to True. EditValue remains as Nothing even when assigning a value

I have an Xtra Tab Control which contains 6 tab pages. On each of these tab pages lives a User Control which contains a Check Edit on a Binding Navigator that I want to default to checked when creating the form as shown below (worth noting that I am using a library for the Binding Navigator and this code cannot be changed):
To do this I thought I'd be fine putting the code in the Initialise method of the User Control so when creating the User Control for each of these tabs I'd be able to set the EditValue to True but unfortunately even when assigning the EditValue to True the EditValue just remains as Nothing (Indeterminate)
I've managed to get the check edit on the first User Control to set by default by using the UserControl_Loaded event, however, for the other 5 tabs the value is not checked as the Loaded event hasn't fired for these yet until the tab is selected.
Any help is appreciated.
Loop through the tabpages to load them

FormGroup still have controls although deleted dynamically

We have angular page with structure of Left bar (Say Component A), Main content (Say Component B)and right side bar (Say Component C).
Under Left bar , we have dynamically added custom controls. Custom control has say 2 textbox (with validations) and a button. There is button called "Delete" under each control so that that control would be deleted if clicked.
Right Side bar has button say "Save" . Once user clicks on it validation do get fired (if applicable) or saves data.
Issue:
Lets Say I have 5 controls on Left side bar. Lets say their names are ctrl01,ctrl02,ctrl03,ctrl04,ctrl05
When I click on delete button of ctrl02 , It gets Deleted. and then FormGroup has only 4 records ctrl01,ctrl03,ctrl04,ctrl05 and so is UI
However when I Delete ctrl03/ctrl04/ctrl05 the object are Deleted from UI but FormGroup still has ctrl01,ctrl02,ctrl03,ctrl04,ctrl05.
So, Application doesn't Save data for ctrl01 as Validation gets fired for controls which are deleted(ctrl03,ctrl04,ctrl05) but still part of FormGroup.
Please note this issue occurs only after Deleting 2nd and onwards controls .For First it works fine.
I also checked if Object holding all these records is properly updated or not after Deleting. It is updating properly. That's why UI shows correct number of Custom controls. Its just FormGroup which is causing this issue.

VB.NET Win. Form - Showing a custom control outside of the container control

I have a created a custom user control which consists of 2 controls:-
Textbox
Listbox
The function of this control is to act as a dropdown list. Below is the image of the control:-
Problem
Now the problem i am facing is that if i insert this user control into a container control like a panel then the list gets hidden inside that container control.
and if i just create the user control outside the container control then it would interfere with the Tab Order (focus order) of the form.
Is there any work around where the user control exists in the container control and still shows the complete list without being hidden in the panel?
Edit i wrongly added c# instead of VB.NET
It can be achieved by having the list as ToolStripDropDown. Similar customization have been done in the following discussion,
Show control inside user control outside the boundaries of its parent
Hope this suits you.

Option Group frame: can I add text boxes that are part of the frame instead of rad button options?

Ok so this maybe a simple/silly question but I don't know so here goes:
In access let's say I want to have a frame control, so I click the option group button and add it to the desgin surface. However, I am not wanting to use this as a option group with radio button selection, instead I would like to add text boxes instead the frame, so that when I reference the frame, it references every control instead of it, hence the text boxes, cbo boxes, etc.....just as it would if they were radio option selections.
So can you do this?
I want whatever controls I add inside the frame to be easily referenced (i.e. make all controls visible just by using frameExample.visible = true) so that I can build my own tab control groupings.....
can this be done?
Thanks!
EDIT:
What I am trying to accomplish is having a form that includes a collection of controls (input controls - cbo boxes, text boxes, etc), that serve as the Main record information. These are saved to a table via an INSERT statement on button_click because this form is unbound.
Next I have 8 categories that are relative per each main record (and data that goes along with it). Each of these categories could have a sub form area and a button click that bring it's relative form into the sub form area. These sub forms would be unbound as well as I would just save data via SQL statement. So i know I could accomplish this by running the insert statement from the parent form, on the main collection control's data that would create the KeyID number, then run a SQL statement that would turn around and load that KeyID number right back onto the page in a hidden text box.
Then when I click one of the sub forms and load its relative collection of controls, I could then save that data along with KeyID for each of these sub-forms/tables.
SO......
I was wondering if instead you could define these controls as a collection so that you could hide and make visible all the ones you need on button clicks and avoid the need for additional forms (subs). I know that if a user enters data into a text box, and then somewhere along the way that box becomes hidden, the data still exists in it and still ends up in the SQL statement....
So I want all these controls to exist on the same form, but I thought what is I could encapsulate them into a frame like an option group, then I could call the frame and all the relative controls would be called up (made visible) as needed.
Sorry for the long explanation but I thought it would help.
I do not think you can do it with an Option Group, but what you are describing is pretty much a subform, yesno?
Some examples of hiding the tab control from an app that went live in March 1998:
Tab driven by transparent command buttons over labels styled to look like colored command buttons:
Same approach, more buttons:
In this case, fake colored command buttons don't drive the tab, but insted show/hide the tab and a subform. In this case, the tab is actually driven by the listbox:
A view of when the tab is hidden and the subform revealed. The listbox drives navigation within the subform, which has a visible tab on it:
So, there's a lot that can be done without showing the tab control.

How to delete the Scrollbar in a class derived from wxHtmlListBox?

In widgets, I have a class named CListCtr which derived from wxHtmlListBox. The list contains 100 items, but I just want to show 10 items in one page and when I press button pagedown I will get another page to show another 10 items. I do not need the scrollbar. But it is always added when created the class.
How can I delete the scrollbar or not create it?
wxHtmlListBox is a specialized wxVScrolledWindow, which handles the scrollbar itself. Naturally, when there are more list items in the list than can be shown at the same time in the client area, a scrollbar will appear.
Note however that there's nothing to say that your wxHtmlListBox needs to contain all available items. If you give it enough space for 10 items, just call SetItemCount(10) instead of SetItemCount(100), and you will get no scrollbar. You can handle the page up / page down or any other navigation keys yourself, and invalidate the contents of your wxHtmlListBox. Since it is a virtual control you don't need to change any data, you just return the next or previous 10 items in your list in the OnGetItem() and OnGetItemMarkup() methods of your derived class.
Please note that this is just an idea how to implement this, I think it's not a good thing to do. The scrollbar is the indicator that there is more data and where the user is relative to begin and end of the data. Don't break the assumptions the user has. How is he to know that page up / down will scroll the visible data?