2008 Jun 20 1:58 PM
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 .
2008 Jun 20 4:22 PM
You need to look for fm CL_GOS_SRV_ATTACHMENT_CREATE or class CL_GOS_SERVICE.
a®
2008 Jun 20 5:13 PM
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.
2008 Jun 20 7:03 PM
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.
2008 Jun 22 8:25 PM
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.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |