Skip to Content

Report to change workstation application

Hi DMS community!

as some of you maybe know it is only possible to change the assigned workstation application in a document info record (DIR) manually in transaction CV02N. In the past I got several messages about this behavior and requests for a kind of report to made such a change easier. So I tried to start with such a report and I thought that I can publish it here to get your feedback and of course recommendations to improve the report behavior. You can also feel free to adopt the report coding and so I hope that at the end we can have a real good working report which can be used by all of us.

*&---------------------------------------------------------------------*

*& Report  Z_RENAME_APPL

*&

*&---------------------------------------------------------------------*

*& NON-OFFICIAL report sample

*&

*&---------------------------------------------------------------------*

REPORT  Z_RENAME_APPL.

CALL FUNCTION 'CVAPI_INIT'.

DATA :  ps_api_control TYPE cvapi_api_control.

   CLEAR ps_api_control.

* Originalbelegung

      ps_api_control-commit_flag    = ' '.

      ps_api_control-no_update_task = 'X'.

      ps_api_control-save_flag      = 'X'.

      ps_api_control-api_mode       = 'X'.

      ps_api_control-tcode = 'CV02'.

      ps_api_control-check_level    = '0'.

      ps_api_control-not_dequeue_all = 'X'.

      ps_api_control-load_flag = 'X'.

* \Originalbelegung

DATA: lc_dokar TYPE DOKAR,

      lc_doknr TYPE DOKNR,

      lc_doktl TYPE DOKTL_D,

      lc_dokvr TYPE DOKVR,

      lt_files_new TYPE TABLE OF CVAPI_DOC_FILE,

      ls_files_new TYPE CVAPI_DOC_FILE,

      lt_files_new2 TYPE TABLE OF CVAPI_DOC_FILE,

      ls_files_new2 TYPE CVAPI_DOC_FILE,

      ls_files TYPE CVAPI_DOC_FILE,

      lt_files TYPE TABLE OF CVAPI_DOC_FILE,

      ls_draw TYPE DRAW,

      ls_message TYPE MESSAGES.

lc_dokar = 'DRW'.

lc_doknr = 'WSAPPL'.

lc_doktl = '000'.

lc_dokvr = '00'.

*get document info record details:

CALL FUNCTION 'CVAPI_DOC_GETDETAIL'

  EXPORTING

*   PF_BATCHMODE          = ' '

*   PF_HOSTNAME           = ' '

    PF_DOKAR              = lc_dokar

    PF_DOKNR              = lc_doknr

    PF_DOKVR              = lc_dokvr

    PF_DOKTL              = lc_doktl

*   PF_READ_DRAD          = ' '

*   PF_READ_DRAP          = ' '

    PF_ACTIVE_FILES       = 'X'

*   PF_READ_COMP          = ' '

*   PF_READ_KPRO          = 'X'

*   PF_READ_DRAT          = 'X'

  IMPORTING

    PSX_DRAW              = ls_draw

*   PFX_DESCRIPTION       =

  TABLES

    PT_FILES              = lt_files

*   PT_COMP               =

*   PT_DRAP               =

*   PT_DRAD               =

*   PT_DRAT               =

  EXCEPTIONS

    NOT_FOUND             = 1

    NO_AUTH               = 2

    ERROR                 = 3

    OTHERS                = 4

          .

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*split filepath and filename to ensure that file is copied to C:\temp\

READ TABLE lt_files INTO ls_files INDEX 1.

*APPEND ls_files TO lt_files_new.

    CALL FUNCTION 'CV120_SPLIT_PATH'

         EXPORTING: pf_path  = ls_files-filename

         IMPORTING: pfx_file = ls_files-filename.

    IF NOT ls_files-filename IS INITIAL.

      CONCATENATE 'C:\temp\' ls_files-filename

      INTO ls_files-filename.

    ENDIF.

APPEND ls_files TO lt_files_new.

*download original file to PC

CALL FUNCTION 'CVAPI_DOC_CHECKOUTVIEW'

  EXPORTING

*   PF_BATCHMODE          = ' '

*   PF_HOSTNAME           = ' '

    PF_DOKAR              = lc_dokar

    PF_DOKNR              = lc_doknr

    PF_DOKVR              = lc_dokvr

    PF_DOKTL              = lc_doktl

*   PF_READ_DRAD          = ' '

*   PF_READ_DRAP          = ' '

*   PF_READ_COMP          = ' '

*   PF_READ_KPRO          = 'X'

*   PF_READ_DRAT          = 'X'

  IMPORTING

   PSX_MESSAGE              = ls_message

*   PSX_DRAW                 =

  TABLES

    PT_FILES              = lt_files_new

*   PT_COMP               =

*   PT_DRAP               =

*   PT_DRAD               =

*   PT_DRAT               =

          .

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

READ TABLE lt_files_new INTO ls_files INDEX 1.

ls_files-DAPPL = 'ACE'.

ls_files-UPDATEFLAG = 'U'.

REFRESH lt_files_new2.

APPEND ls_files TO lt_files_new2.

CALL FUNCTION 'CVAPI_DOC_MAINTAIN'

  EXPORTING

*   PF_HOSTNAME                = ' '

    PS_DRAW                    = ls_draw

*   PF_STATUSLOG               = ' '

*   PF_REVLEVEL                =

    PS_API_CONTROL             = ps_api_control

*   PF_FTP_DEST                = ' '

*   PF_HTTP_DEST               = ' '

  IMPORTING

    PSX_MESSAGE                = ls_message

*   PFX_DOKAR                  =

*   PFX_DOKNR                  =

*   PFX_DOKVR                  =

*   PFX_DOKTL                  =

  TABLES

*   PT_DRAD_X                  =

*   PT_DRAT_X                  =

    PT_FILES_X                 = lt_files_new2

*   PT_COMP_X                  =

*   DOCUMENTDESCRIPTIONS       =

          .

COMMIT WORK.

I'm attaching the coding also as TXT file so you can download it easier. Please let me know your comments on this.

Tags:

No comments