on 07-04-2016 2:10 PM
Hi everybody !
I'm trying to get some results reports on RESTFUL BI4 by VBA 2010 with WinHttpRequest object. Some reports are ok, some are not (just got header result)... trying with 600 sec on timout, same result.
My access on webservices are ok.
Status response is ok (200)
Here my code for document refresh :
------------------------------------------
Public Function Refresh_Rep(ByVal Lng_IdDoc As Long, Optional ByVal Str_XML_Parameters As String, _
Optional ByVal Lng_Timeout As Long = 15, _
Optional ByVal Enm_MyLanguage As Enm_Language) As Boolean
With Obj_AppBO
.Open "PUT", Str_MyUrl & "/raylight/v1/documents/" & Lng_IdDoc & "/parameters?lovinfo=false", True
.SetRequestHeader "X-SAP-LogonToken", """" + Str_MyToken + """"
.SetRequestHeader "Content-Type", "application/xml"
.SetRequestHeader "Accept", "application/xml"
Select Case Enm_MyLanguage
Case 0
.SetRequestHeader "Accept-Language", "fr_FR"
Case 1
.SetRequestHeader "Accept-Language", "en-US"
End Select
If Str_XML_Parameters = "" Then
.Send ("<parameters>" _
& "</parameters>")
Else
.Send (Str_XML_Parameters)
End If
.WaitForResponse Lng_Timeout
End With
Refresh_Rep = True
End Function
------------------------------------------
Here my code to get reports result :
------------------------------------------
Public Function Get_Result_Rapport(ByVal Lng_IdDoc As Long, Optional ByVal Lng_IdRep As Long = 1, _
Optional ByVal Lng_Timeout As Long = 15) As String
With Obj_AppBO
.Open "GET", Str_MyUrl & "/raylight/v1/documents/" & Lng_IdDoc & "/reports/" & Lng_IdRep, True
.SetRequestHeader "X-SAP-LogonToken", """" + Str_MyToken + """"
.SetRequestHeader "Accept", "text/csv; charset=""UTF-8"""
.SetRequestHeader "Content-Type", "text/xml"
.SetRequestHeader "Accept-Language", "en-US"
.Send
.WaitForResponse Lng_Timeout
Get_Result_Rapport = .ResponseText
End With
End Function
------------------------------------------
I hope my speech is understandable ... I don't practice enough English ...
My bad, last report has change during new process (BO XIR2 > BI4) a different parameter ...
So to use report in French, we need 2 headers :
.SetRequestHeader "Accept-Language", "fr_FR"
.SetRequestHeader "X-SAP-PVL", "fr-FR"
Have a nice day guys !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel, Bonjour Anthony,
I found a solution for almost reports :
When I use this command <.SetRequestHeader "Accept-Language", "fr_FR"> I need to add this one : <.SetRequestHeader "X-SAP-PVL", "fr-FR"> else no data in result.
I checked reports : parameters & data is ok.
One report still answer without data in French. I'll test modifing Get_Result_Rapport to add localization.
Thanks for helping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great Stéphane,
Basically, "Accept-Language" is for message localization when you're using the API.
"X-SAP-PVL" is to specify in which language the document must be opened. It is very important to keep the same value in all your requests because if you changed of value ('fr' to 'en' for instance), the document will be opened in the new locale. That can cause unpredictable behavior if it is not used with a lot of cautiouness.
Regards,
Anthony
PS : if the issue is resolved, please mark this topic as closed
Bonjour Stéphane,
As Dan, I guess some of your reports may be simply empty (no data inside). Or maybe some documents required some prompts to be filled to collect data?
Try to open such reports using BI Launch Pad and trigger a refresh operation to check the behavior.
Best regards,
Anthony
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stephane,
My first guess is the parameters passed to the report are resulting in no data returned.
Can you verify that the parameters passed, when no data is returned, actually do return data in BI Launchpad for that particular report tab?
I doubt that its related to the Accept-Language, but just to be sure, is there any pattern to the issue if you use fr_FR? I see that you only accept "en-US" when exporting to CSV. I'm not sure if this would affect localization of some specific parameter types.
Dan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.