Skip to Content
author's profile photo Former Member
Former Member

Reg GOS File Attachment Control

My requiremnet is when attaching file in GOS in standard transactions

file size check should be done. Only files of some kb should be allowed for attachment. How to do this.

I tried with gos_srv_request badi. But it is not supporting.

This check should be applicable for any transaction wherever GOS

is activated.

When I activate the BADI gos_srv_request file attachment is not happening. Any other soln for this.kindly help me out.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2010 at 12:40 PM

    Example for XD02

    PARAMETERS: p_key TYPE swo_typeid OBLIGATORY,
    p_type TYPE swo_objtyp OBLIGATORY,
    p_file TYPE c LENGTH 100 OBLIGATORY,
    p_desc TYPE so_obj_des OBLIGATORY.
    
    DATA: ls_fol_id TYPE soodk,
    ls_obj_id TYPE soodk,
    ls_obj_data TYPE sood1,
    ls_folmem_k TYPE sofmk,
    ls_note TYPE borident,
    ls_object TYPE borident,
    lv_ep_note TYPE borident-objkey,
    lv_offset TYPE i.
    
    DATA: it_objhead TYPE STANDARD TABLE OF soli,
    it_content LIKE STANDARD TABLE OF soli,
    wa_content LIKE soli.
    
    ls_object-objkey = p_key.
    ls_object-objtype = p_type.
    
    TRY.
    OPEN DATASET p_file FOR INPUT IN BINARY MODE.
    WHILE sy-subrc = 0.
    READ DATASET p_file INTO wa_content.
    APPEND wa_content TO it_content.
    ENDWHILE.
    CLOSE DATASET p_file.
    CATCH cx_sy_file_access_error.
    MESSAGE 'Error reading file' TYPE 'E'.
    ENDTRY.
    
    CALL FUNCTION 'SO_CONVERT_CONTENTS_BIN'
    EXPORTING
    it_contents_bin = it_content[]
    IMPORTING
    et_contents_bin = it_content[].
    
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    region = 'B'
    IMPORTING
    folder_id = ls_fol_id
    EXCEPTIONS
    OTHERS = 1.
    
    ls_obj_data-objsns = 'O'.
    ls_obj_data-objla = sy-langu.
    ls_obj_data-objdes = p_desc.
    lv_offset = STRLEN( p_file ) - 3.
    ls_obj_data-file_ext = p_file+lv_offset(3).
    ls_obj_data-objlen = LINES( it_content ) * 255.
    
    CALL FUNCTION 'SO_OBJECT_INSERT'
    EXPORTING
    folder_id = ls_fol_id
    object_type = 'EXT'
    object_hd_change = ls_obj_data
    IMPORTING
    object_id = ls_obj_id
    TABLES
    objhead = it_objhead
    objcont = it_content
    EXCEPTIONS
    active_user_not_exist = 35
    folder_not_exist = 6
    object_type_not_exist = 17
    owner_not_exist = 22
    parameter_error = 23
    OTHERS = 1000.
    
    IF sy-subrc = 0 AND ls_object-objkey IS NOT INITIAL.
    ls_folmem_k-foltp = ls_fol_id-objtp.
    ls_folmem_k-folyr = ls_fol_id-objyr.
    ls_folmem_k-folno = ls_fol_id-objno.
    ls_folmem_k-doctp = ls_obj_id-objtp.
    ls_folmem_k-docyr = ls_obj_id-objyr.
    ls_folmem_k-docno = ls_obj_id-objno.
    lv_ep_note = ls_folmem_k.
    ls_note-objtype = 'MESSAGE'.
    ls_note-objkey = lv_ep_note.
    CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
    EXPORTING
    obj_rolea = ls_object
    obj_roleb = ls_note
    relationtype = 'ATTA'
    EXCEPTIONS
    OTHERS = 1.
    ELSE.
    MESSAGE 'Not OK' TYPE 'I'.
    RETURN.
    ENDIF.
    
    IF sy-subrc = 0.
    MESSAGE 'OK' TYPE 'I'.
    ELSE.
    MESSAGE 'Not OK' TYPE 'I'.
    ENDIF.
    

    In selection screen

    p_key = customer number

    p_type = KNA1

    P_FILE = YOUR DOCUMENT

    P_DESC = DOCUMENT DESC.

    Edited by: kk.adhvaryu on Sep 23, 2010 2:43 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2010 at 12:20 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 27, 2013 at 05:16 PM

    Hi there friends!

    I'm facing the same situation... I need to limit the attachment's size added to GOS, but i don't know how, or where...

    Any ideia?????

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.