cancel
Showing results for 
Search instead for 
Did you mean: 

look up table in sap bw

former_member203111
Participant
0 Kudos

Hello guys,

I am new in learning ABAP and trying to write a logic in field routine where I want to look up product hierarchy text from text table.

I have written the following statement but getting an error

SELECT SINGLE * FROM /BIC/TZPRODH1
INTO @DATA(W_PDH1) WHERE
Prod.Hier. = @SOURCE_FIELDS-PRDHA <<<< Error is in this line)
AND LANGU = 'E'.

RESULT = W_PDH1-TXTSH.

Error: Boolean expression is required in positions starting with PROD

Can someone please help and explain how Boolean expression will work in my logic.

Thanks

matt
Active Contributor
0 Kudos

Prod.Hier. isn't the field name, is my guess. Look at table /BIC/TZPRODH1 in SE11 to make sure you're writing the field name correctly.

In ABAP the full stop / period / . represents the end of the statement. So what you've written is:

SELECT SINGLE * FROM /BIC/TZPRODH1
INTO @DATA(W_PDH1) WHERE Prod.
Hier.
 = @SOURCE_FIELDS-PRDHA
AND LANGU = 'E'.

which isn't ABAP.

Torsten_
Advisor
Advisor
0 Kudos

Hi,

SOURCE_FIELDS is a table!

Torsten

former_member203111
Participant
0 Kudos

Hi,

The SOURCE_FIELDS-PRDHA is a datasource but I am trying to look up a text field from the text table named /BIC/TZPRODH1

I changed the code to below and there is no error in the syntax now and data loads successfully but I still don't see the text populated in the field in my DSO.

SELECT SINGLE * FROM /BIC/TZPRODH1
INTO @DATA(W_PHDTXT) WHERE
TXTSH = @SOURCE_FIELDS-PRDHA
AND LANGU = 'E'.

RESULT = W_PHDTXT-TXTSH.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

roland_szajko
Product and Topic Expert
Product and Topic Expert
0 Kudos

Are you sure, that you want to filter on TXTSH?

SELECT SINGLE * FROM /BIC/TZPRODH1
INTO @DATA(W_PHDTXT) WHERE
TXTSH = @SOURCE_FIELDS-PRDHA
AND LANGU = 'E'.

What this statement does, it reads a record from the table /BIC/TZPRODH1 whgre the value of the field TXTSH is the value in PRDHA. Is this really what you want to do? Did you tried using the key field of /BIC/TZPRODH1 instead of TXTSH?