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

Problems in Change document concept.Entry missing in CDHDR

Former Member
0 Likes
3,869

i have created a change document object and using generated function module (*_write_document) in my custom program.

its code is written as follows.


REPORT  ZTEST_DEMO.

data :n_ztest_table TYPE ztest_table,

       o_ztest_table TYPE ztest_table.

DATA  i_CDTXT TYPE TABLE OF CDTXT.

START-OF-SELECTION   .

SELECT SINGLE * FROM ztest_table into o_ztest_table.

   MOVE-CORRESPONDING o_ztest_table to n_ztest_table.

  n_ztest_table-FIELD2 = ''.

  update ztest_table FROM n_ztest_table.

  COMMIT WORK and wait.

  check sy-subrc is INITIAL.

CALL FUNCTION 'ZTEST_DEMO_WRITE_DOCUMENT'

   EXPORTING

     OBJECTID                      = '11'

     TCODE                         = sy-tcode

     UTIME                         = sy-uzeit

     UDATE                         = sy-datum

     USERNAME                      = sy-uname

*   PLANNED_CHANGE_NUMBER         = ' '

  OBJECT_CHANGE_INDICATOR       = 'U'

*   PLANNED_OR_REAL_CHANGES       = ' '

*   NO_CHANGE_POINTERS            = ' '

*   UPD_ICDTXT_ZTEST_DEMO         = ' '

     N_ZTEST_TABLE                 = n_ztest_table

     O_ZTEST_TABLE                 = o_ztest_table

*   UPD_ZTEST_TABLE               = ' '

   TABLES

     ICDTXT_ZTEST_DEMO             = i_CDTXT

           .

commit work and wait.

i am not using generated includes , i am waiting for the system to throw syntax error.

my ztable keeps on updating every time but i am not able to find an entry in CDHDR table or CDPOS table.

I have field1 data element change document checkbox ticked.

entry in ztable.

please guide me what i am missing or m i doing something in a wrong way.

i have created a change document object and using generated function module (*_write_document) in my custom program.

its code is written as follows.


REPORT  ZTEST_DEMO.

data :n_ztest_table TYPE ztest_table,

       o_ztest_table TYPE ztest_table.

DATA  i_CDTXT TYPE TABLE OF CDTXT.

START-OF-SELECTION   .

SELECT SINGLE * FROM ztest_table into o_ztest_table.

   MOVE-CORRESPONDING o_ztest_table to n_ztest_table.

  n_ztest_table-FIELD2 = ''.

  update ztest_table FROM n_ztest_table.

  COMMIT WORK and wait.

  check sy-subrc is INITIAL.

CALL FUNCTION 'ZTEST_DEMO_WRITE_DOCUMENT'

   EXPORTING

     OBJECTID                      = '11'

     TCODE                         = sy-tcode

     UTIME                         = sy-uzeit

     UDATE                         = sy-datum

     USERNAME                      = sy-uname

*   PLANNED_CHANGE_NUMBER         = ' '

  OBJECT_CHANGE_INDICATOR       = 'U'

*   PLANNED_OR_REAL_CHANGES       = ' '

*   NO_CHANGE_POINTERS            = ' '

*   UPD_ICDTXT_ZTEST_DEMO         = ' '

     N_ZTEST_TABLE                 = n_ztest_table

     O_ZTEST_TABLE                 = o_ztest_table

*   UPD_ZTEST_TABLE               = ' '

   TABLES

     ICDTXT_ZTEST_DEMO             = i_CDTXT

           .

commit work and wait.

i am not using generated includes , i am waiting for the system to throw syntax error.

my ztable keeps on updating every time but i am not able to find an entry in CDHDR table or CDPOS table.

I have field1 data element change document checkbox ticked.

entry in ztable.

please guide me what i am missing or m i doing something in a wrong way.

8 REPLIES 8
Read only

JuanCarlosDelga
Contributor
0 Likes
3,071

Hi abhishek,

Are the data element in your table relevants for change document.

They have the checkbox Change document checked.

Regards.

JCD

Read only

0 Likes
3,071

hello juan,

i have created new custom data element with predefined type as char 20.

i have checked the checkbox for change documents.

Read only

0 Likes
3,071

Hi Adhishek,

Try informing the parameter UPD_ZTEST_TABLE with 'I' when you are inserting a register or 'U' if you are updating.

Regards.

JCD

Read only

0 Likes
3,071

Juan,

as you can see i am updating ztable . so i am made the changes i.e UPD_ZTEST_TABLE = 'U'. but still i am not able to see any entry in CDHDR Table.

CALL FUNCTION 'ZTEST_DEMO_WRITE_DOCUMENT'

  EXPORTING

    OBJECTID                      = '11'

    TCODE                        = sy-tcode

    UTIME                        = sy-uzeit

    UDATE                        = sy-datum

    USERNAME                      = sy-uname

*  PLANNED_CHANGE_NUMBER        = ' '

  OBJECT_CHANGE_INDICATOR      = 'U'

*  PLANNED_OR_REAL_CHANGES      = ' '

*  NO_CHANGE_POINTERS            = ' '

*  UPD_ICDTXT_ZTEST_DEMO        = ' '

    N_ZTEST_TABLE                = n_ztest_table

    O_ZTEST_TABLE                = o_ztest_table

    UPD_ZTEST_TABLE              = 'U'

  TABLES

    ICDTXT_ZTEST_DEMO            = i_CDTXT

          .

Read only

0 Likes
3,071

Hi abhishek,

Maybe you need to do the following

  DATA: lv_objectid TYPE cdobjectv.

  lv_objectid = n_ztest_table-FIELD1.

CALL FUNCTION 'ZTEST_DEMO_WRITE_DOCUMENT'

  EXPORTING

    OBJECTID                      =  lv_objectid

    TCODE                        = sy-tcode

    UTIME                        = sy-uzeit

    UDATE                        = sy-datum

    USERNAME                      = sy-uname

*  PLANNED_CHANGE_NUMBER        = ' '

  OBJECT_CHANGE_INDICATOR      = 'U'

*  PLANNED_OR_REAL_CHANGES      = ' '

*  NO_CHANGE_POINTERS            = ' '

*  UPD_ICDTXT_ZTEST_DEMO        = ' '

    N_ZTEST_TABLE                = n_ztest_table

    O_ZTEST_TABLE                = o_ztest_table

    UPD_ZTEST_TABLE              = 'U'

  TABLES

    ICDTXT_ZTEST_DEMO            = i_CDTXT

Have you try the function in SE37?

Regards.

JCD

Read only

0 Likes
3,071

i have done as you said but still the problem remains same.


Juan Carlos Delgado Peña wrote:

Have you try the function in SE37?

Means?

i have check the FM in SE37. its exists ofcourse.

For note: i haven't used auto generated includes in my custom program.

what diff does they make.

Read only

0 Likes
3,071

Hi Abhishek,

It's a function, so can be checked in SE37, the autogenerated includes that i use is one that ends with CDT, that contains 2 more includes that have the data declaration. Debug the function in SE37.

Regards.

JCD

Read only

0 Likes
3,071

juan,

i tried to debug the FM.

everything seems ok. Except in the last.When below FM is called it is not executed properly.


CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'

     EXPORTING

       OBJECTCLASS             = 'ZTEST_DEMO'

       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.

Exception 4 -> NO POSITION ENTERED is raised . and sy-subrc is returned 4.

I am still clueless what does this mean and how to rectify it.