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

data type mismatch

Former Member
0 Likes
2,104

hi

my query is

SELECT sobid objid FROM hrp1001 INTO TABLE it_var

FOR ALL ENTRIES IN it_org

WHERE sclas EQ 'O' AND

otype EQ 'D' AND

seqnr = it_org-seqnr AND

sobid = it_org-orgeh.

sobid is

sobid TYPE hrp1001-sobid

and orgeh is

pa0001-orgeh

now error is

 When you use the addition "FOR ALL ENTRIES IN itab", the fields "SOBID"
and "IT_ORG-ORGEH" must have the same type and the same length.
   

bcoz SOBID is char type (45) and ORGEH is numeric (8).

Please tell me how to remove the error?

Is there any way other than FOR all entries to write this query?

Sachin

5 REPLIES 5
Read only

Former Member
0 Likes
1,037

Hi Sachin,

In this case you can take one more variable say ORGEH2 of character type with length 45.

Loop at it_org.

pass the value of ORGEH to ORGEH2 (ORGEH2 = ORGEH)

modify it_org with index transporting ORGEH2.

endloop.

After this you can write your code as mentioned in your mail.

Hope this will help you.

Regards,

Deepa Kulkarni

Read only

Former Member
0 Likes
1,037

> SELECT sobid objid FROM hrp1001 INTO TABLE it_var

> FOR ALL ENTRIES IN it_org

> WHERE sclas EQ 'O' AND

> otype EQ 'D' AND

> seqnr = it_org-seqnr AND

> sobid = it_org-orgeh.

>

>

> bcoz SOBID is char type (45) and ORGEH is numeric (8).

Hi ,

Define one more filed sobid in your internal table it_org with type as sobid.

Now loop at it_org and assign the value of it_org-orgeh to it_org-sobid and modify the internal table.

after this write your select query as -


SELECT sobid objid FROM hrp1001 INTO TABLE it_var

FOR ALL ENTRIES IN it_org

WHERE sclas EQ 'O' AND

otype EQ 'D' AND

seqnr = it_org-seqnr AND

sobid = it_org-sobid. " Changed

Read only

Former Member
0 Likes
1,037

Hi,

Take one TEMP field in IT_ORG with length 45. Before writing this select statement, move ORGEH to temp field and then use TEMP instead of ORGEH.

loop at it_org.

it_org-temp = it_org-orgeh.

modify it_org transporting temp.

endloop.

SELECT sobid objid FROM hrp1001 INTO TABLE it_var

FOR ALL ENTRIES IN it_org

WHERE sclas EQ 'O' AND

otype EQ 'D' AND

seqnr = it_org-seqnr AND

sobid = it_org-TEMP. -


Change here

Regards,

Anil

Read only

Former Member
0 Likes
1,037

Hi,

Use extra variable like

data:lv_orgeh type hrp1001-sobid.

move orgeh to lv_orgeh.

SELECT sobid objid FROM hrp1001 INTO TABLE it_var

FOR ALL ENTRIES IN it_org

WHERE sclas EQ 'O' AND

otype EQ 'D' AND

seqnr = it_org-seqnr AND

sobid = lv_orgeh.

i think this will work.

Anil d

Read only

Former Member
0 Likes
1,037

The only way is to add another field to your internal table of the required type or else declare an internal table having fields SEQNR and ORGEH where ORGEH is of char (45). Now append all the values from the internal table IT_ORG to this internal table and use it for retriving data from HRP1001.

Regards,

Susanta