Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Selection screen field not working in Query

Former Member
0 Kudos

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

17 REPLIES 17

former_member196079
Active Contributor
0 Kudos

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

0 Kudos

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

former_member196079
Active Contributor
0 Kudos

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

0 Kudos

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."

0 Kudos

So - how is CHECK_DATE defined? Code pelase.

Rob

0 Kudos

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.

0 Kudos

Kindly provide your check_date declaration part

Thanks & Regards,

Vallamuthu.M

0 Kudos

That was pretty well everything except what I asked for.

Rob

0 Kudos

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,

0 Kudos

Is it a SELECT-OPTION, a PARAMETER or a simple data field?

Rob

0 Kudos

It is a simple data field used in the query/Infoset.

Thanks

0 Kudos

Didn't you say it's on the selection screen?

Rob

0 Kudos

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,

0 Kudos

Any suggestions please.

0 Kudos

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

0 Kudos

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.

vallamuthu_madheswaran2
Active Contributor
0 Kudos

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