none
SAP Data binding error RRS feed

  • Question

  •  

    My code is

    ..............

    SAPBinding binding = new SAPBinding();

    binding.ReceiveTimeout = TimeSpan.MaxValue;

    binding.SendTimeout = TimeSpan.MaxValue;

    //set up an endpoint address

    EndpointAddress address = new EndpointAddress("sap://CLIENT=800;LANG=EN;@Aserver/00");

    try

    {

    ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(binding, address);

    // add credentials

    factory.Credentials.UserName.UserName = "ssss";

    factory.Credentials.UserName.Password = "88888";

    // Open client

    factory.Open();

     

    //get a channel from the factory

    IRequestChannel irc = factory.CreateChannel();

    //open the channel

    irc.Open();

    //create an XML message to send to the SAP system

    //We are performing the SD_RFC_CUSTOMER_GET operation.

    //The XML below specifies that we want to search for customers with names starting with "AB"

    string inputXml = "<RFC_READ_TABLE xmlns=\"http://Microsoft.LobServices.Sap/2007/03/Rfc/\"><DELIMITER></DELIMITER> <NO_DATA></NO_DATA> <QUERY_TABLE>K*</QUERY_TABLE> <ROWCOUNT>10</ROWCOUNT><ROWSKIPS>0</ROWSKIPS> <DATA></DATA> <FIELDS></FIELDS><OPTIONS></OPTIONS></RFC_READ_TABLE>";

    //create an XML reader from the input XML

    XmlReader reader = XmlReader.Create(new MemoryStream(Encoding.Default.GetBytes(inputXml)));

    //create a WCF message from our XML reader

    Message inputMessge = Message.CreateMessage(MessageVersion.Soap11, "http://Microsoft.LobServices.Sap/2007/03/Rfc/RFC_READ_TABLE", reader);

    //send the message to SAP and obtain a reply

    Message replyMessage = irc.Request(inputMessge);

    //create a new XML document

    XmlDocument doc = new XmlDocument();

    //load the XML document with the XML reader from the output message received from SAP

    doc.Load(replyMessage.GetReaderAtBodyContents());

    //write the output XML to a file C:\\out.xml

    doc.Save("D:\\WSDL\\readtab.xml");

    //close the channel

    irc.Close();

    //close the factory

    factory.Close();

    ........

    exception

    ............

    Details: ErrorCode=RFC_EXCEPTION. ErrorGroup=RFC_ERROR_APPLICATION_EXCEPTION. SapErrorMessage=TABLE_NOT_AVAILABLE. AdapterErrorMessage=Error returned by RfcCallReceiveEx while calling RFC: RFC_READ_TABLE..

    ..............

    i don't know how to pass the input XML with integer data type

    Any help is appreciated
    Monday, December 17, 2007 2:43 PM

Answers

  • I'm not sure if we can help you here, since your query is specific to a RFC in SAP. You would need to consult your SAP consultant, or go through the SAP documentation, in order to determine the appropriate parameters to be passed to the RFC_READ_TABLE RFC.

    Off the top of my head, I see that you are passing in K* as input to the QUERY_TABLE parameter in the RFC. I think you need to give the name of a specific table here - wild cards wont work. You might try using the XML below:

    string inputXml = "<RFC_READ_TABLE xmlns=\"http://Microsoft.LobServices.Sap/2007/03/Rfc/\"><QUERY_TABLE>BSEG</QUERY_TABLE> <ROWCOUNT>10</ROWCOUNT><DATA /></RFC_READ_TABLE>";


    The above XML will return the first 10 rows of the BSEG table.


    Monday, December 17, 2007 3:28 PM
  • Mustansir,

    You are right, if I give the complete name it works, thanks a lot

    .................

    ..................

    Thanks again, u've been a gr8 help.

    Taruna

    Tuesday, December 18, 2007 5:51 AM

All replies

  • I'm not sure if we can help you here, since your query is specific to a RFC in SAP. You would need to consult your SAP consultant, or go through the SAP documentation, in order to determine the appropriate parameters to be passed to the RFC_READ_TABLE RFC.

    Off the top of my head, I see that you are passing in K* as input to the QUERY_TABLE parameter in the RFC. I think you need to give the name of a specific table here - wild cards wont work. You might try using the XML below:

    string inputXml = "<RFC_READ_TABLE xmlns=\"http://Microsoft.LobServices.Sap/2007/03/Rfc/\"><QUERY_TABLE>BSEG</QUERY_TABLE> <ROWCOUNT>10</ROWCOUNT><DATA /></RFC_READ_TABLE>";


    The above XML will return the first 10 rows of the BSEG table.


    Monday, December 17, 2007 3:28 PM
  • Mustansir,

    You are right, if I give the complete name it works, thanks a lot

    .................

    ..................

    Thanks again, u've been a gr8 help.

    Taruna

    Tuesday, December 18, 2007 5:51 AM