For a complete list of all my blogs regarding content management, please see here.
When I am creating attachment for my business object via code provided in solution:

  ls_prop-name = ‘DESCRIPTION’.

    ls_prop-value = ‘created by Tool’.

    APPEND ls_prop TO lt_prop.

    ls_prop-name = ‘CREATED_BY’.

    ls_prop-value = XXX – some one else other than sy-uname

    APPEND ls_prop TO lt_prop.

CALL METHOD cl_crm_documents=>create_with_table

      EXPORTING

        business_object     = ls_bo

        properties          = lt_proproperties_attr     = lt_properties_attr

        file_access_info    = lt_file_info

        file_content_binary = lt_file_content

        raw_mode            = ‘X’

      IMPORTING

        loio                = ls_loio

        phio                = ls_phio

        error               = ls_error.

I meet with the error below:Characteristic of class CRM_L_DOC is not valid

/wp-content/uploads/2013/12/clipboard1_336333.png


I debugged a little and found it is caused because the content management code regards “CREATED_BY” field as read only ( protected field ) if internal mode is inactive.

/wp-content/uploads/2013/12/clipboard2_336334.png

/wp-content/uploads/2013/12/clipboard3_336338.png


I use where use list on the field internal_mode and found the FM below could activate internal mode with 02 passed into.

/wp-content/uploads/2013/12/clipboard4_336340.png


/wp-content/uploads/2013/12/clipboard5_336341.png

After I call that FM in my program, the error is gone and attachment could be created. Unfortunately, I still could not specify the created_by field, I find it is always filled as sy-uname in line 298.

/wp-content/uploads/2013/12/clipboard6_336342.png

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply