Skip to Content

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

Regarding Logic for comparing 3 internal tables data

Hi,

I have a issue related to <b>Logic for comparing 3 internal tables data</b>.

I had decalred 3 internal Tables & Final Internal Tables as follows.

<b>DATA: BEGIN OF i_pdata1 OCCURS 0,

zzexgen LIKE zexport_class-zzexgen,

zzalnum LIKE zexport_class-zzalnum,

zzembgr LIKE zexport_class-zzembgr,

zzsecgk LIKE zexport_class-zzsecgk,

END OF i_pdata1.

DATA: BEGIN OF i_pdata2 OCCURS 0,

zzexgen LIKE zexport_customer-zzexgen,

zzkunnr LIKE zexport_customer-zzkunnr,

END OF i_pdata2.

DATA: BEGIN OF i_pdata3 OCCURS 0,

zzexgen LIKE zexport_country-zzexgen,

zzgenla LIKE zexport_country-zzgenla,

END OF i_pdata3.</b>

And Final Internal Table as:

<b>DATA: BEGIN OF i_pdata OCCURS 0,

zzexgen LIKE zexport_header-zzexgen,

END OF i_pdata.</b>

Now what i have to do is to populate all the first 3 internal tables.

And then findout common Entries for [ZZEXGEN] field in all the 3 fields and push them to i_pdata.

And make use those ZZEXGEN field values.

I had written following select statements to REtrieve and fill all the first 3 internal tables.


<b>  SELECT zzexgen
         zzalnum
         zzembgr
         zzsecgk
         FROM zexport_class
         INTO TABLE i_pdata1
         WHERE zzalnum = i_data-alnum AND
               zzembgr = i_data-embgr AND
               zzsecgk = i_data-secgk.

  IF sy-subrc EQ 0.
  ENDIF.

  SELECT zzexgen
         zzkunnr
         FROM zexport_customer
         INTO TABLE i_pdata2
         WHERE zzkunnr = i_data-kunnr.

  IF sy-subrc EQ 0.
  ENDIF.

  SELECT zzexgen
         zzgenla
         FROM zexport_country
         INTO TABLE i_pdata3
         WHERE zzgenla = i_data-land1.

  IF sy-subrc EQ 0.
  ENDIF.</b>

Now i need to write a logic to find out Common entries for ZZEXGEN field in all 3 internal tables and push them to final internal table I_PDATA.

Can anybody tell me the easiest logic to do so.

<b>Ex for reference :

Internal Table I_PDATA1 would have Ext_1 and Ext_2.

Internal Table I_PDATA2 would have Ext_1 and Ext_2.

Internal Table I_PDATA3 would have Ext_1, Ext_2 & Ext_3.

Now final internal table[I_PDATA] values should be

Ext_1 and Ext_2.</b>

Can anybody tell me the logic.

Thanks in advance.

Thanks & Regards,

Rayeez.

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