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

Get attachment list items

Former Member
0 Likes
3,243

Hi,

in transaction ME21N (or ME22N & ME23N), i created some notes with Generic Object Service.

Now, in ABAP i would like to get back items of this list. Can you send me an ABAP example ?

Thanks for your help.

Cheers.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,537

Try something like following

PARAMETERS P_EBELN LIKE EKKO-EBELN.
DATA : GS_OBJECT   TYPE          SIBFLPORB,
       GT_LINKS    TYPE TABLE OF OBL_S_LINK,
       GS_LINKS    TYPE          OBL_S_LINK,
       GS_FOLDERID TYPE          SOODK,
       GS_OBJECTID TYPE          SOODK,
       GS_NOTE_HD  TYPE          SOOD2,
       GT_NOTE_LN  TYPE TABLE OF SOLI WITH HEADER LINE.
GS_OBJECT-INSTID = P_EBELN.
GS_OBJECT-TYPEID = 'BUS2012'.
GS_OBJECT-CATID  = 'BO'.
TRY.
    CALL METHOD CL_BINARY_RELATION=>READ_LINKS_OF_BINREL
      EXPORTING
        IS_OBJECT    = GS_OBJECT
        IP_RELATION  = 'NOTE'
      IMPORTING
        ET_LINKS     = GT_LINKS
*      ET_ROLES     =
        .
  CATCH CX_OBL_PARAMETER_ERROR .
  CATCH CX_OBL_INTERNAL_ERROR .
  CATCH CX_OBL_MODEL_ERROR .
ENDTRY.
LOOP AT GT_LINKS INTO GS_LINKS.
  GS_FOLDERID = GS_LINKS-INSTID_B+00(17).
  GS_OBJECTID = GS_LINKS-INSTID_B+17(17).
  CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
*   FILTER                           =
      FOLDER_ID                        = GS_FOLDERID
*   FORWARDER                        =
      OBJECT_ID                        = GS_OBJECTID
*   OWNER                            =
*   F_MAILER                         = ' '
 IMPORTING
*   OBJECT_FL_DISPLAY                =
    OBJECT_HD_DISPLAY                = GS_NOTE_HD
*   OBJECT_RC_DISPLAY                =
 TABLES
    OBJCONT                          = GT_NOTE_LN[]
*   OBJHEAD                          =
*   OBJPARA                          =
*   OBJPARB                          =
 EXCEPTIONS
   ACTIVE_USER_NOT_EXIST            = 1
   COMMUNICATION_FAILURE            = 2
   COMPONENT_NOT_AVAILABLE          = 3
   FOLDER_NOT_EXIST                 = 4
   FOLDER_NO_AUTHORIZATION          = 5
   OBJECT_NOT_EXIST                 = 6
   OBJECT_NO_AUTHORIZATION          = 7
   OPERATION_NO_AUTHORIZATION       = 8
   OWNER_NOT_EXIST                  = 9
   PARAMETER_ERROR                  = 10
   SUBSTITUTE_NOT_ACTIVE            = 11
   SUBSTITUTE_NOT_DEFINED           = 12
   SYSTEM_FAILURE                   = 13
   X_ERROR                          = 14
   OTHERS                           = 15
            .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  WRITE:/ 'TITLE :' ,GS_NOTE_HD-OBJDES.
  LOOP AT GT_NOTE_LN.
    WRITE:/ GT_NOTE_LN-LINE.
  ENDLOOP.
ENDLOOP.

7 REPLIES 7
Read only

Former Member
0 Likes
1,537

Hi,

You can use fm READ_TEXT as per my yesterday's post.

Do you face any problem using READ_TEXT? Let me know.

It seems your problem is not resolved as I could not see your today.

Regards,

Anil Salekar

Read only

0 Likes
1,537

Hi,

absolutely my problem is not resolved. FM READ_TEXT is not use for note result from GOS. Do you know GOS ?

Thanks for your help.

Read only

Former Member
0 Likes
1,537

Hi,

use read_text FM


  CALL FUNCTION 'READ_TEXT'
    EXPORTING
*     CLIENT                        = SY-MANDT
      id                            = id
      language                      = language
      name                          = name
      object                        = object
*     ARCHIVE_HANDLE                = 0
*     LOCAL_CAT                     = ' '
*   IMPORTING
*     HEADER                        = HEADER
    TABLES
      lines                         = lines
*   EXCEPTIONS
*     ID                            = 1
*     LANGUAGE                      = 2
*     NAME                          = 3
*     NOT_FOUND                     = 4
*     OBJECT                        = 5
*     REFERENCE_CHECK               = 6
*     WRONG_ACCESS_TO_ARCHIVE       = 7

for id,language,name,object give the textname in t-code so10 and click on display and there

goto->header to get information about id,language,name,object.

Thnaks & Reagrds,

Sateesh.

Read only

Former Member
0 Likes
1,538

Try something like following

PARAMETERS P_EBELN LIKE EKKO-EBELN.
DATA : GS_OBJECT   TYPE          SIBFLPORB,
       GT_LINKS    TYPE TABLE OF OBL_S_LINK,
       GS_LINKS    TYPE          OBL_S_LINK,
       GS_FOLDERID TYPE          SOODK,
       GS_OBJECTID TYPE          SOODK,
       GS_NOTE_HD  TYPE          SOOD2,
       GT_NOTE_LN  TYPE TABLE OF SOLI WITH HEADER LINE.
GS_OBJECT-INSTID = P_EBELN.
GS_OBJECT-TYPEID = 'BUS2012'.
GS_OBJECT-CATID  = 'BO'.
TRY.
    CALL METHOD CL_BINARY_RELATION=>READ_LINKS_OF_BINREL
      EXPORTING
        IS_OBJECT    = GS_OBJECT
        IP_RELATION  = 'NOTE'
      IMPORTING
        ET_LINKS     = GT_LINKS
*      ET_ROLES     =
        .
  CATCH CX_OBL_PARAMETER_ERROR .
  CATCH CX_OBL_INTERNAL_ERROR .
  CATCH CX_OBL_MODEL_ERROR .
ENDTRY.
LOOP AT GT_LINKS INTO GS_LINKS.
  GS_FOLDERID = GS_LINKS-INSTID_B+00(17).
  GS_OBJECTID = GS_LINKS-INSTID_B+17(17).
  CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
*   FILTER                           =
      FOLDER_ID                        = GS_FOLDERID
*   FORWARDER                        =
      OBJECT_ID                        = GS_OBJECTID
*   OWNER                            =
*   F_MAILER                         = ' '
 IMPORTING
*   OBJECT_FL_DISPLAY                =
    OBJECT_HD_DISPLAY                = GS_NOTE_HD
*   OBJECT_RC_DISPLAY                =
 TABLES
    OBJCONT                          = GT_NOTE_LN[]
*   OBJHEAD                          =
*   OBJPARA                          =
*   OBJPARB                          =
 EXCEPTIONS
   ACTIVE_USER_NOT_EXIST            = 1
   COMMUNICATION_FAILURE            = 2
   COMPONENT_NOT_AVAILABLE          = 3
   FOLDER_NOT_EXIST                 = 4
   FOLDER_NO_AUTHORIZATION          = 5
   OBJECT_NOT_EXIST                 = 6
   OBJECT_NO_AUTHORIZATION          = 7
   OPERATION_NO_AUTHORIZATION       = 8
   OWNER_NOT_EXIST                  = 9
   PARAMETER_ERROR                  = 10
   SUBSTITUTE_NOT_ACTIVE            = 11
   SUBSTITUTE_NOT_DEFINED           = 12
   SYSTEM_FAILURE                   = 13
   X_ERROR                          = 14
   OTHERS                           = 15
            .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  WRITE:/ 'TITLE :' ,GS_NOTE_HD-OBJDES.
  LOOP AT GT_NOTE_LN.
    WRITE:/ GT_NOTE_LN-LINE.
  ENDLOOP.
ENDLOOP.

Read only

0 Likes
1,537

GTREN thanks for this program but it dump with this message :

Relationship ATTA Can No Longer Be Used with this Interface

A module was called to read object relationships. The relationship types transferred to the interface can only be accessed in connection with CL_BINARY_RELATION class, because the model datea has been converted to a new relationship service. A conversion of the read calls is also part of this conversion.

Read only

0 Likes
1,537

Ok try like following

PARAMETERS P_EBELN LIKE EKKO-EBELN.

DATA : GS_OBJECT   TYPE          SIBFLPORB,
       GS_FOLDERID TYPE          SOODK,
       GS_OBJECTID TYPE          SOODK,
       GS_NOTE_HD  TYPE          SOOD2,
       GT_NOTE_LN  TYPE TABLE OF SOLI WITH HEADER LINE,
       GT_SRGBTBREL TYPE TABLE OF SRGBTBREL,
       GS_SRGBTBREL TYPE          SRGBTBREL.


GS_OBJECT-INSTID = P_EBELN.
GS_OBJECT-TYPEID = 'BUS2012'.
GS_OBJECT-CATID  = 'BO'.
SELECT * FROM SRGBTBREL
    APPENDING CORRESPONDING FIELDS OF TABLE  GT_SRGBTBREL
        WHERE INSTID_A = GS_OBJECT-INSTID
          and TYPEID_A = GS_OBJECT-TYPEID
          and CATID_A  = GS_OBJECT-CATID
          and RELTYPE  = 'NOTE'.
LOOP AT GT_SRGBTBREL INTO GS_SRGBTBREL.
  GS_FOLDERID = GS_SRGBTBREL-INSTID_B+00(17).
  GS_OBJECTID = GS_SRGBTBREL-INSTID_B+17(17).
  CALL FUNCTION 'SO_OBJECT_READ'
    EXPORTING
*   FILTER                           =
      FOLDER_ID                        = GS_FOLDERID
*   FORWARDER                        =
      OBJECT_ID                        = GS_OBJECTID
*   OWNER                            =
*   F_MAILER                         = ' '
 IMPORTING
*   OBJECT_FL_DISPLAY                =
    OBJECT_HD_DISPLAY                = GS_NOTE_HD
*   OBJECT_RC_DISPLAY                =
 TABLES
    OBJCONT                          = GT_NOTE_LN[]
*   OBJHEAD                          =
*   OBJPARA                          =
*   OBJPARB                          =
 EXCEPTIONS
   ACTIVE_USER_NOT_EXIST            = 1
   COMMUNICATION_FAILURE            = 2
   COMPONENT_NOT_AVAILABLE          = 3
   FOLDER_NOT_EXIST                 = 4
   FOLDER_NO_AUTHORIZATION          = 5
   OBJECT_NOT_EXIST                 = 6
   OBJECT_NO_AUTHORIZATION          = 7
   OPERATION_NO_AUTHORIZATION       = 8
   OWNER_NOT_EXIST                  = 9
   PARAMETER_ERROR                  = 10
   SUBSTITUTE_NOT_ACTIVE            = 11
   SUBSTITUTE_NOT_DEFINED           = 12
   SYSTEM_FAILURE                   = 13
   X_ERROR                          = 14
   OTHERS                           = 15
            .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  WRITE:/ 'TITLE :' ,GS_NOTE_HD-OBJDES.
  LOOP AT GT_NOTE_LN.
    WRITE:/ GT_NOTE_LN-LINE.
  ENDLOOP.
ENDLOOP.

Read only

0 Likes
1,537

Great !! Thanks a lot GTREN.