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: 

hello problem wid sql stmt

Former Member
0 Kudos
184

i have declared my type as

TYPES:BEGIN OF ST_REGUH,

LAUFD TYPE REGUH-LAUFD,

LAUFI TYPE REGUH-LAUFI,

XVORL TYPE REGUH-XVORL,

LIFNR TYPE REGUH-LIFNR,

WAERS TYPE REGUH-WAERS,

NAME1 TYPE REGUH-NAME1,

RWBTR TYPE REGUH-RWBTR,

END OF ST_REGUH.

SELECT laufd

laufi

XVORL

LIFNR

waers

name1

rwbtr INTO TABLE it_reguh FROM reguh WHERE laufd = reguh-laufd AND

laufi = reguh-laufi .

IF sy-subrc <> 0.

MESSAGE e042(zmmcase).

ENDIF.

but it is going to short dump giving error analysis as folows. can anyone help me???

reward pts available.

11 REPLIES 11

former_member386202
Active Contributor
0 Kudos
159

Hi,

Just check ur where condition.

regards,

Prashant

harimanjesh_an
Active Participant
0 Kudos
159

hi mohan,

u cant use like this.......

u r selecting from reguh and checking ur condition again from the same table......

this is not possible.....

U have to read values of laufd and laufi from user and pass them to SELECT query or LAUFD and LAUFI values should be in some internal table and u can pass those values to SELECT query...

Example. :

<b>Data : w_laufd TYPE reguh-laufd,

w_laufi TYPE reguh-laufi.

SELECT-OPTIONS : s_laufd FOR w_reguh,

s_laufi FOR w_laufi.</b>

SELECT laufd

laufi

XVORL

LIFNR

waers

name1

rwbtr INTO TABLE it_reguh FROM reguh <b>WHERE laufd IN s_laufd AND

laufi IN s_laufi .</b>

IF sy-subrc <> 0.

MESSAGE e042(zmmcase).

ENDIF.

Reward me if useful........

Harimanjesh AN

Former Member
0 Kudos
159

what is error analysis?

Former Member
0 Kudos
159

Hi,

I think there is a problem with your where condition.

try this:

********************************************

TYPES:BEGIN OF ST_REGUH,

LAUFD TYPE REGUH-LAUFD,

LAUFI TYPE REGUH-LAUFI,

XVORL TYPE REGUH-XVORL,

LIFNR TYPE REGUH-LIFNR,

WAERS TYPE REGUH-WAERS,

NAME1 TYPE REGUH-NAME1,

RWBTR TYPE REGUH-RWBTR,

END OF ST_REGUH.

data : it_reguh type standard table of st_reguh.

data : w_LAUFD TYPE REGUH-LAUFD,

w_LAUFI TYPE REGUH-LAUFI.

select-options: s_LAUFD for w_LAUFD,

s_LAUFI for w_LAUFI.

SELECT laufd

laufi

XVORL

LIFNR

waers

name1

rwbtr

INTO TABLE it_reguh

FROM reguh

WHERE laufd in s_laufd AND

laufi in s_laufi.

IF sy-subrc <> 0.

MESSAGE e042(zmmcase).

ENDIF.

********************************************

reward points if useful.

regards,

Vinod Samuel.

Former Member
0 Kudos
159

hi,

your where condition is not correct .

you cannot compare the same table date with itself.

either u can use some other variable or a constant in your where condition.

regards,

sohi

Former Member
0 Kudos
159

hi,

while declaring table for ur structure use type keyword instead of like as for types we must use type keyword only.

and in ur select satement try like this

SELECT laufd

laufi

XVORL

LIFNR

waers

name1

rwbtr INTO TABLE it_reguh FROM reguh WHERE laufd = p_laufd AND

laufi = p_laufi. /// becozz this are input fields and those are compared to database table fields in where condition n if it is satisfied den only u ll get all records dat are suited to dat condition.

if helpful reward some points.

with regards,

Suresh Aluri.

Former Member
0 Kudos
159

hi madan

tables : reguh.

TYPES:BEGIN OF ST_REGUH,

LAUFD like REGUH-LAUFD,

LAUFI like REGUH-LAUFI,

XVORL like REGUH-XVORL,

LIFNR like REGUH-LIFNR,

WAERS like REGUH-WAERS,

NAME1 like REGUH-NAME1,

RWBTR like REGUH-RWBTR,

END OF ST_REGUH.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:s_LAUFD for REGUH-LAUFD.

SELECTION-SCREEN end OF BLOCK B1.

data : it_reguh type STANDARD TABLE OF ST_REGUH.

start-of-selection.

SELECT laufd

laufi

XVORL

LIFNR

waers

name1

rwbtr INTO TABLE it_reguh FROM reguh WHERE laufd = s_laufd AND

laufi = reguh-laufi .

IF sy-subrc <> 0.

MESSAGE e042(zmmcase).

ENDIF.

it's will help u

kk.

Former Member
0 Kudos
159

Your WHERE statement bis wrong..........

Former Member
0 Kudos
159

I think you have make mistake as follow

the first: I havenot found the definition of internal table.

data:it_reguh like table of st_reguh.

the second :

you should pay more attention to where cause.

may thest can help you!

Former Member
0 Kudos
159

Hello,

See in Select Statement , in where condition you are compairing Same Table filed.

when ever you write any Where condition it shoud be like::

select a b c d from abc into table it_abc where a = 'A' and b = it_xys-b and

c in s_c.

where a,b,c,d is field s of table ABC

it_abc is internal table and

it_xtz is also internal table which is holding data now,

s_c is selection screen varible where you can give selection for data.

Thanks,

Hetal

Former Member
0 Kudos
159

hi madan

this is code is perfect working check it

tables : reguh.

TYPES:BEGIN OF ST_REGUH,

LAUFD like REGUH-LAUFD,

LAUFI like REGUH-LAUFI,

XVORL like REGUH-XVORL,

LIFNR like REGUH-LIFNR,

WAERS like REGUH-WAERS,

NAME1 like REGUH-NAME1,

RWBTR like REGUH-RWBTR,

END OF ST_REGUH.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:s_LAUFD for REGUH-LAUFD.

SELECTION-SCREEN end OF BLOCK B1.

data : it_reguh type STANDARD TABLE OF ST_REGUH,

wa_reguh type st_reguh.

start-of-selection.

SELECT laufd

laufi

XVORL

LIFNR

waers

name1

rwbtr FROM reguh INTO TABLE it_reguh WHERE laufd in s_laufd .

loop at it_reguh into wa_reguh.

write : / wa_reguh-laufd,wa_reguh-laufi.

endloop.

regards

kk.