piersharding / RSAP

SAP NW RFC connector for R
21 stars 16 forks source link

forum for users of RSAP and more example code? #7

Open aspiringguru opened 6 years ago

aspiringguru commented 6 years ago

hi, this isn't really a normal git query, but asking for pointers to resources I was hoping to be out there.

I've been referring to https://www.rdocumentation.org/packages/RSAP/versions/0.9 and https://cran.r-project.org/web/packages/RSAP/RSAP.pdf

RSAP seems to be working on the project I've inherited, I need to extend the project and navigating queries on an existing SAP system has been difficult.

This next question is more of a SAP question, but hoping others have solved it.

Not a bug. But hoping commets will shed light or point me in right direction.

rpremraj commented 6 years ago

Here you'll find some important system tables and others: http://www.system-overload.org/sap/tables.html

DD02L/T/V and DD03L/T should get you what you need.

piersharding commented 6 years ago

A good place to start are the tests - https://github.com/piersharding/RSAP/tree/master/tests . These should help with basic usage. Assuming that these functions still exist you can use them to query individual RFC functions: RFC_GET_FUNCTION_INTERFACE_P, RFC_GET_STRUCTURE_DEFINITION_P.

aspiringguru commented 6 years ago

I'll admit I'm still stumped on how to explore as described. Will close this issue as it is broader than I need at the moment. Will try as described and refine my request to my immediate need.

side note: I'm surprised this package hasn't attracted more attention and use case examples.

wesnm commented 6 years ago

If you want the table description, pass the NO_DATA argument to the RFC_READ_TABLE method. The RSAPReadTable function doesn't support this, but you can invoke it directly, e.g. RSAPInvoke(con, 'RFC_READ_TABLE', list(QUERY_TABLE=table, NO_DATA='Y')). The result will have a data.frame of fields, types, length, and field names. Some parameters will need to be zero-padded on the left, so you'll want to test. The stringi function stri_pad_left is useful for this.

If you are using RFC_READ_TABLE with a long option argument (WHERE clause), you'll need to break it up into a list of strings less than 72 characters in length. I've been using stringi::stri_wrap to accomplish this: options <- stringi::stri_wrap(options, width=70)

One tip -- when you need to pass a table as a parameter, it needs to be a named list of lists, e.g RSAPInvoke(con, method, list(SALES_DOCUMENTS=list(VBELN=list("0000123456"))))

I have found https://www.sapdatasheet.org to be immensely valuable.