2006 Mar 13 8:01 PM
Hi there. I actually am having two different problems here that are related. What I am trying to do is set up a report program so that it can either be called from a custom screen (using a "SUBMIT WITH" statement that passes a field for account number) or run from a report tree. Either way, the user will see the selection screen.
My first problem is with the passed parameter (the account number). If the program is called using the "SUBMIT WITH" statement, I want the field for the passed parameter to be greyed out so that the input value cannot be changed. But if the program is run from the report tree, then I need to allow input for that field. I have the field set up as a SELECT-OPTION to allow a range of input values, in case it needs to be run for multiple accounts from the report tree. I can't seem to get the field to grey out just for the "SUBMIT WITH" instances. I tried setting it up with a MODIF ID value and using this code:
INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
IF p_acct > 0.
LOOP AT SCREEN.
CHECK screen-group1 = 'ACT'.
screen-input = 0.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
The field p_acct is the SELECT-OPTION that I'm passing in the "SUBMIT WITH" statement. But when I debug this, the value doesn't show up yet in p_acct when the program reaches this code. It is filled, however, when the selection screen appears. How do I reference the field at that point after the value has been passed but before the selection screen comes up?
My second issue is with referencing a specific value of p_acct later on in my code. I need to run the report code for every account in whatever range is entered in p_acct. How do I reference the specific value that the program is at? For instance, if the entered range is 10000070 to 10000085, how do I know which of those values is currently being evaluated? I need to pass the current value to a function module, and I also need to use it in a SELECT statement to get records from another table. How do I do this?
Thanks in advance for any help!
- April King
2006 Mar 13 8:44 PM
Easiest way to implement this is to add another parameter in no-display mode. When you are doing the submit, do a submit with this parameter value as 'X' and in your AT SELECTION-SCREEN OUTPUT, you see if this parameter is 'X' then grey out the selection option for account and if not, open it for input.
Regards,
Srinivas
PS: The reason why you are not able to turn the select option to gray out is probably because your if p_acct > 0. p_acct is a select option according to you, but this check is for a parameter. Also, you should not do this kind of check because, the user online(report tree) also will face a problem once he enters a value and presses the ENTER key. It will be greyed out even if the user wants to change it later.
Are you doing the SUBMIT VIA SELECTION-SCREEN?
Hi there. I actually am having two different problems here that are related. What I am trying to do is set up a report program so that it can either be called from a custom screen (using a "SUBMIT WITH" statement that passes a field for account number) or run from a report tree. Either way, the user will see the selection screen.
My first problem is with the passed parameter (the account number). If the program is called using the "SUBMIT WITH" statement, I want the field for the passed parameter to be greyed out so that the input value cannot be changed. But if the program is run from the report tree, then I need to allow input for that field. I have the field set up as a SELECT-OPTION to allow a range of input values, in case it needs to be run for multiple accounts from the report tree. I can't seem to get the field to grey out just for the "SUBMIT WITH" instances. I tried setting it up with a MODIF ID value and using this code:
INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
IF p_acct > 0.
LOOP AT SCREEN.
CHECK screen-group1 = 'ACT'.
screen-input = 0.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
The field p_acct is the SELECT-OPTION that I'm passing in the "SUBMIT WITH" statement. But when I debug this, the value doesn't show up yet in p_acct when the program reaches this code. It is filled, however, when the selection screen appears. How do I reference the field at that point after the value has been passed but before the selection screen comes up?
My second issue is with referencing a specific value of p_acct later on in my code. I need to run the report code for every account in whatever range is entered in p_acct. How do I reference the specific value that the program is at? For instance, if the entered range is 10000070 to 10000085, how do I know which of those values is currently being evaluated? I need to pass the current value to a function module, and I also need to use it in a SELECT statement to get records from another table. How do I do this?
Thanks in advance for any help!
- April King
2006 Mar 13 8:16 PM
If you are passing to select-options, you should be passing as a range.
ranges: r_acct for ....
submit zprogram
with p_acct in r_acct.
....Then in your "Z" program, you should do a select against the table to get all of the values in your range(select-option) and put in an internal table.
Then loop thru the itab and process each account number accordingly.
Regards,
Rich Heilman
2006 Mar 13 9:26 PM
Rich,
Thank you for your response. I'm having some problems getting the value passed correctly this way. Here's what I did.
1) In the calling program I defined
RANGES: r_acct FOR zts_transaction-account.
The code then looks like this:
r_acct-low = zts_transaction-account.
SUBMIT zhr_ts_transactions_rpt
WITH p_acct IN r_acct
WITH p_scrn = 'X'
VIA SELECTION-SCREEN
AND RETURN.
2)In the report program, I have this:
SELECT-OPTIONS p_acct FOR zts_transaction-account MODIF ID act
OBLIGATORY.
But nothing is coming in through p_acct. What do I need to change?
Thanks,
April
2006 Mar 13 9:28 PM
You missed the following statements.
r_acct-low = zts_transaction-account. <-- existing code
r_acct-option = 'EQ'.
r_acct-sign = 'I'.
APPEND r_acct.
2006 Mar 13 9:33 PM
As Srinivas has mentioned, you need to fill the range. The range is just like a select-option in structure as it is really an interal table. The table will always have the OPTION SIGN LOW and HIGH fields. You need to fill the table with data, simply moving values to the header line of the table will not cut it, so you need to append the record to the table.
Hopefully you have a better understanding of ranges/select-options.
Regards,
Rich Heilman
2006 Mar 14 1:27 PM
Rich and Srinivas,
Thanks again for the replies. I wasn't thinking of the range as an internal table before. That solved it, so everything works correctly now. Thank you!
- April
2006 Mar 13 8:44 PM
Easiest way to implement this is to add another parameter in no-display mode. When you are doing the submit, do a submit with this parameter value as 'X' and in your AT SELECTION-SCREEN OUTPUT, you see if this parameter is 'X' then grey out the selection option for account and if not, open it for input.
Regards,
Srinivas
PS: The reason why you are not able to turn the select option to gray out is probably because your if p_acct > 0. p_acct is a select option according to you, but this check is for a parameter. Also, you should not do this kind of check because, the user online(report tree) also will face a problem once he enters a value and presses the ENTER key. It will be greyed out even if the user wants to change it later.
Are you doing the SUBMIT VIA SELECTION-SCREEN?
2006 Mar 13 9:20 PM
Srinivas,
Thank you for the reply! That solved the problem with greying the field. You're right, with the previous statement it was greying once the user entered a value on the selection screen. I am using the "SUBMIT VIA SELECTION-SCREEN" option.
- April
2006 Mar 13 9:23 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |