Application Development and Automation 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: 
Read only

Simplr selection query in ABAP

Former Member
0 Likes
1,005

Folks,

I haev selection screen and on selection screen user may give more than one selection parameters.I have to serach database acordingly.For that i have written query like this


select * from ZNSLVWHDIMMD_LCL
             into corresponding fields of table IT_VIEW
             WHERE SALESRLNO = Stru_Cn_Selcrtr-ca_slsrl
             and   CREATEDBY = Stru_Cn_Selcrtr-ca_crtby
             and   STARTDATE = Stru_Cn_Selcrtr-ca_validfrm
             and   ENDDATE   = Stru_Cn_Selcrtr-ca_validto
             and   STATUS    = Stru_Cn_Selcrtr-ca_status
             and   BRANDID   = Stru_Cn_Selcrtr-ca_brand
             and   MODELNO   = Stru_Cn_Selcrtr-ca_model.

Now the problem is that it does not work when user gives only one parameter say

"SALESRLNO" = 0000000002 .When i checked sy-subrc,it is 4 means no data in table.but there is a data in table with SALESRLNO = 0000000002>how to solve this.

Folks,

I haev selection screen and on selection screen user may give more than one selection parameters.I have to serach database acordingly.For that i have written query like this


select * from ZNSLVWHDIMMD_LCL
             into corresponding fields of table IT_VIEW
             WHERE SALESRLNO = Stru_Cn_Selcrtr-ca_slsrl
             and   CREATEDBY = Stru_Cn_Selcrtr-ca_crtby
             and   STARTDATE = Stru_Cn_Selcrtr-ca_validfrm
             and   ENDDATE   = Stru_Cn_Selcrtr-ca_validto
             and   STATUS    = Stru_Cn_Selcrtr-ca_status
             and   BRANDID   = Stru_Cn_Selcrtr-ca_brand
             and   MODELNO   = Stru_Cn_Selcrtr-ca_model.

Now the problem is that it does not work when user gives only one parameter say

"SALESRLNO" = 0000000002 .When i checked sy-subrc,it is 4 means no data in table.but there is a data in table with SALESRLNO = 0000000002>how to solve this.

8 REPLIES 8
Read only

Former Member
0 Likes
970

before passing the user entry to the select query

use the conversion exit input FM ie

CONVERSION_EXIT_ALPHA_INPUT

not sure hweather it ll work, it ll be better for all if u paste the complete code.

Thank-You

Read only

0 Likes
970

if Stru_Cn_Selcrtr-ca_slsrl is initial and Stru_Cn_Selcrtr-ca_crtby is initial

and Stru_Cn_Selcrtr-ca_validfrm is initial and Stru_Cn_Selcrtr-ca_validto is initial

and Stru_Cn_Selcrtr-ca_status is initial and Stru_Cn_Selcrtr-ca_brand is initial

and Stru_Cn_Selcrtr-ca_model is initial.

select * from ZNSLVWHDIMMD_LCL

into corresponding fields of table IT_VIEW.

ELSE.

**If any of these are given then select data accordingly.

select * from ZNSLVWHDIMMD_LCL

into corresponding fields of table IT_VIEW

WHERE SALESRLNO = Stru_Cn_Selcrtr-ca_slsrl

and CREATEDBY = Stru_Cn_Selcrtr-ca_crtby

and STARTDATE = Stru_Cn_Selcrtr-ca_validfrm

and ENDDATE = Stru_Cn_Selcrtr-ca_validto

and STATUS = Stru_Cn_Selcrtr-ca_status

and BRANDID = Stru_Cn_Selcrtr-ca_brand

and MODELNO = Stru_Cn_Selcrtr-ca_model.

endif.

This is the code ...and my data type in dictionary is string..for table ZNSLVWHDIMMD_LCL

Read only

0 Likes
970

I think you would be better off using SELECT-OPTIONS rather than PARAMETERS.

Rob

Read only

0 Likes
970

yaa i just figured that out..but i m using ABAP-OO.I cant use select option.

Read only

0 Likes
970

You can't use Select-Options because your using 00 ABAP??? Why??? First time I hear that -:O

Greetings,

Blag.

Read only

0 Likes
970

Means i have to build up internal table from parameters i cant use slect option on selection screen.thats wat i means.

Read only

0 Likes
970

PROBLEM SOLVED ..BY MAKING INTERNAL TABLE HAVING STRUCTURE LIKE SELECT STATEMENT.THANX DUDES FOE ANSWER THOUGH.

Read only

Former Member
0 Likes
970

Its problem of parameter on selection screen so make internal table as select-option so system will select desired data.