huysentruitw / SapNwRfc

SAP NetWeaver RFC library for .NET 5, .NET Core and .NET Framework
MIT License
149 stars 43 forks source link

Unable to Read JOB Spool using RFC - BAPI_XBP_GET_SPOOL_AS_DAT #86

Closed Kalyan7829 closed 1 year ago

Kalyan7829 commented 1 year ago

Hello Team,

I have a requirement where i need to read the spool logs after executing the SAP job using RFC.

However I am getting the exception as below image

C# code -

Export Parameters image

Import Paramaters

image

Really not sure what datatype to be used to get the logs for the export parameter - SPOOL_LIST.

can you pls help me with this?

Thanks in Advance!

tom-j-irvine commented 1 year ago

You need to look at this part of the documentation: https://github.com/huysentruitw/SapNwRfc#define-models-with-a-nested-table

In your function, the SPOOL_LIST is a table

Your import parameters look okay. For export, assuming your SAPReturnBAPI class is defined correctly, that also looks okay.

For the SPOOL_LIST, I would do something like this (a similar question was answered here: https://github.com/huysentruitw/SapNwRfc/issues/58)

public class SapJobDatSpoolExportParameters
{
    [SapName("SPOOL_LIST")]
    public SapSpoolListItem[] SpoolList { get; set; ) }
}

public class SapSpoolListItem
{
    [SapName("")]
    public string Value { get; set; }
}
Kalyan7829 commented 1 year ago

@tom-j-irvine ,

Firstly Thankyou for the quick response.

The Solution you provided is working as per the requirement.