04-07-2010 3:59 PM
Hi Gurus!
I have a small problem with one of my query that I just created for finding status of our customers. I have a code section which handles it all . The problem is that I ahve a user field called "Check date" which I ahve used in selection screen as well as the layout, when I put a value in this field in the selection screen the report dosent give any output " NO data to display" but when I leave it open it does give me the out put with the saem check date as I ahd entered earlier in my selection screen.
I am not sure where my selection code is working wrong . Could anyone please help me out please.
DATA: ls_vakpa LIKE vakpa.
DATA old_date LIKE sy-datum.
old_date = key_date - num_days.
status = 'ACTIVE'.
check_date = old_date.
* (If I entere this field (check_date) with any date
* and run it does not give me output and without
* entry it dioes give output.
SELECT SINGLE * FROM vakpa INTO ls_vakpa
WHERE kunde = kna1-kunnr
AND audat > old_date.
IF sy-subrc <> 0.
SELECT SINGLE * FROM vakpa INTO ls_vakpa
WHERE kunde = kna1-kunnr
AND audat < old_date.
IF sy-subrc = 0.
ls_audat = ls_vakpa-audat.
ls_vbeln = ls_vakpa-vbeln.
ELSE.
CLEAR ls_audat.
clear ls_vbeln.
ENDIF.
status = 'INACTIVE'.
ELSE.
ls_audat = ls_vakpa-audat.
ls_vbeln = ls_vakpa-vbeln.
ENDIF.
Edited by: Rob Burbank on Apr 7, 2010 12:08 PM
04-07-2010 4:04 PM
Hi..
try to insert your login in the
at selection-screen output.
if old_dare is initial.
old_date = key_date - num_days.
check_date = old_date.
endif.
regards
Marco
04-07-2010 4:38 PM
Hi Marco!
Thanks for your reply . I added the same in the Query under the
at selection-screen output section , but it still does not work when I insert the selection screen with some date in check_date.
Thanks
04-07-2010 4:42 PM
Hi....
the date is a PARAMETER or a SELECT-OPTION??
because if you're using a selectoption you must use IN...
SELECT SINGLE * FROM vakpa INTO ls_vakpa
WHERE kunde = kna1-kunnr
AND audat > old_date.
IF sy-subrc 0.
SELECT SINGLE * FROM vakpa INTO ls_vakpa
WHERE kunde = kna1-kunnr
AND audat IN old_date.
IF sy-subrc = 0.
ls_audat = ls_vakpa-audat.
ls_vbeln = ls_vakpa-vbeln.
Best regards
Marco
04-07-2010 4:51 PM
Thats correct , its a select option , but when I give the 'IN' operator it gives me syntax error .
"The IN operator with "CHECK_DATE" is followed neither by an internal
table nor by a value list."
04-07-2010 5:13 PM
04-07-2010 5:24 PM
DATA: ls_vakpa LIKE vakpa.
DATA old_date LIKE sy-datum.
old_date = key_date - num_days.
status = 'ACTIVE'.
check_date = old_date.
if old_date is initial.
old_date = key_date - num_days.
check_date = old_date.
endif.
SELECT SINGLE * FROM vakpa INTO ls_vakpa
WHERE kunde = kna1-kunnr
* AND audat > old_date.
AND audat > check_date.
IF sy-subrc <> 0.
SELECT SINGLE * FROM vakpa INTO ls_vakpa
WHERE kunde = kna1-kunnr
* AND audat < old_date.
AND audat < check_date.
IF sy-subrc = 0.
ls_audat = ls_vakpa-audat.
ls_vbeln = ls_vakpa-vbeln.
ELSE.
CLEAR ls_audat.
clear ls_vbeln.
ENDIF.
status = 'INACTIVE'.
ELSE.
ls_audat = ls_vakpa-audat.
ls_vbeln = ls_vakpa-vbeln.
ENDIF.
04-07-2010 5:51 PM
Kindly provide your check_date declaration part
Thanks & Regards,
Vallamuthu.M
04-07-2010 5:55 PM
04-07-2010 6:03 PM
I ahve created an additional filed for the Check_date field and declared it as kna1-erdat as kna1 is used in teh infoset along with adrc table . This check_date field is under teh extras tab . I tried putting it under the selection tab in teh infoset and ran the query but still it dosent exceute as per teh selectiuon give.
Thanks,
04-07-2010 6:14 PM
04-07-2010 6:51 PM
04-07-2010 6:57 PM
04-07-2010 7:50 PM
Yes , I meant that I have not put that field under the selection tab in the infoset , I just created it as an extra additional filed and in teh query used this field for selection as well as the output layout. Somehow when I run the query with the check date field in selection with a date and run it , it dosent give any output , but when I run it without entering any data in it it does give me output.
I just meant to say that I have not used this field in under the selection tab in the infoset , instead I ahve used it under the EXTRA tab.
Thanks,
04-07-2010 8:44 PM
04-08-2010 7:51 AM
Can you check the date format in the table and the date given in the selection screen.
Sometimes the datefield will be having conversion rotuines
04-08-2010 3:19 PM
No the date format is the same in both selection screen as well as the tables. Probably it has to something with the infoset , but not sure where.
04-07-2010 5:19 PM
Hi,
Declare old_date as range.
RANGES: r_id FOR cdhdr-change_ind.
r_id-sign = 'I'.
r_id-option = 'BT'.
r_id-low = <old_date from value>
r_id-high = <old_date high value>
APPEND r_id. CLEAR r_id.
SELECT * FROM vakpa INTO table ls_vakpa
WHERE kunde = kna1-kunnr
AND audat in old_date.
Thanks & Regards,
Vallamuthu.M