‎2012 Dec 25 7:23 AM
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.
‎2012 Dec 25 9:24 AM
Hi ,
Have you used 'Destination' addition of 'CALL Function'.
It might be possible it is getting data from your local system.
‎2012 Dec 25 7:56 PM
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
‎2012 Dec 26 4:11 AM
Hi,
See the following links
1. http://help.sap.com/saphelp_nw04/helpdata/en/22/0424ba488911d189490000e829fbbd/content.htm
2. http://help.sap.com/saphelp_nw04/helpdata/en/22/042518488911d189490000e829fbbd/content.htm
3. http://saptechnical.com/Tutorials/ABAP/RFCCall/Page1.htm -Showing you an example.
‎2012 Dec 26 5:13 AM
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
‎2012 Dec 26 11:29 AM
SELECT MDTEXT FROM /BIC/MZG_PRDCAT INTO corresponding fields of TABLE ZN_PRDCAT WHERE MDTEXT not null.
‎2012 Dec 26 11:38 AM
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.
‎2012 Dec 26 11:56 AM
‎2012 Dec 26 1:08 PM
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?
‎2012 Dec 26 4:00 PM
can u update Reply it with images..
what table function structure u r passing..which is easy to under stand..
‎2012 Dec 26 5:14 PM
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.
‎2012 Dec 26 5:50 PM
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.