2013 May 02 11:36 AM
Hi Experts,
I want to get the data when people log in and this data was save in two tables A and B.
A has the information but without the user_name
so I need to select the A table first and get the user_name in table B
And I also try to set a 5 sec buffer just in case
so here comes the problem!!!!!!!!!!
I use Range to set the buffer
r_utime-sign = 'I'.
r_utime-option = 'BT'.
r_utime-low = icd-utime.
r_utime-high = icd-utime + 000005.
SELECT SINGLE * FROM B
WHERE clas = icd-clas
AND id = icd-id
AND udate = icd-udate
AND utime IN r_utime
.
For Example.
I have a data like below
sign = I
option = BT
low = 141430
high = 141435
But after execute the program,I still get a data which it's time = 141152
it should not in this report.Because 141152 not between 141430~141435.
Is any wrong happen in my program?
Hi Experts,
I want to get the data when people log in and this data was save in two tables A and B.
A has the information but without the user_name
so I need to select the A table first and get the user_name in table B
And I also try to set a 5 sec buffer just in case
so here comes the problem!!!!!!!!!!
I use Range to set the buffer
r_utime-sign = 'I'.
r_utime-option = 'BT'.
r_utime-low = icd-utime.
r_utime-high = icd-utime + 000005.
SELECT SINGLE * FROM B
WHERE clas = icd-clas
AND id = icd-id
AND udate = icd-udate
AND utime IN r_utime
.
For Example.
I have a data like below
sign = I
option = BT
low = 141430
high = 141435
But after execute the program,I still get a data which it's time = 141152
it should not in this report.Because 141152 not between 141430~141435.
Is any wrong happen in my program?
2013 May 02 11:52 AM
Hi,
Try to add the last line just in to position where i addded:
r_utime-sign = 'I'.
r_utime-option = 'BT'.
r_utime-low = icd-utime.
r_utime-high = icd-utime + 000005.
APPEND r_utime.
2013 May 03 2:18 AM
hey Solc,
thanks your respond, I try to add append but in vain.....
2013 May 02 12:43 PM
Hi,
In your case r_utime is like an work area. You need to append it to a internal table with similar structure as r_utime. then use the same in SELECT query after IN, it will work.
Cheers,
Arindam
2013 May 02 2:01 PM
Hi,
Below statement missed in your code before select query.
APPEND R_UTIME[].
Regards,
Shaiksha Vali.
2013 May 02 3:11 PM
Hi,
like Jiri Solc allready said the append is Missing.
Additional be sure that you have defined:
1st.) The range where you add the Values for the Select.
2nd.) The Line of the Range where you set the Values.
The SAP Example is this here:
In your case spfli-carrid would be B-utime
DATA: spfli_wa TYPE spfli,
r_carrid TYPE RANGE OF spfli-carrid,
r_carrid_line LIKE LINE OF r_carrid.
r_carrid_line-sign = 'I'.
r_carrid_line-option = 'BT'.
r_carrid_line-low = 'AA'.
r_carrid_line-high = 'LH'.
APPEND r_carrid_line TO r_carrid.
SELECT *
FROM spfli
INTO spfli_wa
WHERE carrid IN r_carrid.
...
ENDSELECT.
Greets,
Lars
2013 May 03 5:29 AM
2013 May 03 5:34 AM
Hi Matthew,
the content is right,I run in debug mode many times
R_UTIME=IBT141430141435
But when I use R_UTIME to select,it still get the data not in this section
(141430~141435).
Ex.141152
2013 May 03 12:05 PM
There's a difference between workarea and internal table.
I bet you checked
r_utime
But you should check:
r_utime[1] or
r_utime[1]-sign
r_utime[1]-option
and so on.
If those there is nothing then your range is empty.
2013 May 03 5:46 AM
Hi,
Please check the definition and the way you populate the data.
The following code is and working example where the ranges tab is populated ok.
DATA: x_utime TYPE sy-uzeit.
RANGES r_utime FOR x_utime.
START-OF-SELECTION.
r_utime-sign = 'I'.
r_utime-option = 'BT'.
r_utime-low = sy-uzeit.
r_utime-high = sy-uzeit + 000005.
APPEND r_utime.
Also check the time representation fo the entries that get selected. Might be that the SELECT query fails due to a mismatch in Time format in table and your Ranges.
Cheers,
Arindam
2013 May 03 7:48 AM
2013 May 03 11:14 AM
Hi Jack Huang,
Can you please post your code here..
Your logic seems to be ok..
but still lets see the complete code written
2013 May 03 11:27 AM
Hi jack,
follow this SCN thread:
http://scn.sap.com/message/5164121
http://scn.sap.com/message/4601722
Thanks
Sabyasachi
2013 May 03 11:30 AM
Hi ,
ranges: bukrs for zstock-bukrs.
bukrs-sign = 'E'. "Exclude
bukrs-option = 'CP'. "Pattern
bukrs-low = 'AB*'. "Low Value
bukrs-high = ''. "High Value
append bukrs.
Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.
Hope this explains it well enough.
Thanks
Sabyasachi
2013 May 03 11:50 AM
Hi Jack,
I guess you have not appended your RANGE, thats why wrong data is fetched from table B.
Write the code as mentioned below:
r_utime-sign = 'I'.
r_utime-option = 'BT'.
r_utime-low = icd-utime.
r_utime-high = icd-utime + 000005.
APPEND r_utime.
Now write down your Select query.
SELECT SINGLE * FROM B
WHERE clas = icd-clas
AND id = icd-id
AND udate = icd-udate
AND utime IN r_utime
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |