‎2009 Feb 10 10:15 PM
I need some help on a selection screen. I have the following:
SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
PARAMETERS: p_bldat TYPE bkpf-bldat OBLIGATORY DEFAULT sy-datum,
p_budat TYPE bkpf-budat OBLIGATORY DEFAULT sy-datum,
p_xref1 TYPE proj-pspid OBLIGATORY,
p_bktxt TYPE bkpf-bktxt,
p_bukrs TYPE bkpf-bukrs OBLIGATORY DEFAULT '1100',
p_waers TYPE bkpf-waers OBLIGATORY DEFAULT 'USD'.
SELECTION-SCREEN: END OF BLOCK a1.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS: p_lifnr TYPE ekko-lifnr OBLIGATORY,
p_ebeln TYPE ekko-ebeln OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK c1 WITH FRAME TITLE text-003.
PARAMETERS: p_amt TYPE wrbtr,
p_ret TYPE wrbtr.
SELECTION-SCREEN: END OF BLOCK c1.
SELECTION-SCREEN: BEGIN OF BLOCK d1 WITH FRAME TITLE text-004.
PARAMETERS: p_cmode TYPE callmode DEFAULT 'N' OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK d1.
AT SELECTION-SCREEN ON p_ebeln.
SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
MESSAGE d_string TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN.
check p_ret is not INITIAL.
IF p_amt > p_ret.
MESSAGE 'Amt. To Be Released is more than the remaining retention. Please check your input.' TYPE 'E'.
ELSEIF p_amt IS INITIAL.
MESSAGE 'Amt. To Be Released is required. Please check your input.' TYPE 'E'.
ENDIF.What I want is for the parameter p_ret to be populated when the user inputs a PO (p_ebeln). This seems to work except I want this to be brought in without running through the other checks (AT SELECTION-SCREEN). In order to bring in p_ret I am having to hit ENTER which will trigger the event AT SELECTION-SCREEN.
How can I bring in p_ret without triggering the event AT SELECTION-SCREEN?
Regards,
Davis
‎2009 Feb 10 11:14 PM
In this case.
If you don't want at selection-screen to be triggered on hitting enter, you can give an if condition in at selection-screen.
tables : sscrfields.
AT SELECTION-SCREEN ON p_ebeln.
SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
clear sscrfield-ucomm.
MESSAGE d_string TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN.
if sscrfields-ucomm = 'ONLI'.
check p_ret is not INITIAL.
IF p_amt > p_ret.
MESSAGE 'Amt. To Be Released is more than the remaining retention. Please check your input.' TYPE 'E'.
ELSEIF p_amt IS INITIAL.
MESSAGE 'Amt. To Be Released is required. Please check your input.' TYPE 'E'.
ENDIF.
endif.The code in at selection-screen is executed only when user presses F8. on pressing 'Enter' it will not be executed.
Hope this helps you.
Regards,
Siddarth
‎2009 Feb 10 10:32 PM
Hi,
You can use the Function module DYNP_VALUES_READ to get the value P_RET...please put a where used list of this function module or search in SCN...you will find a sample code of how to get the values..
Thanks
Naren
‎2009 Feb 10 10:50 PM
I could be wrong but won't I need an event to trigger this (like on value request)? If so, this will not help as I need it to be a smooth transition without user interaction.
Regards,
Davis
‎2009 Feb 10 11:00 PM
Hi,
you can use
at selection-screen on value-request for p_ret.
SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
MESSAGE d_string TYPE 'S' display like 'E'.
ENDIF.this provides you to press F4 and does not trigger any other event apart from on value-request event.
Hope this helps.
Regards,
Siddarth
‎2009 Feb 10 11:00 PM
Hi,
Yes..you still have to press enter..to trigger the code..
AT SELECTION-SCREEN ON p_ebeln...
Please let me know if this is not you are looking for.
Thanks
Naren
‎2009 Feb 10 11:05 PM
That won't work then as the enter will trigger the event block AT SELECTION-SCREEN thus I will have the same issue I currently have.
I have gone around my issue by defaulting a value into p_amt but this isn't the end-solution I would like to use.
Regards,
Davis
‎2009 Feb 10 11:08 PM
Hi Davis,
Did you try the code I provided this will surely work if you press F4. this will not trigger at selection-screen event.. this will only trigger at selection-screen on value-request for p_ret.
at selection-screen on value-request for p_ret.
SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
MESSAGE d_string TYPE 'S' display like 'E'.
ENDIF.Please let me know if its not working
Regards,
Siddarth
‎2009 Feb 10 11:10 PM
Thanks for the suggestion but I don't want to force the user to interact with the selection screen, to get this value, other than entering a PO and hitting enter.
Regards,
Davis
‎2009 Feb 10 11:14 PM
In this case.
If you don't want at selection-screen to be triggered on hitting enter, you can give an if condition in at selection-screen.
tables : sscrfields.
AT SELECTION-SCREEN ON p_ebeln.
SELECT SINGLE kwert INTO p_ret FROM zretention WHERE ebeln = p_ebeln AND ebelp = '00000' AND TYPE = 'C'.
IF NOT sy-subrc = 0 OR p_ret IS INITIAL.
CONCATENATE 'Purchase Order' p_ebeln 'does not have any retention available for release!' INTO d_string.
clear sscrfield-ucomm.
MESSAGE d_string TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN.
if sscrfields-ucomm = 'ONLI'.
check p_ret is not INITIAL.
IF p_amt > p_ret.
MESSAGE 'Amt. To Be Released is more than the remaining retention. Please check your input.' TYPE 'E'.
ELSEIF p_amt IS INITIAL.
MESSAGE 'Amt. To Be Released is required. Please check your input.' TYPE 'E'.
ENDIF.
endif.The code in at selection-screen is executed only when user presses F8. on pressing 'Enter' it will not be executed.
Hope this helps you.
Regards,
Siddarth
‎2009 Feb 10 11:17 PM
I have never seen that trick! Thanks a lot Siddharth!!
Regards,
Davis
‎2009 Feb 10 11:18 PM
Hi,
If you don't want to trigger the at selection-screen..validations...
then you can move the validations code to the start-of-selection...
Or check if the user has pressed F8 (execute) to trigger the validations..Like this..
IF sy-ucomm = 'ONLI'...Do all your validations here...
Thanks
Naren
‎2009 Feb 10 11:18 PM