Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

String "starts with" function in ABAP

Hi!

I need to check in ABAP, if a given profit center (char 10) starts with P172. It could be filled with zeros -> 0000P17255. So I need to perform 2 actions:

1)

Lefttrim the 0 -> Result: P17255.

2)

Check, if the string starts with P172.

How can I do this in ABAP?

Thanks,

Konrad

Tags:
Former Member
Former Member replied

data : var(10) type c.

move profit_center to var.

call conversion_exit_alpha_output

exporting

var

importing

var

condense var no-gaps.

if var+0(4) = 'P172'.

*--condition satisfied...

endif.

************************(or)****************

data : var(10) type c.

move profit_center to var.

shift var left deleting leading '0'.

if var+0(4) = 'P172'.

endif.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question