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

can not get data from database

Former Member
0 Likes
1,383

hi all,

there is a problem , when i write like below :

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs = p_bukrs

AND hkont = p_hkont.

p_bukrs , p_hkont are all on the selection screen , and p_bukrs = 1200 another is eq blank. i can not find any data , but with the same condition i can find some data in database , when i debeg i found that p_hkont is initial.

when i write like this :

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs = p_bukrs .

this time i can find the data like the database.

so , does someone know where the problem is , why i can not get data ?

kind regards

kevin

1 ACCEPTED SOLUTION
Read only

rajesh_akarte2
Active Participant
0 Likes
1,354

Hi Kevin,

Try this:

make ur selection parameter as select options and change the queries to

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs IN p_bukrs

AND hkont IN p_hkont.

Now try i think now it will work.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Regards,

Rajesh Akarte

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 5:22 PM

13 REPLIES 13
Read only

rajesh_akarte2
Active Participant
0 Likes
1,355

Hi Kevin,

Try this:

make ur selection parameter as select options and change the queries to

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs IN p_bukrs

AND hkont IN p_hkont.

Now try i think now it will work.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Regards,

Rajesh Akarte

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 5:22 PM

Read only

Former Member
0 Likes
1,354

hi,

maybe bukrs and hkont are both mandatory fields for bsis table, and keeping hkont eq blank wil not give any result, as no result matches the given fields.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 5:23 PM

Read only

Former Member
0 Likes
1,354

Hi Kevin,

As HKONT is a key field in BSIS and you are not passing anything to it so it is not fetching any data. The best way is change paramters to select-option as some one said or make both the parameters mandatory.

Regards,

Atish

Read only

Former Member
0 Likes
1,354

HI Kevin,

I think here you need to use conversion exit for p_hkont field.

The actual length of this field is 10 char. I think you are giving less than 10 char in the selection screen.

Just add zeros in the left side and execute it. You will get data.

use this function module to add zeros,

<b>CONVERSION_EXIT_ALPHA_OUTPUT</b>

Read only

Former Member
0 Likes
1,354

Hi,

U r not getting data bcoz of conversion exit.

use this FM before passing data..

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = p_hkont

IMPORTING

OUTPUT = p_hkont

.

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs = p_bukrs

AND hkont = p_hkont.

now it will work.

regds,

Paras

Read only

0 Likes
1,354

Hi Paras ,

the field p_hkont is a parameter , it is reference to field bsis-hkont, and it is the key field of table BSIS , but in program i want to get all data where p_bukrs = 1200 and hkont i don't fill it.

i have tried the FM you told me , i think it will work if i enter some value to field p_bukrs , but this time , i don't enter anything , so , i still can not get data form bsis.

can you explain this ?

thanks

regards

kevin

Read only

0 Likes
1,354

Hi Kevin,

have you tried as I said.

Define p_hkont as

TABLES bsis.

SELECT-OPTIONS p_hkont FOR bsis-hkont.

and use IN in the WHERE clause.

Regards,

Atish

Read only

0 Likes
1,354

hi Atish ,

it may work , but if i just want to use p_hkont as a parameter , how can i do this ? pls explain more , thanks

regards

kevin

Read only

0 Likes
1,354

Hi Kevin u can use p_hkont as parameter use the following syntax for declaration :

SELECT-OPTIONS p_hkont FOR bseg-hkont <b>NO-EXTENSION</b>

<b>NO INTERVALS.</b>

Regards,

Rajesh Akarte

Read only

0 Likes
1,354

Hi Kevin,

You can use as told by Rajesh, it will effectively show as a parameter on the selection screen, but if you want to use the PARAMETERS in the program then you need to make that field mandatory so that it should not be blank. There is no other option in that case.

Regards,

Atish

Read only

0 Likes
1,354

hi ,

thanks a lot , i have tried you way and solved this

best regards

kevin

Read only

mahaboob_pathan
Contributor
0 Likes
1,354

hi,

if u r using bukrs and hkont as parameters in selection screen then

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs = p_bukrs

AND hkont = p_hkont.

this will work.

if u r using then as select-option then the above does n't work.

bcoz select-options work as internal table bcoz of that u have use the query like this

SELECT * FROM bsis INTO CORRESPONDING FIELDS OF TABLE it_temp

WHERE bukrs IN p_bukrs

AND hkont IN p_hkont.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Edited by: Alvaro Tejada Galindo on Aug 15, 2008 5:25 PM

Read only

Former Member
0 Likes
1,354

hi all ,

thanks u for the answers. the issue is solved now

regards