<?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 module - input datatype Mismatch in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346229#M517575</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure,  all you need to do is not assign a type to the importing and/or exporting parameters,  this makes them generic and they will take the type of what is being pass to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here is a funcitno module,  notice there is no type in the signature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

function z_test.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(I_STR)
*"  EXPORTING
*"     REFERENCE(E_STR)
*"----------------------------------------------------------------------


  e_str = i_str.

  translate e_str using '#_'.


endfunction.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when you call this,  you can pass a string, a character field, what ever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Jun 2007 13:02:02 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2007-06-15T13:02:02Z</dc:date>
    <item>
      <title>Function module - input datatype Mismatch</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346228#M517574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have developed a function module that would convert any '#' in a supplied string to '_'. I have defined the import and export parameters as 'string'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module is getting called only if we call it exporting a variable of datatype 'string' and does not get called if we export a variable whose data type is different from 'string' (say Char20).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One work around is to define another variable with data type 'string' and pass this variable to the function module (after taking the contents of the variable with a different data type into this 'string' variable). But, isn't there a better solution like the SAP standard function module 'string_length' which can be called by exporting a variable of any data type (like char20, char10, num, string etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want this function module to be used in Transformation (in BI) while loading data into an InfoProvider. I may want to remove '#' in 0MATERIAL or 0CUSTOMER or ZCUSTOMER which may have different datatypes and I do not want the user to do the workaround while calling this function module (by creating a variable with 'String') each time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bajrang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Sriram Bajrang Bulusu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2007 12:35:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346228#M517574</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-15T12:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Function module - input datatype Mismatch</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346229#M517575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure,  all you need to do is not assign a type to the importing and/or exporting parameters,  this makes them generic and they will take the type of what is being pass to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here is a funcitno module,  notice there is no type in the signature.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

function z_test.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(I_STR)
*"  EXPORTING
*"     REFERENCE(E_STR)
*"----------------------------------------------------------------------


  e_str = i_str.

  translate e_str using '#_'.


endfunction.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when you call this,  you can pass a string, a character field, what ever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2007 13:02:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346229#M517575</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-06-15T13:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Function module - input datatype Mismatch</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346230#M517576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So then the callling program looks like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: char20 type char20.
data: str type string.

char20 = 'aiwkdn#s;als#eoco'.


call function 'Z_TEST'
     exporting
          i_str = char20
     importing
          e_str = str.


write:/ str.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2007 13:03:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-input-datatype-mismatch/m-p/2346230#M517576</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-06-15T13:03:45Z</dc:date>
    </item>
  </channel>
</rss>

