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

How to Link Tables having different data types

Former Member
0 Likes
1,036

Hi Experts,

I am new to ABAP.My requirement is to fetch data from CCIHT_WAH,CCIHT_IHVA and AUSP Tables.I can link CCIHT_WAH and CCIHT_IHVA tables using CCIHT_WAH-RECN = CCIHT_IHVA-RECNROOT.Also I want to establish a link between CCIHT_IHVA and AUSP Tables.When I look into these Tables I found similar data in RECN and OBJEK fields,but the data types and size of these fields doesn't match.So I was unable to link these Tables.I Read in SDN that there is a link between these Tables using CCIHT_WAH-RECN = CCIHT_IHVA-RECNROOT.

Can Any one pls help me to sort out these issue?

Regds,

Sam.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
957

Hi Vik,

Thanx for ur Prompt reply.

As per ur suggestion I created an Internal Table IT_CCIHT_IHVA and declared RECN(50) TYPE C.But when I am fetching data from CCIHT_IHVA and storing into this internal table,system is showing Dump error.Error description is as follows:Error in module RSQL of the database interface.

I am using the following code:

Declaration:

TYPES : BEGIN OF STRU_CCIHT_IHVA,

RECN(50) TYPE C,

  • RECN TYPE CCIHT_IHVA-RECN,

RECNROOT TYPE CCIHT_IHVA-RECNROOT,

RECNTOBJ TYPE CCIHT_IHVA-RECNTOBJ,

IHVALCAT TYPE CCIHT_IHVA-IHVALCAT,

CLASS TYPE KLAH-CLASS,

END OF STRU_CCIHT_IHVA.

DATA : IT_CCIHT_IHVA TYPE STANDARD TABLE OF STRU_CCIHT_IHVA,

WA_CCIHT_IHVA TYPE STRU_CCIHT_IHVA.

Selection:

SELECT RECNROOT

RECNTOBJ

IHVALCAT

RECN

FROM CCIHT_IHVA

INTO TABLE IT_CCIHT_IHVA

FOR ALL ENTRIES IN IT_CCIHT_WAH

WHERE RECNROOT EQ IT_CCIHT_WAH-RECN AND

RECNTOBJ EQ IT_CCIHT_WAH-RECN AND

IHVALCAT EQ P_CNTCL.

Pls help me in this matter.

Regds,

Sam.

Hi Experts,

I am new to ABAP.My requirement is to fetch data from CCIHT_WAH,CCIHT_IHVA and AUSP Tables.I can link CCIHT_WAH and CCIHT_IHVA tables using CCIHT_WAH-RECN = CCIHT_IHVA-RECNROOT.Also I want to establish a link between CCIHT_IHVA and AUSP Tables.When I look into these Tables I found similar data in RECN and OBJEK fields,but the data types and size of these fields doesn't match.So I was unable to link these Tables.I Read in SDN that there is a link between these Tables using CCIHT_WAH-RECN = CCIHT_IHVA-RECNROOT.

Can Any one pls help me to sort out these issue?

Regds,

Sam.

6 REPLIES 6
Read only

Former Member
0 Likes
957

Hi

Before linking this you need take a seperate internal table of same data type of OBJEK.loop the table CCIHT_IHVA and pass field

data to internal table.

Using this internal table you select the data from table AUSP.

Regards,

Raghu

Read only

Former Member
0 Likes
957

Hi Raghu,

Thanx for ur immediate reply.

OBJEK field in AUSP Table is a Character data type with field length 50 whereas RECN in CCIHT_IHVA Table is a NUMC data type with a field length of 20.Can I be able to link these 2 tables? Will I have to make these 2 field types equal and if so how?

Your Answer is highly appreciable.

Regds,

Sam.

Read only

0 Likes
957

Hi,

In the internal table declarations of these fields, declare both the fields as type char of some specific length.

Though their original type is different, data can be selected and the tables can be linked by declaring both the fields as char type.

Regards,

Vik

Read only

Former Member
0 Likes
958

Hi Vik,

Thanx for ur Prompt reply.

As per ur suggestion I created an Internal Table IT_CCIHT_IHVA and declared RECN(50) TYPE C.But when I am fetching data from CCIHT_IHVA and storing into this internal table,system is showing Dump error.Error description is as follows:Error in module RSQL of the database interface.

I am using the following code:

Declaration:

TYPES : BEGIN OF STRU_CCIHT_IHVA,

RECN(50) TYPE C,

  • RECN TYPE CCIHT_IHVA-RECN,

RECNROOT TYPE CCIHT_IHVA-RECNROOT,

RECNTOBJ TYPE CCIHT_IHVA-RECNTOBJ,

IHVALCAT TYPE CCIHT_IHVA-IHVALCAT,

CLASS TYPE KLAH-CLASS,

END OF STRU_CCIHT_IHVA.

DATA : IT_CCIHT_IHVA TYPE STANDARD TABLE OF STRU_CCIHT_IHVA,

WA_CCIHT_IHVA TYPE STRU_CCIHT_IHVA.

Selection:

SELECT RECNROOT

RECNTOBJ

IHVALCAT

RECN

FROM CCIHT_IHVA

INTO TABLE IT_CCIHT_IHVA

FOR ALL ENTRIES IN IT_CCIHT_WAH

WHERE RECNROOT EQ IT_CCIHT_WAH-RECN AND

RECNTOBJ EQ IT_CCIHT_WAH-RECN AND

IHVALCAT EQ P_CNTCL.

Pls help me in this matter.

Regds,

Sam.

Read only

0 Likes
957

Hi,

In the select statement, use the same order of fields as that of what you have declared in the internal table and check if you are still getting the dump.


SELECT RECN 
RECNROOT
RECNTOBJ
IHVALCAT
FROM CCIHT_IHVA
INTO TABLE IT_CCIHT_IHVA
FOR ALL ENTRIES IN IT_CCIHT_WAH
WHERE RECNROOT EQ IT_CCIHT_WAH-RECN AND
RECNTOBJ EQ IT_CCIHT_WAH-RECN AND
IHVALCAT EQ P_CNTCL.

Regards,

Vik

Read only

0 Likes
957

Hi Vik,

Thank u very much for ur valuable input.My problem is solved now.

Wishing u all the best.

Regds,

Sam.