Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Change sales order user status

Hello experts,

I'm trying to update the user status with the following code without success:

DATA : LIT_STATUS_COMT       TYPE CRMT_STATUS_COMT,
       WA_STATUS_COMT        LIKE LINE OF LIT_STATUS_COMT,
       LIT_FIELD_NAMES       TYPE CRMT_INPUT_FIELD_NAMES_TAB,
       WA_INPUT_FIELD_NAMES  LIKE LINE OF LIT_FIELD_NAMES.


SELECTION-SCREEN BEGIN OF BLOCK AAA.
PARAMETERS: P_GUID  TYPE CRMT_STATUS_COM-REF_GUID,
            P_STAT TYPE   CRMT_STATUS_COM-STATUS.
SELECTION-SCREEN END OF BLOCK AAA.

CLEAR WA_STATUS_COMT.
WA_STATUS_COMT-REF_GUID       = P_GUID.
WA_STATUS_COMT-REF_KIND       = 'A' .
WA_STATUS_COMT-STATUS         = P_STAT. " Pass the user status
WA_STATUS_COMT-USER_STAT_PROC = 'ZOR00001'. " Value for the User Status Profile.
WA_STATUS_COMT-ACTIVATE       = 'X'.
INSERT WA_STATUS_COMT INTO TABLE LIT_STATUS_COMT.


WA_INPUT_FIELD_NAMES-FIELDNAME = 'ACTIVATE'.
APPEND WA_INPUT_FIELD_NAMES TO LIT_FIELD_NAMES.

  CALL FUNCTION 'CRM_STATUS_MAINTAIN_OW'
    EXPORTING
      IT_STATUS_COM        = LIT_STATUS_COMT
    CHANGING
      CT_INPUT_FIELD_NAMES = LIT_FIELD_NAMES
    EXCEPTIONS
      NOT_ALLOWED          = 1
      ERROR_OCCURRED       = 2
      WARNING_OCCURRED     = 3
      OTHERS               = 4.


  DATA: LT_OBJECTS_TO_SAVE  TYPE  CRMT_OBJECT_GUID_TAB,
        LS_OBJECTS_TO_SAVE  LIKE LINE OF LT_OBJECTS_TO_SAVE.

  LS_OBJECTS_TO_SAVE = P_GUID.
  APPEND LS_OBJECTS_TO_SAVE TO LT_OBJECTS_TO_SAVE.

  CALL FUNCTION 'CRM_STATUS_SAVE_OW'
   EXPORTING
     IT_HEADER_GUID           = LT_OBJECTS_TO_SAVE

best regards,

Ronen.

Tags:
Former Member
Former Member replied

Ronen,

Instead of FM CRM_STATUS_CHANGE_EXTERN_OW, I will suggest you to use FM CRM_STATUS_CHANGE_EXTERN. This works fine in our case..

Thanks

RR

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question