Industry sector: SAP Grantor Management


SAP CRM Objects: SAP CRM Case Management


Business Scenario: As part of Grantor management process, fund manager reviewing a case having multiple applications, can approve or reject applications based on business criteria. Once the manual activity is complete and Case needs to be progressed further to initiate payments for approved applications.

Review meeting minutes for the approval of the application are captured in excel and should be attached to SAP CRM case.


As part of automatic process, multiple files need to be attached to case. An utility will help end user to efficiently perform this task and same can be used for batch process of case in small funds scenario.


Above scenario can vary from client to client.


How to Attach excel file to SAP CRM CASE?

DATA : lv_string                   TYPE string,

           lv_xstring                  TYPE xstring,

           lt_file_content           TYPE sdokcntbins,    

           lt_file_contents         TYPE sdokcntbins,

           ls_business_object   TYPE sibflporb,

           ls_file_access_info   TYPE sdokfilaci,

           lt_file_access_info    TYPE sdokfilacis,

           lt_properties             TYPE sdokproptys,
           ls_properties           
TYPE sdokpropty,

           lv_error                    TYPE skwf_error,

           ls_phio                    TYPE skwf_io.

* Prepare content of the attachment

            Loop at content to be added to the file.

            CONCATENATE lv_string 

                             File-attr1 cl_bcs_convert=>gc_tab

            File-attr2 cl_bcs_convert=>gc_crlf

INTO lv_string. 

Endloop.

*Additionally you can add column header to each of the attribute in the same way as attributes shown above, but before the above loop.


       
CALL FUNCTION ‘SCMS_STRING_TO_XSTRING’
         
EXPORTING
           
text     = lv_string
         
IMPORTING
           
buffer   = lv_xstring
         
EXCEPTIONS
            failed  
= 1
           
OTHERS   = 2.

        CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
         
EXPORTING
           
buffer        = lv_xstring
         
IMPORTING
            output_length
= lv_xsize
         
TABLES
            binary_tab   
= lt_file_content.

        APPEND LINES OF lt_file_content TO lt_file_contents.

        ls_file_access_infomimetype = ‘application/vnd.ms-excel’.
        ls_file_access_info
file_size  = lv_xsize + lv_xsize_l.
        ls_file_access_info
file_name = <FILE NAME>.
        ls_file_access_info
binary_flg = ‘X’.
       
INSERT  ls_file_access_info INTO TABLE lt_file_access_info.

        ls_propertiesname = ‘KW_RELATIVE_URL’.
        ls_properties
value = text004.

        INSERT ls_properties INTO TABLE lt_properties.

        ls_propertiesname = ‘DESCRIPTION’.
       
INSERT ls_properties INTO TABLE lt_properties.

        ls_propertiesname ‘DOC_DATE’.
        ls_properties
value = sydatum.
       
INSERT ls_properties INTO TABLE lt_properties.

        ls_propertiesname = ‘LANGUAGE’.
        ls_properties
value = ‘E’.
       
INSERT ls_properties INTO TABLE lt_properties.

ls_business_objectinstid = <SAP CRM CASE GUID>.
ls_business_object
typeid = <SAP CRM CASE Business Object> example ‘BUS20900’.             “#EC NOTEXT
ls_business_object
catid  = ‘BO’.                   “#EC NOTEXT

        CALL METHOD cl_crm_documents=>create_with_table
         
EXPORTING
            business_object    
= ls_business_object
            properties         
= lt_properties
            file_access_info   
= lt_file_access_info
            file_content_binary
= lt_file_contents
         
IMPORTING
            phio               
= ls_phio
            error              
= lv_error.

        COMMIT WORK.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply