Application Development 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: 

Syntax error

Former Member
0 Kudos

hello all,

SELECT B~MATNR

INTO TABLE LT_FINAL

FROM /SAPAPO/MATLOC AS A

INNER JOIN /SAPAPO/MATKEY AS B ON AMATID EQ BMATID

INNER JOIN /SAPAPO/LOC AS C ON ALOCID EQ CLOCID

WHERE C~LOCID EQ LT_ORDKEYS-LOCID.

Error : lt_ordkeys is a table without header line.

My Declaration is.

data : LT_ORDKEYS TYPE /SAPAPO/OM_ORDKEY_TAB,

But i cannot declare like

LT_ORDKEYS TYPE /SAPAPO/OM_ORDKEY_TAB with header line.

Then i cannot pass it to Fm CALL FUNCTION '/SAPAPO/OM_ORDER_GET_DATA'

importing parameter : et_ordkeys.

How to solve this ?

5 REPLIES 5

Former Member
0 Kudos

You can decalre it as LT_ORDKEYS TYPE <b>TABLE OF</b> /SAPAPO/OM_ORDKEY_TAB.

Best Regards,

Vibha

*Plz mark useful answers

Former Member
0 Kudos

Hi John,

the problem is, that the WHERE-Condition

WHERE C~LOCID EQ LT_ORDKEYS-LOCID.

compares a single value with a table.

Can you declare a range (e.g. LR_ORDKEYS), put the values from LT_ORDKEYS into this range and change the condition to

WHERE c~LOCID IN LR_ORDKEY?

?

Regards,

Stefan

Former Member
0 Kudos

Hi,

try below code

data LT_ORDKEYS like /SAPAPO/OM_ORDKEY_TAB occurs 0

with header line.

Regards

amole

0 Kudos

Hi,

Can U paste tHe code from where ur getting the locid passed into the select query.

Regards

Ahasan

Former Member
0 Kudos

Hi Johnn,

Since LT_ORDKEYS is a table, try using the statement 'FOR ALL ENTRIES' in the select stmt. That should then equate each record of LT_ORDKEYS with C~LOCID.Also check LT_ORDKEYS is not initial before using a SELECT with <b>'FOR ALL ENTRIES'</b> to avoid performance issues.

SELECT B~MATNR

INTO TABLE LT_FINAL

FROM /SAPAPO/MATLOC AS A

INNER JOIN /SAPAPO/MATKEY AS B ON AMATID EQ BMATID

INNER JOIN /SAPAPO/LOC AS C ON ALOCID EQ CLOCID

<b>FOR ALL ENTRIES IN LT_ORDKEYS</b>

WHERE C~LOCID EQ LT_ORDKEYS-LOCID.

Regards.