Skip to Content
PLM Document Management System (DMS)

Report to correct blank workstation application values

Tags:

Purpose

The reason for this report is that sometimes inconsistent datasets could appear in the SAP system and you find orignal files in a document info record that do not have a workstation application assigned. Normally this should not happen but in such a situation you might face strange error message related to the start authorization for the original file.

Solution

To fill the workstation application again there are two possible ways. The first one is to use transaction CV02N, open the document and then add the workstation application value manually in the affected original details. This solution is ok, if you have only few such originals.

If you think that there are maybe more of them and a manual correction would mean to much work you need a report that searches and corrects these datasets. So I tried to create the first version of such a report and I would like to present this coding now to you in this document. Please keep in mind that this is one of my first reports and so the coding logic might be simple. But I would like to ask you to test this report if you face such issues in your system and please feel free to provide feedback on the report behavior or even create a new version of the report and update the coding in this document. So at the end we will have a very good designed report that helps us in the end to correct such inconsistencies fast and easy.

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

*& Report  Z_HOPFC_DAPPL

*&

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

*& Version 1.0

*& This is a special correction report if you have originals without workstation application.

*& Please note that this is not an official SAP report.

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

REPORT  z_hopfc_dappl.

DATA: it_files TYPE TABLE OF dms_doc_files.

DATA: wa_dappl_files TYPE dms_doc_files.

DATA: file_extension TYPE c.

DATA: pf_dappl TYPE dms_doc_files-dappl.

DATA: lt_tdwp  LIKE TABLE OF tdwp WITH HEADER LINE.

DATA: lf_lines type i.

DATA: pf_file TYPE DRAW-FILEP.

DATA: wa_tdwp TYPE TDWP.

TABLES: DMS_DOC_FILES.

*1. SELECT on table DMS_DOC_FILES where DAPPL is empty to an internal table

SELECT * FROM  dms_doc_files INTO CORRESPONDING FIELDS OF TABLE it_files

       WHERE  dappl  = ' '.

*2. LOOP over this table result

LOOP AT it_files INTO wa_dappl_files.

pf_file = wa_dappl_files-filename.

      CALL FUNCTION 'CV120_DOC_GET_APPL'

         EXPORTING: pf_dialog = ' '

                    pf_file   = pf_file

         IMPORTING: pfx_dappl = pf_dappl

         TABLES:    ptx_tdwp = lt_tdwp.

     describe table lt_tdwp lines lf_lines.

  if lf_lines is initial.

***    no appl found

    message i317(26) raising not_create.

  elseif lf_lines > 1.

***  more than 1 appl found -> take first one to solve the critical situation.

READ TABLE lt_tdwp INDEX '1' INTO wa_tdwp.

wa_dappl_files-dappl = wa_tdwp-dappl.

UPDATE dms_doc_files FROM wa_dappl_files.

ENDLOOP.