Wednesday, June 5, 2013

Consume Web Service in ABAP Stack

During SAP Development along with other system, we need to communicate with other system.
We will focus on one communication type which is web service.

Here is my experience in achieving web service communication.

  1. Create ABAP Proxy. In order for ABAP Stack to consume web service, you will need to generate proxy in ABAP stack. Please go to transaction code se80. As per screen shot, please right click on the Enterprise Service -> choose create














  2. Create Logical Port. Please go to transaction SOAMANAGER. Please follow the screen shot below to create logical port. Please do Ping Web Service after that to see whether web service can be called.






















  3. Test your web service consumer. Go back to transaction code se80. Please open your service consumer. Press Execute as per screen shot below:









  4. Consume in ABAP Function Module. Please see coding below:


    FUNCTION zkrb_test02.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *" IMPORTING
    *" VALUE(I_INPUT) TYPE CHAR10 DEFAULT 'kris'
    *" EXPORTING
    *" VALUE(I_OUTPUT) TYPE CHAR10
    *"----------------------------------------------------------------------

    DATA: o_proxy TYPE REF TO zsc_co_zkrb_test01.
    DATA: port_name TYPE prx_logical_port_name.
    DATA: wa_input TYPE zsc_zkrb_test01,
    wa_output TYPE zsc_zkrb_test01response.

    CLEAR: port_name, wa_input, wa_output.

    port_name = 'LP_KRB_TEST01'. "Based on Logical Port we created in soamanager



    TRY.
    CREATE OBJECT o_proxy
    EXPORTING
    logical_port_name = port_name.
    CATCH cx_ai_system_fault .
    ENDTRY.

    * Populate data
    wa_input-i_input = i_input.

    TRY.
    CALL METHOD o_proxy->zkrb_test01
    EXPORTING
    input = wa_input
    IMPORTING
    output = wa_output.
    CATCH cx_ai_system_fault .
    CATCH cx_ai_application_fault .
    ENDTRY.



    i_output = wa_output-e_output.

    ENDFUNCTION.


Notes:
This is in SAP ECC 6.0. You may refer to consume web service in abap stack in other lower version in below website:
http://www.sapdev.co.uk/sap-webapps/sap-webservices/ws_abapproxy.htm

Thursday, May 2, 2013

Authorization of Business Explorer Query in Business Object Web Intelligence


Recently, I have faced problem in authorization in Web Intelligence report using Business Explorer (Bex) Query.

Thanks to my friend (AT) for the help and solution. I would like to blog it for benefit of everybody.

Here is the story.

1. Bex query has been developed with characteristic restriction (Country: zctry)



2. Analysis authorization has been maintained based on country. (transaction code: RSECADMIN)
We would like to restrict user information based on country.




3. In SAP BW/BI, we create one role and assign to one user. (Transaction code: PFCG)
This role will contain BI analysis authorization with value 'ZCTRY'.



4. In SAP BW/BI, we are able to run it based on user with certain country authorization. (transaction code: RSRT)



The problem was occurred when it is in Business Object Web Intelligence (WebI). WebI report shows all the countries information.
After we explore more.

The issues were:
1. New user is logon using Enterprise authentification



2. It was wrong Setup of OLAP connection. It should be "SSO" instead of Prompt / Predefined Authentication.







Beside those issue, please don't forget to maintain below objects in Business Object CMC (Central Management Console) :
1. authentication: please use sap_all profile user to get sap roles









2. user and groups

Please assigned the new adapted role from BW to the user in Business Object.





Business Object WebI will show the same result of information as in SAP BW/BI with same user: