<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Function over RFC Call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790966#M40036</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to allocate space for the parameter value to be received into, on exporting[0].addr:&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting[0].addr = malloc(&amp;lt;parm len&amp;gt; + 1);&lt;/P&gt;&lt;P&gt;memset(exporting[0].addr,0, &amp;lt;parm len&amp;gt; + 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Aug 2004 17:09:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2004-08-16T17:09:15Z</dc:date>
    <item>
      <title>Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790965#M40035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I try to call an Function in SAP over a RFC Call in C++.&lt;/P&gt;&lt;P&gt;I established a connection via RFC and can send the call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my request:&lt;/P&gt;&lt;P&gt;rfc_rc = RfcCall( handle, cha_prog,exporting, tables);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function i called in SAP requires an importing parameter. So tried to put the format into the exporting parameter but i don`t know how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My field definition in SAP is:&lt;/P&gt;&lt;P&gt;Parametername: I_IM_ID&lt;/P&gt;&lt;P&gt;TYPE: CHAR(4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do i call the RFC correctly with an exporting paramter?&lt;/P&gt;&lt;P&gt;I tried the follwing code&lt;/P&gt;&lt;P&gt;exporting[0].name = "I_IM_ID";&lt;/P&gt;&lt;P&gt;exporting[0].nlen = 7;&lt;/P&gt;&lt;P&gt;exporting[0].type = RFCTYPE_CHAR;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it doesn`t work.&lt;/P&gt;&lt;P&gt;Where have my value stand, which i want to export to the function?  &lt;/P&gt;&lt;P&gt;Is it the "exporting[0].addr" field?&lt;/P&gt;&lt;P&gt;The value i want to export is put in a CString variable called cst_over;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone post the correctly code for an correct RFC call?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don`t know, if this is the right forum, if not i am sorry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetz&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Aug 2004 13:06:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790965#M40035</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2004-08-16T13:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790966#M40036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to allocate space for the parameter value to be received into, on exporting[0].addr:&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting[0].addr = malloc(&amp;lt;parm len&amp;gt; + 1);&lt;/P&gt;&lt;P&gt;memset(exporting[0].addr,0, &amp;lt;parm len&amp;gt; + 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Aug 2004 17:09:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790966#M40036</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-08-16T17:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790967#M40037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi thanks,&lt;/P&gt;&lt;P&gt;and in which parameter is the value itself set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The length of my parameter i want to export is always 4 &lt;/P&gt;&lt;P&gt;so the coding have to look like&lt;/P&gt;&lt;P&gt;exporting[0].addr = malloc(4);&lt;/P&gt;&lt;P&gt;memset(exporting[0].addr,0, 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is missed?&lt;/P&gt;&lt;P&gt;Perhaps you can post an correctly RFC Call Coding? &lt;/P&gt;&lt;P&gt;With my parameters.&lt;/P&gt;&lt;P&gt;I am looking forward to your answer thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetz&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 06:48:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790967#M40037</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2004-08-17T06:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790968#M40038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you go into SE37 and display the source code of your RFC, and cut-n-paste the comment section at the top that describes the interface of the Function Module, into your next post on the Forum.  Then I'll code up the interface for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Piers Harding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 07:19:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790968#M40038</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-08-17T07:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790969#M40039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks, hereis the header code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION /YOWN/RFDEL.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Globale Schnittstelle:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(I_RACKID) TYPE  /BROSE/TRACK-RACKID &lt;/P&gt;&lt;P&gt;*"     VALUE(I_BZEIT) TYPE  /BROSE/TRACK-BZEIT OPTIONAL&lt;/P&gt;&lt;P&gt;*"     VALUE(I_DATUM) TYPE  /BROSE/TRACK-DATUM OPTIONAL&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Parameter i want to export is the I_RACKID, he is from TYPE CHAR(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 07:39:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790969#M40039</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2004-08-17T07:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790970#M40040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I get it. You need to set the value of the parameter = exporting from your client point of view - not the RFCs point of view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting[0].name = malloc(8);&lt;/P&gt;&lt;P&gt;memcpy(exporting[0].name,"I_RACKID", 8);&lt;/P&gt;&lt;P&gt;exporting[0].nlen = 8;&lt;/P&gt;&lt;P&gt;exporting[0].type = RFCTYPE_CHAR;&lt;/P&gt;&lt;P&gt;exporting[0].leng = 4;&lt;/P&gt;&lt;P&gt;exporting[0].addr = malloc(5);&lt;/P&gt;&lt;P&gt;memset(5,0,exporting[0].addr);&lt;/P&gt;&lt;P&gt;sprintf(exporting[0].addr, "%s", some_cpp_value.c_str());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are responsible for managing your own memory in RFC calls, except for when dealing with tables, so you need to   allocate and free it as appropriate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Piers Harding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 08:00:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790970#M40040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-08-17T08:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790971#M40041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piers,&lt;/P&gt;&lt;P&gt;all works instead of one coding line &lt;/P&gt;&lt;P&gt;"sprintf(exporting[0].addr, "%s", some_cpp_value.c_str());"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so it looks by me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting[0].name = malloc(8);&lt;/P&gt;&lt;P&gt;memcpy(exporting[0].name,"I_RACKID", 8);&lt;/P&gt;&lt;P&gt;exporting[0].nlen = 8;&lt;/P&gt;&lt;P&gt;exporting[0].type = RFCTYPE_CHAR;&lt;/P&gt;&lt;P&gt;exporting[0].leng = 4;&lt;/P&gt;&lt;P&gt;exporting[0].addr = malloc(5);&lt;/P&gt;&lt;P&gt;memset(exporting[0].addr,0,5);&lt;/P&gt;&lt;P&gt;sprintf(exporting[0].addr, "%d", value-&amp;gt;get_racid());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value i want to export is returned by the method value-&amp;gt;get_racid() .. it is an integer value with 4 places..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i want to compile my programm follwing error message gets out:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;error C2664: 'sprintf' : Convert the Parameters 1 from 'void *' into 'char *' not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is wrong, what have i to do?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 08:42:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790971#M40041</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2004-08-17T08:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790972#M40042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK.  Well if you are using an integer (this assumes that value-&amp;gt;get_racid() returns an integer) to write to your char(4), then you should do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* casting everything to be sure */&lt;/P&gt;&lt;P&gt;sprintf((char *) exporting[0].addr, "%04d", (int) value-&amp;gt;get_racid());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Piers Harding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 09:04:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790972#M40042</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-08-17T09:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790973#M40043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piers,&lt;/P&gt;&lt;P&gt;i can now compile it but if i run the programm.&lt;/P&gt;&lt;P&gt;The command &lt;/P&gt;&lt;P&gt;"rfc_rc = RfcCall( handle, cha_prog,export,tables);"&lt;/P&gt;&lt;P&gt;aborts with the follwing error code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"RFC_INVALID_PARAMETER"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;greetz stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Stefan Köhler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Stefan Köhler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 10:07:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790973#M40043</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2004-08-17T10:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Function over RFC Call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790974#M40044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For all here is a code that works.&lt;/P&gt;&lt;P&gt;The error was that i dont send the "exporting[1].name = (char *)0;" value which shows that this is the last export parameter....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here a full working coding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exporting[0].name = malloc(8);&lt;/P&gt;&lt;P&gt;memcpy(exporting[0].name,"I_RACKID", 8);&lt;/P&gt;&lt;P&gt;exporting[0].nlen = 8;&lt;/P&gt;&lt;P&gt;exporting[0].type = RFCTYPE_NUM;&lt;/P&gt;&lt;P&gt;exporting[0].leng = 4;&lt;/P&gt;&lt;P&gt;exporting[0].addr = malloc(5);&lt;/P&gt;&lt;P&gt;memset(exporting[0].addr,0,5);&lt;/P&gt;&lt;P&gt;int_racid = value-&amp;gt;get_racid();&lt;/P&gt;&lt;P&gt;sprintf((char *) exporting[0].addr, "%04d", int_racid);&lt;/P&gt;&lt;P&gt;exporting[1].name = (char *)0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2004 10:49:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-over-rfc-call/m-p/790974#M40044</guid>
      <dc:creator>stefan_koehler</dc:creator>
      <dc:date>2004-08-17T10:49:19Z</dc:date>
    </item>
  </channel>
</rss>

