Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Attachment File Problem !!!

Former Member
0 Likes
1,173

Hi, everybody!

I recently empolder a program for attachment file problem !

but as soon as display attachment file occurs error message. as follows

The service <'Attachment list'> is not available

Program code from below!

PERFORM USER_ATTACH. u201Cattachment file
*&---------------------------------------------------------------------*
*&      Form  USER_ATTACH
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM USER_ATTACH .
  DATA: L_KEY TYPE ZTSECP015-ZF15NO.
  IF NEW = 'X'.
*   New item.
    SELECT MAX( ZF15NO ) FROM ZTSECP015 INTO L_KEY.
    L_KEY = L_KEY + 1.
  ELSE.
*   Change item.
    L_KEY = GT_ZTSECP015-ZF15NO.
  ENDIF.

  PERFORM ATTACH_FILE USING 'ZESE11NO'
                            L_KEY.
ENDFORM.                    " USER_ATTACH
*&---------------------------------------------------------------------*
*&      Form  attach_file
*&---------------------------------------------------------------------
*       text
*----------------------------------------------------------------------*
FORM ATTACH_FILE USING P_OBJTYPE
                       P_OBJKEY.

  DATA  GO_MANAGER TYPE REF TO CL_GOS_MANAGER.
  DATA: GS_SERVICE_SELECTION TYPE SGOS_SELS,
        GT_SERVICE_SELECTION TYPE TGOS_SELS.
  DATA  GP_SERVICE   LIKE SGOSATTR-NAME.
  DATA  GS_OBJECT    TYPE BORIDENT.
  DATA  GS_BC_OBJECT TYPE SIBFLPOR.

  REFRESH GT_SERVICE_SELECTION.
  CLEAR GS_SERVICE_SELECTION.
  GS_SERVICE_SELECTION-SIGN = 'I'.
  GS_SERVICE_SELECTION-OPTION = 'EQ'.
  GS_SERVICE_SELECTION-LOW = 'PCATTA_CREA'.
  APPEND GS_SERVICE_SELECTION TO GT_SERVICE_SELECTION.

  IF GO_MANAGER IS INITIAL.
    CREATE OBJECT GO_MANAGER
      EXPORTING
        IP_NO_COMMIT         = ' '
        IP_NO_INSTANCE       = ' '
        IP_MODE              = 'E'
        IT_SERVICE_SELECTION = GT_SERVICE_SELECTION.
  ENDIF.

  GP_SERVICE =  'PCATTA_CREA'.
  GS_OBJECT-OBJKEY = P_OBJKEY.
  GS_OBJECT-OBJTYPE = P_OBJTYPE.

  CALL METHOD GO_MANAGER->START_SERVICE_DIRECT
    EXPORTING
      IP_SERVICE       = GP_SERVICE
      IS_OBJECT        = GS_OBJECT
      IS_BC_OBJECT     = GS_BC_OBJECT
    EXCEPTIONS
      NO_OBJECT        = 1
      OBJECT_INVALID   = 2
      EXECUTION_FAILED = 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.
ENDFORM.                    " attach_file



PERFORM USER_VIEW.  u201DDIsplay attachment file
*&---------------------------------------------------------------------*
*&      Form  USER_VIEW
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM USER_VIEW .
  DATA: L_KEY TYPE ZTSECP015-ZF15NO.
  IF NEW = 'X'.
*   New item.
    SELECT MAX( ZF15NO ) FROM ZTSECP015 INTO L_KEY.
    L_KEY = L_KEY + 1.
  ELSE.
*   Change item.
    L_KEY = GT_ZTSECP015-ZF15NO.
  ENDIF.

  PERFORM VIEW_ATTACH USING 'ZESE11NO'
                            L_KEY
                            SPACE.
ENDFORM.                    " USER_VIEW
*&---------------------------------------------------------------------*
*&      Form  view_attach
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM VIEW_ATTACH USING P_OBJTYPE
                       P_OBJKEY
                       P_READONLY.

  DATA  GO_MANAGER TYPE REF TO CL_GOS_MANAGER.
  DATA: GS_SERVICE_SELECTION TYPE SGOS_SELS,
        GT_SERVICE_SELECTION TYPE TGOS_SELS.
  DATA  GP_SERVICE   LIKE SGOSATTR-NAME.
  DATA  GS_OBJECT    TYPE BORIDENT.
  DATA  GS_BC_OBJECT TYPE SIBFLPOR.

  REFRESH GT_SERVICE_SELECTION.
  CLEAR GS_SERVICE_SELECTION.
  GS_SERVICE_SELECTION-SIGN = 'I'.
  GS_SERVICE_SELECTION-OPTION = 'EQ'.
  GS_SERVICE_SELECTION-LOW = 'VIEW_ATTA'.
  APPEND GS_SERVICE_SELECTION TO GT_SERVICE_SELECTION.

  IF GO_MANAGER IS INITIAL.
    CREATE OBJECT GO_MANAGER
      EXPORTING
        IP_NO_COMMIT         = ' '
        IP_NO_INSTANCE       = ' '
        IP_MODE              = 'E'
        IT_SERVICE_SELECTION = GT_SERVICE_SELECTION.
  ENDIF.

  IF P_READONLY = 'X'.
    CALL METHOD GO_MANAGER->SET_RW_MODE
      EXPORTING
        IP_MODE = 'D'.
  ENDIF.

  GP_SERVICE = 'VIEW_ATTA'.
  GS_OBJECT-OBJKEY = P_OBJKEY.
  GS_OBJECT-OBJTYPE = P_OBJTYPE.

  CALL METHOD GO_MANAGER->START_SERVICE_DIRECT
    EXPORTING
      IP_SERVICE       = GP_SERVICE
      IS_OBJECT        = GS_OBJECT
      IS_BC_OBJECT     = GS_BC_OBJECT
    EXCEPTIONS
      NO_OBJECT        = 1
      OBJECT_INVALID   = 2
      EXECUTION_FAILED = 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.

ENDFORM.                    " view_attach

I already created Object in transaction code SWO1。

Please help me !

Thanks Advanced !

Edited by: Matt on Dec 10, 2008 9:36 AM - tags added

4 REPLIES 4
Read only

Former Member
0 Likes
540

Hi XIONGFEI,

One question. You want to attachement the document with a Business Object to save the document into a repository? Or only save the document on SAP (local)?

If the response is the second, to save a document on Sap use the service 'CREATE_ATTA' instead of 'PCATTA_CREA'.

After use this function, you can view tha attachement.

Hope you helps.

Best Regards.

Read only

0 Likes
540

Hi !

Thanks your answer !

I want only save the ducument on SAP(local) !

but when i view attachment have no any appear, just pop-up message !

Please help me !

Thanks Advanced !

Read only

0 Likes
540

Hi XIONGFEI,

Please, change the service in your first PERFORM than i explain in my first post. After you probe if you see the attachements documents with VIEW_ATTA function:

FORM ATTACH_FILE USING P_OBJTYPE
P_OBJKEY.

DATA GO_MANAGER TYPE REF TO CL_GOS_MANAGER.
DATA: GS_SERVICE_SELECTION TYPE SGOS_SELS,
GT_SERVICE_SELECTION TYPE TGOS_SELS.
DATA GP_SERVICE LIKE SGOSATTR-NAME.
DATA GS_OBJECT TYPE BORIDENT.
DATA GS_BC_OBJECT TYPE SIBFLPOR.

REFRESH GT_SERVICE_SELECTION.
CLEAR GS_SERVICE_SELECTION.
GS_SERVICE_SELECTION-SIGN = 'I'.
GS_SERVICE_SELECTION-OPTION = 'EQ'.
GS_SERVICE_SELECTION-LOW = *'CREATE_ATTA'* --''PCATTA_CREA'.--
APPEND GS_SERVICE_SELECTION TO GT_SERVICE_SELECTION.

Best Regards.

Edited by: Matt on Dec 10, 2008 9:37 AM tags added

Read only

Former Member
0 Likes
540

hi,

see this link.

Regards,

Flavya