Skip to Content
0
Former Member
Jun 11, 2007 at 01:37 PM

Regarding Offset usage in Select statement

1196 Views

Hi All,

I have written one select stmt.

SELECT objectid

changenr

udate

FROM CDHDR

INTO TABLE t_cdhdr

FOR ALL ENTRIES IN t_material

WHERE OBJECTCLAS EQ c_material AND

OBJECTID+0(18) EQ t_material-matnr AND

UDATE EQ P_PLCHDT.

But this is giving syntax error because of Offeset i have used for OBJECTID field.

I have to use this as matnr & cdhdr-objectid lengths are diffrent.

Please clarify wether there is any direct way i can modify select statement so that it works.

Instead of above select as it is not working i have written below code:

SELECT objectid

changenr

udate

FROM CDHDR

INTO TABLE t_cdhdr

WHERE OBJECTCLAS EQ c_material AND

UDATE EQ P_PLCHDT.

IF SY-SUBRC EQ 0.

LOOP AT T_MATERIAL INTO WA_MATERIAL.

READ TABLE t_cdhdr INTO wa_cdhdr WITH KEY

OBJECTID+0(18) = WA_MATERIAL-MATNR.

IF SY-SUBRC EQ 0.

MOVE wa_cdhdr-objectid TO wa_cdhdr_f-objectid.

MOVE wa_cdhdr-changenr TO wa_cdhdr_f-changenr.

MOVE wa_cdhdr-udate TO wa_cdhdr_f-udate.

APPEND wa_cdhdr_f TO t_cdhdr_f.

ENDIF.

ENDLOOP.

Is this code correct replacement for above, Please clarify!

Can anybody give solutions for above issues!

Thanks,

Deep.