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

fetching data from CDHDR and CDPOS table

Former Member
0 Likes
3,849

Hi experts,

I need to fetch the UTIME,UDATE and TCODE from CDHDR table and field TABNAME from the table CDPOS table by passing or joining the PO tables (EKKO and EKPO) values.

Could any one show me how to do this with out effecting the performance.

If I pass ebeln to objectid of CDPOS table I am getting multiple entries , so will i need to join with EKPO or EKKO . I am confused on this.

Thanks in advance

sai

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
1,867

CDPOS is a cluster table , you cannot put a JOIN in this table.

a®

Read only

Former Member
0 Likes
1,867

Hi

Pass Object Class = EINKBELEG and Tabname = EKKO or EKPO in CDPOS table and fetch the needed fields

If not pass the Object Class = EINKBELEG and Date(if you know) to CDHDR, take the Changenr and objectid and pass to CDPOS and fetch the required fields

Edited by: Anji Reddy Vangala on May 7, 2009 5:20 PM

Read only

Former Member
0 Likes
1,867

Hi sai,

try this way to get the Change time and date for the Purchase orders...



  SELECT *  FROM cdhdr INTO TABLE change_tab
                             WHERE objectclas = 'EINKBELEG'
                               AND objectid   = ekpo-ebeln.

  SORT change_tab.

  CONCATENATE sy-mandt ekpo-ebeln ekpo-ebelp INTO itemstring.

   LOOP AT change_tab.
    SELECT * FROM cdpos WHERE objectclas = 'EINKBELEG' AND
                              objectid   = ekpo-ebeln  AND
                              changenr   = change_tab AND
                              ( tabname  = 'EKKO'  OR
                                tabname  = 'EKPO' )   .
   ENDLOOP.

regards,

Prabhudas