‎2007 Mar 22 2:28 AM
Hi,
I am trying to pass an internal table from a function module to a calling program.
This is the internal table structure in my function module.
DATA: BEGIN OF authtab OCCURS 0,
seqnr like sy-tabix,
field_1 type XUFIELD,
fieldval type XUVAL,
END OF authtab.
The passing parameters are
*" REFERENCE(DATE) TYPE DATS
*" TABLES
*" AUTHTAB
my calling function is:
CALL FUNCTION XXX
EXPORTING
XXX = XXX
XXX = XXX
XXX = XXX
TABLES
AUTHTAB = authentab.
authentab is an internal table i declared in my calling program
DATA: BEGIN OF authentab OCCURS 0,
seqnr like sy-tabix,
field type XUFIELD,
fieldval type XUVAL,
END OF authentab.
The FM works fine. But i cant pass the content of the internal table over to the calling program for display. Anyone know how to go abt solving this?
regards,
r3venant
‎2007 Mar 22 2:56 AM
Hi,
I think you cann't declare internal table in the FM for Table parameter.
You should do this:
1. Create Structure in SE11 for Table Parameter (ex. Z_AUTH ).
2. Insert your Table Parameter at tab TABLES in your FM:
Parameter Name: <b>TAB_AUTHTAB</b>.
Type Spec: LIKE
Associated Type: Z_AUTH ( Your Sturcture Name that you created in SE11).
And in calling program, cretate the internal table, like this:
DATA: IT_AUTHTAB TYPE STANDARD TABLE OF Z_AUTH OCCURS 0 WITH HEADER LINE.
CALL FUNCTION XXX
EXPORTING
XXX = XXX
XXX = XXX
XXX = XXX
TABLES
<b>TAB_AUTHTAB</b> = IT_AUTHTAB.
Regards,
‎2007 Mar 22 2:56 AM
Hi,
I think you cann't declare internal table in the FM for Table parameter.
You should do this:
1. Create Structure in SE11 for Table Parameter (ex. Z_AUTH ).
2. Insert your Table Parameter at tab TABLES in your FM:
Parameter Name: <b>TAB_AUTHTAB</b>.
Type Spec: LIKE
Associated Type: Z_AUTH ( Your Sturcture Name that you created in SE11).
And in calling program, cretate the internal table, like this:
DATA: IT_AUTHTAB TYPE STANDARD TABLE OF Z_AUTH OCCURS 0 WITH HEADER LINE.
CALL FUNCTION XXX
EXPORTING
XXX = XXX
XXX = XXX
XXX = XXX
TABLES
<b>TAB_AUTHTAB</b> = IT_AUTHTAB.
Regards,
‎2007 Mar 22 3:04 AM
Hi Jatra,
Ok i understand where u are coming from. I think that might be the last option i would try becoz i dun want to create a table just for that. 😃 thanks anyway
‎2007 Mar 22 2:58 AM
r3venant,
Check 2 things.
1.In your function module is the internal table getting filled with some data ?.
Have you checked it in debugging mode.
2.Is the date passing date value through parameter is available in function
module?.Check in debugg mode
Pls. reward if useful
‎2007 Mar 22 3:13 AM
Hi kaipha,
The function module works fine, the internal table "authtab" is filled with data that i want to pass to the calling program. But i cant seem to display the data. Its empty over at the calling program.
Regards,
r3venant
‎2007 Mar 22 3:10 AM
can you give the attributes from tables tab of your fm for this table?
aRs
‎2007 Mar 22 3:15 AM
hi ars,
I've only declared authtab under the table tab w/o any typing or associated type.
regards,
r3venant
‎2007 Mar 22 3:22 AM
Define a strcuture in SE11 for authtab.
in tables declaration TAB of fm define LIKE structure your created in SE11
aRs
‎2007 Mar 22 3:31 AM
Inside the function module code, declare an internal table with the same structure and move the contents of the tables parameter internal table to this one. After that you will be able to work with the individual fields.
So in other words, I will declare an internal table inside the function module code that is exactly similar to what you declared in your calling program.
FUNCTION XXXXX.
*TABLES
*ITAB
DATA: BEGIN OF local_authtab OCCURS 0,
seqnr like sy-tabix,
field_1 type XUFIELD,
fieldval type XUVAL,
END OF local_authtab.
local_authtab[] = itab[].
*-- do whatever you want to do with local_authtab. if you modify local_authtab, then add this statement at the end, just before ENDFUNCTION.
clear itab[].
itab[] = local_authtab[].
‎2007 Mar 22 3:53 AM
i cant under stand 1 thing in your tables paramenter you declare AUTHTAB and in source code also you are dclaring like
DATA: BEGIN OF authtab OCCURS 0,
seqnr like sy-tabix,
field_1 type XUFIELD,
fieldval type XUVAL,
END OF authtab.
and system does not give any error .....
as per i can understand you did not define any tables parameter in the tab tables?
if i am right then declare in the tables tab (after changing tab) AUTHTAB and delete the declaration of authtab in source code .. and do the modification or any thing with AUTHTAB it will automatically assign the value to your prog ..
regards
shiba dutta
‎2007 Mar 22 4:08 AM
Hi Srinivas, Thanks for your reply.
Hi SHIBA, yep you are correct there was error in the codes i gave sorry this is the new one.
FM : i declare
authtab TYPE STANDARD TABLE OF ust12 WITH HEADER LINE.
under table tab : parameter name : authtab1
end of the FM i did a
authtab1[] = authtab.
now all my content is held in authtab1.
In the calling program, i declare authtab again.
authtab TYPE STANDARD TABLE OF ust12 WITH HEADER LINE.
with the calling :
CALL FUNCTION XXX
EXPORTING
UNAME = sy-uname
OBJECT = XXX'
FIELD = XXX
DATE = sy-datum
TABLES
AUTHTAB1 = authtab.
by here, when debugging, there is no data in authtab1 i think... there is no data. Any idea?
regards,
r3venant
‎2007 Mar 22 5:49 AM
sorry again i cant get you
end of the FM i did a
authtab1[] = authtab.
in the source code also you are declaring authtab?
if it is so
authtab1[] = authtab[].
just put a break point in the fn module and check before endfunction statement if authtab1 containing any value or not if it is containing any value then your itab in prog should also get the value.
just check in above statement authtab1[] = authtab[]. authtab[] what value it contains?
regards
shiba dutta
‎2007 Mar 22 6:15 AM
‎2007 Mar 22 1:15 PM
> Hi Srinivas, Thanks for your reply.
>
> Hi SHIBA, yep you are correct there was error in the
> codes i gave sorry this is the new one.
>
> FM : i declare
>
> authtab TYPE STANDARD TABLE OF ust12 WITH HEADER
> LINE.
>
> under table tab : parameter name : authtab1
>
> end of the FM i did a
> authtab1[] = authtab. <b><-- this has to be authtab1[] = authtab[].</b>
>
> now all my content is held in authtab1.
>
> In the calling program, i declare authtab again.
> authtab TYPE STANDARD TABLE OF ust12 WITH HEADER
> LINE.
>
> with the calling :
> CALL FUNCTION XXX
> EXPORTING
> UNAME = sy-uname
> OBJECT = XXX'
> FIELD = XXX
> DATE = sy-datum
> TABLES
> AUTHTAB1 = authtab.
> here, when debugging, there is no data in authtab1 i
> think... there is no data. Any idea?
>
> regards,
> r3venant
‎2007 Mar 22 1:20 PM
Hi,
you try once by using the squarebrackets for the internal table you are using.
TABLES
AUTHTAB = authentab[].