0

we need to pass deep data structures from an external system to SAP using SSIS. Since my colleague tells me SSIS does not have any data types resembling ABAP structures or tables our first approach was to pass an XML file as string.

However then the problem arose that SSIS has a 5000 character limit on strings rendering this approach futile aswell.

He then suggested passing the xml string as type "Object" since there, no such restriction exists.

Unfortunately in ABAP it is not possible to parameterize an RFC Function Module with generic parameters from where I could try to do some casting. Furthermore the Object type cannot be passed to the importing string parameter of the FM and I don't know what dictionary data type corresponds to object, in fact I think there is none. Is there maybe a way around this?

A final approach I thought of was to split the string and call the fm multiple times storing the string each time. However, I'm told that splitting the string is also not possible in SSIS. I am somewhat doubtful that SSIS really has all that shortcomings since those sound more like basic functionality but what do I know... (in regard to SSIS, nothing at all)

Does anybody have an idea on how to pass the deep structure to ABAP SOAP Provider?

Cheers

Christian
  • 534
  • 4
  • 18
  • 1
    Why do you have to use SSIS? I see so many questions on here where people try to use SSIS for things it can't do very well. – Nick.Mc Jan 11 '21 at 13:08
  • Unfortunately I have no influence over the SSIS part. According to the client their subpar software can only export using SSIS so that's why... Can you confirm that SSIS in fact cannot do all the things the client claimes? (String splitting, data types) – Christian Jan 11 '21 at 13:30
  • Well, questions... How do you plan to integrate with SAP - by calling RFC or by importing data packages with SAP XI/PI? IDOCs, or something else? Here is a [short review of SSIS capabilities connecting SAP](https://social.technet.microsoft.com/wiki/contents/articles/1958.ssis-with-sap-connectors.aspx). – Ferdipux Jan 11 '21 at 14:39
  • it is very easy to do this using .NET and if you have to use SSIS you can use a script component. How are you uploading the XML? via webservice? – KeithL Jan 11 '21 at 16:03
  • @Ferdipux Calling RFC of the SOAP Provider FM – Christian Jan 11 '21 at 16:04
  • @KeithL Via Soap Webservice. Can you elaborate on the script component? – Christian Jan 11 '21 at 16:04
  • There is only SSIS that limits you in length, I see no problem in passing XML as string and process it on the ABAP side ([max length is 2Gb](https://github.com/SAP/PyRFC/issues/97#issuecomment-489028373)). If you want, however, to use the XML in RFC params (*to map* XML elements to params), you need some sort of middleware – Suncatcher Jan 21 '21 at 13:38

1 Answers1

1

Using Script component to upload string in this case xml.

build the XML using sql as defined in this post:

https://www.sqlshack.com/for-xml-path-clause-in-sql-server/

How to execute that SQL and return into a string:

            string uploadSOAP = "";
            using (OleDbConnection conn = new OleDbConnection([your conn string]))
            {
                string sql = [your XML SQL query];
                using (OleDbCommand cmd = new OleDbCommand(sql, conn))
                {
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    uploadSOAP = (string) cmd.ExecuteScaler();
                }
            }

Now how to upload that string:

WebClient wc = new WebClient();
//wc.Credentials = new NetworkCredential([username],[password]);
wc.UploadString([url to upload to],uploadSOAP);

Namespaces to add (in the using section):

System.Data.OleDb;
System.Net;

Notes:

  1. ExecuteScalar() returns the value from 1st row and 1st column in the case of for XML path is your entire xml string
  2. string data type really doesn't have a limit in c#. I've seen some places that it is 2GB of data. You can convert to a stream if you are getting larger than that and then use uploadData.
  3. I will insert a commented out code for adding credentials.
KeithL
  • 5,348
  • 3
  • 19
  • 25
  • Thank you Keith! Is the upload string not restricted to 5000 chars? – Christian Jan 11 '21 at 16:36
  • 1
    No limit: https://stackoverflow.com/questions/46446081/maximum-data-length-for-webclient-uploadstring-method#:~:text=The%20only%20theoretical%20limit%20is,to%20be%20limited%20before%20that. – KeithL Jan 11 '21 at 16:43
  • 2
    you are really just using SSIS as a wrapper here. Everything is done in c# which has different data types than SSIS – KeithL Jan 11 '21 at 16:44