You are on page 1of 3

GOS

Attachment in SAP Screen Personas









GOS Attachment in SAP Screen Personas
Akila Murugesan

1

GOS Attachment in SAP Screen Personas


Overview
Using Services for Object / GOS attachment functionality can be made easy using screen personas.
Generally attaching documents in GOS involves navigating through popups and menu options, this can
be avoided by using the prescribed Function Module. The given function module portrays simplifying
attachment creation and viewing for SAP PM Work Orders and can be extended to any SAP document.

SAP Screen Personas Script


The following script shows an example of how the function module can be used within the flavor to
show the attachment list for the transaction IW32.

// Simplify attachment viewing and creation

// Obtain the order number for which attachments are to be viewed.

var sOrder =
session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:*/ssubSUB_LEVEL:SAPLCOIH:*/subSUB_KOPF:SAPL
COIH:1102/txtCAUFVD-AUFNR").text;

// Call RFC by specifying the order number.

var oRFC = session.createRFC("Z_PERSONAS_GOS_ATTACHMENT");

// Specify the order number

oRFC.setParameter("I_BOR_INSTID", sOrder);

// Specify the Business object type

oRFC.setParameter("I_BOR_TYPEID", "BUS2007");

// Specify the field length, to determine the number of leading zeroes

oRFC.setParameter("I_LEADING_ZEROES", 10);

// Specify the Change or Display mode for GOS attachment

oRFC.setParameter("I_MODE", 'C');

oRFC.send();

ABAP Function Module



function z_personas_gos_attachment.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_BOR_INSTID) TYPE SIBFBORIID
*" VALUE(I_BOR_TYPEID) TYPE SIBFTYPEID
*" VALUE(I_LEADING_ZEROES) TYPE NUMC4 OPTIONAL
*" VALUE(I_MODE) TYPE CHAR1 DEFAULT 'D'
*" EXPORTING
*" VALUE(E_ERROR) TYPE STRING
*"----------------------------------------------------------------------
data: lv_instid type sibfboriid,
ls_object type sibflporb.
field-symbols <conv> type any.

2

GOS Attachment in SAP Screen Personas


if i_leading_zeroes is not initial.
assign lv_instid(i_leading_zeroes) to <conv>.
if sy-subrc ne 0.
e_error = 'Leading 0 conversion'.
return.
endif.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = i_bor_instid
importing
output = <conv>.
else.
lv_instid = i_bor_instid.
endif.

ls_object-instid = lv_instid.
ls_object-typeid = i_bor_typeid.
ls_object-catid = 'BO'.

* Call GOS attachment pop-up


* Mode = 'C' for change mode (To view and create attachments)
call function 'GOS_ATTACHMENT_LIST_POPUP'
exporting
is_object = ls_object
* IP_CHECK_ARL = 'X'
* IP_CHECK_BDS = 'X'
* IP_NOTES = 'X'
* IP_ATTACHMENTS = 'X'
* IP_URLS = 'X'
ip_mode = i_mode
* IMPORTING
* EP_SAVE_REQUEST =
* TABLES
* IT_OBJECTS =
.

endfunction.

Whitelist ABAP Function Module


Once the function module is created in the system, ensure that its white listed in SAP Screen Personas
Admin transaction.

Go to transaction /personas/admin

Click on display button on the ‘Function Module Whitelist’

Now click on Display/Change button to create an entry for the function module as shown below:

You might also like