Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Smart Forms

Former Member
0 Likes
1,140

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

12 REPLIES 12
Read only

Former Member
0 Likes
1,110

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

Read only

0 Likes
1,110

hi Mark,

Use <b>NEW-PAGE</b> STATEMENT FOR THE SAME...

Regards,

Santosh

Read only

0 Likes
1,110

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,

Read only

0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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.

Read only

0 Likes
1,110

Could u pls, give a sample code, so that I can use the same.

Regards,

Read only

0 Likes
1,110

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,

Read only

0 Likes
1,110

Hi Mark,

Did u get solution for ur query ?

Let me know ,if u dont get it.

<b>Thanks

Venkat.O</b>

Read only

Former Member
0 Likes
1,110

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

Read only

venkat_o
Active Contributor
0 Likes
1,110

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>

Read only

Former Member
0 Likes
1,110

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

Read only

Former Member
0 Likes
1,110

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