05-23-2006 10:32 AM
Hello friends,
I have the following code, but when I run it gives me the following error msg ""LV_LOCID" cannot be a table, a reference, a string, or contain any of these objects"
CODE:
Loop at lt_slpo into ls_slpo.
If ls_slpo-IOBJNM eq 'LOCNO'.
CALL FUNCTION '/SAPAPO/DM_LOCID_GET'
EXPORTING
I_LOCNO_RTAB = ls_slpo-LOW
IMPORTING
E_LOCID_TAB = lv_locid
EXCEPTIONS
NO_LOCATION = 1
NOT_QUALIFIED = 2
OTHERS = 3.
IF SY-SUBRC eq 0.
Select MATID LOCID from /SAPAPO/MATLOC
into corresponding fields of table lt_matloc
Where
locid = lv_locid.
ENDIF.
Any input would be appreiciate.
Many thanks
05-23-2006 10:50 AM
HI Shah,
Can you give us the declaration for lv_locid?
Regards,
ravi
05-23-2006 10:51 AM
05-23-2006 10:53 AM
Then, in the where condition,
you should pass only
lv_locid-<field for location id>
where locid = lv_locid-<field for location id>.
Regards,
Ravi
05-23-2006 10:56 AM
hi Ravi,
can you a bit explain what, lv_locid-<field for location id> is ?
_Thanks
05-23-2006 10:58 AM
then the issue is with the other parameter..
Pl change your function call as follows..
data: w_rtab type /SAPAPO/LOCNO_RSTR.
If ls_slpo-IOBJNM eq 'LOCNO'.
w_rtab-sign = 'I'.
w_rtab-option = 'EQ'.
w_rtab-low = ls_slpo-LOW.
append w_rtab.
CALL FUNCTION '/SAPAPO/DM_LOCID_GET'
EXPORTING
I_LOCNO_RTAB = w_rtab
IMPORTING
E_LOCID_TAB = lv_locid
EXCEPTIONS
NO_LOCATION = 1
NOT_QUALIFIED = 2
OTHERS = 3.
Regards,
Suresh Datti
05-23-2006 11:00 AM
YOur lv_locid is declared as a table type.
This table has many fields in it.
So, when you pass this value in the where condition, the system is getting confused betwen the types of the left hand side and right hand side of the where clause.
i don't know the field name of the location id.
you should write your select statement as
select..
..
.
where
locid = lv_locid-locid.
Regards,
Ravi
05-23-2006 11:04 AM
Hi,
I hope it will woek, will check now
Data:
lv_locid type /SAPAPO/LOCID, "/SAPAPO/LOCID_TAB,
Regards,
05-23-2006 11:09 AM
Did you check the code I posted? Both the IMP/EXP parmeters of this function call should be Table Types ie in this case RANGES.
Regards,
Suresh Datti
05-23-2006 11:10 AM
HI Shah,
It will not work. This time it will give the dump at the function call statement.
The variable which is collecting the exporting parameter type should have the same type as the function module parameter.
Regards,
ravi
05-23-2006 11:21 AM
Hi Ravi,
Thanks for your explanation, but the thing is that
The table type /SAPAPO/LOCID_TAB contains only row-type /SAPAPO/LOCID, so I want to know all fields of table type /SAPAPO/LOCID_TAB, how I can see that ??
Thanks
05-23-2006 11:23 AM
Hi Shah,
go to se11 transaction and give your /SAPAPO/LOCID_TAB as the table name and see for yourself.
Regards,
ravi
05-23-2006 11:25 AM
Double click on /SAPAPO/LOCID and you can see it.
OR
In se11, type /SAPAPO/LOCID in the DATA TYPE field and display.
Regards,
Ravi
Note : Please mark all the helpful answers
05-23-2006 11:27 AM
it is just a RANGES.. like any other select-option.. the fields will be SIGN,OPTION,LOW & HIGH..
Regards,
Suresh Datti
05-23-2006 11:27 AM
05-23-2006 11:28 AM
05-23-2006 11:30 AM
Hi Shah,
Pl change your function call to what I have posted earlier & your SELECT statement as below.
Select MATID LOCID from /SAPAPO/MATLOC
into corresponding fields of table lt_matloc
Where
locid in lv_locid.
Regards,
Suresh Datti
05-23-2006 11:36 AM
HI Shah,
I now under stand your problem.
Change your code as follows:
data: ;v_locid value type /sapapo/locid.
Loop at lt_slpo into ls_slpo.
If ls_slpo-IOBJNM eq 'LOCNO'.
CALL FUNCTION '/SAPAPO/DM_LOCID_GET'
EXPORTING
I_LOCNO_RTAB = ls_slpo-LOW
IMPORTING
E_LOCID_TAB = lv_locid
EXCEPTIONS
NO_LOCATION = 1
NOT_QUALIFIED = 2
OTHERS = 3.
IF SY-SUBRC eq 0.
read table lv_locid into lv_locid_value index 1.
Select MATID LOCID from /SAPAPO/MATLOC
into corresponding fields of table lt_matloc
Where
locid = lv_locid_value.
ENDIF.
Regards,
Ravi
05-23-2006 11:42 AM
Hi Ravi,
Many thanks for your reply, for my better understanding can you pls expaint "locid = lv_locid_value.", from where you got _value ??
Hi Suresh, I tried your code sample, it gives me the same error as before.
Thanks for your inputs
RAVI , can yo pls re-sure me that
Data: lv_locid type /SAPAPO/LOCID, and not /SAPAPO/LOCID_TAB
Message was edited by: Shah H
05-23-2006 11:44 AM
No Ravi it will not work.. I_LOCNO_RTAB is a RANGES. you will have to pass the table & not just the LOW value.
Regards,
Suresh DAtti
05-23-2006 12:03 PM
Hi,
I dont understand what was the real problem, but now I am using the following FM
/SAPAPO/DM_LOCNO_GET_LOCID, I hope it will work fine,
Anyway, thanks for your inputs guys,
05-23-2006 12:05 PM
HI Shah,
I think you have to change the design of you code slightly.
data: ls_locno type /SAPAPO/LOC_LOCNO_RSTR.
data: lt_locno type /SAPAPO/LOC_LOCNO_RTAB.
data: ls_locid type /SAPAPO/LOCID.
data: lt_locid type /SAPAPO/LOCID_TAB.
loop at lt_slpo into ls_slpo where IOBJNM eq 'LOCNO'.
move-corresponding ls_slpo into ls_locno.
append ls_locno to lt_locno.
clear ls_locno.
endloop.
CALL FUNCTION '/SAPAPO/DM_LOCID_GET'
EXPORTING
I_LOCNO_RTAB = lt_locno
IMPORTING
E_LOCID_TAB = lt_locid
EXCEPTIONS
NO_LOCATION = 1
NOT_QUALIFIED = 2
OTHERS = 3.
if sy-subrc = 0.
loop at lt_locid into ls_locid.
ls_locid_range-low = ls_locid.
ls_locid_range-sign = 'I'.
ls_locid_range-option = 'EQ'.
append ls_locid_range to lt_locid_range.
clear ls_locid_range.
endloop.
Select MATID LOCID from /SAPAPO/MATLOC
into corresponding fields of table lt_matloc
Where
locid in lt_locid_range.
endif.
Regards,
Ravi
05-23-2006 10:51 AM
Hi Shah,
I think the issue may not be with the select option.. How did you declare <b>lv_locid</b> in your program? it should be as follows..
<b>data lv_lovis type /SAPAPO/LOCID_TAB.</b>
Regards,
Suresh Datti
05-23-2006 10:57 AM
Shah,
Looks like /SAPAPO/LOCID_TAB is table type (not a single variable) and that cannot be used as a part of the SELECT statement and that is why the error.
You will have pass only one variable to the SELECT statement. So, if /SAPAPO/LOCID_TAB is a strcuture then use lv_locid-fieldname else you will have to loop at lv_locid and fire that select statement for each row.
Regards,
Ravi
Note : Please mark all the helpful answers
Message was edited by: Ravikumar Allampallam