Skip to Content
0
Former Member
May 02, 2005 at 01:52 PM

Error Extracting data from a STRUCTURE in SELECT statement

60 Views

Hi,

I have an SAP defined structure BIW_KNA1_S which has been enhanced with 2 fields (ZZS1 and ZZS2). I need to populate these 2 fields with data from the 2 SORT fields from ADRC table.

I tried the following code but i do not get any output. This piece of code is in a FORM statement from which i should return contents of table ITAB in the foll. code.

DATA ZS TYPE TABLE OF ADRC WITH HEADER LINE.

DATA ITAB LIKE TABLE OF BIW_KNA1_S WITH HEADER LINE.

FIELD-SYMBOLS: <FS> LIKE ITAB.

SELECT SORT1 SORT2 FROM ADRC INTO CORRESPONDING FIELDS OF TABLE

ZS WHERE ADDRNUMBER IS NOT NULL.

LOOP AT ITAB ASSIGNING <FS>.

IF ZS-ADDRNUMBER IS NOT INITIAL.

<FS>-ZZS1 = ZS-SORT1.

<FS>-ZZS2 = ZS-SORT2.

ENDIF.

ENDLOOP.

Since i did not get any output, I then added the foll. line of code before the LOOP statement.

SELECT * FROM BIW_KNA1_S INTO CORRESPONDING FIELDS OF TABLE ITAB

WHERE KUNNR IS NOT NULL.

When i execute this, i get the foll. error.

"BIW_KNA1_S is not defined in the ABAP dictionary as table, projection view or database view."

How to extract data from a structure BIW_KNA1_S using a SELECT statement.

Could someone help.

Thanks