06-16-2011 10:07 AM
Hello Experts ,
I have screen 100 with some elements , one of them is Custom Control with name 'OB_GUI_CUSTOM_CONTAINER_1'.
I want to make invisible this custom container in default, for this i use this code in pbo:
*************************************************************************
LOOP AT SCREEN.
CASE screen-name.
WHEN 'OB_GUI_CUSTOM_CONTAINER_1' .
screen-invisible = '1'.
screen-active = '0'.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
**************************************************************************
The problem is , this screen name not exist, i saw another elements in my screen like input fields, text fields, and pushbutton .
Why this is happend ? How can i make to my custom control to be invisible and not active in my screen ?
Thanks For The Help,
Avi.
06-16-2011 2:05 PM
You don't need a subscreen to make a custom container invisible (or any other container/control), just don't call the constructor (or free it if it has already been instantiated), it will appear empty. Am I wrong?
Sandra
06-16-2011 10:37 AM
Loop at screen only relates to classic controls , while custom container is an example of GUI control . There is no mechanism in SAP which allows to directly hide such controls. The only technique is by means of [switching subscreen|;. Basically it requires switching subscreen with the control with empty subscreen. This is the same technique used for expand/collaps functionality in many standard programs.
Regards
Marcin
06-16-2011 11:23 AM
Thanks for the help,
Can you tell me how can i do this in this way ?
You have idea how can i to invisibile my custom control in another way ? ( not with subscreen ) .
Thanks for the help.
Avi.
06-16-2011 11:39 AM
Thanks for the help,
>
> Can you tell me how can i do this in this way ?
>
> You have idea how can i to invisibile my custom control in another way ? ( not with subscreen ) .
>
> Thanks for the help.
>
> Avi.
There is really no big deal in working with subscreens. I doubt you will be able to achieve this w/o playing with screens. You could of course create two screen versions and switch them when you want to hide custom control, but this is very close to what subscreen technique requires. It's even less complicated and timeconsuming. So I recommend you don't be scary and go for something new to learn - subscreens. Once you understand the concept, you will see their pover in classical UI programming.
Regards
Marcin
06-16-2011 2:05 PM
You don't need a subscreen to make a custom container invisible (or any other container/control), just don't call the constructor (or free it if it has already been instantiated), it will appear empty. Am I wrong?
Sandra
06-16-2011 2:28 PM
Thanks, you don't wrong, i do this but i want to click on pushbutton and disappear custom, and click another pushbutton
and take the custom again , it is not simple for me because i have user command from my alv custom to another screens ,
Can you tell me exactly what you mean ?
Thanks for the help.
Avi.
06-16-2011 3:07 PM
Avi,
if you want to display your custom container (by the way, what does it contain?) in front of the ALV, you just have to use CALL SCREEN screen_number, that screen contains your custom container. You leave that screen by using SET SCREEN 0, and you return to the ALV... Why do you need to make its content invisible?
Sandra
06-16-2011 3:15 PM
Hello sandra,
in my screen 100 i have some elements like input fields , and text fields .
I want in defaults that my custom control will not be display , and with pushbutton i will display my custom , on click another
pushbutton the custom will be display again.
Thanks For The Help.
Avi.
06-16-2011 3:37 PM
Hello Avi,
As Sandra has mentioned if you don't need the Custom Container(CC) don't create the object in the PBO of your screen!
In the PAI module, instantiate the CC(if not done so) otherwise free the element. Something like this:
MODULE pai INPUT.
DATA: text_area TYPE REF TO cl_gui_custom_container,
text_view TYPE REF TO cl_gui_textedit.
CASE ok_code.
WHEN 'EXIT'. "Exit from the screen
LEAVE TO SCREEN 0.
WHEN 'PICK'. "Pushbutton OK-Code
IF text_area IS BOUND.
text_area->free( ). "Desturctor
text_view->free( ).
CLEAR: text_area, text_view.
ELSE.
CREATE OBJECT:
text_area
EXPORTING
container_name = 'TEXT',
text_view
EXPORTING
parent = text_area
wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
wordwrap_position = 80
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
text_view->set_statusbar_mode(
statusbar_mode = cl_gui_textedit=>false ).
text_view->set_toolbar_mode(
toolbar_mode = cl_gui_textedit=>false ).
ENDIF.
ENDCASE.
ENDMODULE. " PAI INPUT
BR,
Suhas
06-16-2011 3:40 PM
@Sandra
By hiding container I would understand hiding custom area used for embeding this GUI control instance, so in fact skipping instantiation of control doesn't assure this area on canvas to be hidden. This I guess apply only for subscreen area when runtime compression is on, but not for this type of area
@Avi
Follow these steps:
- create main screen 100 where you place your input fields, texts ect but w/o custom area (for custom container), place there also subscreen area for the subscreen
"screen 100 flow
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN area_name INCLUDING sy-repid g_dynnr.
PROCESS AFTER INPUT.
CALL SUBSCREEN area_name.
MODULE PAI_100.
- create subscreen 101 and place there only custom area
- create empty subscreen 102
- create ABAP program which by default will set screen with custom area, and on PAI action will display the other one
data g_dynnr type sy-dynnr value '0101'. "default subscreen
MODULE pai_100 INPUT.
if ok_code = 'FC_PUSH'. "pushbutton function code on screen 100
"switch subscreens
case g_dynnr.
when '0101'.
g_dynnr = '0102'.
when '0102'.
g_dynnr = '0101'.
endcase.
endif.
ENDMODULE.
- enjoy with power of subscreens:)
Regards
Marcin
You may want to have a look at sample program DEMO_DYNPRO_SUBSCREENS too.
Edited by: Marcin Pciak on Jun 16, 2011 4:40 PM
06-16-2011 4:16 PM
Hello Marcin,
By hiding container I would understand hiding custom area used for embeding this GUI control instance, so in fact skipping instantiation of control doesn't assure this area on canvas to be hidden.
If i understand correctly you mean to say if we don't instantiate the CC object, then the CC area is present on the screen but has no object linked to it! So technically speaking it is not hidden.
Can you please explain in detail(as usual) on this one?
BR,
Suhas
06-16-2011 5:59 PM
Thanks ,
i will check this code.
Avi.
Edited by: avi azulay on Jun 16, 2011 8:16 PM
06-16-2011 8:09 PM
If i understand correctly you mean to say if we don't instantiate the CC object, then the CC area is present on the screen but has no object linked to it! So technically speaking it is not hidden.
Exactly! and this custom area (container for a container) still occupies a place on the screen. Moreover you can't compress this area (so it would be hidden if no object is linked to it), whereas this is working fine for subscreen area.
Regards
Marcin
06-16-2011 8:31 PM
At least, there were 2 possibilities proposed here, but we can't assume which one fits best Avi's requirement...
06-16-2011 9:39 PM
Thanks sandra , and thanks all people which help me,
I was use in 2 subscreen area.
Thanks for the help,
Avi.
05-06-2014 2:05 PM