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

length and conversion problem

Former Member
0 Likes
2,427

hi sap,

i have a requirment where by i need to get the material number

so when i use the select statement such as like this it issues me syntax error while checking what could i do to avoid this error message?

select * from cabn into CORRESPONDING FIELDS OF TABLE lt_cabn

where atnam in so_h_sub.

if sy-subrc = 0.

select

  • from ausp into CORRESPONDING FIELDS OF TABLE lt_ausp

FOR ALL ENTRIES IN lt_cabn

where atinn = lt_cabn-atinn

and atwrt in so_value.

select * from inob into CORRESPONDING FIELDS OF TABLE lt_inob

FOR ALL ENTRIES IN lt_ausp

where cuobj eq lt_ausp-objek.

-


ERROR----


-


> here it gives me syntax problem saying that FOR ALL ENTIRES IN ITAB the fields CUOBJ and LT_AUSP-OBJEK should have the same LENGTH and TYPE.

-


so how can i avoid this problem? please i need your valuble response where am struck here.

-


if sy-subrc = 0.

select * from mara into CORRESPONDING FIELDS OF TABLE lt_mara

FOR ALL ENTRIES IN lt_inob

where matnr = lt_inob-objek.

endif.

endif.

thank you,

pasala.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,637

hi

please check the data type cuobj and in internal table having same dataytpe , length ( lt_ausp-objek)

8 REPLIES 8
Read only

Former Member
0 Likes
1,638

hi

please check the data type cuobj and in internal table having same dataytpe , length ( lt_ausp-objek)

Read only

0 Likes
1,637

hi dharma,

ausp- objek - char len - 50 - Key of object to be classified

inob - cuobj - char len - 18 - Configuration (internal object number)

but when i use record by record it does not give this problem but when i use like for all entries in command it gives me this problem.

how can i get the records l

select * from inob into correspondig fields of table lt_inob

for all entries in lt_ausp

where cuobj = lt_ausp-objek.

i want those records that are eqvual to cuobj = ausp-objek.

how can i get it.

Read only

0 Likes
1,637

hi

try to use Ramchander logic,

Create a temporary internal table and append the data.The use for all entries using the temp internal table.

Example:

types:table of ty_temp,

inob type cuobj,

end of ty_temp.

data:lt_temp type tabl of ty_temp,

wa_temp type ty_temp.

loop at lt_ausp.

wa_temp-inob = lt_ausp-objek.

append wa_temp to lt_temp,

endloop.

select * from inob into correspondig fields of table lt_inob

for all entries in lt_temp

where cuobj = lt_temp-inob.

Edited by: dharma raj on Dec 30, 2009 5:19 PM

Read only

Former Member
0 Likes
1,637

Hi,

While using For ALL Entries the Internal Table Field length and Databse from which you are retriving the data field lenght must be the same, in that case only U can get the data properly. In order to restrict this instead of decalaring the internal table with reference to the table , decalare the internal table with required field as a structure , in that structure refer that particular field (CUOBJ as AUSP-OBJNUM) and retrive the data by using FOR ALL ENTRIES as usual.

Read only

0 Likes
1,637

hi tulasi,

can you please little more clearer pls? i really appreiciate it.

thank you.

Read only

Former Member
0 Likes
1,637

Hi

Create a temp lt_inob with an extra field of type matnr.
suppose you it_inob contain only one field objek

data : begin of  temp_inob occurs 0,
     objek type inob-objek,
    matnr type mantr,
end of temp_inob.

loop at it_inob.
temp_inob-objek = it_inob-objek.
temp_inob-matnr = it_inob-objek.
append temp_inob.
endloop.

now you can use this temp_inob in select query in place of original it_inob.
" the result is same only one extra Loop.

here also you can use
delete adjacent duplicates from temp_inob comparing matnr.

select * from mara into CORRESPONDING FIELDS OF TABLE lt_mara
FOR ALL ENTRIES IN temp_inob
where matnr = temp_inob-matnr " now your matnr in Temp is same length of mara-matnr and also contains the value of OBJEK.


" This will serve your purpose without doubt.


I normally follow this method in order to overcome this.
This is to the best of my knowledge. may be some other better process might be there.

Cheerz

Ram

Read only

Former Member
0 Likes
1,637

CUOBJ and LT_AUSP-OBJEK should be of same data type.

Please press F1 on for all entries to know more.

Please close the thread if your issue is resolved.

Read only

Former Member
0 Likes
1,637

Hi Baskar,

ausp- objek - char len - 50 - Key of object to be classified

inob - cuobj - char len - 18 - Configuration (internal object number)

declare a structure for INOB.

data : begin of inob,

cuobj like ausp-objek,

klart like inob-klart,

--

--

end of inob.