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: 

How can I write this SQL?

Former Member
0 Kudos

the statement have the question:

stxh-tdname length 70

itab-vbeln length 10

select tdobject into table it_stxh

from stxh

for all entries in itab

where ( tdid = 'Z006' and tdspras = 'E' and tdname+0(10) = itab-vbeln and tdobject = 'VBBK' ).

tdname+0(10) = itab-vbeln ???

1 ACCEPTED SOLUTION

Former Member
0 Kudos

very thanks to every one,thank you !

7 REPLIES 7

Former Member
0 Kudos

the code checks if

the first ten char in tdname match the field itab-vbeln

Regards,

Aparna

Former Member
0 Kudos

any variable of char/string type can be accessed char wise..

char_variable+x(w)

this means we are refering to w characters from the xth character

if char_variable = 'APARNA'

then char_variable+0(3) = 'APA'

Regards,

Aparna

Former Member
0 Kudos

When you define the first Internal Table ITAB, define vbeln as the same type of stxh-tdname.

Eg.

data: begin of itab occurs 0,

vbeln like STXH-TDNAME,

erdat like vbak-erdat,

end of itab.

START-OF-SELECTION.

Select VBELN

ERDAT

from vbak

into CORRSPONDING FIELDS of table itab.

Then you can directly use this ITAB in the next query

select tdobject into table it_stxh

from stxh

for all entries in itab

where ( tdid = 'Z006' and tdspras = 'E' and tdname = itab-vbeln

and tdobject = 'VBBK' ).

Pls reward it if it is useful.

Former Member
0 Kudos

Hi,

This selcts works when the First 10 charecters of the field TDANME should be equals to the VBELN

Regards

Sudheer

Former Member
0 Kudos

i dont think it is possible with for all entries ... you can do like this..

data : vtdname(11).

loop at itab.

concatenate itab-vbeln '%' into vtdname.

select single tdobject into it_stxh

from stxh

where ( tdid = 'Z006' and tdspras = 'E' and tdname like vtdname and tdobject = 'VBBK' ).

append it_stxh.

endloop.

regards

shiba dutta

Former Member
0 Kudos

very thanks to every one,thank you !

0 Kudos

Hi ,

Please reward with points if the answer was helpful in solving your quesry