Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with CS (Contains String)

Former Member
0 Likes
935

Hi,

I am comparing a work area field (wa_entity-service_descript) with an internal table field (lt_output-catalog_name) using CS (Contains String).

It works fine when wa_entity-service_descript = Edwards Medical Supply - Internal catalog

and lt_output-catalog_name = EDWARDS MEDICAL.

It returns sy-fdpos = 0.

But when wa_entity-service_descript = AGRO Envelope corporation - Internal catalog

and lt_output-catalog_name = ARGO ENVELOPE CO

CS returns false and the value of sy-fdpos = 60.

Why is CS not returning true in this case? What should I do so that the comparison returns true?

Thanks and Regards,

Jayesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
792

Maybe because you have AGRO and ARGO...

5 REPLIES 5
Read only

Former Member
0 Likes
793

Maybe because you have AGRO and ARGO...

Read only

Former Member
0 Likes
792

In the example, you have mentioned that work area contains service desciption starting with "AGRO" and you are comparing with catalog name starting with "ARGO". So both values are not matching and that returns total length of service description, which is true by working definition of CS. Read below:

If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.

Let me know if you have any further queries.

Don't forget to mark helpful answers!

Gaurav Parmar.

Read only

Former Member
0 Likes
792

when wa_entity-service_descript = Edwards Medical Supply - Internal catalog

and lt_output-catalog_name = EDWARDS MEDICAL.

st1 contains string st2...

in second case...

when wa_entity-service_descript = AGRO Envelope corporation - Internal catalog

and lt_output-catalog_name = ARGO ENVELOPE CO

st1 contains string st2...(WRONG NA)

st2 contains string st1...(CORRECT IS)..

THATS Y IT IS sy-fdpos = 60..

PLS TELL ME WT EXACTLY UR REQUIREMENT....

SO THAT WILL HELP U.

RAMESH

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
792

Hi,

The spelling is wrong.

wa_entity-service_descript = A<b>GR</b>O Envelope corporation - Internal catalog

and lt_output-catalog_name = A<b>RG</b>O ENVELOPE CO

Read only

Former Member
0 Likes
792

Re: Problem with CS (Contains String)

Posted: Oct 26, 2006 4:55 AM Reply E-mail this post

when wa_entity-service_descript = Edwards Medical Supply - Internal catalog

and lt_output-catalog_name = EDWARDS MEDICAL.

st1 contains string st2...

in second case...

when wa_entity-service_descript = AGRO Envelope corporation - Internal catalog

and lt_output-catalog_name = ARGO ENVELOPE CO

st1 contains string st2...(WRONG NA)(AND ALSO OBSERVE 'AGRO' NOT THERE 'ARGO' IS THERE)

st2 contains string st1...(CORRECT IS)..

THATS Y IT IS sy-fdpos = 60..

PLS TELL ME WT EXACTLY UR REQUIREMENT....

SO THAT WILL HELP U.