10-13-2008 12:39 PM
Hi all,
I need to have a Dynamic screen selection which works the following way:
Firstly I have a selection-screen which has a single parameter on it:
selection-screen begin of block b1 with frame title text-001.
parameters: pa type proj-pspid.
selection-screen end of block b1.
Now here Im using the AT SELECTION-SCREEN ON VALUE-REQUEST event to display a limited number of entries only (using the FM F4IF_INT_TABLE_VALUE_REQUEST ) in the F4 help.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa.
----------
-----------
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
---------------------
After this based on the selection I need to display another Selection screen.
For Example if,
if pa+3(2) = 'GW'.
I need to display parameters p3 and p4 only on the selection screen:
selection-screen begin of block b2 with frame title text-001.
parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1,
p4 RADIOBUTTON GROUP rad2 modif id sc1.
parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2,
p6 RADIOBUTTON GROUP rad2 modif id sc2.
selection-screen end of block b2.
elseif pa+3(2) = 'MP'.
parameters p5 and p6 only needs to be displayed.
In ideal conditions I know we could write the above code under the AT SELECTION-SCREEN OUTPUT event. But here Ive already defined a AT SELECTION-SCREEN ON VALUE-REQUEST event to display the pa value for restricted F4 help.
Right now my problem is that all the parameters (p3,p4,p5,p6) are all being displayed. Only after I get an input in the parameters field will I get the preferred parameters displayed in the subsequent selection screen (Loop at Screen....endloop).
But initially I want the second selection screen to be totally blank.
So right now its getting a bit too confusing for me on a Monday afternoon after a 6 day long vacation
Any inputs on this?
Regards,
pk
10-13-2008 12:43 PM
10-13-2008 12:43 PM
10-13-2008 12:51 PM
Common K.P.N,
Pull up your socks and put on your thinking hat....Diwali is looong way away.
pk
10-13-2008 12:56 PM
10-13-2008 12:57 PM
Hi Prashant,
You can try something like this. A Lazy solution
SELECTION-SCREEN BEGIN OF SCREEN 100.
PARAMETERS: pa TYPE proj-pspid.
SELECTION-SCREEN END OF SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 200.
PARAMETERS: p3 RADIOBUTTON GROUP rad2 MODIF ID sc1,
p4 RADIOBUTTON GROUP rad2 MODIF ID sc1.
PARAMETERS: p5 RADIOBUTTON GROUP rad2 MODIF ID sc2,
p6 RADIOBUTTON GROUP rad2 MODIF ID sc2.
SELECTION-SCREEN END OF SCREEN 200.
CALL SCREEN 100.
Now you can play with your own logic.
Cheers,
Kothand
10-13-2008 1:03 PM
It would be great if I can get everything in the same screen, instead of multiple screens.
In fact I have another selection screen(that I havnt mentioned) based on the selection from the second Selection screen.
selection-screen begin of block b3 with frame title text-001.
parameters: p7 RADIOBUTTON GROUP rad3 USER-COMMAND c2 default 'X' modif id sb1,
p8 RADIOBUTTON GROUP rad3 modif id sb1,
p9 RADIOBUTTON GROUP rad3 modif id sb1,
p10 RADIOBUTTON GROUP rad3 modif id sb1.
selection-screen end of block b3.
So effectively that would be 3 screens and then the final report in the 4 screen. My CMD and GMs would have the time and patience for that kind of navigation.
@Amit: Common Bro, I know you have a solution for me. Dont make me hit the Abuse Button on you for not providing an answer
pk
10-13-2008 1:24 PM
> Dont make me hit the Abuse Button on you for not providing an answer
> pk
Pk,
I would suggest you to just run ME2N transaction>/H> and press Shift +F4(Dynamic selection).you will found yourself in debugmode from here you may see the exact logic for your requirment(may be this is tough task).
please let me know if you have any concern in this logic.
PS:BTW nowadays I'm often reporting to SCN for myself so no need to bother either you or KPN
but you may hit twice
KPN came up with unacceptable behavior so it was necessary to intimate him/her once
Cheers
Edited by: Ámit Güjärgoüd on Oct 13, 2008 2:25 PM
Edited by: Ámit Güjärgoüd on Oct 13, 2008 2:26 PM
10-13-2008 1:30 PM
>KPN came up with unacceptable behavior so it was necessary to intimate him/her once
i think kpn is he not she . some times i found more fun in your comments. KPN you there..?
10-13-2008 1:36 PM
10-13-2008 1:46 PM
10-13-2008 1:46 PM
I played around a little with the sy-ucomm = 'ONLI' event for F8 execution. But even that doesnt seem to serve the purpose or am I missing the Obvious?
@ Amit:
PS:BTW nowadays I'm often reporting to SCN for myself so no need to bother either you or KPN
but you may hit twice
Now this is what I call the Abuse of the Abuse button
pk
10-13-2008 1:51 PM
10-13-2008 2:01 PM
Common guys, I see no reason for any bad blood here. Lets keep it simple. I have no bad feelings for any comments made by anyone. In fact Ive taken KPN's comment in good humour. And Im sure he meant it that way too. Even otherwise Im least bothered. I have my Flame-resisted suit on.
You guys have an issue to resolve here... so get on with it
pk
Random Thought: Why do my threads get so complicated??
EDIT: Vijay, whats on your mind regarding adding that event after F4?
Edited by: prashanth kishan on Oct 13, 2008 6:33 PM
10-13-2008 2:08 PM
I am just rephrasing your question. Based on F4 value you want to show some of your screen elements(parameters/radiobuttons etc). if so after selecting the value , you have to hit enter button. then you can see the elements .
check this sample once.
REPORT ZTEST_ZERO_01.
data:
begin of fs_vbeln,
vbeln type vbeln_va,
posnr type posnr_va,
end of fs_vbeln,
t_vbeln like standard table of fs_vbeln.
data: lt_tab like ddshretval occurs 0 with header line.
parameters: p1(10).
selection-screen begin of block b2 with frame title text-001.
parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1,
p4 RADIOBUTTON GROUP rad2 modif id sc1.
parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2,
p6 RADIOBUTTON GROUP rad2 modif id sc2.
selection-screen end of block b2.
at selection-screen output.
loop at screen.
if screen-group1 = 'SC1'.
if p1 eq '123456'.
screen-active = 1.
else.
screen-active = 0.
endif.
modify screen.
endif.
if screen-group1 = 'SC2'.
if p1 eq '456789'.
screen-active = 1.
else.
screen-active = 0.
endif.
modify screen.
endif.
endloop.
at selection-screen on value-request for p1.
select vbeln posnr
into table t_vbeln
up to 20 rows
from vbap.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'VBELN'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
callback_program = sy-cprog
tables
value_tab = t_vbeln
return_tab = lt_tab
exceptions
parameter_error = 1
no_values_found = 2.
if sy-subrc eq 0.
loop at lt_tab.
clear p1.
p1 = lt_tab-fieldval.
endloop.
endif.
10-13-2008 2:09 PM
Hi prashanth,
I know that you will take it like that.I dint make any unacceptable comment in fact.Still it went like that and i am trying to justify myself.
i want to stop answering to the off topics but still i am doing. i dont know what you call.
If you really feel its my mistake i am absolutely sorry.
Regards
K.P.N
10-13-2008 2:49 PM
VIjay,
Im closer to the solution now. You are right. Having another event(Pressing F8 or hitting ENTER after the display ) after F4 does help in some though I would have loved to see the second selection-screen being displayed without pressing F8.
Will play around with it some more and see if I can re-invent the bulb.
@KPN: I have no hard feelings towards you. I guess Amit too doesnt have any. I think he misunderstood you. A smiley after your comment would have done the trick and avoided misunderstandings
@Amit: Chill Dude. I know you are frustrated at not getting your early bonus, because of the market situation but its ok. Things will get better soon.
Peace,
pk
EDIT: added text
Edited by: prashanth kishan on Oct 13, 2008 7:23 PM
10-13-2008 2:49 PM
Hi Guys,
In addition to Vijay's code this one line addition does the magic of - SIMULATING ENTER KEY HIT
REPORT ZTEST_ZERO_01.
data:
begin of fs_vbeln,
vbeln type vbeln_va,
posnr type posnr_va,
end of fs_vbeln,
t_vbeln like standard table of fs_vbeln.
data: lt_tab like ddshretval occurs 0 with header line.
parameters: p1(10).
selection-screen begin of block b2 with frame title text-001.
parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1,
p4 RADIOBUTTON GROUP rad2 modif id sc1.
parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2,
p6 RADIOBUTTON GROUP rad2 modif id sc2.
selection-screen end of block b2.
at selection-screen output.
loop at screen.
if screen-group1 = 'SC1'.
if p1 eq '123456'.
screen-active = 1.
else.
screen-active = 0.
endif.
modify screen.
endif.
if screen-group1 = 'SC2'.
if p1 eq '456789'.
screen-active = 1.
else.
screen-active = 0.
endif.
modify screen.
endif.
endloop.
at selection-screen on value-request for p1.
select vbeln posnr
into table t_vbeln
up to 20 rows
from vbap.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'VBELN'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
callback_program = sy-cprog
tables
value_tab = t_vbeln
return_tab = lt_tab
exceptions
parameter_error = 1
no_values_found = 2.
if sy-subrc eq 0.
loop at lt_tab.
clear p1.
p1 = lt_tab-fieldval.
endloop.
CALL SCREEN 1000. " <----1000 By Default. If you use some other screen number use that
endif.
Is this a clean way?
Cheers,
Kothand
10-13-2008 3:11 PM
> VIjay,
>
> Im closer to the solution now. You are right. Having another event(Pressing F8 or hitting ENTER after the display ) after F4 does help in some though I would have loved to see the second selection-screen being displayed without pressing F8.
>
the same thing(similer code) is done in that report code which i suggested first but sorry I'm not in front on SAP now so not able to try and play around your code.
@K.P.N:Okay time to shake hands Boy
sorry to KPN, Pk, Vijay and all of other guys/girls;-)
who through this thread if my words were hurts anybody in anyway at any corner of their heart
Cheers
Edited by: Ámit Güjärgoüd on Oct 13, 2008 4:13 PM
10-13-2008 3:15 PM
i think it is one best possible solution i feel. your solution will work.
10-13-2008 3:22 PM
Unfortunatley no. Or may be I need to work on those lines first thing in the morning tomarrow. Im too mentally and physically tired to try it today
@Amit: Too many cooks spoil the broth.
pk
10-13-2008 3:24 PM
>@Amit: Too many cooks spoil the broth.
I am one in that..., is it..?
10-13-2008 3:27 PM
> I am one in that..., is it..?
My sense says No
PS:Unless you count yourself in
Cheers
Edited by: Ámit Güjärgoüd on Oct 13, 2008 4:29 PM
10-13-2008 5:46 PM
Oh no no...
I said that in the context of his too many smileys and nothing else.
@Amit: I will try your ME2N method as a last resort.
pk
10-13-2008 7:28 PM
>
> Hi Guys,
>
> In addition to Vijay's code this one line addition does the magic of - SIMULATING ENTER KEY HIT
>
>
> REPORT ZTEST_ZERO_01. > > data: > begin of fs_vbeln, > vbeln type vbeln_va, > posnr type posnr_va, > end of fs_vbeln, > t_vbeln like standard table of fs_vbeln. > > data: lt_tab like ddshretval occurs 0 with header line. > > parameters: p1(10). > > selection-screen begin of block b2 with frame title text-001. > > parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1, > p4 RADIOBUTTON GROUP rad2 modif id sc1. > > parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2, > p6 RADIOBUTTON GROUP rad2 modif id sc2. > > selection-screen end of block b2. > > at selection-screen output. > > loop at screen. > if screen-group1 = 'SC1'. > if p1 eq '123456'. > screen-active = 1. > else. > screen-active = 0. > endif. > modify screen. > endif. > > if screen-group1 = 'SC2'. > if p1 eq '456789'. > screen-active = 1. > else. > screen-active = 0. > endif. > modify screen. > endif. > > endloop. > > > at selection-screen on value-request for p1. > select vbeln posnr > into table t_vbeln > up to 20 rows > from vbap. > call function 'F4IF_INT_TABLE_VALUE_REQUEST' > exporting > retfield = 'VBELN' > dynpprog = sy-cprog > dynpnr = sy-dynnr > value_org = 'S' > callback_program = sy-cprog > tables > value_tab = t_vbeln > return_tab = lt_tab > exceptions > parameter_error = 1 > no_values_found = 2. > > if sy-subrc eq 0. > loop at lt_tab. > clear p1. > p1 = lt_tab-fieldval. > endloop. > > CALL SCREEN 1000. " <----1000 By Default. If you use some other screen number use that > endif. > >
>
> Is this a clean way?
> Cheers,
> Kothand
One more solution would be to SUBMIT the same program,
in addition to CALL SCREEN 1000, I believe we can also use
SUBMIT ZTEST_ZERO_01 VIA SELECTION-SCREEN WITH p1 = p1.
10-14-2008 5:03 AM
Kothand,
It took me all of two minutes on a fresh Tuesday morning to get the solution for my issue using call screen 1000. Had to make a small adjustment with my PSPID field character capturing to get the desired result.
No pressing F8 or hitting the ENTER key. Its precisely the way I wanted it.
God Bless you Kothand.
Special thanks to Vijay too.
Have a great week ahead.
@Rajesh and Eswar: Will look into the solutions provided by you two soon and update it here.
pk
Edited by: prashanth kishan on Oct 14, 2008 9:34 AM
10-14-2008 6:21 AM
Its my pleasure.
Ofcourse its full of fun and challenge to answer one of the rarest questioner in SDN
Cheers,
Kothand
10-13-2008 12:49 PM
Hi
I am not sure but you can trying using module pool here:
if if pa+3(2) = 'GW'.
call screen 200.
"you can create three screens or one screen and two subscreens also for ur three conditions.
In the screen you give the radio buttons and from there itself give(loop-endloop) and then display it.
Regards,
VIshwa.
10-13-2008 12:55 PM
I had explored that option even before I started work on this issue. The point is I dont want to confuse my end-users (in this case my CMD and GMs) with too many screens. They would prefer a Dashboard with minimum navigation to get an over all picture.
pk
10-13-2008 1:22 PM
after choosing the F4 help, you need to press enter/trigger some action using checkbox or radiobutton then only you will get the desired result.
10-13-2008 1:09 PM
Hey
Its better put a count in OUTPUT event as below.
DATA: gv_count TYPE i.
AT SELECTION-SCREEN OUTPUT.
ADD 1 TO gv_count.
IF gv_count GT 1 AND pa+3(2) = 'GW'.
LOOP AT SCREEN.
" Make the fields visible.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
" Make the fields invisible.
ENDLOOP.
ENDIF.
Asik.
10-13-2008 2:18 PM
Hi
Try this.
data flag TYPE C.
AT SELECTION-SCREEN.
flag = 'X'.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
if flag = ''.
if screen-group1 = 'SC1' or screen-group1 = 'SC2'.
screen-active = 0.
endif.
elseif flag = 'X'.
"Your Code"
endif.
MODIFY SCREEN.
ENDLOOP.
When u execute the report for first time it will not trigger AT SELECTION-SCREEN event.
Regards
Sathar
10-13-2008 2:41 PM
Hi,
This can be a possible solution for your requirement. But this will work only when you hit enter , after selecting the PSPID value through F4 help.So based on this value either p3,p4 or p5,p6 radio buttons will be displayed.Just try the below code and let me know if it fits.
DATA: BEGIN OF I_VALUE_TAB OCCURS 0,
PSPID LIKE PROJ-PSPID,
END OF I_VALUE_TAB.
selection-screen begin of block b1 with frame title text-001.
parameters: pa type proj-pspid.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-001.
parameters: p3 RADIOBUTTON GROUP rad2 modif id sc1 USER-COMMAND COM,
p4 RADIOBUTTON GROUP rad2 modif id sc1.
parameters: p5 RADIOBUTTON GROUP rad2 modif id sc2,
p6 RADIOBUTTON GROUP rad2 modif id sc2.
selection-screen end of block b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa.
SELECT PSPID INTO TABLE I_VALUE_TAB FROM PROJ.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'PSPID'
DYNPPROG = sy-repid
DYNPNR = SY-DYNNR
DYNPROFIELD = 'PSPID'
WINDOW_TITLE = 'Valid Codes'(021)
VALUE_ORG = 'S'
TABLES
VALUE_TAB = I_VALUE_TAB.
at selection-screen output .
if pa+0(6) = 'xxxxx'.
LOOP AT SCREEN.
IF screen-group1 = 'SC1'.
screen-active = 1.
screen-intensified = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'SC2'.
screen-active = 0.
screen-intensified = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF PA+0(6) = 'xxx'.
LOOP AT SCREEN.
IF screen-group1 = 'SC2'.
screen-active = 1.
screen-intensified = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'SC1'.
screen-active = 0.
screen-intensified = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
*otherwise no more radio buttons will appear.
LOOP AT SCREEN.
IF screen-group1 = 'SC2'.
screen-active = 0.
screen-intensified = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'SC1'.
screen-active = 0.
screen-intensified = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Regards,
Sudheer
10-14-2008 4:09 AM
Hi,
How about trying it this way???
TYPE-POOLS: vrm.
TYPES: BEGIN OF t_sal_doc,
vbeln TYPE vbeln,
END OF t_sal_doc.
DATA: i_sal_doc TYPE STANDARD TABLE OF t_sal_doc,
wa_sal_doc TYPE t_sal_doc.
DATA: i_val TYPE vrm_values,
wa_val TYPE vrm_value.
PARAMETERS: p_vbeln TYPE vbeln AS LISTBOX VISIBLE LENGTH 10
USER-COMMAND abc,
p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X' MODIF ID md1,
p_rad2 RADIOBUTTON GROUP grp1 MODIF ID md1,
p_rad3 RADIOBUTTON GROUP grp2 DEFAULT 'X' MODIF ID md2,
p_rad4 RADIOBUTTON GROUP grp2 MODIF ID md2.
INITIALIZATION.
SELECT vbeln INTO TABLE i_sal_doc
UP TO 20 ROWS FROM vbak.
LOOP AT i_sal_doc INTO wa_sal_doc.
wa_val-key = wa_sal_doc-vbeln.
APPEND wa_val TO i_val.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_VBELN'
values = i_val
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'MD1'.
IF p_vbeln = '0000004972'.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
WHEN 'MD2'.
IF p_vbeln = '0000076843'.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
Regards
Eswar