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

Select Query

Former Member
0 Likes
752

hi all,

I have the data declared as per below:

DATA : BEGIN OF wa_dfkk.

INCLUDE STRUCTURE dfkkcrh.

DATA: datum LIKE dfkkcrp-datum,

bonit LIKE dfkkcrp-bonit,

END OF wa_dfkk.

and have the below query

SELECT SINGLE b~gpart

b~kjahr

b~bon01

b~bon02

b~bon03

b~bon04

b~bon05

b~bon06

b~bon07

b~bon08

b~bon09

b~bon10

b~bon11

b~bon12

b~bonma

b~bonvh

b~bmadt

b~lfdnr

b~bonfr

b~bfrdt

b~brldt

b~bnext

b~bexdt

b~bcmtf

a~datum

a~bonit

FROM dfkkcrp AS a

INNER JOIN dfkkcrh AS b

ON agpart = bgpart

AND akjahr = bkjahr

INTO CORRESPONDING FIELDS OF wa_dfkk

WHERE a~gpart EQ p_gpart

AND a~kjahr EQ p_kjahr

AND a~lfdnr EQ p_lfdnr.

the execution leads to dump for mismatch target fields.whereas the fields are in the same order in the declaration as well.

What can be the reason?Appreciate your inputs.

Regards,

Stock

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
703

hi,

try this

SELECT SINGLE b~gpart

b~kjahr

b~bon01

b~bon02

b~bon03

b~bon04

b~bon05

b~bon06

b~bon07

b~bon08

b~bon09

b~bon10

b~bon11

b~bon12

b~bonma

b~bonvh

b~bmadt

b~lfdnr

b~bonfr

b~bfrdt

b~brldt

b~bnext

b~bexdt

b~bcmtf

a~datum

a~bonit

FROM dfkkcrp AS a

INNER JOIN dfkkcrh AS b

ON agpart = bgpart

AND akjahr = bkjahr

wa_dfkk remove corresponding flds and select as in the same order as the work area

WHERE a~gpart EQ p_gpart

AND a~kjahr EQ p_kjahr

AND a~lfdnr EQ p_lfdnr.

this once happened 2 me..

5 REPLIES 5
Read only

Former Member
0 Likes
704

hi,

try this

SELECT SINGLE b~gpart

b~kjahr

b~bon01

b~bon02

b~bon03

b~bon04

b~bon05

b~bon06

b~bon07

b~bon08

b~bon09

b~bon10

b~bon11

b~bon12

b~bonma

b~bonvh

b~bmadt

b~lfdnr

b~bonfr

b~bfrdt

b~brldt

b~bnext

b~bexdt

b~bcmtf

a~datum

a~bonit

FROM dfkkcrp AS a

INNER JOIN dfkkcrh AS b

ON agpart = bgpart

AND akjahr = bkjahr

wa_dfkk remove corresponding flds and select as in the same order as the work area

WHERE a~gpart EQ p_gpart

AND a~kjahr EQ p_kjahr

AND a~lfdnr EQ p_lfdnr.

this once happened 2 me..

Read only

Former Member
0 Likes
703

hi

good

i think you r trying to join one structure with on database table.and that may be the reason it is going for dump

dfkkcrh is a structure

dfkkcrp is a database table i guess

FROM dfkkcrp AS a

INNER JOIN dfkkcrh AS b

ON agpart = bgpart

AND akjahr = bkjahr

INTO CORRESPONDING FIELDS OF wa_dfkk

WHERE a~gpart EQ p_gpart

AND a~kjahr EQ p_kjahr

AND a~lfdnr EQ p_lfdnr.

check this joining statement and do the correction.

thanks

mrutyun^

Read only

Former Member
0 Likes
703

Hi Stock

I have Copied the Code which you have given and its working fine for me.. as in no Dump is generated. I have just added the Parameters declarations

PARAMETERS : p_gpart TYPE gpart,

p_kjahr TYPE kjahr,

p_lfdnr TYPE lfdnr.

Please check the data in the tables if possible. I see no problem with the declaration or the Query.

-

Santosh

Read only

0 Likes
703

hi Santosh,

you are right..

I double checked the query and the dump version is with INTO WA_DFKK statement and not the INTO CORRESPONDING fields of WA_DFKK statement as in the post. Sorry for that as i gave the working query.

Moreover unable to understand the dump behind INTO WA_DFKK as the field info and the order remains the same as per the declarartion and both DFKKCRP and DFKKCRH are transparent tables.

Can youpls check again in your codes.

Regards,

stock

Read only

Former Member
0 Likes
703

Hi stock,

SELECT SINGLE b~gpart

b~kjahr

b~bon01

b~bon02

b~bon03

b~bon04

b~bon05

b~bon06

b~bon07

b~bon08

b~bon09

b~bon10

b~bon11

b~bon12

b~bonma

b~bonvh

b~bmadt

b~lfdnr

b~bonfr

b~bfrdt

b~brldt

b~bnext

b~bexdt

b~bcmtf

a~datum

a~bonit

FROM dfkkcrp AS a

INNER JOIN dfkkcrh AS b

ON agpart = bgpart

AND akjahr = bkjahr

INTO CORRESPONDING FIELDS OF wa_dfkk

WHERE a~gpart in p_gpart

AND a~kjahr in p_kjahr

AND a~lfdnr in p_lfdnr.

you have not given any select options if p_gpart is a select option the above one will be useful

Reward points if useful

thanks

swaroop