2013 Apr 29 3:51 PM
Hi,
I created the statements below, SERVER and LOCAL are two checkbox parameter. When I do a check on the program and I keep getting errors like
"incorrect nesting: before the statement "AT SELECTION-SCREEN", the structure introduced by "IF" must be concluded by "ENDIF"".
I am not sure what is wrong with the statements below.
IF SERVER = 'X'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER.
PERFORM GET_VALUE_FILENAME USING 'SERVER' SERVER.
ELSE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR LOCAL.
PERFORM GET_VALUE_FILENAME USING 'LOCAL' LOCAL.
ENDIF.
Really appreciate your input and response.
Hi,
I created the statements below, SERVER and LOCAL are two checkbox parameter. When I do a check on the program and I keep getting errors like
"incorrect nesting: before the statement "AT SELECTION-SCREEN", the structure introduced by "IF" must be concluded by "ENDIF"".
I am not sure what is wrong with the statements below.
IF SERVER = 'X'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER.
PERFORM GET_VALUE_FILENAME USING 'SERVER' SERVER.
ELSE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR LOCAL.
PERFORM GET_VALUE_FILENAME USING 'LOCAL' LOCAL.
ENDIF.
Really appreciate your input and response.
2013 Apr 29 4:26 PM
AT.... statements are events - not commands. You specify in the
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER. what you want to happen when someone requests value help of field SERVER. Similarly for the LOCAL. That is, when someone is in field SERVER and hits F4, the program execution jumps to the AT SELECTION-SCREEN.
I suggest you check some simple examples of how to use value help. There's plenty to be found with a little searching.
2013 Apr 29 4:38 PM
Hi Blue,
please go through below Example.
REPORT Z_SRI_HELP_VALUE_FOR_TABLES .
tables tcurt.
DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_WAERS LIKE TCURT-WAERS, "Currency
P_LTEXT LIKE TCURT-LTEXT, "Long Text
P_KTEXT LIKE TCURT-KTEXT. "Short Text
*-----------------------------------------------------------------------
*--- Example of updating value of another field on the screen ----------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.
CLEAR: DYFIELDS[], DYFIELDS.
*--- select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'WAERS'
tabname = 'TCURT'
IMPORTING
SELECT_VALUE = P_WAERS.
*--- get long text for the selected currency
SELECT SINGLE LTEXT FROM TCURT
INTO DYFIELDS-FIELDVALUE
WHERE SPRAS = SY-LANGU
AND WAERS = P_WAERS.
IF SY-SUBRC <> 0.
CLEAR DYFIELDS-FIELDVALUE.
ENDIF.
*--- update another field
DYFIELDS-FIELDNAME = 'P_LTEXT'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
tables
dynpfields = DYFIELDS .
*-----------------------------------------------------------------------
*--- Example of reading value of another field -------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.
*--- read another field
CLEAR: DYFIELDS[], DYFIELDS.
DYFIELDS-FIELDNAME = 'P_WAERS'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS .
READ TABLE DYFIELDS INDEX 1.
*--- get short text and update current field
SELECT SINGLE KTEXT FROM TCURT
INTO P_KTEXT
WHERE SPRAS EQ SY-LANGU
AND WAERS EQ DYFIELDS-FIELDVALUE.
*-----------------------------------------------------------------------
If any more query please put all your code and let me know what you exactly want, so we can suggest some other way for the same...
2013 Apr 29 4:38 PM
Hi,
You simply keep your code as follows
IF SERVER = 'X'.
PERFORM GET_VALUE_FILENAME USING 'SERVER' SERVER.
ELSE.
PERFORM GET_VALUE_FILENAME USING 'LOCAL' LOCAL.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR LOCAL.
Best Regards,
Pushkar Dhale
2013 Apr 29 5:09 PM
Blue,
Whenever you declare an event block such as INITIALIZATION, START-OF-SELECTION, or AT SELECTION-SCREEN [ON...] you are ending the previous event block. The compiler expects all IF and LOOP statements to have their corresponding END statements when a new event block is defined.
In your case, you could just remove the IF-ELSE-ENDIF block and things will work fine.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER.
PERFORM GET_VALUE_FILENAME USING 'SERVER' SERVER.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR LOCAL.
PERFORM GET_VALUE_FILENAME USING 'LOCAL' LOCAL.
If you want to disable the value-help for local when SERVER is 'X' and vice versa, you could add this to your code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER.
CHECK server = 'X'.
PERFORM GET_VALUE_FILENAME USING 'SERVER' SERVER.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR LOCAL.
CHECK server = space.
PERFORM GET_VALUE_FILENAME USING 'LOCAL' LOCAL.
If the logical expression in the CHECK statement evaluates to false, the event block will be exited before the subroutine can be called.
Best,
Eric
2013 Apr 29 6:07 PM
Hi Blue,
Try this code.
REPORT ZTEST_1.
PARAMETERS: server AS CHECKBOX,
local AS CHECKBOX.
AT SELECTION-SCREEN.
IF server = 'X'.
*-- Write teh logic for SERVER Check Box
WRITE: 'SERVER Checkbox selected.'.
ENDIF.
IF local = 'X'.
*-- Write teh logic for LOCAL Check Box
WRITE: 'LOCAL Checkbox selected.'.
ENDIF.
Thanks & Regards,
Venugopal M n
2013 Apr 30 4:09 AM
Hi,
The event triggering statements (AT SELECTION-SCREEN ON VALUE-REQUEST FOR SERVER.)cannot be placed in IF-ENDIF construct. Standard events cannot have a conditional execution in an IF-ELSE construct based on user input as also present in your case.
You can frame the logic in different way, assuming you are trying to give search help for selection from presentation or application server based on User input :
*Block in the selection screen
SELECTION-SCREEN BEGIN OF BLOCK b1.
*Radio button for the user to select from presentation or application(in your case Local and Server)
PARAMETERS: rprefl RADIOBUTTON GROUP radf USER-COMMAND clk DEFAULT 'X',
rappfl RADIOBUTTON GROUP radf.
*Two different parameters on screen to give different search helps for LOCAL and SERVER
*Design with MODIF ID usage to hide the non-selected field as per radio button input
PARAMETERS: p_fpath1 TYPE string MODIF ID pre,
p_fpath2 TYPE eseftappl MODIF ID app.
SELECTION-SCREEN END OF BLOCK b1.
*At seelction screen output hide non selected field based on radio button input
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF rprefl EQ 'X'.
IF screen-group1 = 'APP'.
screen-active = 0.
ENDIF.
ELSEIF rappfl EQ 'X'.
IF screen-group1 = 'PRE'.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
* TWO distinct VALUE-REQUEST EVENTS designed for each sceen field p_fpath1(LOCAL)
* and p_fpath2(SERVER) . Only one event will be executed as other field will be hidden based
* on user input selected in radio-button group radf.
*****************************************************
** AT SELECTION-SCREEN ON VALUE-REQUEST for LOCAL
*****************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath1.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
title = 'Upload File'
mode = 'O'
IMPORTING
filename = p_fpath1
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE text-t08 TYPE 'I'.
ENDIF.
*****************************************************
** AT SELECTION-SCREEN ON VALUE-REQUEST for SERVER
*****************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath2.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = '/'
IMPORTING
serverfile = p_fpath2
EXCEPTIONS
canceled_by_user = 1.
IF sy-subrc <> 0.
MESSAGE text-t08 TYPE 'I'.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |