Skip to Content
avatar image
Former Member

BADI CRM_DOC_AUTHORITY not working while validating file size on CRM 702

Hi,

For the purpose of validating the size of document uploaded in CRM Content Management I have coded the BADI CRM_DOC_AUTHORITY method AUTHORITY_CHECK as per the directions of the following Note #720434 . The method is called 4 times on the creation of a new document attachment on all the 4 occasions I clear the IOS_AUTH table and insert data in IOS_NOT_AUTH but no validation or error message is displayed the user is successfully able to upload an attachment of whatever size he wants. Also the document days that this solution is valid upto CRM 500. The badi is called when a breakpoint is placed and runs smoothly and proceeds how it should proceed, but does do the needful. Please help ..... code attached below.

BADI Implementation Code:

method IF_EX_CRM_DOC_AUTHORITY~AUTHORITY_CHECK.
  DATA : LT_PHIO TYPE STANDARD TABLE OF SKWF_IO,
         ls_PHIO TYPE SKWF_IO,
         LV_SIZE TYPE SDOK_FSIZE,
         LS_ERROR TYPE SKWF_IOERR,
         LV_ERROR TYPE BOOLEAN,
         LS_AUTH TYPE SKWF_IO


        .
*  IF LV_CHECK = ''.
*
*  ENDIF.
  CLEAR: LV_ERROR, LS_ERROR, LV_SIZE, ls_PHIO.
  IF ACTIVITY = '01' OR ACTIVITY = '04' OR ACTIVITY = '06'.
    LT_PHIO[] = IOS[].
    LOOP AT LT_PHIO INTO ls_PHIO.
      IF ls_PHIO-OBJID IS NOT INITIAL.
        IF SY-TVAR0 NE 'X'.
          IF ls_PHIO-OBJTYPE = 'L'.
            SY-TVAR0 = 'X'.
            CL_CRM_DOCUMENTS=>GET_FILE_INFO(
            EXPORTING
              LOIO      =   ls_PHIO  " ID of Logical InfoObject (LOIO)
*        PHIO      =     " PHIO ID
            IMPORTING
*        FILE_NAME =     " Relative Storage Location of Physical Document
*        MIMETYPE  =     " HTML content type
*        FILE_TYPE =     " Type of data transfer
              FILE_SIZE =  LV_SIZE   " File size (in bytes)
*        BAD_IOS   =     " Table with KW Object Error Objects
*        DOC_TYPE  =     " CRM Content Management: Clear Text for MIME Type
              ).
            SY-TVAR0 = ''.
            IF LV_SIZE IS NOT INITIAL.
              CHECK_SIZE(
              EXPORTING
                IM_SIZE  = LV_SIZE    " File size (in bytes)
              IMPORTING
                EX_ERROR = LV_ERROR    " Error
                ).
              IF LV_ERROR IS NOT INITIAL.
                READ TABLE IOS_AUTH INTO LS_AUTH WITH KEY OBJID = ls_PHIO-OBJID.
                IF SY-SUBRC IS INITIAL.
*                  MOVE-CORRESPONDING LS_AUTH TO LS_ERROR.
                  LS_ERROR-ID = 'ZBDA'.
                  LS_ERROR-TYPE = 'E'.
                  LS_ERROR-NO = '016'.
*                LS_ERROR-CLASS = ls_PHIO-CLASS .
*                LS_ERROR-OBJID = ls_PHIO-OBJID.
                  APPEND LS_ERROR TO IOS_NOT_AUTH.
                  DELETE IOS_AUTH WHERE OBJID = ls_PHIO-OBJID.
                ENDIF.
                CLEAR : LS_ERROR, LS_AUTH.
              ENDIF.
            ENDIF.
          ELSE.
            SY-TVAR0 = 'X'.
            CL_CRM_DOCUMENTS=>GET_FILE_INFO(
            EXPORTING
*          LOIO      =   ls_PHIO  " ID of Logical InfoObject (LOIO)
              PHIO      =     ls_PHIO" PHIO ID
            IMPORTING
*        FILE_NAME =     " Relative Storage Location of Physical Document
*        MIMETYPE  =     " HTML content type
*        FILE_TYPE =     " Type of data transfer
              FILE_SIZE =  LV_SIZE   " File size (in bytes)
*        BAD_IOS   =     " Table with KW Object Error Objects
*        DOC_TYPE  =     " CRM Content Management: Clear Text for MIME Type
              ).
            SY-TVAR0 = ''.
            IF LV_SIZE IS NOT INITIAL.
              CHECK_SIZE(
              EXPORTING
                IM_SIZE  = LV_SIZE    " File size (in bytes)
              IMPORTING
                EX_ERROR = LV_ERROR    " Error
                ).
              IF LV_ERROR IS NOT INITIAL.
                READ TABLE IOS_AUTH INTO LS_AUTH WITH KEY OBJID = ls_PHIO-OBJID.
                IF SY-SUBRC IS INITIAL.
                  MOVE-CORRESPONDING LS_AUTH TO LS_ERROR.
                  LS_ERROR-ID = 'ZBDA'.
                  LS_ERROR-TYPE = 'E'.
                  LS_ERROR-NO = '016'.
                  APPEND LS_ERROR TO IOS_NOT_AUTH.
                  DELETE IOS_AUTH WHERE OBJID = ls_PHIO-OBJID.
                ENDIF.
                CLEAR : LS_ERROR, LS_AUTH.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDLOOP.


  ENDIF.


endmethod.
Add comment
10|10000 characters needed characters exceeded

  • Former Member

    I did you get any answer for this. If so please post your answer here.. Thanks in advance

  • Former Member

    Hi, Did you get answer for this, If yes please post your answer here I am also having same problem, Thanks in advance...

  • Get RSS Feed

0 Answers