Application Development and Automation 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: 
Read only

ABAP Function Module is not working

Former Member
0 Likes
1,538

Hi Experts,

I created a remote function module to fetch the data from another system. I need the data in internal table with one column. But while I am selecting the data in internal table its always selecting in first column of the table irrespective of whatever column I am selecting.

In Function Module under tables tab i created an internal table.

ZN_PRDCAT LIKE /BIC/MZG_PRDCAT

in the source code i written.

SELECT MDTEXT FROM /BIC/MZG_PRDCAT INTO TABLE ZN_PRDCAT  WHERE MDTEXT NE ''.

at the target system where i am using the FM is selecting the data in first field of the table. Like here MDTEXT is having char type with 30 character and i created the internal table at target system with same length and type but only first 3 characters are coming for the same.

Please help me how can i send this 1 column to my target system.

11 REPLIES 11
Read only

jitendra_it
Active Contributor
0 Likes
1,229

Hi ,

Have you used 'Destination' addition of 'CALL Function'.

It might be possible it is getting data from your local system. 

Read only

Former Member
0 Likes
1,229

Hi Mangilal,

     1st you have to create a RFC DESTINITAION between 2 systems using tcode SM59. when you execute your RFC fm, you have to pass RFC target system id......

thanks

Sabyasachi

Read only

Former Member
0 Likes
1,229

Hi Mangilal,

Your Select statement is Wrong. you are selecting a single parameter into an internal table.

Since you want to sent only one column in the target system , create an internal table in source as well as target system as well.

Regards,

Dipesh

Read only

Former Member
0 Likes
1,229

SELECT MDTEXT FROM /BIC/MZG_PRDCAT INTO corresponding fields of TABLE ZN_PRDCAT  WHERE MDTEXT not null.

Read only

0 Likes
1,229

HI Mohit,

Its not about field selection condition its taking extra space in the clumn data. I have 4 fields like MANDT CATAGORY LANG TXTMD now MANDT having length 4 CATEGORY having 20 and LANGUAGE 1 and TXTMD is 30. while i am selecting in the target system its taking space for the first 3 coulmns 4+1+20 = 24 and then showing the 4th column data after space even those columns are not there in select statmement.

Read only

0 Likes
1,229

Try CONDENSE <fieldname> NO-GAPS.

Read only

0 Likes
1,229

HI Mohit,

Thanks for the reply i already tried with all these tricks. My question is why this is displaying like this what is the reason?

Read only

0 Likes
1,229

can u update Reply it with images..

what table function structure u r passing..which  is easy to under stand..

Read only

0 Likes
1,229

You are selecting one field but placing it into a table that consists of multiple fields. In this case the selected field's content is "spread" over the table structure, starting from the very first field. E.g. in the example given ZN_PRDCAT structure is (I guess):

MANDT - 3

CATEGORY - 20

LANG - 1

TXTMD - ?

So when you do this:

SELECT MDTEXT FROM /BIC/MZG_PRDCAT INTO TABLE ZN_PRDCAT

the content of MDTEXT field is read and the first 3 characters are placed in ZN_PRDCAT-MANDT, the next 20 characters in ZN_PRDCAT-CATEGORY, the next 1 character in ZN_PRDCAT-LANG and so forth.

If only one field is needed, then define the table structure with just that one field. If for some strange reason this is not possible then use SELECT... INTO CORRESPONDING, as already suggested, and when reading data make sure to read only the same one field.

If I may suggest - going forward, use debugger and try to do some analysis before posting a question on SCN (as you see, most of the replies were off track anyway). I've also made similar mistake in the past but never went to SCN with it since this error is obvious in debugger. Also you might want to read ABAP Help a bit more. Based on this post, I feel there is lack of understanding on some basic concepts that need to be learned before moving past the "hello world" development level.

Good luck.

Read only

0 Likes
1,229

HI Jelena,

Thanks for your reply.

I already debugged whole code multiple time and then only posted the question. Target side if i am using corresponding statement data is coming in correct field but at the target system not at proper place even structure with one field and proper type.

dont know what is the exact working of Tables in FM.