‎2007 Jun 26 4:39 PM
The customer wanted four custom columns added in an append to MSEG and SAP signed-off on the desirability of this approach (because it eliminates the need to customize MB51.)
The customer also wants change history on each of these four columns in CDPOS.
So I wrote the following code:
*mseg = xmseg.
UPD_MSEG = 'U'.
objectid = xmseg-mblnr.
mseg = xmseg.
mseg-zzlifnr = wa_zzmseg_qm_2007-zzlifnr.
PERFORM CD_CALL_ZCUSTMSEG.
mseg = xmseg.
mseg-zzltno = wa_zzmseg_qm_2007-zzltno.
PERFORM CD_CALL_ZCUSTMSEG.
mseg = xmseg.
mseg-zzvnlt = wa_zzmseg_qm_2007-zzvnlt.
PERFORM CD_CALL_ZCUSTMSEG.
mseg = xmseg.
mseg-zzname1 = wa_zzmseg_qm_2007-zzname1.
PERFORM CD_CALL_ZCUSTMSEG.
FORM CD_CALL_ZCUSTMSEG .
IF ( UPD_MSEG NE SPACE )
OR ( UPD_ICDTXT_ZCUSTMSEG NE SPACE )
.
CALL FUNCTION 'ZCUSTMSEG_WRITE_DOCUMENT '
EXPORTING
OBJECTID = objectid
TCODE = 'MIGO'
UTIME = sy-uzeit
UDATE = sy-datum
USERNAME = sy-uname
PLANNED_CHANGE_NUMBER = ' '
OBJECT_CHANGE_INDICATOR = 'U'
PLANNED_OR_REAL_CHANGES = ' '
NO_CHANGE_POINTERS = ' '
O_MSEG
= *MSEG
N_MSEG
= MSEG
UPD_MSEG
= 'U'
UPD_ICDTXT_ZCUSTMSEG
= ' '
TABLES
ICDTXT_ZCUSTMSEG
= ICDTXT_ZCUSTMSEG
.
ENDIF.
CLEAR PLANNED_CHANGE_NUMBER.
ENDFORM.
But isn't there a way to use a single function call to get the four CDPOS rows written with the new/old values for the four different field names ???
Confused as usual.
djh
‎2007 Jun 26 4:47 PM
Hi,
Check for fm CHANGEDOCUMENT_MULTIPLE_CASE
call function 'CHANGEDOCUMENT_MULTIPLE_CASE'
exporting
tablename = 'CCARD '
change_indicator = upd_ccard
docu_delete = 'X'
tables
table_old = yccard
table_new = xccard
exceptions
nametab_error = 1
open_missing = 2
position_insert_failed = 3
others = 4.
a®
‎2007 Jun 26 4:43 PM
Hi david,
1. This is maintained in the Data element of that field.
<b> (In se11, data element, tab for Further Characteristic
there is a checkbox , for "Change Document")</b>
2. If it is ticked, then that field, will automatically get stored in change documents.
regards,
amit m.
‎2007 Jun 26 4:43 PM
Hi David,
Please check this FM.
CHANGEDOCUMENT_PREPARE_POS
CHANGEDOCUMENT_*_CASE
Regards,
Ferry Lianto
‎2007 Jun 26 4:47 PM
Hi,
Check for fm CHANGEDOCUMENT_MULTIPLE_CASE
call function 'CHANGEDOCUMENT_MULTIPLE_CASE'
exporting
tablename = 'CCARD '
change_indicator = upd_ccard
docu_delete = 'X'
tables
table_old = yccard
table_new = xccard
exceptions
nametab_error = 1
open_missing = 2
position_insert_failed = 3
others = 4.
a®
‎2007 Jun 26 4:54 PM
Amit - That's not the question, although what you say is true.
Ferry/aRs -
Since you suggested two different approaches, which is the better one or the one you use ???
I looked at the "multiple case" before, but I must not have looked hard enough, because it didn't seem to work for me. I will try again.
Since you both answered so quickly, I gave each 6 instead of 10. I'll make up with "2's" for further responses if you have the time.
Thanks again
djh
‎2007 Jun 26 4:55 PM
‎2007 Jun 26 4:59 PM
gave the 10 to aRs because of the code example - I can see immediately that there's supposed to be a table of old/new instead of a single old/new pair.
At least I assume that's what the function does.
‎2007 Jun 26 5:01 PM
Hi David,
Please use FM CHANGEDOCUMENT_MULTIPLE_CASE as suggested by aRs.
OBJECTID(10) = XEBAN-BANFN.
CALL FUNCTION 'SWE_REQUESTER_TO_UPDATE'.
CALL FUNCTION 'CHANGEDOCUMENT_OPEN'
EXPORTING
OBJECTCLASS = 'BANF '
OBJECTID = OBJECTID
PLANNED_CHANGE_NUMBER = ' '
PLANNED_OR_REAL_CHANGES = ' '
EXCEPTIONS
SEQUENCE_INVALID = 1
OTHERS = 2.
CALL FUNCTION 'CHANGEDOCUMENT_MULTIPLE_CASE'
EXPORTING
TABLENAME = 'EBAN '
REFTABLENAME = 'WEBAN '
CHANGE_INDICATOR = 'U'
DOCU_DELETE = ' '
TABLES
TABLE_OLD = YEBAN
TABLE_NEW = XEBAN
EXCEPTIONS
NAMETAB_ERROR = 1
OPEN_MISSING = 2
POSITION_INSERT_FAILED = 3
OTHERS = 4.
CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'
EXPORTING
OBJECTCLASS = 'BANF '
OBJECTID = OBJECTID
DATE_OF_CHANGE = UDATE
TIME_OF_CHANGE = UTIME
TCODE = TCODE
USERNAME = USERNAME
EXCEPTIONS
HEADER_INSERT_FAILED = 1
OBJECT_INVALID = 2
OPEN_MISSING = 3
NO_POSITION_INSERTED = 4
OTHERS = 5.
Regards,
Ferry Lianto