‎2006 Jun 01 10:05 AM
Hi
I need some help.
I'm using tables, vbk, kna1 and zbrtab.
I'm trying to fetch records from these 3 tables on the basis of select-option.
I'm able to fetch the records into internal table, now i want them to be printed on the smartform
Could someone help me. I'm able to call the smartform form but it is printing the last record of the internal table. I've used loop at it also.
then I called the function to call the smartform as well as the Fun. Module of that form.
*also please tell me how to show no. of pages displayed in the smartform.
Thanks and Regards,
Deepa
‎2006 Jun 01 10:58 AM
HI
GOOD
CHECK WHEATHER AFTER LOOPING THE INTERNAL TABLE YOU HAVE APPENDED THE FIELD INTO THE INTERNAL TABLE OR NOT.IF YOU WONT APPEND IT WILL SHOW THE LAST RECORD ONLY.
THANKS
MRUTYUN
‎2006 Jun 01 10:12 AM
Hi
u hav to decalre the internal structure in the smartform globally and then in the window in which ur printing the itab u hav to give loop into itab(itabnme).
-
>to display the number of pages use <b>SFSY-formpages</b> or <b>SFSY-jobpages</b>(this gives u total number of pages in the spool)
‎2006 Jun 01 10:23 AM
I hope you are using only one internal table finally to fill all the data fetched from the 3 tables.
Create a structure(say ZLT_TEST) in SE11 with all the fields of your final internal table. Create a Tabletype(Say ZTT_TEST) in SE11 and give this structure name as the Linetype..
Now in the form interface, in Tables tab, give the tablename(say ITAB) of type ZTT_TEST.. In Global attributes, create a variable(say WA) of type ZLT_TEST..
In MAIN window, create a TABLE and in DATA tab,
ITAB into WA...
and use WA fields in the TABLE texts
‎2006 Jun 01 10:25 AM
Hii
I guess you might be printing thevalue
outside the loop .
Try printing the value inside the loop .
otherwise paste your code
as regards page number
<b>&page&</b> -- prints the current page no
also check this and use per your functionality
<b>&sapscript-formpages&</b> to print the number of
pages written to the form
<b>&sapscript-jobpages&</b> to print the number of
pages written to the spool list
<b>/: &page& &sapscript-formpages&
/: &page& &sapscript-jobpages&</b>
/: &page& <b>of</b> &sapscript-formpages&
The first page of the document will take the value of d_page_number
<b>/: ^$PAGE d_page_num</b>
Reward points if helpful
revert back for more help
regards
Naresh
‎2006 Jun 01 10:33 AM
Hi Deepa,
I think, you have written LOOP statement in the print (driver) program to print each record and Then within the the LOOP... ENDLOOP, you called smartform function module.
Here you can follow this method,
In the driver (print) program, Just fetch all records based on selection cretiria from the different database tables and store them in a internal table.
Then call your smartform dynamic function module and assign corresponding parameters and your internal table.
In the Layout, design your windows. Create a TABLE node in the Main window and assign your internal table to the TABLE node.
Make sure that, the internal table structure should be same in the layout and in your driver (print) program.
For no of pages: just use system variables. &PAGE& and &SYSF-FORMPAGES&
Let me know if you have any issues.
Thanks,
Ram
‎2006 Jun 01 10:43 AM
hi,
I've created a structure in se11 of the 3 internal table type, then in DATA tab of Table i've Internal table = 'It' into 'It'.
and when I try to call this smartform in the report I'm still getting the single record in the smartform.
Please help.
Thanks and Regards,
Deepa
‎2006 Jun 01 10:46 AM
Have you specified the postion for the fields in the cells for your TABLE node..?
‎2006 Jun 01 10:55 AM
hi deepa,
did u write in the smartform for the table u have created in the <b>Data</b> tab did u specify the loop
checking the operand...
thanks,
priya.
‎2006 Jun 01 10:58 AM
HI
GOOD
CHECK WHEATHER AFTER LOOPING THE INTERNAL TABLE YOU HAVE APPENDED THE FIELD INTO THE INTERNAL TABLE OR NOT.IF YOU WONT APPEND IT WILL SHOW THE LAST RECORD ONLY.
THANKS
MRUTYUN
‎2006 Jun 02 11:05 AM
Hi Mrutyunjaya,
I just put the internal table name in the Data tab of Table in Smartform, could you please tell me how to append the internal table lines in smartform.
Thanks and Regards,
Deepa
‎2006 Jun 01 12:53 PM
***This is followin code which I've wriiten
Please see is something which I've done wrong, please correct it and let me know where I need to correct it and what mistake I've done.
I've created a table in Main node and there in data i've typed in It(structure which is same as in my report)
I'm able to get the data in my internal table in report on the basis of the following query in the report, but when I'm trying to call the smartform it is only showing the first record of the internal Table.
When I use Loop at IT in report and call the smartform in that loop then in smartform the last record of the internal table is getting printed,
I'm unable find the solution please help,
Thanks in advance for your valuable time and support.
Please help.
Thanks and Regards,
Deepa.
REPORT ZSMARTFORM_CR .
*****************************************************
*
Created By : Deepa Roy Chowdhury *
Date : 26th May 2006 *
Assignment Given by: Sameer Bhargava *
*
*****************************************************
tables: zbrtab,
vbak,
kna1,
zit_cr.
DATA: /1BCDWB/SF00000274 TYPE rs38l_fnam.
*data: begin of it occurs 0,
kunnr like zbrtab-kunnr,
spart like zbrtab-spart,
vbeln like zbrtab-vbeln,
bldat like zbrtab-bldat,
invamt like zbrtab-invamt,
dmbtr like zbrtab-dmbtr,
vbelv like zbrtab-vbelv,
Name1 like kna1-name1,
name2 like kna1-name2,
ort01 like kna1-ort01,
pstlz like kna1-pstlz,
stras like kna1-stras,
bstnk like vbak-bstnk,
bstdk like vbak-bstdk,
amtinv(13) type p decimals 2,
amtpe(13) type p decimals 2,
sysd like sy-datum,
end of it.
*data: it type table of zbrtab with header line,
it1 type table of kna1 with header line,
it2 type table of vbak with header line,
it3 type table of zit_cr with header line.
data: begin of itab occurs 0.
include structure zit_cr.
data: end of itab.
data dt like sy-datum.
data amt5 type p decimals 2.
itab-sysd = sy-datum.
dt = itab-sysd.
select-options S_vbelv for zbrtab-vbelv.
*parameter S_vbelv like zbrtab-vbelv.
select kunnr spart vbeln bldat invamt dmbtr vbelv from zbrtab into
corresponding fields of table itab
where vbelv in S_vbelv.
loop at itab.
select single name1 name2 stras ort01 pstlz from kna1 into (itab-name1,
itab-name2,itab-stras,itab-ort01,itab-pstlz) where kunnr = itab-kunnr.
*into(it-name1 , it-name2 , it-stras , it-ort01 , it-psltz)
select single bstnk bstdk from vbak into (itab-bstnk,itab-bstdk)
*(it-bstnk,it-bstdk)
where vbeln = itab-vbeln.
modify itab index sy-tabix.
endloop.
loop at itab.
itab-datem = dt - itab-bldat.
move itab-invamt to itab-amtinv.
move itab-dmbtr to itab-amtpe.
amt5 = itab-invamt + itab-dmbtr.
move amt5 to itab-amt5.
if itab-datem >= 90.
move itab-amtinv to itab-amt1.
elseif
itab-datem lt 90 and itab-datem ge 60.
move itab-amtinv to itab-amt2.
elseif
itab-datem lt 60 and itab-datem ge 30.
move itab-amtinv to itab-amt3.
*write: / ' 30 days'.
else.
move itab-amtinv to itab-amt4.
*write: / 'current'.
endif.
itab-sysd = dt + 15.
modify itab index sy-tabix.
endloop.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZCR_SMARTFROM'
FM_NAME = /1BCDWB/SF00000274.
CALL FUNCTION '/1BCDWB/SF00000274'
EXPORTING
TABLES
it = itab.
EXCEPTIONS