We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE: [sap-dev] CDHDR and CDPOS usage

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from tere90210 on Apr 5 at 3:28 PM
Hi:

You have two options.

The first one, is to make a SELECT to the CDPOS with OBJECTCLASS = 'MATERIAL', TABNAME (the one that has the movement type), also de FIELDNAME, the FIELDVALUE '31', and the CHANGE_IND 'U' (for Update, I for Insert).

After this SELECT, you must do a SELECT to the CDHDR, wich contains the Dates of this CHANGENUMBERS you already searched. With this information, you just have to SORT i_cdhdr BY udate DESCENDING.

***This example is for the NetPrice Value changed for POs
SELECT objectclas
objectid
changenr
tabkey
FROM cdpos
INTO TABLE i_cdpos
WHERE objectclas EQ 'EINKBELEG' "EINKBELEG is for POs, you should use MATERIAL objectclas
AND objectid EQ i_ebeln-ebeln
AND tabname EQ 'EKPO' "This is the table where the ME23N stores the NetPrice field
AND fname EQ 'NETPR'
AND chngind EQ 'U'.

IF sy-subrc EQ 0.
SORT i_cdpos2 BY objectid ASCENDING
changenr DESCENDING
tabkey ASCENDING .

SELECT objectid
changenr
udate
FROM cdhdr
INTO TABLE i_cdhdr2
FOR ALL ENTRIES IN i_cdpos2
WHERE objectclas EQ i_cdpos2-objectclas
AND objectid EQ i_cdpos2-objectid
AND changenr EQ i_cdpos2-changenr.
IF sy-subrc = 0.
SORT i_cdhdr2
BY objectid ASCENDING changenr DESCENDING udate DESCENDING .
ENDIF.


The second option is to use the FM 'CHANGEDOCUMENT_READ'.

CALL FUNCTION 'CHANGEDOCUMENT_READ'
EXPORTING
objectclass = 'EINKBELEG'
objectid = l_objectid
tablekey = l_tabkey
tablename = 'EKPO '
TABLES
editpos = i_editpos
EXCEPTIONS
no_position_found = 1
wrong_access_to_archive = 2
time_zone_conversion_error = 3
OTHERS = 4.

You should place the cursor on the Movement Type field, press F1 and then Technical information, and you will know which table and field you must use.

I hope this help you.

If you have any questions, please let us know.

Greetings,
Tere Cristerna.



Mar?a Teresa Cristerna Mata
Stay hungry... stay foolish (Steve Jobs)

---------------Original Message---------------
From: prerna
Sent: Thursday, April 05, 2012 3:08 PM
Subject: CDHDR and CDPOS usage

I have request- is there a report that lists XDC status changes, and date the change was made? I'm hoping to find out when the materials were moved out of status 31, other than looking 1 by 1 through MM03.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Toolbox.com and message author.
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
tere90210  
ABAP Consultant
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Toolbox.com for iPhone & Android: Ask Questions & Get Answers Anywhere. Download the Free App

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language