‎2006 Apr 17 5:23 PM
HI
I have a smartform question, I am bringing fields in from a print program to a smartform. One of the tables I am bringing in is based on a structure "SFC_ITAB" I am trying to loop at at this table. In the loop node I use the name of the table and I am told it is not a table nor is it defined as an internal table. Is it not considered a table when it is brought into the form?
I have defined an internal table in the global definitions as
itab1 type TABLE OF SFC_ITAB this compiles fine. I just cannot seem to get the smartform to recognize the variable as a table in the Form Interface. Any suggestions
‎2006 Apr 17 5:29 PM
George,
Smart forms can definitely take TABLES as parameters.
Can you some show us how you have declared the paramter?
regards,
Ravi
‎2006 Apr 17 5:29 PM
George,
Smart forms can definitely take TABLES as parameters.
Can you some show us how you have declared the paramter?
regards,
Ravi
‎2006 Apr 17 5:39 PM
In the print program it is defined as
DATA: ITAB_TDR LIKE SFC_ITAB OCCURS 0 WITH HEADER LINE.
In the smart form in the FORM INTERFACE node on theIMPORT tab it is defined as ITAB_TDR TYPE SFC_ITAB. This all compiles fine it is when I try to loop at this in the loop node I am given a message that "ITAB_TDR" is neither specified under "TABLES" nor defined as an internal table. Any other Info you need?
Thanks
‎2006 Apr 17 5:43 PM
George,
You will have to declare in the TABLES parameter. By declaring it in the IMPORT parameters you are only declaring a WORK AREA and that will have only one row.
The reason why the PRINT program is not giving a error is because of the way its been declared with HEADER line in the program. So, you are passing only the HEADER line.
After chaning to TABLES pass the body like this ITAB_HDR[].
Regards,
Ravi
‎2006 Apr 17 5:52 PM
Hi Thanks for the replies
I tried to define it in the tables tab as
ITAB_TDR TYPE SFC_ITAB and was given the message
SFC_ITAB Only table types may be used as the reference type for a table parameter. It does not seem to like the fact the reference is to a structure
Any suggestions
‎2006 Apr 17 6:10 PM
George,
In SE11, look at the WHERE USED LIST of the structure SFC_ITAB in the TABLE TYPES. IF you are able to find use that to refer in the Form, else you will have create a TABLE TYPE referring to SFC_ITAB in SE11.
By the way, I am guessing SFC_ITAB is a strcuture in SE11.
Regards,
Ravi
Note :Please mark all the helpful answers
‎2006 Apr 17 6:14 PM
I am making some progress here
In the tables tab I have defined the table as
ITAB_TDR LIKE SFC_ITAB
In the global def global data I have defined the work area as
ITAB1 LIKE SFC_ITAB This all compiles well now, I am now getting a dump because of the way the table is being passed from the print program I have tried 2 ways. The first
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
itab_tdr[] = itab_tdr[]
and the second
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
itab_tdr[] = itab_tdr[]
caufvd = caufvd
afvgd = afvgd
dafft = dafft
daffv = daffv
l_charg = l_charg
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
gs_itab_tdr = itab_tdr[]
Thanks in advance for any help
‎2006 Apr 17 6:24 PM
George,
Not sure, but try this
In the print program also refer the ITAB_TDR to SFC_ITAB.
ITAB_TDR TYPE SFC_ITAB.
And then you can pass ITAB_TDR for the form without [].
Try this and let me know.
Regards,
Ravi
Note : Please close the thread if this solves the issue
‎2006 Apr 17 6:33 PM
Sorry to be a pain but I am in a time crunch on this and I am not that famillar with smartforms, Ok the problem is not the passing of the table it is stil the defining of it. I take it that it should ONLY be defined in the TABLES tab and not in the IMPORT tab correct. As soon as I took out the table definition the dump stopped. Again I had it defined in the tables as ITAB_TDR LIKE SFC_ITAB. Now I looked and since it is a structure there is NO table type for SFC_ITAB. If I try to create one I am told it already exists choose another name. I am quite stumped here.
‎2006 Apr 17 6:36 PM
George,
As far as you are marking the helpful answers, its absolutely no pain at all ... Just kidding.
If a TABLE TYPE exists for SFC_ITAB, go to SE11, enter SFC_ITAB in the DATA TYPE field and hit on the WHERE USED LIST and SELECT only the TABLE TYPE when the POP UP comes. This will give you the TABLE TYPE which is referring to SFC_ITAB.
Use that in both the SMART Forms as well as the PRINT PRogram.
Regards,
Ravi
‎2006 Apr 17 6:43 PM
Hi
Yes I am assigning points (-;, ok That is what I did initially, I entered SFC_ITAB and chose Table Types in the POP UP, It comes back that there is none. So then I hit create to try and create a Table Type for this structure but am told the name already exists?
‎2006 Apr 17 6:54 PM
George,
It might be just a coincedence that a table type exists with that name that refers to a different structure. did you look at what strcuture it is referring to. '
If it is referring to the same one go ahead and use that in the form and program.
Regards
Ravi
‎2006 Apr 17 7:35 PM
Thanks for your help, I have it compiling now and it seems to be passing the table. I won't know for sure until I do some formatting etc. But at least I am not getting any dumps. Thanks again
‎2006 Apr 17 7:37 PM
I am happy it executes now.
Once it works fine, don't forget to close the thread.
Let me know if you have any issues with the LOOPING of the TABLE object as that is where the question started.
Regards,
Ravi
‎2006 Apr 17 8:14 PM
I do have 1 additional looping question before I know if it is looping correctly, Here is the code I am trying to duplicate from the print program at this point.
LOOP AT itab_tdr WHERE object = obj-alt.
Save Indextable of header
itab_ord = itab_tdr.
LOOP AT caufvd_tab WHERE aufnr = itab_tdr-aufnr.
caufvd = caufvd_tab.
Charge ermitteln
SELECT SINGLE * FROM afpo WHERE aufnr = caufvd-aufnr
AND posnr = 0001.
Materialbezeichnung
SELECT SINGLE * FROM makt WHERE matnr = caufvd-plnbez
AND spras = sy-langu.
My question is 2 fold where can I add code for
caufvd = caufvd_tab. And where can I do the selects in the smartform to coincide with the right node?
Thanks
‎2006 Apr 18 4:41 AM
George,
I don't just writing so much of logic inside your SMART Form. Do all the processing the PRINT program, have a structure that accomodates all the fields that you want to print and send data using the table of that structure type.
You can write SELECTS inside the PROGRAM lines object of the SMART Form
Regards,
Ravi
‎2006 Apr 18 7:24 PM
‎2006 Apr 17 5:33 PM
I could not uderstand ur problem. Try to specify parameter in Form interface ->Tables
if u r using that table to export from function module of smart form.
In program declare that table with header line.
regards
vinod
‎2006 Apr 18 5:00 AM
George,
To define an internal table you may use the technique as below. Under TYPES tab define a type like this:
Types: Begin of T_SFC_ITAB occurs 0,
fld1 of SFC_ITAB
fld2 of SFC_ITAB
etc...
......
End of T_SFC_ITAB.
Now define an internal table I_SFC_ITAB type T_SFC_ITAB.
Thanks,
Bala