Calling a Function in SAP

I'm calling a Transaction form my Function module like
CALL TRANSACTION 'ZLVSCRAP' USING i_bdcdata
MODE v_mode
UPDATE c_s
MESSAGES INTO i_messages.
But when I’m in the PGM, i can not do commits, because it jumps back into my Function, and dose not finish the rest of the logic in the called pgm? And with me doing commits it thinks i have hold on orders that were created in the called pgm which also hangs me up?
Please help?????

Hi ,
i did use your idea but when i excute the statment in the v_mode "a" it works fine but when i set it back to "N" mode it give me 1001 error in the message which its telling me that ther is  00 344 No batch input data for screen & &
DATA: ctu_params_tmp LIKE ctu_params.
CLEAR: ctu_params_tmp.
ctu_params_tmp-dismode = v_mode.
ctu_params_tmp-updmode = c_s.
ctu_params_tmp-defsize = 'X'.
ctu_params_tmp-racommit = 'X'.
  CALL TRANSACTION 'ZLVSCRAP' USING i_bdcdata
  OPTIONS FROM ctu_params_tmp
   MESSAGES INTO i_messages.

Similar Messages

  • Calling php functions from sap

    hi all,
       I have to call the php functions from the r/3. my requirement is that I have to read the mail from the internet adress([email protected]) through php and then send its content in r/3.For that I have to write function in php which are rfc enabled and then call those function in r/3. Can anyone help me in calling the php function from r/3 and how to get the content of mail in r/3.I have to create php as a server and r/3 as client.
    regards
    ashish

    hi Anton,
    I have get have to read the read the internert mail in php hrough this class . I am sending you that code test_pop3.php. For this you even need pop3 class. I am  even sending you that code.It will be better if you give me your mail id. But I donot know how to create a rfc enabled function in php that can be read in r/3 .
    <?php
    test_pop3.php
    @(#) $Header: /home/mlemos/cvsroot/pop3/test_pop3.php,v 1.6 2005/10/18 17:44:46 mlemos Exp $
    ?><HTML>
    <HEAD>
    <TITLE>Read email attachments from pop3 server</TITLE>
    </HEAD>
    <BODY>
    <?php
         require("pop3.php");
      /* Uncomment when using SASL authentication mechanisms */
         require("sasl.php");
         $pop3=new pop3_class;
         $pop3->hostname="";             /* POP 3 server host name                      */
         $pop3->port=110;                         /* POP 3 server host port                      */
         $user="";          /* Authentication user name                    */
         $password="";                    /* Authentication password                     */
         $pop3->realm="";                         /* Authentication realm or domain              */
         $pop3->workstation="";                   /* Workstation for NTLM authentication         */
         $apop=0;                                 /* Use APOP authentication                     */
         $pop3->authentication_mechanism="USER";  /* SASL authentication mechanism               */
         $pop3->debug=0;                          /* Output debug information                    */
         $pop3->html_debug=0;                     /* Debug information is in HTML                */
         $pop3->join_continuation_header_lines=1; /* Concatenate headers split in multiple lines */
         if(($error=$pop3->Open())=="")
              echo "<PRE>Connected to the POP3 server "".$pop3->hostname."".</PRE>\n";
              if(($error=$pop3->Login($user,$password,$apop))=="")
                   echo "<PRE>User "$user" logged in.</PRE>\n";
                   if(($error=$pop3->Statistics($messages,$size))=="")
                        echo "<PRE>There are $messages messages in the mail box with a total of $size bytes.</PRE>\n";
                        $result=$pop3->ListMessages("",0);
                        if(GetType($result)=="array")
                             for(Reset($result),$message=0;$message<count($result);Next($result),$message++)
                                  echo "<PRE>Message ",Key($result)," - ",$result[Key($result)]," bytes.</PRE>\n";
                             $result=$pop3->ListMessages("",1);
                             if(GetType($result)=="array")
                                  for(Reset($result),$message=0;$message<count($result);Next($result),$message++)
                                       echo "<PRE>Message ",Key($result),", Unique ID - \"",$result[Key($result)],"\"</PRE>\n";
                                  if($messages>0)
                                            $var = 1;     
                                       if(($error=$pop3->RetrieveMessage($var,$headers,$body,-1))=="")
                                            for($line=0;$line<count($headers);$line++)
                                       if(($error=$pop3->RetrieveMessage(34,$headers,$body,-1))=="")
                                            echo "<PRE>Message 1:\n-Message headers starts below-</PRE>\n";
                                            for($line=0;$line<count($headers);$line++)
                                                 echo "<PRE>",HtmlSpecialChars($headers[$line]),"</PRE>\n";
                                                 echo "<PRE>-Message headers ends above-\n-Message body starts below-</PRE>\n";
                                            for($line=0;$line<count($body);$line++)
                                                 echo "<PRE>",HtmlSpecialChars($body[$line]),"</PRE>\n";
                                            echo "<PRE>-Message body ends above-</PRE>\n";
                                            if(($error=$pop3->DeleteMessage(1))=="")
                                                 echo "<PRE>Marked message 1 for deletion.</PRE>\n";
                                                 if(($error=$pop3->ResetDeletedMessages())=="")
                                                      echo "<PRE>Resetted the list of messages to be deleted.</PRE>\n";
                                  if($error==""
                                  && ($error=$pop3->Close())=="")
                                       echo "<PRE>Disconnected from the POP3 server "".$pop3->hostname."".</PRE>\n";
                             else
                                  $error=$result;
                        else
                             $error=$result;
         if($error!="")
              echo "<H2>Error: ",HtmlSpecialChars($error),"</H2>";
    ?>
    </BODY>
    </HTML>
    *******start of new php file********
    <?php
    pop3.php
    @(#) $Header: /home/mlemos/cvsroot/pop3/pop3.php,v 1.15 2005/10/18 17:43:25 mlemos Exp $
    class pop3_class
         var $hostname="";
         var $port=110;
         var $quit_handshake=0;
         var $error="";
         var $authentication_mechanism="USER";
         var $realm="";
         var $workstation="";
         var $join_continuation_header_lines=1;
         /* Private variables - DO NOT ACCESS */
         var $connection=0;
         var $state="DISCONNECTED";
         var $greeting="";
         var $must_update=0;
         var $debug=0;
         var $html_debug=0;
         var $next_token="";
         /* Private methods - DO NOT CALL */
         Function Tokenize($string,$separator="")
              if(!strcmp($separator,""))
                   $separator=$string;
                   $string=$this->next_token;
              for($character=0;$character<strlen($separator);$character++)
                   if(GetType($position=strpos($string,$separator[$character]))=="integer")
                        $found=(IsSet($found) ? min($found,$position) : $position);
              if(IsSet($found))
                   $this->next_token=substr($string,$found+1);
                   return(substr($string,0,$found));
              else
                   $this->next_token="";
                   return($string);
         Function SetError($error)
              return($this->error=$error);
         Function OutputDebug($message)
              $message.="\n";
              if($this->html_debug)
                   $message=str_replace("\n","<br />\n",HtmlEntities($message));
              echo $message;
              flush();
         Function GetLine()
              for($line="";;)
                   if(feof($this->connection))
                        return(0);
                   $line.=fgets($this->connection,100);
                   $length=strlen($line);
                   if($length>=2
                   && substr($line,$length-2,2)=="\r\n")
                        $line=substr($line,0,$length-2);
                        if($this->debug)
                             $this->OutputDebug("S $line");
                        return($line);
         Function PutLine($line)
              if($this->debug)
                   $this->OutputDebug("C $line");
              return(fputs($this->connection,"$line\r\n"));
         Function OpenConnection()
              if($this->hostname=="")
                   return($this->SetError("2 it was not specified a valid hostname"));
              if($this->debug)
                   $this->OutputDebug("Connecting to ".$this->hostname." ...");
              if(($this->connection=@fsockopen($this->hostname,$this->port,$error))==0)
                   switch($error)
                        case -3:
                             return($this->SetError("-3 socket could not be created"));
                        case -4:
                             return($this->SetError("-4 dns lookup on hostname \"$hostname\" failed"));
                        case -5:
                             return($this->SetError("-5 connection refused or timed out"));
                        case -6:
                             return($this->SetError("-6 fdopen() call failed"));
                        case -7:
                             return($this->SetError("-7 setvbuf() call failed"));
                        default:
                             return($this->SetError($error." could not connect to the host \"".$this->hostname."\""));
              return("");
         Function CloseConnection()
              if($this->debug)
                   $this->OutputDebug("Closing connection.");
              if($this->connection!=0)
                   fclose($this->connection);
                   $this->connection=0;
         /* Public methods */
         /* Open method - set the object variable $hostname to the POP3 server address. */
         Function Open()
              if($this->state!="DISCONNECTED")
                   return($this->SetError("1 a connection is already opened"));
              if(($error=$this->OpenConnection())!="")
                   return($error);
              $this->greeting=$this->GetLine();
              if(GetType($this->greeting)!="string"
              || $this->Tokenize($this->greeting," ")!="+OK")
                   $this->CloseConnection();
                   return($this->SetError("3 POP3 server greeting was not found"));
              $this->Tokenize("<");
              $this->must_update=0;
              $this->state="AUTHORIZATION";
              return("");
         /* Close method - this method must be called at least if there are any
         messages to be deleted */
         Function Close()
              if($this->state=="DISCONNECTED")
                   return($this->SetError("no connection was opened"));
              if($this->must_update
              || $this->quit_handshake)
                   if($this->PutLine("QUIT")==0)
                        return($this->SetError("Could not send the QUIT command"));
                   $response=$this->GetLine();
                   if(GetType($response)!="string")
                        return($this->SetError("Could not get quit command response"));
                   if($this->Tokenize($response," ")!="+OK")
                        return($this->SetError("Could not quit the connection: ".$this->Tokenize("\r\n")));
              $this->CloseConnection();
              $this->state="DISCONNECTED";
              return("");
         /* Login method - pass the user name and password of POP account.  Set
         $apop to 1 or 0 wether you want to login using APOP method or not.  */
         Function Login($user,$password,$apop=0)
              if($this->state!="AUTHORIZATION")
                   return($this->SetError("connection is not in AUTHORIZATION state"));
              if($apop)
                   if(!strcmp($this->greeting,""))
                        return($this->SetError("Server does not seem to support APOP authentication"));
                   if($this->PutLine("APOP $user ".md5("<".$this->greeting.">".$password))==0)
                        return($this->SetError("Could not send the APOP command"));
                   $response=$this->GetLine();
                   if(GetType($response)!="string")
                        return($this->SetError("Could not get APOP login command response"));
                   if($this->Tokenize($response," ")!="+OK")
                        return($this->SetError("APOP login failed: ".$this->Tokenize("\r\n")));
              else
                   $authenticated=0;
                   if(strcmp($this->authentication_mechanism,"USER")
                   && function_exists("class_exists")
                   && class_exists("sasl_client_class"))
                        if(strlen($this->authentication_mechanism))
                             $mechanisms=array($this->authentication_mechanism);
                        else
                             $mechanisms=array();
                             if($this->PutLine("CAPA")==0)
                                  return($this->SetError("Could not send the CAPA command"));
                             $response=$this->GetLine();
                             if(GetType($response)!="string")
                                  return($this->SetError("Could not get CAPA command response"));
                             if(!strcmp($this->Tokenize($response," "),"+OK"))
                                  for(;;)
                                       $response=$this->GetLine();
                                       if(GetType($response)!="string")
                                            return($this->SetError("Could not retrieve the supported authentication methods"));
                                       switch($this->Tokenize($response," "))
                                            case ".":
                                                 break 2;
                                            case "SASL":
                                                 for($method=1;strlen($mechanism=$this->Tokenize(" "));$method++)
                                                      $mechanisms[]=$mechanism;
                                                 break;
                        $sasl=new sasl_client_class;
                        $sasl->SetCredential("user",$user);
                        $sasl->SetCredential("password",$password);
                        if(strlen($this->realm))
                             $sasl->SetCredential("realm",$this->realm);
                        if(strlen($this->workstation))
                             $sasl->SetCredential("workstation",$this->workstation);
                        do
                             $status=$sasl->Start($mechanisms,$message,$interactions);
                        while($status==SASL_INTERACT);
                        switch($status)
                             case SASL_CONTINUE:
                                  break;
                             case SASL_NOMECH:
                                  if(strlen($this->authentication_mechanism))
                                       return($this->SetError("authenticated mechanism ".$this->authentication_mechanism." may not be used: ".$sasl->error));
                                  break;
                             default:
                                  return($this->SetError("Could not start the SASL authentication client: ".$sasl->error));
                        if(strlen($sasl->mechanism))
                             if($this->PutLine("AUTH ".$sasl->mechanism.(IsSet($message) ? " ".base64_encode($message) : ""))==0)
                                  return("Could not send the AUTH command");
                             $response=$this->GetLine();
                             if(GetType($response)!="string")
                                  return("Could not get AUTH command response");
                             switch($this->Tokenize($response," "))
                                  case "+OK":
                                       $response="";
                                       break;
                                  case "+":
                                       $response=base64_decode($this->Tokenize("\r\n"));
                                       break;
                                  default:
                                       return($this->SetError("Authentication error: ".$this->Tokenize("\r\n")));
                             for(;!$authenticated;)
                                  do
                                       $status=$sasl->Step($response,$message,$interactions);
                                  while($status==SASL_INTERACT);
                                  switch($status)
                                       case SASL_CONTINUE:
                                            if($this->PutLine(base64_encode($message))==0)
                                                 return("Could not send message authentication step message");
                                            $response=$this->GetLine();
                                            if(GetType($response)!="string")
                                                 return("Could not get authentication step message response");
                                            switch($this->Tokenize($response," "))
                                                 case "+OK":
                                                      $authenticated=1;
                                                      break;
                                                 case "+":
                                                      $response=base64_decode($this->Tokenize("\r\n"));
                                                      break;
                                                 default:
                                                      return($this->SetError("Authentication error: ".$this->Tokenize("\r\n")));
                                            break;
                                       default:
                                            return($this->SetError("Could not process the SASL authentication step: ".$sasl->error));
                   if(!$authenticated)
                        if($this->PutLine("USER $user")==0)
                             return($this->SetError("Could not send the USER command"));
                        $response=$this->GetLine();
                        if(GetType($response)!="string")
                             return($this->SetError("Could not get user login entry response"));
                        if($this->Tokenize($response," ")!="+OK")
                             return($this->SetError("User error: ".$this->Tokenize("\r\n")));
                        if($this->PutLine("PASS $password")==0)
                             return($this->SetError("Could not send the PASS command"));
                        $response=$this->GetLine();
                        if(GetType($response)!="string")
                             return($this->SetError("Could not get login password entry response"));
                        if($this->Tokenize($response," ")!="+OK")
                             return($this->SetError("Password error: ".$this->Tokenize("\r\n")));
              $this->state="TRANSACTION";
              return("");
         /* Statistics method - pass references to variables to hold the number of
         messages in the mail box and the size that they take in bytes.  */
         Function Statistics(&$messages,&$size)
              if($this->state!="TRANSACTION")
                   return($this->SetError("connection is not in TRANSACTION state"));
              if($this->PutLine("STAT")==0)
                   return($this->SetError("Could not send the STAT command"));
              $response=$this->GetLine();
              if(GetType($response)!="string")
                   return($this->SetError("Could not get the statistics command response"));
              if($this->Tokenize($response," ")!="+OK")
                   return($this->SetError("Could not get the statistics: ".$this->Tokenize("\r\n")));
              $messages=$this->Tokenize(" ");
              $size=$this->Tokenize(" ");
              return("");
         /* ListMessages method - the $message argument indicates the number of a
         message to be listed.  If you specify an empty string it will list all
         messages in the mail box.  The $unique_id flag indicates if you want
         to list the each message unique identifier, otherwise it will
         return the size of each message listed.  If you list all messages the
         result will be returned in an array. */
         Function ListMessages($message,$unique_id)
              if($this->state!="TRANSACTION")
                   return($this->SetError("connection is not in TRANSACTION state"));
              if($unique_id)
                   $list_command="UIDL";
              else
                   $list_command="LIST";
              if($this->PutLine("$list_command".($message ? " ".$message : ""))==0)
                   return($this->SetError("Could not send the $list_command command"));
              $response=$this->GetLine();
              if(GetType($response)!="string")
                   return($this->SetError("Could not get message list command response"));
              if($this->Tokenize($response," ")!="+OK")
                   return($this->SetError("Could not get the message listing: ".$this->Tokenize("\r\n")));
              if($message=="")
                   for($messages=array();;)
                        $response=$this->GetLine();
                        if(GetType($response)!="string")
                             return($this->SetError("Could not get message list response"));
                        if($response==".")
                             break;
                        $message=intval($this->Tokenize($response," "));
                        if($unique_id)
                             $messages[$message]=$this->Tokenize(" ");
                        else
                             $messages[$message]=intval($this->Tokenize(" "));
                   return($messages);
              else
                   $message=intval($this->Tokenize(" "));
                   $value=$this->Tokenize(" ");
                   return($unique_id ? $value : intval($value));
         /* RetrieveMessage method - the $message argument indicates the number of
         a message to be listed.  Pass a reference variables that will hold the
         arrays of the $header and $body lines.  The $lines argument tells how
         many lines of the message are to be retrieved.  Pass a negative number
         if you want to retrieve the whole message. */
         Function RetrieveMessage($message,&$headers,&$body,$lines)
              if($this->state!="TRANSACTION")
                   return($this->SetError("connection is not in TRANSACTION state"));
              if($lines<0)
                   $command="RETR";
                   $arguments="$message";
              else
                   $command="TOP";
                   $arguments="$message $lines";
              if($this->PutLine("$command $arguments")==0)
                   return($this->SetError("Could not send the $command command"));
              $response=$this->GetLine();
              if(GetType($response)!="string")
                   return($this->SetError("Could not get message retrieval command response"));
              if($this->Tokenize($response," ")!="+OK")
                   return($this->SetError("Could not retrieve the message: ".$this->Tokenize("\r\n")));
              for($headers=$body=array(),$line=0;;)
                   $response=$this->GetLine();
                   if(GetType($response)!="string")
                        return($this->SetError("Could not retrieve the message"));
                   switch($response)
                        case ".":
                             return("");
                        case "":
                             break 2;
                        default:
                             if(substr($response,0,1)==".")
                                  $response=substr($response,1,strlen($response)-1);
                             break;
                   if($this->join_continuation_header_lines
                   && $line>0
                   && ($response[0]=="\t"
                   || $response[0]==" "))
                        $headers[$line-1].=$response;
                   else
                        $headers[$line]=$response;
                        $line++;
              for($line=0;;$line++)
                   $response=$this->GetLine();
                   if(GetType($response)!="string")
                        return($this->SetError("Could not retrieve the message"));
                   switch($response)
                        case ".":
                             return("");
                        default:
                             if(substr($response,0,1)==".")
                                  $response=substr($response,1,strlen($response)-1);
                             break;
                   $body[$line]=$response;
              return("");
         /* DeleteMessage method - the $message argument indicates the number of
         a message to be marked as deleted.  Messages will only be effectively
         deleted upon a successful call to the Close method. */
         Function DeleteMessage($message)
              if($this->state!="TRANSACTION")
                   return($this->SetError("connection is not in TRANSACTION state"));
              if($this->PutLine("DELE $message")==0)
                   return($this->SetError("Could not send the DELE command"));
              $response=$this->GetLine();
              if(GetType($response)!="string")
                   return($this->SetError("Could not get message delete command response"));
              if($this->Tokenize($response," ")!="+OK")
                   return($this->SetError("Could not delete the message: ".$this->Tokenize("\r\n")));
              $this->must_update=1;
              return("");
         /* ResetDeletedMessages method - Reset the list of marked to be deleted
         messages.  No messages will be marked to be deleted upon a successful
         call to this method.  */
         Function ResetDeletedMessages()
              if($this->state!="TRANSACTION")
                   return($this->SetError("connection is not in TRANSACTION state"));
              if($this->PutLine("RSET")==0)
                   return($this->SetError("Could not send the RSET command"));
              $response=$this->GetLine();
              if(GetType($response)!="string")
                   return($this->SetError("Could not get reset deleted messages command response"));
              if($this->Tokenize($response," ")!="+OK")
                   return($this->SetError("Could not reset deleted messages: ".$this->Tokenize("\r\n")));
              $this->must_update=0;
              return("");
         /* IssueNOOP method - Just pings the server to prevent it auto-close the
         connection after an idle timeout (tipically 10 minutes).  Not very
         useful for most likely uses of this class.  It's just here for
         protocol support completeness.  */
         Function IssueNOOP()
              if($this->state!="TRANSACTION")
                   return($this->SetError("connection is not in TRANSACTION state"));
              if($this->PutLine("NOOP")==0)
                   return($this->SetError("Could not send the NOOP command"));
              $response=$this->GetLine();
              if(GetType($response)!="string")
                   return($this->SetError("Could not NOOP command response"));
              if($this->Tokenize($response," ")!="+OK")
                   return($this->SetError("Could not issue the NOOP command: ".$this->Tokenize("\r\n")));
              return("");
    ?>

  • Error occuring when calling a function via BSP

    In BSP, I call the function 'SD_DELIVERY_UPDATE_PICKING' to update a delivery. Unfortunately, when there is an error during processing this function (it is returned in the export table PROT), I found that this delivery is always locked! On the other hand, calling this function in SAP GUI, I haven't found this problem. How can I solve it. I try to use the command 'commit work.', but it doesn't work.
    Moreover, when this function raises an error message, in SAP GUI this function terminates its work according to the message type 'E' rule. However, in BSP, when this error message is raised, the page shows 'The page cannot be displayed'. How can I solve these problems.

    you should do something like below.
    call function 'SD_DELIVERY_UPDATE_PICKING'
        exporting
          vbkok_wa      = <vbkok_wa>
          synchron      = ' '
          no_messages_update = ' '
        tables
          vbpok_tab     = tvbpok
          prot          = wat_prot
        exceptions
          error_message = 2.
      case sy-subrc.
        when 0.
          describe table wat_prot lines fa_lines.
          if fa_lines = 0.
            commit work.
          else.
    * fill a vairable with a message and show it in BSP page
          endif.
        when 2.
    Regards
    Raja

  • How to call javascript function?

    Hi,
    How to call javascript function for SAP button
    control onclick event?
    Thanks in advance.

    Hi Sundar,
      u can call java script  in design mode.
      Add this code in ur design part inside body and call the function as
    <sap:button id="a" onSelect="javascript:go();"
    Add inside body:
      <script language="javascript>
    function go(){
    alert("hai");
      </script>
    Regards,
    Vinoth.M

  • Can i call a function module of SAP?

    Hi, i have a question... Can i call a function module of SAP... I need print a document from a device, can i call the function module of SAP in order that me it prints it?
    Thanks,

    Hi Victor,
    you can use the GenericSync Example of the MDK. This calls the Module to verify the user directly. Generic Sync is exactly for that purpose: call a BADI directly and no usage of SyncBO. Be aware, that you - out of the box- sync your app data as well at that moment, because a sync runs both - generic and smartsync. Even worse: even when you have nothing to sync in Generic Sync - so nothing to print - it will call the function module for generic sync as long as it is registered.
    Well,  anyway, this is the way to call a function module separate.
    If it works with you rparticular print module? I have no idea, but if this is a normal function module - well, it should be ok.
    Hope this helps.
    Regards,
    Oliver

  • Calling a functional module in SAP

    Hi
    We have a require ment like we need to update the details in SAP by calling a functional module, the data comes from a legacy which deletes immediately after it sends to XI by using a webservice, It is XI responsibility to update the details. In case SAP is down , Can we preserve this message and update SAP as and when the SAP is Up.
    Please comment.
    Regs
    Ramesh

    Hi Prasad
    Thank you so much. It has good information.
    As Naveen Pandrangi's blog
    XI : RFCAdapter ReConnect Issue
    "when the end system comes up, calls from XI would be successful. RFC Adapter would now check the connection for every message instead of only once when the communication channel is updated."
    Here small question is what about the old messages that were failed due to Connection Failure or SAP down.
    Please try to comment.
    Thanks in advance
    Ramesh

  • Calling RFC function module in other SAP system...

    Hi,
    I have a report on one SAP system and a function module on other system. The function module is RFC enabled. How can I call this RFC enabled function module from other SAP system in the report which is different SAP ?
    system.
    Thanks.
    Regards,
    Rajesh.

    call the function module in orginal system in se38 ,copy the function module ,paste the function module in other system,and maintain destination here ,otherwise you will get short dump.
    here detination should be SM59 destination,this is case sensitive.
    Reward Points if it is helpful
    Thanks
    Seshu

  • IS IT POSSIBLE TO CALL FUNCTION IN sap QUERY sq01

    IS IT POSSIBLE TO CALL FUNCTION IN sap QUERY sq01

    Use enhancement project SQUE0001 for background downloads of query data.  Use the 'Private File' option with the query execution.

  • Send data to ECC table through RFC Call function from SAP B1 via  b1if

    Hi,
    I have created scenario in B1if which triggers from SAP B1, now I have to send this data in to ECC table, so I have created scenario for that with inbound SAP B1, outbound void and in process RFC Call atom is there but I am not getting data in receiver and also how to write xml to send data in RFC function. Function for RFC has configured from ECC end and have access of that function.
    So please help me to send data to ECC table through RFC Call function from SAP B1 (9.0) via b1if
    Thanks

    Solved by my own.

  • Call Function in SAP Query

    Hi All,
    How do you call a function in SQ02 & Populate a structure table?
    Thanks
    Adeel
    Edited by: Adeel Sarwar on Mar 4, 2009 2:03 PM

    Done

  • Can we call a function module in ADHOC query

    Hi
    Can we call a function module in ADHOC query if yes how.
    Also we ned to know how to call a function module in SAP query.
    An early responce is appreciated.
    Thanks and best regards
    Rajeev

    Okay as far as I understand your aim is:
    To fill a field in the output list with a value that is based on the current line information and calculated by a function module
    So go to SQ02 and create an additional field in the InfoSet.
    You can refer in the coding to the technical names you can see in the left tree window like P0000-PERNR.
    More information is avaiable in the Help part look for additional field in SQ02.
    Regards,
    Michael

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

  • Calling a function from a DLL, exectution in background mode.

    Dear Experts,
    We have created an ABAP report the calls a function from a DLL file. If the report is executed in on-line mode the program calls and executes the function from the DLL, but if the ABAP programa is executed in background mode it doesnt calls the DLL function.
    Do you know a way to solve the problem when executing in background mode?
    Best regards.
    Antonio

    Hi Gabriel,
    Let me explain in details about my DLL function.
    We are importing the business partners from legacy system into the SAP CRM system, so at the moment we created the BP master data via BAPI, I get the name of the BP and this moment I call the function in the DLL file. I export the parameter name and I receive back a simplified string with the name reduced to a code. This code I get back from the dll it is insert in a Z table, so there is no interaction in the screen, all must be executed in background mode, because there are a lot of business partners to be converted in SAP system.
    I am sending my code for your considerations.
    Instancia a DLL
      CREATE OBJECT dll 'MTCODE.CPFONET'.
      IF sy-subrc NE 0.
        RAISE without_dll.
      ENDIF.
    Move para a tabela interna IT_NAME os valores recebidos na TI_NAME
      it_name[] = ti_name[].
    Para cada registro importado
      LOOP AT it_name.
        CLEAR v_string_ret.
        wa_matchcode-zregid     = it_name-zregid.
        wa_matchcode-name1_text = it_name-name1_text.
        v_string = it_name-name1_text.
        CONDENSE  v_string.
        TRANSLATE v_string TO UPPER CASE.
        CALL METHOD  OF dll 'SetNome' EXPORTING #1 = v_string.
        CALL METHOD  OF dll 'ExecMatch'.
        CALL METHOD  OF DLL 'GetMCData' = v_string_ret.
        FREE OBJECT dll.
      Preenche os campos do match-code de acordo com o retorno da DLL
        SPLIT v_string_ret
        AT '|'
        INTO wa_matchcode-zparmcln
             wa_matchcode-zparmcfn
             v_empty
             wa_matchcode-name_first
             wa_matchcode-name_last
             wa_matchcode-namemiddle.
      Adiciona o registro com o match-code correspondente na TE_MATCHCODE
        APPEND wa_matchcode TO te_matchcode.
      ENDLOOP.

  • System failure, during call of function module RSWR_RFC_SERVICE_TEST

    Hi Team,
         I am working with BW and Portal Integration, with the Netweaver
    2004s SP 11 version. I have a issue when i run the RSPOR_SETUP program
    to test the configuration.
    The error is on status 5 and 12, i get the following error:
    System failure, during call of function module RSWR_RFC_SERVICE_TEST,
    and when i enter at the dev_jrfc.trc log file, i have the following
    error:
    Exception thrown [Tue Jul 10 16:12:16,687]:Exception thrown by
    application running in JCo Server
    java.lang.RuntimeException: call FM RSWR_RFC_SERVICE_TEST to ProgId
    smxpedvc_PORTAL_EPD on host smxpedvc.grupoempresarialangeles.com.mx
    with SSO not authorized: No login module succeeded.
            at
    com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest
    (RFCDefaultRequestHandler.java:79)
            at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequest
    (RFCJCOServer.java:156)
            at com.sap.mw.jco.JCO$Server.dispatchRequest(JCO.java:7785)
            at com.sap.mw.jco.MiddlewareJRfc$Server.dispatchRequest
    (MiddlewareJRfc.java:2405)
            at com.sap.mw.jco.MiddlewareJRfc$Server.listen
    (MiddlewareJRfc.java:1728)
            at com.sap.mw.jco.JCO$Server.listen(JCO.java:8145)
            at com.sap.mw.jco.JCO$Server.work(JCO.java:8265)
            at com.sap.mw.jco.JCO$Server.loop(JCO.java:8212)
            at com.sap.mw.jco.JCO$Server.run(JCO.java:8128)
            at com.sap.engine.core.thread.impl3.ActionObject.run
    (ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute
    (SingleThread.java:100)
            at com.sap.engine.core.thread.impl3.SingleThread.run
    (SingleThread.java:170)
    Could you help me to solve this issue.
    Thanks so much.

    Have you checked the user that is used to connect from J2EE back to ABAP?
    I had a similar problem, went into the Visual Administrator and found the incorrect password (or possibly outdated password) was being used to communicate back to ABAP, and updating that sorted out my problem.
    Hope this helps.
    Cheers,
    Andrew

  • Call of function module "SUBST_START_BATCHJOB" by RFC failed

    Hello Guru's,
    We have the following Issue:
    In Phase PREP_INIT/JOB_RSUPDTEC we get this error from EHPI (Version 710-1)
    Checks after phase PREP_INIT/JOB_RSUPDTEC were negative!
    Last error code set: BATCHJOB RSUPDTEC FAILED: Calling RSUPDTEC failed - repeat phase.
    In the file PSUPDTEC.LOG are the following error:
    4 ETQ260 Starting batchjob "RSUPDTEC"
    4 ETQ230 Starting RFC Login to: System = "E11", GwHost = "sape11", GwService = "sapgw00"
    4 ETQ359 RFC Login to: System="E11", Nr="00", GwHost="sape11", GwService="sapgw00"
    4 ETQ232 RFC Login succeeded
    4 ETQ233 Calling function module "SUBST_START_BATCHJOB" by RFC
    4 ETQ399 JOBNAME='RSUPDTEC', REPNAME='RSUPDTEC', VARNAME='', BATCHHOST='sape11', IV_SCHEDEVER=' '
    4 ETQ234 Call of function module "SUBST_START_BATCHJOB" by RFC succeeded
    4 ETQ399 Returned JOBCOUNT='14230100'
    2EETQ235 Call of function module "SUBST_START_BATCHJOB" by RFC failed (error-status "27")
    2EETQ261 Start of batchjob "RSUPDTEC" failed
    In the Sysem we can see, that the Job RSUPDTEC was created by DDIC but not started.
    We can start (and finish) the job successfully as logged in DDIC.
    We don't know whats the problem. The EHPI stopped every time at this point.
    Need Help...
    regards
    Chris

    Issue solved.
    In /etc/hosts the first entry was SAPE11.
    But it must be sape11, because the instance is sape11_E11_00.
    In SM51 we could see that
    sape11_E11_00     SAPE11     Dialog Batch Update Upd2 Spool Enqueue ICM     active
    We changed the entry and restarted SAP.
    Then the job can be started.

Maybe you are looking for

  • HT3382 DVI to VGA adaptor with Apple Mini

    I have a slightly older Apple mini and would like to connect it to my TV, which only has a VGA port. Which adapter should I use? The "Apple DVI to VGA adaptor"?

  • Error in releasing billing document to accounting

    Hi All, While releasing a billing document , i am getting error as : No Valuation segment exists in the material master record for product xxxxx. However on further analysis it is found that in order to valuate line item for COPA system is reading va

  • I have trouble running flash player on both IE and firefox

    Whenever Adobe realeses a new version of Adobe Flash Player I have difficulties. I wonder why they keep releasing new versions! I can have adobe flash player installed and working on either Firefox or IE. If one of them has it installed when I try do

  • Ghost TV Monitor detected

    Hi My 17' Alu show a TV monitor in the Display Panel. I've never connected a TV on this port. All sessions are affected. I am afraid that it is a hardware problem. Any idea? Vincent

  • Can a .m file be loaded dynamically????

    Dear All, Can anybody tell me whether a .m file be loaded dynamically loaded into a mathscript node and executed??? Thanks in advance! Saranya