Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Note Number: 953823 says string not supported in FM ??

Former Member
0 Kudos
183

Hello Friends

I am desperately trying to findout how to send a variable length string from XI and save it in a table.

However, SAP Note Number: 953823 says that STRING is not supported in FM but the work around it suggests is as follows:

========================================================

The only work around for this is :

To wrap the Function module used in function control with the custom function module,which substitutes the STRING parameter with CHAR datatype.

========================================================

But the problem is that for CHAR datatype you have to give the field length, the requirement I have is to send a VARIABLE LENGTH data.

Could some one help me in understanding how this can be achieved?

Thanks a lot in advance

Ram

6 REPLIES 6

former_member186746
Active Contributor
0 Kudos
92

You have to find out what the maximum length is and use that in the declaration.

Regards, Rob.

Former Member
0 Kudos
92

Interesting question. Maybe I don't completely understand. When you say store it in a table, do you mean a database table or an itab?

I seem to be able to pass a string to a FM. Am I doing something wrong?

I created a type of string called "ZTYSTR".

I then created this FM.

*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_STR) TYPE  ZTYSTR
*"----------------------------------------------------------------------

  DATA:
     l_string   type string.

  l_string = i_str.

ENDFUNCTION.

Then I call the function module as such.

REPORT zz_temp.


DATA: g_str  TYPE string VALUE 'Hello World'.

CALL FUNCTION 'Z_TEMP'
  EXPORTING
    i_str = g_str.

Debugging the FM, it says that both the parameter and local variable are of type string.

0 Kudos
92

Hi Jerry

Thanks for taking time to create an example function. I appreciate it.

But the main problem that arises is when you try to save this string in a database table. That is when it gives an error message as follows,

When I try to activate the bapi it gives an error message that says

<DATABASE_TABLE> must be a flat structure. You cannot use internal tables,

strings, references, or structures as components.

In your example, you are just sending the String back. I tried and it worked. But when I enter the code to update my database table (in my BAPI) and try to activate, that is when I see this error message.

If you have any other suggestions, please let me know.

Thanks a lot

Ram

Edited by: Ram Prasad on Mar 20, 2008 2:48 PM

0 Kudos
92

A database table has fixed columns, unless you use a type of RAWSTRING. In Oracle, that's converted to a type BLOB (binary large object).

Please see table REPOSRC for an example of that. Maybe that would allow you to store the string. Storing it may be easy enough, but using RAWSTRINGS probably aren't very convenient. You might be better off using a very large CHAR field.

0 Kudos
92

Jerry,

Thanks for your quick response.

yes I tried using VARILRAW (that they have used in a table called VARI).

However, eventhough it is storing the string successfully, it is storing it in Binary format and I have problems in converting it back to string again.

Any ideas on this?

Thanks a lot

Ram

0 Kudos
92

Thanks a lot Jerry,

I tried your suggestion of using 'RAWSTRINGS', but again the same problem in updating the table from BAPI or a program from SE38. I get the following error

'<DATABASE_TABLE> must be a flat structure. You cannot use internal tables,

strings, references, or structures as components.'

Any suggestions will be highly appreciated.

Tks

Ram