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

field lenght difference

Former Member
0 Likes
865

Hi all ,

i'm using the below query in which ebeln lenght is 10 and tdnam field lenght is 70.

so its giving error so how to fetch values.

select TDOBJECT TDNAME TDID TDSPRAS

from stxh into corresponding fields of table it_stxh

for all entries in it_ekpo

where TDNAME = it_ekpo-ebeln and

spras = 'en'.

if i don't use for all entries also still its not fetching values

Regards

Suprith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
806

Hi Suprith,

Create an internal table just like it_ekpo, say it_new_ekpo. The onlu difference will be ebeln field in it_new_ekpo will be of type stxh-TDNAME.

Before the select for all entries. Do as below.

loop at it_ekpo into wa_ekpo.

Move-corresponding wa_ekpo into wa_new_ekpo.

wa_new_ekpo-ebeln = wa_new-ebeln.

append wa_new_ekpo into it_new_ekpo.

endloop.

select TDOBJECT TDNAME TDID TDSPRAS
from stxh into corresponding fields of table it_stxh
for all entries in it_new_ekpo
where TDNAME = it_new_ekpo-ebeln and
spras = 'en'.

Hope this helps,

Murthy.

8 REPLIES 8
Read only

Former Member
0 Likes
806

take one more internal table and that table should be same as your it_ekpo.

only change in that table should be the VBELN FIELD should be of same type and length which is there in STXH table.

then copy all data of IT_EKPO into new created internal table.

Then fire select Query you will get the result.

Read only

Former Member
0 Likes
806

For SELECT statement with FOR ALL ENTRIES IN ITAB type and length of field

in WHERE clause should be same.

Create anothe internal table with field TDNAME and move all the data from field it_ekpo-ebeln into target field of new itab and write the SELECT query.

Read only

Former Member
0 Likes
806

Hi,

Just try the below code...

1) add one more field (ebeln2) in it_ekpo of type tdname.

2) Pass all the data from it_ekpo-ebeln to it_ekpo-ebeln2.

3) Use

 select TDOBJECT TDNAME TDID TDSPRAS
from stxh into corresponding fields of table it_stxh
for all entries in it_ekpo
where TDNAME = it_ekpo-ebeln*2* and
spras = 'en'.

Since i dont have sap access, could not able to check.

Read only

Former Member
0 Likes
806

Hi Suprith,

If you are using the Forall entries..the field type should be equal other wise it will give the error..

so take one more filed name tdnam_ebeln at the end of the internal table it_ekpo of type TDNAME at the end of that internal table

do below.


loop at  it_ekpo into wa_ekpo

wa_ekpo-tdnam_ebeln  = wa_ekpo-ebeln.

modify it_ekpo  from wa_ekpo index sy-tabix tranporting tdnam_ebeln.

endloop.

select TDOBJECT TDNAME TDID TDSPRAS
from stxh into corresponding fields of table it_stxh
for all entries in it_ekpo
where TDNAME = it_ekpo-tdnam_ebeln and         " here compare with the modified field
spras = 'en'.

now it works

Thanks!

Edited by: Prasanth on Mar 12, 2009 2:31 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
806

Hello,

You have no option but to make the field ebeln as CHAR70.

You can make the field EBELN of IT_EKPO as CHAR70 & try the select from EKPO.

If the select fails try like this: Select data from EKPO into table IT_EKPO & then loop on IT_EKPO move the all corresponding EBELN to a new table IT_EKPO_CONV which has a field of char70.

Use the table IT_EKPO_CONV to select from STXH.

BR,

Suhas

Read only

former_member222860
Active Contributor
0 Likes
806

You''ve given Fieldname SPRAS in the where_clause, but STXH hasn't.

use it as TDSPRAS

where TDNAME = it_ekpo-ebeln and
TDSPRAS = 'en'.    " see here

thanks|

Mahesh

Read only

Former Member
0 Likes
807

Hi Suprith,

Create an internal table just like it_ekpo, say it_new_ekpo. The onlu difference will be ebeln field in it_new_ekpo will be of type stxh-TDNAME.

Before the select for all entries. Do as below.

loop at it_ekpo into wa_ekpo.

Move-corresponding wa_ekpo into wa_new_ekpo.

wa_new_ekpo-ebeln = wa_new-ebeln.

append wa_new_ekpo into it_new_ekpo.

endloop.

select TDOBJECT TDNAME TDID TDSPRAS
from stxh into corresponding fields of table it_stxh
for all entries in it_new_ekpo
where TDNAME = it_new_ekpo-ebeln and
spras = 'en'.

Hope this helps,

Murthy.

Read only

Former Member
0 Likes
806

Hey,

Instead use FM READ_TEXT to ready any standard text from STXH table.

Regards

Saravanan