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: 

Structure assignment to character string

Former Member
0 Kudos

Hi,

We have a FM which involves assignment of

     Structures to Character strings

     Typeless Structure (Imported into FM though TABLES) to Integer type Structure

I have verified that the data in the source structure is compatible with the destination structure in both cases.

The problem is when the FM is executed in test mode, from SE37, it ends in runtime error 'UC_OBJECTS_NOT_CONVERTIBLE'.

But when we execute the program which calls the FM (in background), it works just fine.

Can anyone let me know why this happens.

I understand UC compatibilty checks will be done in the system. But why does the code work in background but not in foreground?

Is there any way to make sure that the FM works even while testing through SE37?

Regards,

Joshua.

1 ACCEPTED SOLUTION

former_member220028
Active Contributor
0 Kudos

Hi,

i dont know how i can help you... i dont know your FM and dont know the code. maybe you provide different data for conversion in foreground and background. Maybe the programm that calls your FM catches the error and so dont lead to a short dump?

background jobs are sheduled with another user. Maybe the job on foreground gets executed on an other application server as when executing in background. I dont know how this could cause an conversion error but maybe the different application servers are on different systems. this is just what comes to my mind - maybe it helps you.

regards

Stefan Seeburger

6 REPLIES 6

former_member220028
Active Contributor
0 Kudos

Hi,

i dont know how i can help you... i dont know your FM and dont know the code. maybe you provide different data for conversion in foreground and background. Maybe the programm that calls your FM catches the error and so dont lead to a short dump?

background jobs are sheduled with another user. Maybe the job on foreground gets executed on an other application server as when executing in background. I dont know how this could cause an conversion error but maybe the different application servers are on different systems. this is just what comes to my mind - maybe it helps you.

regards

Stefan Seeburger

0 Kudos

Hi Stefan,

          One tiny correction.

          The FM works fine in foreground and background, if I execute the program that calls the FM. (I have verified the FM is actually called)

          But if I execute the FM in SE37, it ends in runtime error.   

         

          The program and FM were executed by the same user, in the same system and with the same inputs. And there is no exception handling logic in the program.

          Please find below the details of the code causing the error.

          The READ statement below is where the error occurs.

         READ TABLE i_include INTO wa_include INDEX ws_cnt.

         I_INCLUDE is in the FMs TABLES section, with TYPING = '' and ASSOCIATED TYPE = ''

         WA_INCLUDE has the below structure:

               DATA: BEGIN OF wa_include,
                    row TYPE i,
               END OF wa_include.

         During the runtime error,

               I_INCLUDE had the values

                    1

                    3

                    5

         

               WS_CNT had the value 1  

Regards,

Joshua.

0 Kudos

Hi,

Is there any reason you do not wish to assign a proper type to the table parameter..? If you don't do so, FM Test farmework simply creates and passes a table of char200 (on NW 702), which is incompatible to your wa_include.

Other than than, please note that the tables parameters by FMs are obsolete.

cheers

Janis

0 Kudos

Hi Janis,

  This FM uses field symbols and called on multiple occassions with different table types.

  That is probably why they have used a typeless parameter.

  The only thing confusing me was, why is the FM working fine when called from a program, but not when the FM is tested from SE37.

Regards,

Joshua.

0 Kudos

Hi,

Bacause the SAP FM testing enviroment also has to pass some table, and since it can't determine the type, it passes a table with one field DEFAULT of character with length 200...

What you say about different table types passed is even more puzzling, because I can't imagine how the READ statement you quoted can process anything more than a table of row type corresponding to wa_include... Unless there are more read statements and some logic deciding what read statements to use when, I'd try to evaluate all uses of FM and consider if the type can be assigned to the table. I can't imagine any other way to make the FM testable via SE37.

cheers

Janis

0 Kudos

Hi Janis,

     Sorry about the confusion.

     I_INCLUDE has a fixed type, and it is the same all time (does not change with every call as I said earlier). We should have used a typed parameter.

   

      Thank you very much for your clarification.

      Apologies as it didnt notice you have answered my question in the first reply.

Regards,

Joshua.