‎2009 Jun 17 1:39 PM
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
‎2009 Jun 17 1:46 PM
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
‎2009 Jun 17 1:48 PM
> 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
‎2009 Jun 17 1:51 PM
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
‎2009 Jun 17 1:55 PM
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
‎2009 Jun 17 5:36 PM
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