Using SUBSTRING during Extraction SAP ECC

Hi there,

we are currently in the middle of the extraction of a production planning process from our SAP ECC. Now there is the need to extract only certain lines of the CDHDR and CDPOS. We know that a join is theoretically possible between AUFK.AUFNR and CDHDR/CDPOS.OBJECTID. To make it an exact join, though, one has to extract a substring of the OBJECTID, as the AUFNR is only a part of the OBJECTID. We tried this:

SUBSTRING (CDHDR.OBJECTID,6,12) = AUFK.AUFNR.

It returned an error, though. Does anybody know, where the problem is or is there a better solution to our problem?

Happy for any help and best regards,

Carl