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

Query problem

Former Member
0 Likes
853

HI all,

I want to get three data from csks table: like below

TELFX, TELTX, TELX1

i put in selection screen

parameter: P_KOKRS like COBK-KOKRS.

parameters: P_KOSTL like coej-objnr+10(6) obligatory.

i create internal table like below

TYPES: BEGIN OF I_CSKS,

TELFX like CSKS-TELFX,

TELTX like CSKS-TELTX,

TELX1 like CSKS-TELX1,

END OF I_CSKS.

data: W_CSKS TYPE STANDARD TABLE OF I_CSKS WITH HEADER LINE.

my query like below

select TELFX TELTX TELX1 from csks INTO TABLE w_CSKS

WHERE KOKRS = P_KOKRS

and kostl = P_KOSTL.

when i run the program everytime its fail.........

can you please help me

vishal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
801

Hi Vishal,

here the length difference is there.

i mean P_KOSTL is just 6 characters only.

But you are passing this into kostl which is 10 characters length.

so definitely it will fail. check in the table CSKS also

like whether data is there or not.

if both the fields are of same lenght and type then you will get the results

regards,

Venkatesh.

5 REPLIES 5
Read only

Former Member
0 Likes
801

Hi,

Change it like this:

parameters: P_KOSTL like coej-objnr obligatory.

select TELFX TELTX TELX1 from csks INTO TABLE w_CSKS

WHERE KOKRS = P_KOKRS

and kostl = P_KOSTL+10(6).

Regards,

Subramanian

Read only

Former Member
0 Likes
801

Make sure that for the parameter combination you enter on the selection screen there is at least one entry in the underlying table (check with SE16). If you leave the first parameter empty (P_KOKRS) it will select only those entries from the table where this field is empty as well.

Hope that helps,

Michael

Read only

0 Likes
801

your parameters shoub be in the same type as in CSKS table.

I your particular case, P_KOSTL has to have lenght 10, because KOSTK is Char10.

If I had wroten the code it would looj like:

PARAMETERS: P_KOKRS like CSKS-KOKRS,

P_KOSTL like CSKS-KOSTL OBLIGATORY.

Read only

Former Member
0 Likes
802

Hi Vishal,

here the length difference is there.

i mean P_KOSTL is just 6 characters only.

But you are passing this into kostl which is 10 characters length.

so definitely it will fail. check in the table CSKS also

like whether data is there or not.

if both the fields are of same lenght and type then you will get the results

regards,

Venkatesh.

Read only

0 Likes
801

Hi Venkatesh

Thanks solvd problem

Thanks

Vishal