cancel
Showing results for 
Search instead for 
Did you mean: 

PO download to excel in SRM portal

Former Member
0 Kudos

hi ,

In SAP Supplier Relationship Management (SAP SRM), we need to download the purchasing documents that are  available for a perticular supplier in the  Microsoft Office Excel format, We had tried all the possibilities from our end , please provide the solution to it where the supplier can download all his orders .


regards,

raj

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Raj,

Have you tried the same in POWL ?

Regards,

Nishanth

vinita_kasliwal
Active Contributor
0 Kudos

Hi Raj

Did that work for you ?

Regards

Vinita

vinita_kasliwal
Active Contributor
0 Kudos

Hi Raj

Below is a ref code which you should be using

1. Create a button which we clicked will save the data on a table in webdynpro to excel file

2. Read all data in internal table and loop to concatenate data via tab and also the headings

3. Convert to Xstring using  SCMS_STRING_TO_XSTRING

4. Convert to excel using  wdr_task=>client_window->client->attach_file_to_response(

METHOD onactionsave_excel .

  DATA: lt_cbp_list     TYPE         wd_this->elements_list,

        ls_cbp_list     TYPE         wd_this->element_list,

        lo_nd_list      TYPE REF TO  if_wd_context_node,

        lv_str          TYPE string,

        lv_date(10)     type c,

        lv_xstr         TYPE xstring.

" Read all data shown in a table to the internal table lt_cbp_list

  lo_nd_list        = wd_context->get_child_node( 'LIST' ).

  lo_nd_list->get_static_attributes_table(

    IMPORTING

      table = lt_cbp_list[] ).

** Generate a header line

  CONCATENATE

  Headine_1

  Heading_2

  Heading_3

              cl_abap_char_utilities=>newline

  INTO lv_str

SEPARATED BY cl_abap_char_utilities=>horizontal_tab.

generate the content in a single line by looping through all entries

  LOOP AT lt_cbp_list INTO ls_cbp_list.

CONCATENATE

ls_cbp_list-object_type

ls_cbp_list-object_id

ls_cbp_list-partner_fct

*ls_cbp_list-partner_guid

ls_cbp_list-pd_type

ls_cbp_list-process_type

INTO lv_str

SEPARATED BY cl_abap_char_utilities=>horizontal_tab.

  ENDLOOP.

 

**** Pass all data here

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

    EXPORTING

      text     = lv_str

*     MIMETYPE = ' '

*     ENCODING =

    IMPORTING

      buffer   = lv_xstr

    EXCEPTIONS

      failed   = 1

      OTHERS   = 2.

  IF sy-subrc <> 0.

* Implement suitable error handling here

  ENDIF.

  wdr_task=>client_window->client->attach_file_to_response(

    i_filename = 'table.xls'

    i_content =  lv_xstr

    i_mime_type = 'EXCEL' ).

ENDMETHOD.

Regards

Vinita