2008 Jul 28 6:41 PM
hi,
when i enter some value in my select option at runtime, it is not stored in the field, for e.g. S_KUNNR !! , i debugged and checked in my select statement, S_KUNNR is blank !! i checked the S_KUNNR structure and it's low and high both were blank !
why so ?
SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM ZXXX WHERE VSTEL IN S_VSTEL AND KUNNR IN S_KUNNR.
thks
2008 Jul 28 6:42 PM
hi,
when i enter some value in my select option at runtime, it is not stored in the field, for e.g. S_KUNNR !! , i debugged and checked in my select statement, S_KUNNR is blank !! i checked the S_KUNNR structure and it's low and high both were blank !
why so ?
SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM ZXXX WHERE VSTEL IN S_VSTEL AND KUNNR IN S_KUNNR.
thks
2008 Jul 28 6:42 PM
2008 Jul 28 7:01 PM
I am very sorry, if my questions sound silly !! But I am new to this and trying my best to learn.
Rich, u said "Select-options are tables, so look at the body of the table, not the header line."
In debugger, I checked the table contents for S_KUNNR, the screen which had
LINE SIGN OPTION LOW HIGH columns. All were blank !!
Also I tried modifying my select statement as Vijay told me earlier, S_KUNNR[] instead of S_KUNNR. Did not work !! Still the table content is blank !!
Any other way ??
2008 Jul 28 7:16 PM
2008 Jul 28 7:25 PM
hi,
select options is a table. So when you are passing values dynamically to the table you have to append the select option.like append s_aufnr after passing the values.
Regards,
radhakrishna
2008 Jul 28 7:37 PM
yes it is behaving exactly what you said...
the solution is using the Function DYNP_VALUES_READ.
REPORT ztest_mod.
DATA: kunnr TYPE kunnr.
* Custom Selection Screen 0200
SELECTION-SCREEN BEGIN OF SCREEN 0200 AS SUBSCREEN.
SELECT-OPTIONS: s_kunnr FOR kunnr.
SELECTION-SCREEN END OF SCREEN 0200.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_kunnr-low.
BREAK-POINT.
START-OF-SELECTION.
"in this screen i have a button with function code 'SEARCH'
" and a subscreen area with name sub
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
ENDMODULE. "status_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
DATA:
i_dyn_fields LIKE TABLE
OF dynpread
WITH HEADER LINE.
MOVE:
'S_KUNNR-LOW' TO i_dyn_fields-fieldname.
APPEND i_dyn_fields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = '0200'
TABLES
dynpfields = i_dyn_fields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc eq 0.
read table i_dyn_fields index 1.
s_kunnr-low = i_dynp_fields-VALUE
s_kunnr-sign = 'I'.
s_kunnr-option = 'EQ'.
append s_kunnr.
ENDIF.
DATA: it_kunnr TYPE TABLE OF kna1.
CASE sy-ucomm.
WHEN 'SEARCH'.
SELECT * FROM kna1
INTO TABLE it_kunnr
WHERE kunnr IN s_kunnr.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_0100 INPUTFlow Logic
PROCESS BEFORE OUTPUT.
*
MODULE status_0100.
*
CALL SUBSCREEN sub INCLUDING sy-repid '0200'.
*
PROCESS AFTER INPUT.
*
MODULE user_command_0100.
2008 Jul 28 7:41 PM
2008 Jul 28 7:44 PM
2008 Jul 28 7:48 PM
I spend my full time with my slow system and Found that finally. I tried differently , atlast i used that FM it is working,
2008 Jul 28 8:15 PM
Thanks Vijay..Yes i am using as subscreen where the selection screen is displayed. So I am trying the Function module solution. One question on that ..
read table i_dyn_fields index 1.
s_KUNNR-low = i_dyn_fields-FIELDVALUE.
s_KUNNR-sign = 'I'.
s_KUNNR-option = 'EQ'.
append s_KUNNR.
this wont work in ECC 6.0 as i need to define a work area for S_KUNNR . what data type is it ? it has sign, low, high etc, right !!
DATA WA_KUNNRSTRUCT TYPE ????
thanks
2008 Jul 28 8:18 PM
2008 Jul 28 8:19 PM
data: r_kunnr type range of kna1-kunnr.
w_kunnr like line of r_kunnr.
data: wa_dynfield like line of i_dyn_fields.
read table i_dyn_fields into wa_dynfield index 1.
w_kunnr-low = wa_dynfield-fieldvalue.
w_KUNNR-sign = 'I'.
w_KUNNR-option = 'EQ'.
append w_KUNNR to s_kunnr.
2008 Jul 28 8:45 PM
yes got it..now the value is read !! one last related question..the code looks like we r handling only the low value !! so i need to read the high values also like this ??
MOVE: 'S_VSTEL-LOW' TO i_dyn_fields-fieldname.
APPEND i_dyn_fields.
MOVE: 'S_VSTEL-HIGH' TO i_dyn_fields-fieldname.
APPEND i_dyn_fields.
...
...
CALL FUNCTION 'DYNP_VALUES_READ'
...
..
read table i_dyn_fields into wa_dynfield index 1.
w_kunnr-low = wa_dynfield-fieldvalue.
w_KUNNR-sign = 'I'.
w_KUNNR-option = 'EQ'.
append w_KUNNR to s_kunnr.
read table i_dyn_fields into wa_dynfield index 2.
w_kunnr-high = wa_dynfield-fieldvalue.
w_KUNNR-sign = 'I'.
w_KUNNR-option = 'EQ'.
append w_KUNNR to s_kunnr.
will this hold good ??
then my select statement will check for all values in this range and fetch the data based on that, right ??
thks
2008 Jul 28 8:52 PM
yes you need to pass HIGH also
but little modification to your code
read table i_dyn_fields into wa_dynfield index 1. <==SKUNNR-LOW
w_kunnr-low = wa_dynfield-fieldvalue.
w_KUNNR-sign = 'I'.
w_KUNNR-option = 'BT'.
read table i_dyn_fields into wa_dynfield index 2. <== you suppose to read it with S_KUNNR-HIGH
w_kunnr-high = wa_dynfield-fieldvalue.
append w_KUNNR to s_kunnr.if you enter
1 to 10
you want between 1 to 10
2008 Jul 28 8:55 PM
read table i_dyn_fields into wa_dynfield with key fieldname = 'S_KUNNR-LOW'.
w_kunnr-low = wa_dynfield-fieldvalue.
w_KUNNR-sign = 'I'.
w_KUNNR-option = 'BT'.
read table i_dyn_fields into wa_dynfield with key fieldname = 'S_KUNNR-HIGH'.
w_kunnr-HIGH = wa_dynfield-fieldvalue.
append w_KUNNR to s_kunnr.
2008 Jul 28 8:57 PM
Actually Vijay, user may enter just one value which i think will be automatically assigned to kunnr-low ??
if he enters for both low and high, this code what u sent will work with w_KUNNR-option = 'BT'.
but, in my case user may enter a single value or a range !!!
so what to do ??
for a note, i have 4 such select options in my subscreen and like this I have 3 subscreens !!
thanks
2008 Jul 28 9:00 PM
read table i_dyn_fields into wa_dynfield with key fieldname = 'S_KUNNR-LOW'.
w_kunnr-low = wa_dynfield-fieldvalue.
w_KUNNR-sign = 'I'.
w_kunnr-option = 'EQ'.
read table i_dyn_fields into wa_dynfield with key fieldname = 'S_KUNNR-HIGH'.
w_kunnr-HIGH = wa_dynfield-fieldvalue.
if w_kunnr-high is not initial.
w_KUNNR-option = 'BT'. <===if the value there EQ will be overwritten by BT
endif.
append w_KUNNR to s_kunnr.
2008 Jul 28 9:48 PM
2008 Jul 28 6:47 PM
may be you are checking the header, Check the Body of the S_KUNNR .
2008 Jul 28 6:47 PM
2008 Jul 28 6:59 PM
2008 Jul 28 7:47 PM
Hi,
I think problem could be...the SQL is in an event for a selection screen field which is declared above the field S_KUNNR.
Let's take this example...In this p_date is declared above so_date...and in the event ON p_date...The value so_date will not be available..
PARAMETERS: p_date TYPE sy-datum.
SELECT-OPTIONS: so_date FOR sy-datum.
AT SELECTION-SCREEN ON p_date.
BREAK-POINT.
so in this case you have might have to use the function module DYNP_VALUES_READ .
Thanks
Naren
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |