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

Attach same file to multiple documents GOS (General Object Serivice)

Former Member
0 Likes
2,321

Hi Friends,

I am using function module to attach the documents which is similar to GOS tool bar.

Function module name : SGOS_DOCUMENT_CREATE_DIALOG.

Please refer below sample code.

DATA : t_bkpf TYPE STANDARD TABLE OF bkpf WITH HEADER LINE,

is_object TYPE borident,

cnt(6) TYPE n.

PARAMETER : p_bukrs TYPE bukrs,

p_gjahr TYPE gjahr.

START-OF-SELECTION.

is_object-objtype = 'BKPF'.

SELECT * FROM bkpf INTO TABLE t_bkpf

WHERE bukrs = p_bukrs

AND gjahr = p_gjahr.

LOOP AT t_bkpf .

CONCATENATE t_bkpf-bukrs t_bkpf-belnr t_bkpf-gjahr

INTO is_object-objkey.

IF cnt = 0.

CALL FUNCTION 'SGOS_DOCUMENT_CREATE_DIALOG'

EXPORTING

is_object = is_object

ip_title = ' Attach Document'

  • IMPORTING

  • EP_DOCUMENT =

WRITE:/ t_bkpf-belnr,

t_bkpf-gjahr,

t_bkpf-bukrs.

endif.

cnt = cnt + 1.

if cnt > 2.

exit.

endif.

ENDLOOP.

In the above code. A dialog will be popuped for every document asking to attach some file or link.

My requirement is , the popup should ask only once.

and rest should be in the background mode.

ie. It should not ask for the popup for rest of the documents.

Is there any class module or function to attach the documents with out popups.

Expecting the answers at the earliest.

Thanks .

Hi Friends,

I am using function module to attach the documents which is similar to GOS tool bar.

Function module name : SGOS_DOCUMENT_CREATE_DIALOG.

Please refer below sample code.

DATA : t_bkpf TYPE STANDARD TABLE OF bkpf WITH HEADER LINE,

is_object TYPE borident,

cnt(6) TYPE n.

PARAMETER : p_bukrs TYPE bukrs,

p_gjahr TYPE gjahr.

START-OF-SELECTION.

is_object-objtype = 'BKPF'.

SELECT * FROM bkpf INTO TABLE t_bkpf

WHERE bukrs = p_bukrs

AND gjahr = p_gjahr.

LOOP AT t_bkpf .

CONCATENATE t_bkpf-bukrs t_bkpf-belnr t_bkpf-gjahr

INTO is_object-objkey.

IF cnt = 0.

CALL FUNCTION 'SGOS_DOCUMENT_CREATE_DIALOG'

EXPORTING

is_object = is_object

ip_title = ' Attach Document'

  • IMPORTING

  • EP_DOCUMENT =

WRITE:/ t_bkpf-belnr,

t_bkpf-gjahr,

t_bkpf-bukrs.

endif.

cnt = cnt + 1.

if cnt > 2.

exit.

endif.

ENDLOOP.

In the above code. A dialog will be popuped for every document asking to attach some file or link.

My requirement is , the popup should ask only once.

and rest should be in the background mode.

ie. It should not ask for the popup for rest of the documents.

Is there any class module or function to attach the documents with out popups.

Expecting the answers at the earliest.

Thanks .

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
1,277

You need to look for fm CL_GOS_SRV_ATTACHMENT_CREATE or class CL_GOS_SERVICE.

Read only

Former Member
0 Likes
1,277

Why donot u copy this Fm SGOS_DOCUMENT_CREATE_DIALOG to a ZFM and do the modification based on ur need i.e put a condition arougd screen call so that it displays the screen only once.

EX::

function Zsgos_document_create_dialog .

*"----


""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(IS_OBJECT) TYPE BORIDENT

*" VALUE(IP_TITLE) TYPE SOOD-OBJDES OPTIONAL

*" EXPORTING

*" VALUE(EP_DOCUMENT) TYPE BORIDENT-OBJKEY

*"----


data rel_type type breltyp-reltype.

data rel_doc type borident.

gs_object = is_object.

call function 'SO_FOLDER_ROOT_ID_GET'

exporting

region = 'B'

importing

folder_id = folder_id

exceptions

others = 1.

    • clear: radio_note, radio_url, radio_atta.*

    • clear: text_control_cont, text_control, url, document_id.* document_title = ip_title.

clear gt_extab[]. "note 608125

append 'CLPB' to gt_extab.

if l_flag = 'X'. << Declare it as static with value 'X'

call screen 2000 starting at 10 3

ending at 83 14.

clear l_flag.

endif.

if not is_object-objkey is initial and radio_atta is initial.

if not document_id is initial.

if not radio_note is initial.

rel_type = 'NOTE'.

elseif not radio_url is initial.

rel_type = 'URL'.

  • elseif not radio_atta is initial.

  • rel_type = 'ATTA'.

endif.

clear rel_doc.

rel_doc-objkey = document_id.

rel_doc-objtype = 'MESSAGE'.

call function 'BINARY_RELATION_CREATE'

exporting

obj_rolea = is_object

obj_roleb = rel_doc

relationtype = rel_type

exceptions

others = 1.

if sy-subrc = 0.

ep_document = document_id.

  • commit work.

endif.

endif.

else.

ep_document = document_id.

endif.

endfunction.

Regards,

Joy.

Read only

Former Member
0 Likes
1,277

Hi Joy

Thanks for your reply.

What you said , like to copy the FM into ZFM.

the same can be achived in the program it self.

By call the rest of the code ....

" clear rel_doc.

rel_doc-objkey = document_id.

rel_doc-objtype = 'MESSAGE'.

call function 'BINARY_RELATION_CREATE'

exporting

obj_rolea = is_object

obj_roleb = rel_doc

relationtype = rel_type

exceptions

others = 1.

if sy-subrc = 0.

ep_document = document_id.

  • commit work.

endif. "

But this both solutions will not work.

Becoz....

All the class methods are called in the PAI & PBO events of Screen 2000.

Even I have done this same with out copying the FM into ZFM.

by passing screen values .

If you have any other way , can you please suggest that.

Read only

0 Likes
1,277

Sorry for this late reply..may be you have already solved the prob. but if not then u can use this solution.

Yes u r right, all method calls are done from the screen pai.

So to overcome it I have copied the function grp SGOSDS to ZSGOSDS. and copied all the

FMs in it to zFMs.

Then in the topinclude define a varaible like

data: l_flag(1) type c value 'X'.

Now in PBO of screen 2000 I have added following code block

if l_flag = 'X'.

clear l_flag.

else.

SUPPRESS DIALOG.

endif.

That means it will display the screen 1st time but prcesses pbo and pai every time whenever we

call this screen.

Hope now it will solve ur problem.

Regards,

Joy.