Bloomberg API: Accessing fields for symbol containing fractions - bloomberg

I am using Bloomberg API C# library, version 3.8.10.1.
I am wondering, what is the rule for formatting/escaping fractions in symbol names?
Instruments service (//blp/instruments) returns symbols like RIOLN 3<3/4> 03/22/2022<corp>, however, querying reference service (//blp/refdata) or market data service (//blp/mktdata) with:
RIOLN 3¾ 06/15/2025 Corp, RIOLN 3<3/4> 06/15/2025 Corp, RIOLN 3 3/4 06/15/2025 Corp gets me Unknown/Invalid security [nid:810] error.
Namely, any modification of such symbol I can think of, gets me this error. Are there any rules for proper formatting of those symbol name fractions?

You can use the "ASCII" ticker: EJ101044 Corp.
You can find it on a terminal by loading the bond and typing FLDS PARSE.
Or you can use a different identifier (such as CUSIP or Bloomberg Unique ID).

Related

What are the symbols used in Binance's dapi (coin futures api)?

I am trying to download historical price data of BTC/USD perpetual futures using binance's api for coin futures, specifically, I'd like to use this endpoint. However, I cannot find what 'symbol' I have to specify for BTC/USD. I've tried multiple variations to no avail (such as BTCUSD, BTCUSD_perpetual, etc. I constantly get the error: "Invalid symbol."
If anyone is interested, I found out that you can get a list of all symbols using: GET /dapi/v1/exchangeInfo​. The BTC/USD perpetual futures one is: BTCUSD_PERP.
The solution above is for coin futures, so in case anyone needs it for the other futures like BTCUSDTPERP, what worked for me was changing to the futures function: client.futures_create_order(symbol=symbol, side=side, type=order_type, quantity=quantity) and using "BTCUSDT".
More info here https://python-binance.readthedocs.io/en/latest/binance.html

How to read ABAP code using a java client

I have a requirement were I need to read ABAP code written by SAP developers. I want to write my own client using Java/Python which can integrate with SAP system and get me the ABAP code.
What I understand that ABAP code is stored in SAP database like HANA, mysql etc. So is there a way which SAP provides where we can read the code like we can do in Git/SVN etc.
I've used RFC calls RPY_FUNCTIONMODULE_READ and RPY_FUNCTIONMODULE_READ_NEW through the perl NWRFC wrapper/library to retreive ABAP code.
You can access tables with below techniques:
Using SAP Connectors via RFC (RFC_READ_TABLE)
Using SOAP Web Service with same function (RFC_READ_TABLE)
Using custom web services with existing functions which are reading report, functions, etc.
You can use both Java or Pyhton for RFC, there is already exits github repo for python.
If you will select reading directly in db table, you need to know structure of saved data. It has own mechanism for OOP objects. Daniel Berlin try to implement binary parser in C++ in sap-reposrc-decompressor project. Never forget this source depended with SAP version.
I think using ADT (ABAP Development Tools) plugin is good for updated systems. There is already Eclipse plugin exists for ADT. ADT not exists in old systems.
If you are planning to use your solution in old system (after 7.01), you can build your own solution with abapGit and custom web services.
NOTE: Keep in mind, report and data elements (variables, tables, types) saved in separate tables. Dynpro objects (screens etc), reports (Smartforms) hard things to decompile.
Before you re-invent a wheel, Take a look at:
ABAPgit. https://docs.abapgit.org/
or the old SAPLink https://wiki.scn.sap.com/wiki/display/ABAP/SAPlink.
If you want JUST the source code, You could expose a very simple rest service/ Endpoint in SAP.
This service would just read the raw code and return it as plain text.
Every abaper could create this for you.
BUT is the raw source only. There is much more to a complete development
and why tools like ABAPGIT exist.
In SICF, create a new endpoint / service.
EG ZCODE_MONKEY with the class below as an example.
Now activate the service.
Call the endpoint
http://server:PORT/zcode_monkey?name=ZCODE_MONKEY
Sample implementation
CLASS zcode_monkey DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES: if_http_extension.
ENDCLASS.
CLASS zcode_monkey IMPLEMENTATION.
METHOD if_http_extension~handle_request.
DATA: lo_src type ref to CL_OO_SOURCE,
l_name TYPE string,
l_repname type c length 30,
l_clskey type seoclskey ,
l_source type rswsourcet,
resultcode TYPE string.
FIELD-SYMBOLS: <line> TYPE LINE OF rswsourcet.
l_name = server->request->get_form_field( name = 'NAME' ).
l_clskey = l_name.
l_repname = l_name.
create OBJECT lo_src
EXPORTING
clskey = l_clskey
EXCEPTIONS
class_not_existing = 1
others = 2 .
IF sy-subrc <> 0.
read REPORT l_repname into l_source.
else.
lo_src->read( ).
lo_src->if_oo_clif_source~get_source( IMPORTING source = l_source ).
ENDIF.
LOOP AT l_source ASSIGNING <line>.
CONCATENATE resultCode
cl_abap_char_utilities=>cr_lf
<line>
INTO resultCode RESPECTING BLANKS. " always show respect ;)
ENDLOOP.
SErver->response->set_content_type( content_type = 'text/plain' ).
server->response->set_cdata( EXPORTING data = resultcode ).
server->response->set_status(
EXPORTING
code = 200
reason = 'this is a 3.50 piece of code. Dont ask...its a demo ' ).
ENDMETHOD.
ENDCLASS.

Get stacktrace of errors from PyRFC call?

Up to now I get only an error message if something inside my SAP RFC function is wrong
pyrfc._exception.ABAPRuntimeError: RFC_ABAP_MESSAGE (rc=4): key=No authorization,
message=No authorization [MSG: class=00, type=E, number=001, v1-4:=No authorization;;;]
It would increase the development speed a lot if I could get a stacktrace of ABAP function. Is there a way to get a stacktrace like for example in Python?
Related: https://softwarerecs.stackexchange.com/questions/52350/sentry-event-from-exception-to-html
Sentry uses a particular JSON to represent a stacktrace and the content of the local variables. Above link contains an example.
Stack trace inside ABAP can be called
with the class cl_abap_get_call_stack.
Local variables are not included in the stack trace returned by the class cl_abap_get_call_stack.
But you could use a log-point to monitor local variables and the stack trace. Log-points can be created, changed and viewed in transaction saab.
A example code snippet:
DATA(formatted_stack) =
cl_abap_get_call_stack=>format_call_stack_with_struct(
cl_abap_get_call_stack=>get_call_stack( ) ).
LOG-POINT ID my_log_point FIELDS formatted_stack
local_variable1 local_variable2.
For the authorization-error, please check transaction su53.
When you see the red authorization-object S_RFC, it means you are not allowed to call the function module in any way!
With ABAP 753 release there was introduced such structure as EPP - Extended Passport.
It seems to be doing something that you want, i.e. showing trace of the called system. I put "seems to be" because I have no 753+ system by my hands so I cannot check in practice.
From the description it should do what you want:
An Extended Passport (EPP) is a data structure that can be sent from a client to a server and is used to analyze call stacks
Extended Passport can be used by frameworks and analysis tools to track external call stacks in communication between clients and servers beyond system boundaries. The values of the EPP components can be saved to log files and used for monitoring. One example of this are short dumps, which all display the most important EPP components.
The DEMO_EPP gives the following usage pattern of EPP:
cl_demo_epp=>init( ).
"this program
cl_demo_epp=>append( ).
"Calling RFC to remote instance
CALL FUNCTION 'DEMO_RFM_EPP_1' DESTINATION instance.
"New SAP LUW
CALL FUNCTION 'DEMO_UPDATE_DELETE' IN UPDATE TASK
EXPORTING
values = VALUE demo_update_tab( ).
COMMIT WORK.
cl_demo_epp=>append( ).
cl_demo_output=>new(
)->begin_section( `Extended Passport (EPP)`
)->display( name = 'EPP Trace'
data = cl_demo_epp=>get( ) ).

GDB Api lookup_symbol does not get symbol address

This is a question about changing GDB code to add my own CLI to it.
I'm using lookup_symbol("XYZ", ...) to find a global system address in my coredump. The API succeeds - i.e, gets the symbol data struct with symbol name, but no address.
'print XYZ' works fine!
What can I change to get the symbol address correctly.

SAP patch SAPK-XXXXX* kind

I know that:
SAP_ABA -> SAPKA?????
SAP_APPL -> SAPKH?????
SAP_BASIS-> SAPKB?????
SAP_BW -> SAPKW?????
SAP_HR -> SAPKE?????
SAP_CRM -> SAPKU?????
But I don't know what SAPK-XXXXX* is. It is often applied to different components. Anybody can talk about this patch?
These package files are created using the so-called Add-On Assembly Kit (AAK). SAPK is something like the designation of the originating system (think of your normal transports, starting with K - btw, this is one of the reasons that a SID may never be "SAP", this would cause collisions here). The dash following the SAPK designates an AAK package. This is followed by a version indicator and/or a package type and/or the short package name.