‎2006 Jun 06 10:48 AM
I am populating internal table with all the data (customer codes) and passing to smartform at once.
My internal table structre is like this
________________________________________________
cus-cd Material Sales
________________________________________________
10001 M1 100
10001 M2 75
10002 M1 150
10002 M2 200
________________________________________________
In smartform I have to display cus-cd 10001 in first page, 10002 information on second page.
Could you pls give some solution for this.
Regards,
MARK K
‎2006 Jun 06 11:11 AM
Hii
Loop at the table and call the SMART Form at AT NEW command.
Ideally, It would be better to call the SMART Form in the loop of the internal tables, once per each change in values ( at new)
2. If you want to force a page break anyways, use the COMMAND object and specify Go TO NEXT PAGE.
anyways Please try the following
In the Table node containg the ITAB->Choose Data Tab
<b>-> Click on the check box Already Sorted
-> Type the field name for Customer in Sort Criteria and select Event on sort Begin and Event on sort End
-> You will now get a new node 'Event on Sort begin"
-> Add the command node below it
-> In the command node choose the Goto New Page (Default Page will be automatically displayed)</b>'
regards
Naresh
‎2006 Jun 06 11:13 AM
hi Mark,
Use <b>NEW-PAGE</b> STATEMENT FOR THE SAME...
Regards,
Santosh
‎2006 Jun 06 11:53 AM
Hi Naresh,
Thanks for your guidelines. It is working fine, but some problems are there, which are listed below.
1. Customer name and address which is in the separate window is not changing when the body changes for each customer.
2. The first page is blank.
Kindly help me to solve this.
Regards,
‎2006 Jun 06 12:52 PM
Hi Mark,
You should use the same data for your customer address as the data used in the Main Window. Because, you are deviving dynamically customers in the Main Window. So you should pass the same fields data.
In form processing, Main window will be processed first and remaining later at point of break.
In the first loop, you shold make sure not to trigger the page break command. So, you wont get first page blank.
I have worked on those issues several times and i am sure it will work it out.
Regards,
Ram
‎2006 Jun 06 11:14 AM
Hi Mark,
Its very simple.
If you using TABLE node to loop all the records, here is the solution for you.
Within the TABLE Node (means like LOOP statement)..write program lines code to check the previous cuc-cd number is same or not.
If not same, then use command node for page-break. So, automatically 10001 will be printed in first page and 10002 will be printed on second page. This solution works for any type of similar data.
Another solution is, LOOP node and Program lines. but logic is same as above to check the previous record and current record.
Just delcare 2 fields in the global definations and for
every loop assign the new value to one field and check the other field which having old value.
Its easy to implement and i already done it.
let me know if you need more information.
‎2006 Jun 06 11:25 AM
Could u pls, give a sample code, so that I can use the same.
Regards,
‎2006 Jun 06 11:34 AM
Hi Venkat,
Upto point no.7, I have done exactly the same as per your steps. But in point no.8 (Under main Area .Loop ur internal table and display) I am not clear.
Could u pls give more details with sample code.
Regards,
‎2006 Jun 08 3:29 AM
Hi Mark,
Did u get solution for ur query ?
Let me know ,if u dont get it.
<b>Thanks
Venkat.O</b>
‎2006 Jun 06 11:19 AM
Mark,
Instead of using the TABLE object, use a LOOP object and inside that use COMMAND object to trigger new page for every customer.
The COMMAND object does not work in TABLE object.
Regards,
Ravi
‎2006 Jun 06 11:23 AM
Hi Mark ,
Follow these steps.
<b>1</b>.
Go to SE11 T.code .
<b>2</b>.
Create Structure ZSCCODE under Data type (fields are which fields ur internal table has )
<b>3</b>.
Create table type ZTCCODE under Data type (Assigne line type as ZSCCODE ).
<b>4</b>.
That is global Internal table .Y u r creating here is u cant create Internal table with ur own fields in Smartform
<b>5</b>.
Now create Interface Internal table in Global Settings .
like this .
Global Settings->Form Interface->Tables Tab.
i_ccode like ZTCCODE.
<b>6</b>.
And also create Work area
Global Settings->Global Definitions->Global Data
w_ccode like ZSCCODE.
<b>7</b>.
Create Table Node .
Right click on Mainwindow->Create->Table
<b>8</b>.
Under main Area .Loop ur internal table and display .
<b>9</b>.
For more documentation go thru this.
http://help.sap.com/saphelp_47x200/helpdata/en/a9/de6838abce021ae10000009b38f842/frameset.htm
Let me know ,if u need any info .
<b>Thanks,
Venkat.O</b>
‎2006 Jun 06 11:46 AM
Hii Mark ,
for point no : 8
In the global definition on TYPES tab.
TYPES : BEGIN OF WA_TAB,
FILED1,
FIELD2,
END OF WA_TAB.
TYPES : TAB TYPE STANDARD TABLE OF WA_TAB INITIAL SIZE 0.
On the global definition on Global Data tab
ITAB TYPE TAB
WA TYPE WA_TAB
In your code node -
Importing - WA
Exporting - ITAB( this is just to be able to use WA & ITAB in the code )
A-FIELD1 = 'C'.
APPEND WA TO ITAB.
If you want to use this ITAB in any other code / table or loop node you will have to use the option -> Loop at itab into wa.
Regards
Naresh
‎2006 Jun 06 1:19 PM
hii Mark ,
As regards blank page , do not trigger page break or new page in the first loop ..
also follow ram's guidelines ..i guess that should solve your problem ..if the problem is not solved ,paste that part of your code , for we can solve it..
Also reward points to the helpful
Revert bqack for more help
Regards
Naresh