Application Development 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: 

How to compare char and numc in select query

Former Member
0 Kudos

Hi,

I want to compare two fields of two different tables. One field is Char type , another is Numc.

How can I compare these fields ?

Is it possible ?

If not, tell me any other ways..

11 REPLIES 11

Sandeep_Kumar
Advisor
Advisor
0 Kudos

what is the problem by the way that you are facing ?

0 Kudos

I am using inner join to combine two tables.

I want to fetch the data from these tables.

The field in one table char, and in another the field is numc.

How to compare these two ?

0 Kudos

Hi Rajesh,

Can you please tell me the table names if they are standard. I will just give a try.

0 Kudos

HI,

In the inner table in which you have numc field, create one more field of type char. THen loop the internal table and then fill the new char field using numc.

Then use the char field in inner join with second table char field.

0 Kudos

SELECT ACBRQNO AGJAHR AWERKS AREQR BREFNUM BDESCRIPT

FROM ZBUDGET_MASTER AS A INNER JOIN ZTRACK_NO_MAST AS B ON

<h5>ACBRQNO = BTRACKNO</h5>

INTO TABLE ITAB

WHERE A~GJAHR = IT_GJAHR AND

A~WERKS IN IT_WERKS AND

A~PROJ IN IT_PROJ.

<h4>CBRQNO is char</h4>

<h4>TRACKNO is numc </h4>

How to compare and fetch ?

0 Kudos

HI

Comparing wont be problem in your case

as char can accomadate the numerics also .but weder you are getting any bug while performing te querry ...!

0 Kudos

It is not showing any bug at all.

But , I couldn't fetch the data from the database.

0 Kudos

ACBRQNO = BTRACKNO

for above two fields CBRQNO & TRACKNO , please check out their Conversion routine in their respective Database table.

1st in SE11-> enter table name ZBUDGET_MASTER & ZTRACK_NO_MAST in different sessions. and check out the data domain used by this fields(CBRQNO & TRACKNO).

In their respective domains of fields(CBRQNO & TRACKNO), click on tab 'DEFINITIONS', then check out the conversion routines in Output Characteristics of the Data Domain of field(CBRQNO & TRACKNO).

From my point of view, both the Conversion routines should be the same.

If Conversion Routines are not there, then insert suitable Conversion routine for both the fields domain(CBRQNO & TRACKNO).

For help for for conversion routines:

http://help.sap.com/saphelp_46c/helpdata/en/cf/21ee19446011d189700000e8322d00/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/35/26b217afab52b9e10000009b38f974/content.htm

http://abaplovers.blogspot.com/2008/03/conversion-routines-in-sap.html

hope this solution could solve your issue..

Awaiting for your reply!!

anup_deshmukh4
Active Contributor
0 Kudos

hello Rajeshblack ,

you cand do it using 'LIKE' addition in your query....and you can use wild Characters also like '%' '+' & '_'

just like select * from makt where makt like '%ABC%'. it will work as 'CP' operater i

just check for the help for LIKE addition in Where clause in query...!

Hope it helps.

former_member184657
Active Contributor
0 Kudos

Is it possible ?

Did you try?

pk

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Try assigning numc also to char type locally in a variable and then compare the char.