09-09-2014 6:54 AM
Hi ABAP experts
I wrote this endroutine, a lookup from a DSO into an infocube.
syntax checks says: E:"WA" cannot be converted to the line type of "ITAB".
What's wrong?
Thanks for any help.
Regards
Thomas
TYPES : BEGIN OF CFM,
CFM_SEC_ID TYPE /BI0/OICFM_SEC_ID,
COMP_CODE TYPE /BI0/OICOMP_CODE,
CALDAY TYPE /BI0/OICALDAY,
FS_BDATE TYPE /BI0/OIFS_BDATE,
END OF CFM.
DATA: ITAB_TARGET TYPE STANDARD TABLE OF _TY_S_TG_1.
DATA : ICOUNT TYPE RSARECORD.
DATA: ITAB TYPE TABLE OF CFM, WA type TABLE OF CFM.
IF NOT RESULT_PACKAGE[] IS INITIAL.
SELECT CFM_SEC_ID COMP_CODE CALDAY FS_BDATE
FROM /BIC/AZXYZ_O0100 INTO CORRESPONDING FIELDS OF TABLE ITAB
FOR ALL ENTRIES IN RESULT_PACKAGE WHERE
CFM_SEC_ID EQ RESULT_PACKAGE-CFM_SEC_ID
AND COMP_CODE EQ RESULT_PACKAGE-COMP_CODE AND
CALDAY EQ RESULT_PACKAGE-CALDAY.
IF SY-SUBRC EQ 0.
SORT ITAB BY CFM_SEC_ID COMP_CODE.
ENDIF.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
READ TABLE ITAB INTO WA
WITH KEY CFM_SEC_ID = <result_fields>-CFM_SEC_ID.
COMP_CODE = <result_fields>-COMP_CODE.
CALDAY = <result_fields>-CALDAY.
IF SY-SUBRC EQ 0.
<RESULT_FIELDS>-FS_BDATE = WA-FS_BDATE.
ENDIF.
APPEND <RESULT_FIELDS> TO ITAB_TARGET.
ENDLOOP.
REFRESH RESULT_PACKAGE.
RESULT_PACKAGE[] = ITAB_TARGET[].
ENDIF.
09-09-2014 7:46 AM
Hi thomas,
Your syntax is incorrect it should be 'wa type cfm' in the declaration instead of WA type TABLE OF CFM
regards,
Aarif
09-09-2014 7:46 AM
Hi thomas,
Your syntax is incorrect it should be 'wa type cfm' in the declaration instead of WA type TABLE OF CFM
regards,
Aarif
09-09-2014 8:13 AM
Thanks Aarif
Now I am getting this error:
E:Field "COMP_CODE" is unknown. It is neither in one of the specified
tables nor defined by a "DATA" statement. "DATA" statement.
09-09-2014 8:17 AM
Hi thomas,
READ TABLE ITAB INTO WA
WITH KEY CFM_SEC_ID = <result_fields>-CFM_SEC_ID.
COMP_CODE = <result_fields>-COMP_CODE.
CALDAY = <result_fields>-CALDAY.
Please remove a full stop after '<result_fields>-CFM_SEC_ID.' and <result_fields>-COMP_CODE. there should be only full stop at the end because read is one statement so it should be like this
READ TABLE ITAB INTO WA
WITH KEY CFM_SEC_ID = <result_fields>-CFM_SEC_ID
COMP_CODE = <result_fields>-COMP_CODE
CALDAY = <result_fields>-CALDAY.
just copy paste this code it will work.