2007 Jun 11 2:37 PM
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.
2007 Jun 11 2:43 PM
Hi
Since CDHDR consumes lot of time, it is better to pass OBJECTID also in the where condition.
So better declare another field equivalent to objectID length in T_MATERIAL and modify it first.
then use for all entries of this int table T_MATERIAL to fetch the data from CDHDR
if not T_MATERIAL [] is initial.
SELECT objectid
changenr
udate
FROM CDHDR
INTO TABLE t_cdhdr
FOR ALL ENTRIES IN t_material
WHERE OBJECTCLAS EQ c_material AND
OBJECTID EQ t_material-new_material AND
UDATE EQ P_PLCHDT.
endif.
Reward points for useful Answers
Regards
Anji
Hi
Since CDHDR consumes lot of time, it is better to pass OBJECTID also in the where condition.
So better declare another field equivalent to objectID length in T_MATERIAL and modify it first.
then use for all entries of this int table T_MATERIAL to fetch the data from CDHDR
if not T_MATERIAL [] is initial.
SELECT objectid
changenr
udate
FROM CDHDR
INTO TABLE t_cdhdr
FOR ALL ENTRIES IN t_material
WHERE OBJECTCLAS EQ c_material AND
OBJECTID EQ t_material-new_material AND
UDATE EQ P_PLCHDT.
endif.
Reward points for useful Answers
Regards
Anji
2007 Jun 11 2:40 PM
declare: t_material-matnr like objid
Abd then use ur folowing codes..
2007 Jun 11 2:42 PM
Hello,
Change the code like this..
concatenate t_material-matnr '%' into t_material-matnr. " Check here
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) LIKE t_material-matnr AND " Check here
UDATE EQ P_PLCHDT.
Vasanth
2007 Jun 11 2:43 PM
Hi
Since CDHDR consumes lot of time, it is better to pass OBJECTID also in the where condition.
So better declare another field equivalent to objectID length in T_MATERIAL and modify it first.
then use for all entries of this int table T_MATERIAL to fetch the data from CDHDR
if not T_MATERIAL [] is initial.
SELECT objectid
changenr
udate
FROM CDHDR
INTO TABLE t_cdhdr
FOR ALL ENTRIES IN t_material
WHERE OBJECTCLAS EQ c_material AND
OBJECTID EQ t_material-new_material AND
UDATE EQ P_PLCHDT.
endif.
Reward points for useful Answers
Regards
Anji
2007 Jun 11 2:45 PM
If OBJECTID contains only the 18 digit material number and nothing after then you can change the type of t_material-matnr to match cdhdr-objectid. If you do not want to change the type of t_material-matnr then have another intermediate table.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |