

Dear,
I would like to fetch the first 10 values from the field edid4.sdata from the segment
where b.segnam = 'E1BPMEPOHEADER' and a.mestyp = 'PORDCR1'
Getting an error message "Function SUBSTRING: parameter at position 1 has incorrect data type LCHR"
Can you please advice "how to extract the values from the sdata of EDID4 table with LCHAR.
Regards
Praveen G.
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shanti,
I have created a similar CDS table function. But when I join it with my CDS, it does not allow me to have multiple document numbers(invoice number, Sales Orders, PO etc). All these fields have been fetched using substring on Sdata field. Not sure why its not allowing me to display 3 documents. Can you please guide me here?

Use below code
substring(cast(B.sdata as abap.char( 1000 )), 1,10) as ApplicationData
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you use CAST SQL operation and convert the LCHR type to a String value and then try to use Substring operation ?
Thanks,
Sijin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
This can be achieved with the help of table function.
As per SAP documentation we cannot use LCHR in cast function (ABAP CDS limitation).
https://launchpad.support.sap.com/#/notes/0002752176
I would definitely suggest trying table function to address this issue. We can use substr in the method.
return select A.mandt,
A.docnum,
A.idoctp,
A.mestyp,
B.dtint2,
B.sdata,
substr(B.sdata, 1,10 ) as SubStringData from edidc A
left outer join edid4 B on A.docnum = B.docnum
and A.idoctp = B.segnamHope this help 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 5 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.