Cdpos
Hi,
I am using these queries one after other but can anybody tell me how to use
FM CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS in place of these queries?
A) select objectclas
objectid
changenr
udate
into table i_cdhdr
from cdhdr
client specified
for all entries in i_data
where objectclas = c_lieferung
and objectid = i_data-vbeln
and udate in so_udate
and ( tcode = c_vl02n or
tcode = c_vl02 )
and change_ind = c_u.
B) Select objectclas
objectid
changenr
fname
into table i_cdpos
from cdpos
client specified
for all entries in i_cdhdr
where objectclas = c_lieferung
and objectid = i_cdhdr-objectid
and changenr = i_cdhdr-changenr
and tabname = c_likp
and fname in r_fname
and chngind = c_u.
Try using FM CHANGEDOCUMENT_READ instead:
call function 'CHANGEDOCUMENT_READ'
exporting
objectclass = c_lieferung
objectid = i_data-vbeln
tables
editpos = change_doc_int
exceptions
no_position_found = 01
wrong_access_to_archive = 02.
Rob
Similar Messages
-
Requisition Change History - not showing all records from CDHDR/CDPOS
Hello,
When viewing the Item Changes for a requisition in ME53N, I don't always see all the records that are contained in tables CDHDR / CDPOS. The missing records are related to release strategies. Does anyone have any ideas why this happens?
Thank you,
Regards,
JackieHello Jackie,
check flag "Change document" is set for the data elements.
Start transaction SE11, enter database table, push button "Display".
Check register "Fields" In the following screen, doulbe click on "Data element" for the field you want to check.
Select register "Further Characteristics" in the following screen, here you can find flag for "Change document".
Best Regards, Dirk -
Problem with Change Document FM - Not all fields are tracked in CDPOS
Hello everybody,
Using transaction SCDO and following necessary steps described in forum, I have created a change document ZFBR to track changes of a table ZFBR. The problem is, the generated FM ZFBR_WRITE_DOCUMENT does not track changes of some fields of the table (inserts are always ok, problem is with updates). After some debugging I realized that the FM DDIF_NAMETAB_GET was returning the table DFIES_TAB where the LOGFLAG was empty for some fields (which are not tracked) so that changes of these fields were not visible in table CDPOS. However, fields with LOGFLAG = 'X' are tracked succesfully (changes are visible in table CDPOS).
I did not specify any fields to be get logged or not during the steps in SCDO (can we do such a specification anywhere?), does anyone know why the field LOGFLAG has the value '' (space)?
Best regards;
Ozcan.Hi again,
The problem has been solved.
The data elements used in a table are the reason for the problem I have described above. When displaying the details of a data element, under tab "Further Characteristics" , the "Change Document" checkbox has to be selected to enable change document tracking. I have copied the problematic data elements with Z prefix and made the necessary enabling. I have replaced the data elements with their Z equivalents.
Best regards.
Ozcan. -
Report for Sales Order Change History CDPOS and CDHDR
How to take a report of the data for the Sales Order Change history for a particular period of time. It is required to take a report of all the Sales Orders for which the basic price has been changed. Please let me know the procedure. I could not get the data from the table CDPOS and CDHDR
Helpful answer would be rewarded.
Regards
PraveenDear Praveen Kumar
Have you tried with VBAP where sale order details at item level would be stored.
Moreover, to my knowledge, there won't be any changes as for as pricing is concerned at sale order level but there is at billing level. Normally, any price increase / decrease would reflect in billing. So why dont you to table join through SQVI VBAP (for sale order details) and VBRP (for billing details) so that you can compare the selling price in sale order with billing.
Thanks
G. Lakshmipathi -
Hi
could any one pls let me know about the use of CDHDR and CDPOS Tables
and what role they can play in capturing Deltas
Regards
DCDHDR has header information for changes in objects.
CDPOS has the information for the positions of the object.
<a href="http://www.sap123.com/showthread.php?t=47">Example with Screenshots</a>
Also Look at :
https://forums.sdn.sap.com/click.jspa?searchID=5749799&messageID=1456945
Re: Delta - Records changed directly in table
Generic delta queue for CDHDR
LBWE, delta extraction without BW -
Hi all,
I am developing a report for which I am fetching fields from CDPOS & CDHDR tables (both r cluster tables). when i run st05, it fetches values from a cluster table CDCLS which takes most of the database time.
Is there any view for CDPOS & CDHDR tables?
How to find the views for cluster tables?
Thanx in advance.
Vijay.hi,
check this code,
here i used function module to get details of cdhdr,cdpos.
TABLES : MARC.
DATA :BEGIN OF GI_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
DISPO LIKE MARC-DISPO,
END OF GI_MARC.
DATA : CHAR TYPE I,
COUNT TYPE I,
VAR TYPE I.
DATA : BEGIN OF GI_FINAL OCCURS 2000,
MATNR LIKE MARC-MATNR,
DISPO LIKE MARC-DISPO,
USERNAME LIKE CDHDR-USERNAME,
UDATE LIKE CDHDR-UDATE,
UTIME LIKE CDHDR-UTIME,
TCODE LIKE CDHDR-TCODE,
TABNAME LIKE CDPOS-TABNAME,
TABKEY LIKE CDPOS-TABKEY,
FNAME LIKE CDPOS-FNAME,
VALUE_NEW LIKE CDPOS-VALUE_NEW,
VALUE_OLD LIKE CDPOS-VALUE_OLD,
CHANGENR LIKE CDHDR-CHANGENR,
END OF GI_FINAL.
DATA : MATNR LIKE MARC-MATNR,
DISPO LIKE MARC-DISPO,
USERNAME1 LIKE CDHDR-USERNAME,
UDATE1 LIKE CDHDR-UDATE,
UTIME LIKE CDHDR-UTIME,
TCODE LIKE CDHDR-TCODE,
CHANGENR LIKE CDHDR-CHANGENR.
DATA : GI_CDHDR LIKE CDHDR OCCURS 0 WITH HEADER LINE.
DATA : GI_CDPOS LIKE CDPOS OCCURS 0 WITH HEADER LINE.
DATA : OBJECTCLAS LIKE CDHDR-OBJECTCLAS VALUE 'MATERIAL',
OBJECTID LIKE CDHDR-OBJECTID,
USERNAME LIKE CDHDR-USERNAME VALUE 'RSS-SPE',
UDATE LIKE CDHDR-UDATE VALUE '20070101',
CHANGE_IND LIKE CDHDR-CHANGE_IND VALUE 'U'.
type-pools: slis.
data: gt_slis_fcat type slis_t_fieldcat_alv.
data: gt_fieldcat type slis_t_fieldcat_alv.
*data: gt_fieldcatall type slis_t_fieldcat_alv.
data: g_repid like sy-repid.
data: gs_layout type slis_layout_alv.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-110.
SELECT-OPTIONS : P_DISPO FOR MARC-DISPO.
SELECT-OPTIONS : RECORDS FOR CHAR.
SELECTION-SCREEN : END OF BLOCK B1.
START-OF-SELECTION.
perform process_data.
perform f_fieldcat_init using gt_fieldcat[].
perform alv_display tables gi_final using gt_fieldcat[].
form process_data.
SELECT MATNR WERKS DISPO FROM MARC INTO TABLE GI_MARC
WHERE DISPO IN P_DISPO
AND WERKS = '1011'." Becoz we hav to chk the
the changes made in the material while extendin tht matrl frm 1011 to
*other plant.
IF NOT GI_MARC[] IS INITIAL.
IF NOT RECORDS-LOW IS INITIAL .
IF NOT RECORDS-HIGH IS INITIAL.
DESCRIBE TABLE GI_MARC LINES COUNT.
IF RECORDS-HIGH < COUNT.
DELETE GI_MARC FROM RECORDS-HIGH TO COUNT.
ENDIF.
IF RECORDS-LOW <> 1.
IF RECORDS-LOW <> 0.
DELETE GI_MARC FROM 1 TO RECORDS-LOW.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
LOOP AT GI_MARC.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = GI_MARC-MATNR
IMPORTING
OUTPUT = GI_MARC-MATNR
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
OBJECTID = GI_MARC-MATNR .
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
ARCHIVE_HANDLE = 0
DATE_OF_CHANGE = UDATE
OBJECTCLASS = OBJECTCLAS
OBJECTID = OBJECTID
TIME_OF_CHANGE = '000000'
USERNAME = USERNAME
LOCAL_TIME = ' '
DATE_UNTIL = '99991231'
TIME_UNTIL = '235959'
TABLES
I_CDHDR = GI_CDHDR
EXCEPTIONS
NO_POSITION_FOUND = 1
WRONG_ACCESS_TO_ARCHIVE = 2
TIME_ZONE_CONVERSION_ERROR = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Processing'.
IF NOT GI_CDHDR[] IS INITIAL.
LOOP AT GI_CDHDR.
MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
VAR = 1.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = GI_FINAL-MATNR
IMPORTING
OUTPUT = GI_FINAL-MATNR
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
ENDIF.
OBJECTID = GI_FINAL-MATNR ."to ensure that objid is in proper
*format
SELECT *
FROM CDPOS
INTO TABLE GI_CDPOS
PACKAGE SIZE 100
FOR ALL ENTRIES IN GI_cdhdr
WHERE OBJECTID = OBJECTID
AND CHANGENR = GI_CDHDR-CHANGENR
AND OBJECTCLAS = OBJECTCLAS
AND CHNGIND = CHANGE_IND." only those values will b
*takn which have been modified nd nt created
IF SY-SUBRC = 0.
LOOP AT GI_CDPOS.
MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
MOVE GI_CDPOS-TABNAME TO GI_FINAL-TABNAME.
MOVE GI_CDPOS-TABKEY TO GI_FINAL-TABKEY.
MOVE GI_CDPOS-FNAME TO GI_FINAL-FNAME.
MOVE GI_CDPOS-VALUE_NEW TO GI_FINAL-VALUE_NEW.
MOVE GI_CDPOS-VALUE_OLD TO GI_FINAL-VALUE_OLD.
APPEND GI_FINAL.
CLEAR GI_FINAL.
ENDIF.
VAR = VAR + 1.
ENDSELECT.
ENDLOOP.
ENDIF.
ENDLOOP.
CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Processing'.
ENDIF.
ENDLOOP.
endform.
form f_fieldcat_init using lt_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_l = 'Material number'.
ls_fieldcat-tabname = 'GI_final'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'DISPO'.
ls_fieldcat-seltext_l = 'mrp controller'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'USERNAME'.
ls_fieldcat-seltext_l = 'Username'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'CHANGENR'.
ls_fieldcat-seltext_l = 'Change Number'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'UDATE'.
ls_fieldcat-seltext_l = 'modified date'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'UTIME'.
ls_fieldcat-seltext_l = 'MODIFIED TIME'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'UDATE'.
ls_fieldcat-seltext_l = 'MODIFIED DATE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TCODE'.
ls_fieldcat-seltext_l = 'TRANSACTION CODE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TABNAME'.
ls_fieldcat-seltext_l = 'TABLE NAME'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'TABKEY'.
ls_fieldcat-seltext_l = 'TABLE KEY'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'FNAME'.
ls_fieldcat-seltext_l = 'FNAME'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'FVALUE'.
ls_fieldcat-seltext_l = 'FVALUE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'VALUE_NEW'.
ls_fieldcat-seltext_l = 'NEW VALUE'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'VALUE_OLD'.
ls_fieldcat-seltext_l = 'OLD VALUE'.
append ls_fieldcat to lt_fieldcat.
endform. " f_fieldcat_init
form alv_display tables gi_final using gt_fieldcat .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' Material list '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
is_layout = gs_layout
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = gi_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform.
regards
siva -
Generic Extractor on cdpos & CDHDR - severe performance issues in productio
Hello friends,
Can you take a look at my code? I have used a view in cdhdr table for extractor.code executes okay in dev and QA, but had to cancel job after running 48 hours. Any help is appreciated. This is my code in CMOD...
FORM Zpurchasing_exit TABLES P_C_T_DATA STRUCTURE ZOXRD40018.
DATA: itab_pct_data LIKE p_c_t_data OCCURS 0 WITH HEADER LINE.
FIELD-SYMBOLS <fs> LIKE ZOXRD40018.
itab_pct_data[] = p_c_t_data[].
LOOP AT itab_pct_data. .
SELECT TABKEY TABNAME VALUE_NEW VALUE_OLD FNAME INTO TABLE itab_cdpos
FROM cdpos
WHERE CHANGENR = itab_pct_data-CHANGENR
and objectid = itab_pct_data-objectid
and objectclas EQ 'EINKBELEG' AND
tabname EQ 'EKET' AND
fname EQ 'SLFDT'.
IF sy-subrc = 0.
DELETE TABLE p_c_t_data FROM itab_pct_data.
LOOP AT itab_cdpos.
itab_pct_data-zzTABKEY = itab_cdpos-TABKEY.
itab_pct_data-zzTABNAME = itab_cdpos-TABNAME.
itab_pct_data-zzVALUE_NEW = itab_cdpos-VALUE_NEW.
itab_pct_data-ZZVALUE_OLD = itab_cdpos-VALUE_OLD.
itab_pct_data-ZZFNAME = itab_cdpos-FNAME.
APPEND itab_pct_data TO p_c_t_data.
CLEAR itab_cdpos.
ENDLOOP.
ENDIF.
REFRESH itab_cdpos.
CLEAR: itab_cdpos, itab_pct_data.
ENDLOOP.Pabloj,
Thanks for the attachment... I did look into this, but not able to write FM properly.
Can you correct my FM?
Here is my code...
DATA : BEGIN OF I_cdhdr OCCURS 0 ,
OBJECTCLAS LIKE cdpos-OBJECTCLAS,
CHANGENR LIKE cdpos-CHANGENR,
OBJECTID LIKE cdpos-OBJECTID,
UDATE like cdhdr-UDATE,
USERNAME like cdhdr-USERNAME,
TCODE like cdhdr-TCODE,
END OF I_cdhdr.
DATA : BEGIN OF I_cdpos OCCURS 0 ,
OBJECTCLAS LIKE cdhdr-OBJECTCLAS,
OBJECTID LIKE cdhdr-OBJECTID,
CHANGENR LIKE cdhdr-CHANGENR,
TABNAME like cdpos-TABNAME,
TABKEY like cdpos-TABKEY,
FNAME like cdpos-FNAME,
CHNGIND like cdpos-CHNGIND,
VALUE_OLD like cdpos-VALUE_OLD,
VALUE_NEW like cdpos-VALUE_NEW,
END OF I_cdpos.
LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'update'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_udate.
APPEND L_R_udate.
ENDLOOP.
LOOP AT G_T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CHANGENR'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_CHANGENR.
APPEND L_R_CHANGENR.
ENDLOOP.
OPEN CURSOR WITH HOLD G_CURSOR FOR
select
OBJECTCLAS CHANGENR OBJECTID UDATE USERNAME from cdhdr
where OBJECTCLAS = 'EINKBELEG'
and udate in L_R_udate and
CHANGENR in L_R_CHANGENR.
FETCH NEXT CURSOR G_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE L_MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR G_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
SELECT OBJECTCLAS OBJECTID CHANGENR TABNAME TABKEY FNAME CHNGIND VALUE_OLD VALUE_NEW FROM CDPOS
INTO TABLE I_CDPOS
FOR ALL ENTRIES IN I_CDHDR
WHERE OBJECTCLAS EQ 'EINKBELEG'
AND OBJECTID EQ I_CDHDR-OBJECTID
AND changenr EQ i_cdhdr-changenr
AND tabname EQ 'EKET'
AND fname EQ 'SLFDT'
and CHNGIND eq 'U'.
Not sure how to append these fields into E_T_DATA? -
Price change in Schedule agreement but not updated in CDHDR and CDPOS
Hi Experts
We have change price in SA ,please see the below screen shot. But these changes not update in CDHDR and CDPOS. We can see current rate in ME33L.
Please guide how to update these changes.
Regards
Parkash ChandGenerally in standard, the changes logs are saved into table CDPOS and CDHDR.
Its working fine in my system.
Can you see the changes log with regards to document number by running program RSSCD200.
Go to SE38 or SA38, enter the program RSSCD200 then press execute.
Enter * in object class and enter the document number
Then press execute. You can find more details into the wiki content Steps to enable logging of changes in change documents - Code Gallery - SCN Wiki -
How to get initial entries of sales orders to go into CDHDR/CDPOS
When a sales order is first created and saved, we do not get an entry in CDHDR and/or CDPOS for it.
People have suggested looking at ERDAT and ERZET, but I have found that those entries may be false - especially if a person doesn't press save for a while.
A followup question to this is that when I use SE16N to look at field CHNGIND in table CDPOS, one of the possible values is J. It appears to work just like E does for deletes, but I cannot find a way to turn it on. I have been successful in using SCDO to turn on values for deletes which I needed ( thus turning the D's into E's ). A "J" appears to be an insert with the value of the field.
Is there some transaction in the system which will force the system to log the initial creation and thus assign it a change number ? I have a workaround of using a user exit to create an entry in a table, but I hate to have to do that if I don't have to. And what do I use to get the system to log the individual values on inserts ? It would help immensely if we had the values on the fields when they are inserted as a lot of logic is going towards determining those values.To anyone who reads this thread.
We ended up adding code to userexit_save_document in MV45AFZZ to create records in a custom table with a field that indicates that the entry needs to be processed. It got us around the date issue in the fact that the query looks for unprocessed entries and thus avoids the whole buffering thing. The only fields we had in the table were VBELN, POSNR, and a single character processing flag ( initial if not processed, 'X' if processed ).
There definitely is some kind of buffering going on so that our date/time went by and got missed.
I never did find any answers to my last two questions - if I ever do I will post it here. If anyone else finds out the answers, please post and I will award credit. -
How to update New_Value and Old_value field in CDPOS
Hi,
I've been going through all the article and threads in the this forum. I can;t seem to get the field populate VALUE NEW, VALUE OLD and also the FNAME field always shows as KEY.
My intersion is to update CDPOS everytime there is a value to a record in my z-table being changed.
Below is my trial code. but it does seem to work. I can INSERT into CDPOS but not UPDATE. Please review my code and let me know how can i get this problem solve please.
REPORT zvintest1.
TABLES: cdhdr, zvin_test.
DATA: objectclass LIKE cdhdr-objectclas,
objctid LIKE cdhdr-objectid,
stct_old TYPE zvin_test,
stct_new TYPE zvin_test,
tablename LIKE cdpos-tabname,
changenum LIKE cdhdr-changenr.
objectclass = 'ZVIN_ATT'.
objctid = '2711'.
tablename = 'ZVIN_TEST '.
CALL FUNCTION 'CHANGEDOCUMENT_OPEN'
EXPORTING
objectclass = objectclass
objectid = objctid
PLANNED_CHANGE_NUMBER = ' '
PLANNED_OR_REAL_CHANGES = 'R'
EXCEPTIONS
sequence_invalid = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
stct_old-vendor = '110'.
stct_old-assembly = 'position'.
stct_old-serialnum = '001'.
stct_old-status = '2'.
*modify zvin_test FROM stct_old.
stct_new-vendor = '110'.
stct_new-assembly = 'position'.
stct_new-serialnum = '001'.
stct_new-status = '1'.
*modify zvin_test FROM stct_old.
CALL FUNCTION 'CHANGEDOCUMENT_SINGLE_CASE'
EXPORTING
change_indicator = 'U'
DOCU_DELETE = 'X'
REFAREA_NEW = STCT_NEW
REFAREA_OLD = stct_old
REFTABLENAME = 'ZVIN_TEST'
tablename = tablename
workarea_new = stct_new
workarea_old = stct_old
EXCEPTIONS
nametab_error = 1
open_missing = 2
position_insert_failed = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'
EXPORTING
date_of_change = sy-datum
objectclass = objectclass
objectid = objctid
tcode = 'MIGO'
time_of_change = sy-uzeit
username = sy-uname
object_change_indicator = 'U'
PLANNED_OR_REAL_CHANGES = 'R'
NO_CHANGE_POINTERS = 'X'
IMPORTING
changenumber = changenum
EXCEPTIONS
header_insert_failed = 1
no_position_inserted = 2
object_invalid = 3
open_missing = 4
position_insert_failed = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
the error i get is NO_POSITION_INSERTED.
Thank you.
Regards,
VinodWhy don't you use the standard functionality of the record changes?
Go to SE11.. open your table.. go to Technical settings ..
here you can find the "Log data changes". Check this checkbox on.
Later on you can track changes by <b>SCU3</b> transaction code...
This the extract from the online help....
Log data changes
The logging flag defines whether changes to the data records of a table should be logged. If logging is activated, every change (with UPDATE, DELETE) to an existing data record by a user or an application program is recorded in a log table in the database.
Note: Activating logging slows down accesses that change the table. First of all, a record must be written in the log table for each change. Secondly, many users access this log table in parallel. This could cause lock situations even though the users are working with different application tables.
Dependencies
Logging only takes place if parameter rec/client in the system profile is set correctly. Setting the flag on its own does not cause the table changes to be logged.
The existing logs can be displayed with Transaction Table history (SCU3).
Regards,
Naimesh Patel -
How to update value in internal table from cdpos taking fname n value_new?
hello everyone,
i want to insert value in internal table from cdpos table taking field name from fname and value from value_new.but the problem is i am not getting how to map the corresponding field of internal table with fname value which is the field name.
for example
i
fieldname
value
name1
raj
name2
sharma
i want to update field name1. this name1 is there in fname with updated value in value_new how to make name1 with fname value
thanks and regards
laxmikant soniHi Laxmikant,
If I have understood your requirement correctly, you need to update an internal table with latest 'value_new' from cdpos table where 'fname' = 'fieldname' .
Hope the below logic will help you:
FIELD-SYMBOLS: <wa_intab> LIKE LINE OF lt_intab. "the internal table you want to change
LOOP AT lt_intab ASSIGNING <wa_intab> .
READ TABLE lt_cdpos INTO wa_cdpos "lt_cdpos contains latest data selected from CDPOS
WITH KEY fname = <wa_intab>-fieldname.
IF sy-subrc = 0.
<wa_intab>-value = wa_cdpos-value_new.
ELSE.
"//logic if the name is not there in CDPOS
ENDIF.
CLEAR wa_cdpos.
ENDLOOP.
If you wish to improve performance, I suggest using
1. "transporting value_new" addition in READ TABLE,
2. select only the data which you require from CDPOS,
3. create the internal tables with only fields which you require,
4. when you are using SELECT,LOOP AT statements, limit records by using WHERE condition
Regards,
Kavya -
Problem with the currency fields in the table cdpos
Hi Gurus,
I have observed one thing with the cdpos table like whenever we made changes to the currecy( and numeric fields also ,i am not sure ) fields ,then in the cdpos table it is showing a new entry for that change but not showing that old value, why? .But when we made any changes to date fields ,then it is storing that old date.
So Is there any specific feature in this table.
Thanks & Regards,
Rakesh.Hello
In ABAP-programm try this:
DATA: NEW LIKE CDPOS-VALUE_NEW,
OLD LIKE CDPOS-VALUE_OLD,
NEW1 TYPE MENGE_D,
OLD1 TYPE MENGE_D.
FIELD-SYMBOLS: <f> TYPE ANY.
* make select from CDHDR and CDPOS
IF CDPOS-FNAME = 'MENGE'.
MOVE CDPOS-VALUE_NEW TO NEW.
MOVE CDPOS-VALUE_OLD TO OLD.
ASSIGN NEW TO <f>.
CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 2
OTHERS = 4.
NEW1 = <f>.
ENDCATCH.
ASSIGN OLD TO <f>.
CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 2
OTHERS = 4.
OLD1 = <f>.
ENDCATCH.
ENDIF.
After this in NEW1 and OLD1 you will see values. -
Update the change history for line items in CDHDR/CDPOS
Hi,
I have a problem in updating the sales order and line items in CDHDR/CDPOS when there is change in header level custom field..
Actually i have a custom field in VBAK which added in additional data A in the header level of sales order.When we have change in that field only some line items only updating in the change history tables(CDHDR/CDPOS),but we need to capture all the line items when the custom field in the header level is changed.
i have added change document flag in the data element of the custom field.
Please advice me how to get all the line items will reflect in CDHDR/CDPOS when the header level custom field has change .
Thanks & Regards
KiranThe purpose of CHANGE DOCUMENT tables is to flag the changes with Old and New values. So when Header data is changed only Header details will be tracked and same for Item tables too.
If you need anything addtional from this then that would customizing.
I am not sure what is your requirement but to make it simple and achive requirement add same field with same setting to line item tables VBAP, VBKD.. (as required, if that's doesnt impact your Order. These fields no need to be on screen). While changing your Custom field of Header level change the item level field too. Then CHANGE DOCUMENT will generate automatically for all the line item including header. -
How to fetch the latest change number from CDPOS Table..?
Hi All,
im trying to fetch teh change number from CDPOS with the below select, but my requirement is always i wants to fetch the latest change number.
SELECT SINGLE objectid changenr FROM cdpos
INTO wa_cdpos
WHERE objectid = wa_e1kna1m-kunnr
AND ( tabname = 'KNA1' OR tabname = 'KNVV')
AND fname = 'AUFSD'
AND ( value_new = '01' OR value_new = space ).
Please let me know how to achive this..?
Ashoktry this way
" SELECT SINGLE objectid changenr FROM cdpos
" INTO wa_cdpos
SELECT objectid changenr FROM cdpos
INTO table t_cdpos
WHERE objectid = wa_e1kna1m-kunnr
AND ( tabname = 'KNA1' OR tabname = 'KNVV')
AND fname = 'AUFSD'
AND ( value_new = '01' OR value_new = space ).
SORT t_cdpos by changenr Descending.
read t_cdos index 1. "this is the latest change
Prabhudas -
Unable to proceed in change document are not updating in CDHD, CDPOS tables
Hi all,
This is a question related to Change document.
I created one custom Change document object ZBUDGETS.
As I am trying to place a trigger on FMIT (Total Funds Management) table I created a Change document object ZBUDGETS.
I included some of the authorized fields from FMIT table on which we placed the trigger.
And of course all those fields are change document enabled in the data element level. I generation of the update program was completed. And I got the function module zbudgets_write_document along with some include programs and structure.
Everything is fine, But i am unable to get this change document generated information to these tables are CDHDR and CDPOS.
the problem is when I make any expenditure like PO Posting, it will be logging in the FMIT table and the respective fields also updating. With this the Change document object should trigger and it should send the record in CDHDR and CDPOS tables. This is not happening. If the records are getting updated in the CDHDR and CDPOS tables I can use those include programs and function modules in my program to retrieve the changes in FMIT table.
Since I am unable to proceed further since the documents are not updating in CDHDR and CDPOS tables.
PrabhakarCDHDR and CDPOS will not be populated with entries only by creating the change document object.Change documents will be written to CDHDR and CDPOS tables only if the function zbudgets_write_document is called in the transaction which updates FMIT.
You need to find an use exit in the transaction updating FMIT and call the function zbudgets_write_document in that exit.
Refer the below link http://help.sap.com/saphelp_47x200/helpdata/en/2a/fa01b6493111d182b70000e829fbfe/content.htm
-Kiran
*Please reward useful answers -
Reg: Object class stored in CDHDR , CDPOS tables
Hi Guys,
we have released blocked Invoice document using transaction MRBR, it is released. we have developed manually zprogram all the invoices which are released manually. but when execute we were unable to get details manually released documents. Here we observed data is fetching from CDHDR, CDPOS tables. Upon observation the Object class we found after released the invoice is getting saved with object class " BELEG". but in zprogram objcet class checking with " INCOMINGINVOICE".
can you explain the which scenario object class is saved with "BELEG", object class is saved with " INCOMINGINVOICE".
Thanks!
Mahendar Patha.Hi Steve,
(If I understood your question correctly then) Under the Object Value Column 0350035419 is the Customer number. Also under Table key column 1st three characters are your client i.e. 050 followed by customer number 0350035419.
-ruby
Maybe you are looking for
-
It just works... You've got to be kidding
The following is an example of how Apple really hasn’t got their Intel machines and OS right when it comes to the much advertised feature of also being able to run Windows. If you are not interested in running Windows on an Apple machine, you may as
-
Import Package - How to? Basic Instructions
Hey Experts - I'm trying to learn about the Import Package. We're using BPC 7.0, Microsoft Version. Where can I go to get some detailed instructions on how this package works? How do I create a Transformation File? What is the .TDM file I see in t
-
HT201181 mcbook pro keyboard is not working correctluy
my macbook pro keyboard is being weird. If I hit the 1 key I get the volume increase- If - The issue seems to only be with the number keys. Some of the other renumbers are behaving strange too. I tried a restart that did not help. I also tried to
-
Do I need to add Apple TV as a device?
I just bought Apple TV and are trying to set up Netflix. Do I have to add Apple TV as a device?
-
Could someone explain how to add this feature to Photoshop cs5. I miss this feature from adobe, and I don't understand there own instructions.