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

Change Document issue

Former Member
0 Likes
2,497

Hi,

I try to implement FM: CHANGEDOCUMENT_OPEN, CHANGEDOCUMENT_SINGLE_CASE, CHANGEDOCUMENT_CLOSE, but i encounter an runtime error : ASSIGN_BASE_TOO_SHORT.

Fehler in ASSIGN-Zuweisung im Programm "SAPLSCD0".

How to resolve this issue? Any sample code for reference?

Regards

Rayden

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,191

Hi,

Any idea how to resolve this issue? Marks will be given for the help.

Regards,

Rayden

13 REPLIES 13
Read only

Former Member
0 Likes
2,192

Hi,

Any idea how to resolve this issue? Marks will be given for the help.

Regards,

Rayden

Read only

0 Likes
2,191

Hi Rayden,

Please check the sample code below. Hope this helps.

CALL FUNCTION 'CHANGEDOCUMENT_OPEN'

EXPORTING

OBJECTCLASS = 'ZSCHEMES_REL'

OBJECTID = OBJECTID

PLANNED_CHANGE_NUMBER = PLANNED_CHANGE_NUMBER

PLANNED_OR_REAL_CHANGES = PLANNED_OR_REAL_CHANGES

EXCEPTIONS

SEQUENCE_INVALID = 1

OTHERS = 2.

CASE SY-SUBRC.

WHEN 0. "OK.

WHEN 1. MESSAGE A600 WITH 'SEQUENCE INVALID'.

WHEN 2. MESSAGE A600 WITH 'OPEN ERROR'.

ENDCASE.

IF UPD_ZIRD_P_RESCHEMES NE SPACE.

CALL FUNCTION 'CHANGEDOCUMENT_SINGLE_CASE'

EXPORTING

TABLENAME = 'ZIRD_P_RESCHEMES'

WORKAREA_OLD = O_ZIRD_P_RESCHEMES

WORKAREA_NEW = N_ZIRD_P_RESCHEMES

CHANGE_INDICATOR = UPD_ZIRD_P_RESCHEMES

DOCU_DELETE = 'X'

EXCEPTIONS

NAMETAB_ERROR = 1

OPEN_MISSING = 2

POSITION_INSERT_FAILED = 3

OTHERS = 4.

CASE SY-SUBRC.

WHEN 0. "OK.

WHEN 1. MESSAGE A600 WITH 'NAMETAB-ERROR'.

WHEN 2. MESSAGE A600 WITH 'OPEN MISSING'.

WHEN 3. MESSAGE A600 WITH 'INSERT ERROR'.

WHEN 4. MESSAGE A600 WITH 'SINGLE ERROR'.

ENDCASE.

ENDIF.

CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'

EXPORTING

OBJECTCLASS = 'ZSCHEMES_REL'

OBJECTID = OBJECTID

DATE_OF_CHANGE = UDATE

TIME_OF_CHANGE = UTIME

TCODE = TCODE

USERNAME = USERNAME

OBJECT_CHANGE_INDICATOR = OBJECT_CHANGE_INDICATOR

NO_CHANGE_POINTERS = NO_CHANGE_POINTERS

EXCEPTIONS

HEADER_INSERT_FAILED = 1

OBJECT_INVALID = 2

OPEN_MISSING = 3

NO_POSITION_INSERTED = 4

OTHERS = 5.

CASE SY-SUBRC.

WHEN 0. "OK.

WHEN 1. MESSAGE A600 WITH 'INSERT HEADER FAILED'.

WHEN 2. MESSAGE A600 WITH 'OBJECT INVALID'.

WHEN 3. MESSAGE A600 WITH 'OPEN MISSING'.

  • WHEN 4. MESSAGE A600 WITH 'NO_POSITION_INSERTED'.

  • do not abort, if positions are not inserted!!!

WHEN 5. MESSAGE A600 WITH 'CLOSE ERROR'.

ENDCASE.

Rgds,

Abhishek Raj.

Read only

0 Likes
2,191

Hi Raj,

Thanks for the feekback.

How you declare the following item :

OBJECTID

O_ZIRD_P_RESCHEMES

N_ZIRD_P_RESCHEMES

Regards,

Rayden

Read only

0 Likes
2,191

Hi,

You need to declare as following

OBJECTID TYPE CDHDR-OBJECTID

The other two O_ZIRD_P_RESCHEMES and

N_ZIRD_P_RESCHEMES are tables where the change document is to be done.

It should be like for eg if "ZTEST" is the table you have to detect changes then u need to declare

O_ZIRD_P_RESCHEMES type ztest.

N_ZIRD_P_RESCHEMES type ztest.

Rgds,

Abhishek

Edited by: Abhishek Raj on Apr 30, 2008 1:16 PM

Read only

0 Likes
2,191

Hi Raj,

I see.

How you declare O_ZIRD_P_RESCHEMES & N_ZIRD_P_RESCHEMES. These 2 table is SAP standard table?

Regards,

Rayden

Read only

0 Likes
2,191

Hi Rayden,

The other two O_ZIRD_P_RESCHEMES and

N_ZIRD_P_RESCHEMES are tables where the change document is to be done.

It should be like for eg if "ZTEST" is the table you have to detect changes then u need to declare

O_ZIRD_P_RESCHEMES type ztest.

N_ZIRD_P_RESCHEMES type ztest.

Reward me if it helped you ;).

Rgds,

Abhishek

Read only

0 Likes
2,191

Hi Raj,

I have hit a error : NO_POSITION_INSERTED in :

CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'

EXPORTING

DATE_OF_CHANGE = sy-datum

OBJECTCLASS = 'ZTEST_CD'

OBJECTID = OBJECTID

TCODE = SY-TCODE

TIME_OF_CHANGE = SY-UZEIT

USERNAME = sy-uname

  • OBJECT_CHANGE_INDICATOR = 'U'

  • PLANNED_OR_REAL_CHANGES = ' '

  • NO_CHANGE_POINTERS = ' '

  • IMPORTING

  • CHANGENUMBER =

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.

Any ideas, what went wrong?

Regards,

Rayden

Read only

0 Likes
2,191

Hi Rayden,

Please declare also the following fields :

OBJECTID TYPE CDHDR-OBJECTID

TCODE TYPE CDHDR-TCODE - pass the transaction code

UTIME TYPE CDHDR-UTIME - pass the system time

UDATE TYPE CDHDR-UDATE - pass the system date

USERNAME TYPE CDHDR-USERNAME - pass sy-uname

PLANNED_CHANGE_NUMBER TYPE SPACE

OBJECT_CHANGE_INDICATOR TYPE CHAR 1 VALUE U'

PLANNED_OR_REAL_CHANGES TYPE SPACE

NO_CHANGE_POINTERS TYPE SPACE

UPD_ICDTXT_ZSCHEMES_REL TYPE SPACE

UPD_ZIRD_P_RESCHEMES TYPE SPACE

Rgds,

Abhishek

Read only

0 Likes
2,191

Hi Raj,

I change the code accordingly.. but i still encounter the same error : NO_POSITION_INSERTED.

I place the CHANGEDOCUMENT code in an UPDATE button. When this UPDATE button is trigger, it will firstly call FM CALL FUNCTION 'CHANGEDOCUMENT_OPEN' follow by 'CHANGEDOCUMENT_SINGLE_CASE'.

After which it will run the logic of updating my table ZSTUDENT with COMMIT WORK statement.

I did debugging, all the statement above run without any error occur.

Eventually it will call FM 'CHANGEDOCUMENT_CLOSE', at this FM, it trigger the error NO_POSITION_INSERTED.

What is the error about? How to resolve this?

Regards,

Rayden

Read only

0 Likes
2,191

Please check whether you have given the object class. You need to debug to know why this kind of error is generated.

I think you are inserting an object. You should test by updating an object.

Rgds

Abhishek

Edited by: Abhishek Raj on Apr 30, 2008 3:06 PM

Read only

0 Likes
2,191

Hi Raj,

Do you have any idea which SAP table store / keep track on the CHANGEDOCUMENT?

Regards,

Rayden

Read only

0 Likes
2,191

Hi Ray,

It is CDPOS.

Rgds

Abhi

Read only

Former Member
0 Likes
2,191

"CHANGE DOCUMENT" in DATA ELEMENT must set.