‎2012 Nov 05 12:39 PM
Hi all,
I have a SELECTION-SCREEN in my program - well, two of them. In the first, I have not entered a specific dynnr, so it is the default SELscreen with dynnr 1000. I have a Dropdown list in that one.
The issue is, that SELscreen used to appear in the upper left-hand corner of my screen by default. That is not especially nice, I would like to display it AS WINDOW, positioned near the middle of the screen. I can do that - but then the Dropdown list is crippled - there is only the empty field. I can click the triangle on the right and something is visible below the field - just the very beginning of the list, maybe 1mm.
I have tried by leaving some more space below using the SKIP command, but to no avail.
Can anybody tell me what is the trick?
Thanks a lot!
Best regards,
Sapperdapper
‎2012 Nov 06 9:20 AM
Hi,
We do not need any fm. Just add it to the event at selection-screen output. I have edited the code.
‎2012 Nov 05 1:07 PM
Hi,
maybe posting the code here will make it somewhat easier for you to tell me what is wrong, so here it is:
*&---------------------------------------------------------------------*
*& Include ZFH_GUI_DOC_CREATION_SELSCREEN *
*&---------------------------------------------------------------------*
* First, there will be a SELECTION SCREEN
* with a Dropdown list from which the user
* can select what type of document he wants.
* We need one FIELD-SYMBOL here to hold the value for the
* language chosen.
FIELD-SYMBOLS <LG>.
*******************************************************************
*** The INITIALIZATION event: Everything within this block (it ends
*** only implicitly with the beginning of a new event-block) is
*** executed before displaying the SELECTION SCREEN.
*******************************************************************
TYPE-POOLS: VRM. "Value request manager
DATA: l_name TYPE vrm_id,
li_list TYPE vrm_values,
l_value LIKE LINE OF li_list.
* The values for the Dropdown listbox
* have to be typed up. They are stored in their
* own INCLUDE just for purposes of clarity.
**********************************************************************
* Following, the values for our Dropdown_list (all the different types
* of documents we want to provide tables for) have to be typed up,
* each one with a block like the following.
**********************************************************************
l_value-key = '1'.
l_value-text = 'Accounting_vendor'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '2'.
l_value-text = 'Accounting_customer'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '3'.
l_value-text = 'Personnel'.
APPEND l_value TO li_list.
CLEAR l_value.
l_name = 'TYPED'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = l_name
values = li_list
EXCEPTIONS
id_illegal_name = 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.
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS WINDOW.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(65) text-030 FOR FIELD TYPED.
SELECTION-SCREEN POSITION 70.
PARAMETERS: TYPED AS LISTBOX VISIBLE LENGTH 30 OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 9.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(65) text-031 FOR FIELD LANG.
SELECTION-SCREEN POSITION 70.
PARAMETERS LANG TYPE C LENGTH 2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(83) text-032.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF SCREEN 1001.
‎2012 Nov 06 5:35 AM
Please read the f1 help of "CALL SELECTION-SCREEN", It explains how to use window co-ordinates.
‎2012 Nov 06 8:27 AM
Hi Kesavadas,
Thank you!
I know how to use the coordinates. I can have my SELscreen displayed in the middle of my screen all right - what I don't know is the nature of the effect that has on the listbox - as I wrote, if I do that, my listbox is reduced to approx. 1mm or less - I can click the triangle on the right and I see something happening, but none of the options in there become visible.
I tried introducing a SKIP command - in the language I worked with before this, you had to leave some empty space underneath a Dropdown list to make it work - but that wasn't it.
Well, I'll try.
Best regards,
Sapperdapper
‎2012 Nov 06 9:05 AM
Hi,
This should solve your problem.
field-symbols <lg>.
type-pools: vrm.
data: l_name type vrm_id,
li_list type vrm_values,
it_return type standard table of ddshretval,
l_value like line of li_list.
selection-screen begin of screen 1001 as window.
selection-screen begin of line.
selection-screen comment 01(20) text-030 for field typed.
selection-screen position 22.
parameters: typed as listbox visible length 30 obligatory.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 01(20) text-031 for field lang.
selection-screen position 22.
parameters lang type c length 2.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 01(83) text-032.
selection-screen end of line.
selection-screen end of screen 1001.
at selection-screen output.
clear li_list.
l_value-key = '1'.
l_value-text = 'Accounting_vendor'.
append l_value to li_list.
clear l_value.
l_value-key = '2'.
l_value-text = 'Accounting_customer'.
append l_value to li_list.
clear l_value.
l_value-key = '3'.
l_value-text = 'Personnel'.
append l_value to li_list.
clear l_value.
l_name = 'TYPED'.
call function 'VRM_SET_VALUES'
exporting
id = l_name
values = li_list
exceptions
id_illegal_name = 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.
start-of-selection.
call selection-screen '1001' starting at 8 12.
if sy-subrc = 0.
write typed.
endif.
‎2012 Nov 06 9:20 AM
Hi,
We do not need any fm. Just add it to the event at selection-screen output. I have edited the code.
‎2012 Nov 06 9:22 AM
Sorry, I guess I was reading on the wrong tab.
I have to compare your code to mine to see what you are actually doing differently.
Best regards,
Sapperdapper
‎2012 Nov 06 9:27 AM
Your initial code did not have any "events" to be processed when the selection screen was called. This was your issue.
‎2012 Nov 06 9:31 AM
True.
I did fill the values for the function 'VRM_SET_VALUES', but not in an event-block. That is likely. I have already had a bunch of problems with SAP telling me there was an out-of-memory-issue just because the order of events in my program was somehow wrong. Up to now, I could always solve those issues by fixing the order of events.
I'll try.
Thanks!
Best regards,
Sapperdapper
P.S.: Oh no - I cannot tell if it works because now I have another issue: There is a second SELECTION-SCREEN defined in my program and it also uses an AT SELECTION-SCREEN OUTPUT event - apparently I cannot have two of those in my program. Well, I'll see if I can rearrange that. The second SELscreen is also called AS WINDOW, so I should be able to also define it in the INITIALIZATION event-block and call it in the START-OF-SELECTION block.
‎2012 Nov 06 9:51 AM
The screen field names in each screen will be different, so you can use a single event for all screens. Just try to include the check if li_list[] is initial...endif etc etc. Many possibilities
‎2012 Nov 06 9:55 AM
Hi Kesavadas,
no, it doesn't work.
I have now rearranged everything a bit: Both SELscreens I have - both AS WINDOW - are packed each in their own INCLUDE and following the two there is an AT SEL... event where I populate the values for the listbox and prepare some variables to be displayed in the second SELscreen.
Then comes the START-OF-SELECTION event and there I call both SELscreens in order, using the same set of coordinates which position the SELscreen in the middle of my screen - using both STARTING AT and ENDING AT.
The program starts all right, but the outcome is the same - I see my listbox, I can click on the triangle, but none of the options in the list appear.
I'll go on trying. There has to be a way to get this right...
Thanks a lot!
Best regards,
Sapperdapper
‎2012 Nov 06 10:00 AM
If this works for you, then there is some adjustment you need to do in your code. Please check the available options.
field-symbols <lg>.
type-pools: vrm.
data: l_name type vrm_id,
li_list type vrm_values,
it_return type standard table of ddshretval,
l_value like line of li_list.
selection-screen begin of screen 1001 as window.
selection-screen begin of line.
selection-screen comment 01(20) text-030 for field typed.
selection-screen position 22.
parameters: typed as listbox visible length 30 obligatory.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 01(20) text-031 for field lang.
selection-screen position 22.
parameters lang type c length 2.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 01(83) text-032.
selection-screen end of line.
selection-screen end of screen 1001.
selection-screen begin of screen 1002 as window.
selection-screen begin of line.
selection-screen comment 01(20) text-030 for field typed.
selection-screen position 22.
parameters: typed1 as listbox visible length 30 obligatory.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 01(20) text-031 for field lang.
selection-screen position 22.
parameters lang1 type c length 2.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 01(83) text-032.
selection-screen end of line.
selection-screen end of screen 1002.
at selection-screen output.
clear li_list.
if sy-dynnr = '1001'.
l_value-key = '1'.
l_value-text = 'Accounting_vendor-1'.
append l_value to li_list.
clear l_value.
l_value-key = '2'.
l_value-text = 'Accounting_customer-1'.
append l_value to li_list.
clear l_value.
l_value-key = '3'.
l_value-text = 'Personnel-1'.
append l_value to li_list.
clear l_value.
l_name = 'TYPED'.
elseif sy-dynnr = 1002.
l_value-text = 'Accounting_vendor-2'.
append l_value to li_list.
clear l_value.
l_value-key = '2'.
l_value-text = 'Accounting_customer-2'.
append l_value to li_list.
clear l_value.
l_value-key = '3'.
l_value-text = 'Personnel-2'.
append l_value to li_list.
clear l_value.
l_name = 'TYPED1'.
endif.
call function 'VRM_SET_VALUES'
exporting
id = l_name
values = li_list
exceptions
id_illegal_name = 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.
start-of-selection.
call selection-screen '1001' starting at 8 12.
check sy-subrc = 0.
call selection-screen '1002' starting at 8 12.
check sy-subrc = 0. write typed.skip 1. write typed1.
‎2012 Nov 06 10:33 AM
Hi Kesavadas,
you have two identical SELscreens here and the AT-event is also split into two identical parts; If you don't mind, please tell me what is the point of that?
‎2012 Nov 06 10:40 AM
I just differentiated the screens to populate different values to the list box, I just used the same variable li_list for both screens. Two screens are not identical, the field names & screen no is different.
‎2012 Nov 06 10:56 AM
Hi,
yes, the names are different of course.
Well, now it works. I think the critical point was that that event-block AT... had to come before the FM - logical, the FM uses the list that is put together in the event-block. I used to have that in the same INCLUDE as the definition of the first SELscreen and then I introduced that event-block afterwards to make it (the event-block) available to both SELscreens, so that did not work out. I could see in the Debugger that at the "time" when that SELscreen was called, the list used by the LISTBOX was empty.
I have now rearranged that and it works. Great!
Thanks a lot!
Best regards,
Sapperdapper