cancel
Showing results for 
Search instead for 
Did you mean: 

Word Document template - In WD, Download via link

balajishahrsap
Participant
0 Kudos

Dear All,

we have a requirement, to have a link in our custom webdynpro component, to download a Word document template.

for example,

In SRM, the Bidder may try to give any supporting documents such as Attachment or notes.

for attachments alone the purchaser (our client ) would like to give a standard word template(should be able to download via a link)

the bidder will have to download this document from the webdynpro component and save in his computer for any modification.

Please let us know for any ideas or suggestions,

Thanks and regards,

Accepted Solutions (0)

Answers (2)

Answers (2)

Gowtham
Contributor
0 Kudos

Hi Balajisha,

There are three options are available to upload the docs into SAP server

  • Create a custom table and store the files there( But this will occupy more memory compare the other methods depends upon the size the document and no security)
  • Upload through GOS
  • Upload through DMS

And in your web Dynpro ABAP page give an File Download UI element , in the page load retrieve the document from the uploaded place and bind it with the FD element.

Even we too had the same requirement , we have used the option of GOS.

FYR : Pls find the attached snap.

- Gowtham

balajishahrsap
Participant
0 Kudos

Hi Gowtham,

Thanks for your reply,

Could you please share more details like ( sample code) how did you upload the template to GOS and the retrieval of the same,

I totally agree that both our requirements are the same 🙂

Thanks

Gowtham
Contributor
0 Kudos

Hi Balajisha,

Kindly find the following link :

- Gowtham

balajishahrsap
Participant
0 Kudos

hi Gowtham,

I have built the table and in the toolbar have linktoaction placed, whenever the user clicks here a the standard template which was upload should get downloaded.

But as of now we are unable to do it, using the above mentioned method. Please let us know for any further suggestions

Regards

Gowtham
Contributor
0 Kudos

Hi Balaji,

can you pls brief what issue you are facing with GOS Method?

- Gowtham

balajishahrsap
Participant
0 Kudos

Hi Gowtham,

We have done the following things

1. Created a new custom component wherein the user can update there templates

and they are provided with an option to modify delete or upload a new template.

2. Existing custom component, which has the link to action. whenever the user click on this the template whatever is updated in step 1 will get downloaded. ( we have achieved this using the custom table) as we decided that we should not create any custom table for this activity, we are looking for the GOS method to get the uploaded template

          Issue raised when GOS is used

          -------------------------------------------

3. Issue with GOS ---- We are able to get the ATTA_ID ( FOLXXXXXXXEXTXXXXX ) of the uploaded template but we are unable to link with the uploaded document to the link to action UI in the existing custom component

Please let me know your thoughts

Thanks and regards,

Balajisha

Gowtham
Contributor
0 Kudos

Hi Balaji,

Kindly find the code which i have used in my component to retrieve the file from GOS and bind it to the Download link's Node.


METHOD help_document .

   DATA  ls_sibflporb                TYPE          sibflporb.

   DATA  lt_fitv_atta_sty            TYPE TABLE OF fitv_atta_sty.

   DATA  ls_fitv_atta_sty            TYPE          fitv_atta_sty.

   DATA  lt_bapiret2                 TYPE TABLE OF bapiret2.

   DATA lo_nd_help_document      TYPE REF TO   if_wd_context_node.

   DATA ls_help_document         TYPE          wd_this->element_help_document.

   DATA  lv_atta_id                  TYPE          so_entryid.

   DATA  lv_content                  TYPE          string.

   DATA  lv_content_hex              TYPE          xstring.

   DATA  ls_bapiret2                 TYPE          bapiret2.

   DATA  lv_name                     TYPE          string.

   lo_nd_help_document = wd_context->get_child_node( name = wd_this->wdctx_help_document ).

   MOVE 'SR-JD-TEMP'   TO ls_sibflporb-instid.

   MOVE 'ZBO_SR'       TO ls_sibflporb-typeid.

   MOVE 'BO'           TO ls_sibflporb-catid.

   CALL METHOD wd_assist->gos_get_links(

   EXPORTING

     is_lporb = ls_sibflporb

   IMPORTING

     et_items = lt_fitv_atta_sty

     et_messages  = lt_bapiret2 ).

   IF NOT lt_bapiret2 IS INITIAL.

     REFRESH lt_bapiret2.

   ENDIF.

   IF lt_fitv_atta_sty IS NOT INITIAL.

     CLEAR ls_fitv_atta_sty.

     LOOP AT lt_fitv_atta_sty INTO ls_fitv_atta_sty.

       CONCATENATE ls_fitv_atta_sty-foltp

       ls_fitv_atta_sty-folyr

       ls_fitv_atta_sty-folno

       ls_fitv_atta_sty-objtp

       ls_fitv_atta_sty-objyr

       ls_fitv_atta_sty-objno

       INTO lv_atta_id

       RESPECTING BLANKS.

       IF lv_atta_id IS NOT INITIAL.

         CALL METHOD wd_assist->gos_get_content(

         EXPORTING

           iv_atta_id                 = lv_atta_id

           iv_objtp                   = 'EXT'

         IMPORTING

           ev_content                = lv_content

           ev_content_hex            = lv_content_hex

           es_message                = ls_bapiret2  ).

         IF ls_bapiret2 IS INITIAL.

           CLEAR ls_bapiret2.

         ENDIF.

         IF sy-subrc EQ '0'.

           MOVE lv_content_hex   TO ls_help_document-content.

         ENDIF.

         IF NOT lv_content IS INITIAL.

           CLEAR lv_content.

         ENDIF.

       ENDIF.

       CLEAR lv_name.

       CONCATENATE ls_fitv_atta_sty-objdes

       ls_fitv_atta_sty-file_ext

       INTO lv_name

       SEPARATED BY '.'.

       MOVE lv_name                   TO ls_help_document-name.

       MOVE ls_fitv_atta_sty-file_ext TO ls_help_document-type.

     ENDLOOP.

     IF ls_help_document IS NOT INITIAL.

       lo_nd_help_document->bind_structure( ls_help_document ).

     ENDIF.

   ENDIF.

ENDMETHOD.

- Gowtham

balajishahrsap
Participant
0 Kudos

Hi Gowtham,

Thanks for the snippet.

Still i have 2 questions

1. WD_assist->get_gos_content --------- hope this is the custom method where in you are getting the hex content using the ATTA_ID.  Could you please let me know what is the logic behind this call.

2.

MOVE 'SR-JD-TEMP'   TO ls_sibflporb-instid.

   MOVE 'ZBO_SR'       TO ls_sibflporb-typeid.

   MOVE 'BO'           TO ls_sibflporb-catid.


from the above code i understood that we need to pass this values mandate to get the content, but in our system we dont have the 'ZBO_SR' component, do you want us to create new type id?


Thanks and regards,

Balajisha

Gowtham
Contributor
0 Kudos

Hi Balaji,

wd_assist->get_gos_content this method directly calls the method get_content from the class cl_fitv_gos , This method helps you to get the content of the document that you uploaded.

ZBO_SR is the custom business object that we created for this project related activities hence i reused the same in GOS also.

You can create your own & no need create any methods or actions in it just create one BO that's enough ,  for creating business object pls refer this link.

- Gowtham

Former Member
0 Kudos

Hi,

upload the file and store the xstring in a Z Table.

Download:

Define a button and in action of this, read the xstring from your z Table and attach it to the http response.

For http response use

cl_wd_runtime_services=>attach_file_to_response

regards

Alex

balajishahrsap
Participant
0 Kudos

Hi Alex,

Thanks for your reply,

Please validate my understanding from your comments,

1. We need to create a custom data base table with one of the field as Xstring content holder.

2. Create a sample Webdynpro component and do the upload for the word doc template.

3. In the main webdynpro component, create a link to action and use the runtime services code to fetch the Xstring content.

Let me know for any correction & also do share some sample code for getting the content using the runtime services code

Thanks