Application Development 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: 

Changing filename of attachment using GOS

Private_Member_15166
Active Contributor
0 Kudos

Hi Gurus ,

I am in the middle of the technical issue related to the  GOS_EXECUTE_SERVICE function module.

Everything is working fine but when i am attaching a file from my pc, it's taking the filename as it is. it sounds good.

But here comes the problem, i have a requirement of adding the filename starting with a common name.

Suppose i have attached a file and it's name is abc.pdf but i want to display it as zbp_abc.pdf.

Thanks and Regards.

Dhananjay

1 ACCEPTED SOLUTION

Private_Member_15166
Active Contributor
0 Kudos

at lastly found the answer.

19 REPLIES 19

Private_Member_15166
Active Contributor
0 Kudos

Hey, is there anyone who can help me?

Private_Member_15166
Active Contributor
0 Kudos

Hey anyone.. Just tell me something.

himanshu_gupta13
Employee
Employee
0 Kudos

Hi Dhananjay,

Go through this my document link below for ref purpose , here defined the process of attaching file using GOS and while attaching file it gives an option to give name of file as per your requirement. It's enables a tool for attachment which is much like in VF03 or other standard tcodes.

http://scn.sap.com/docs/DOC-39470

Many Thanks / Himanshu Gupta

0 Kudos

Hi Himanshu,

Thanks for your first reply

I have used this function module.

CONCATENATE ls_final-pernr ls_final-reinr INTO

         ls_object-objkey.

         ls_object-objtype = 'BUS2089'.

         CALL FUNCTION 'GOS_EXECUTE_SERVICE'

           EXPORTING

             ip_service           = 'VIEW_ATTA'

             is_object            = ls_object

             ip_no_commit         = ' '

             ip_popup             = 'X'

             ip_rwmod             = 'E'

*           IT_SERVICE_SELECTION =

*           IP_VSI_PROFILE       =

           IMPORTING

             ep_event             = lp_event

             ep_status            = lp_status

             ep_icon              = lp_icon

             ep_message           = lp_message

           EXCEPTIONS

             execution_failed     = 1

             OTHERS               = 2.


It's working great. but i want to add a prefix before the file name. means after saving the file it must look like tv_abc.pdf and not like abc.pdf.

But file which i have selected from desktop is abc.pdf and after attaching it looks like tv_abc.pdf on screen.


Thanks in advance.


Regards

Dhananjay

0 Kudos

Hi,

maybe (not sure) you could do this modify the SWO1 transaction of the corresponding object.

or you could copy/change the class used for archived the object.

Did you use the standard GOS button or a specific object ?

regards

Fred

0 Kudos

Hi  Frederic,

I am using the standard GOS Button.

Can you please tell me where to modify the SWO1 transaction for the create button.

Any help will be appreciated.

I did lots of things like copied the standard class to zclass. But always got failure.

Regards.

Dhananjay

0 Kudos

Hi,

if you use the standard GOS button, you could copy and change the class link to the button using the table SGOSATTR

Here a doc   explains how to change the menu.

regads

Fred

0 Kudos

Hi Fred,

in that attachment, i just found that how i can change the menu. i don't want to change the menu.

On the click of create attachment, the popup window will open. i will select a file, suppose abc.pdf. after selecting it, when the contents of alv will be displayed, i want to see it as tv_abc.pdf.

Thanks for your response.

Regards

Dhananjay

0 Kudos

You could use BAdI GOS_SRV_REQUEST (*) to "intercept" service execution and use your own copy of standard methods, including the rename of attachment.

Regards,

Raymond

(*) I prefer usage of BAdI to change of tables SGOSATTR/SGOSCUST as it enables more options.

0 Kudos

Hi Raymond,

I didn't understand. Can you explain please? Or if you have any document then give me the link.

I have not that much experience with SAP.

Thanks

Dhananjay

0 Kudos

Read first the BAdI documentaiton (and some documents at help.sap.com on how to implement BAdI - Level 4: Node: Implementation of BAdIs. Selected. Trigger this link to expandhttps://help.sap.com/saphelp_nw04s/helpdata/en/5e/ebb541c5b63031e10000000a155106/content.htmImplementation of BAdIs) with this BAdI you can use your own method to attach a document, so you could wrap the standard method and then analyze its result and change data.

Also use search tool to get document like Attach files to GOS with Save, Retrieve, Delete functionality in SAP Web Dynpro ABAP - Part 1 where you will find many of the required FM and methods you will require for your task.

Regards,

Raymond

Private_Member_15166
Active Contributor
0 Kudos

even now i have not the answers.

Please tell me if you have..

Private_Member_15166
Active Contributor
0 Kudos

Hi,

At lastly i debugged deeply  'cl_gos_srv_attachment_create' class with 'execute' method and i found that i can change it at the 'SO_OBJECT_INSERT' . But this is the standard class and standard function module, so how i can add my piece of code for my requirement???.

Any ideas?

Private_Member_15166
Active Contributor
0 Kudos

Hey any exrta suggestions??

janosdezsi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dhananjay,

there will be a standard solution for this from Basis 7.30. Please have a look on KBA 1895197. But this is a manual solution to change the filename after it was attached.

(Please not, that this development currently available only from GOS standard attachments and not for ArchiveLink business documents.)

Best regards,

Janos

Private_Member_15166
Active Contributor
0 Kudos

at lastly found the answer.

0 Kudos

Can you please share this with the others? Maybe it will help other SCN users too.

0 Kudos

1. Import parameter from report program and export the parameter at:

Include program -> LSO30F00

Sub-Routine -> so_split_file_and_extension ( line no 246-311)

  Enhancement implementation to be done at the end of sub-routine for prefixing the file with ‘TV_”.


2. Clearing of import parameter at end of the report.



Thanks

Dhananjay

0 Kudos

Hi Dhanajay,

  Above mentioned solution was very helpful for me.

But My requirement is how to put validation while deleting attachment.

Validation:User ID through which attachment got created should allowed to Delete attchment.

I am not getting right place to put validation.

Regards,

Pai