You are on page 1of 11

9/5/2018 How to print new table AT NEW command in smartforms

(http://w
ww.sap.c
Products
om/) (https://www.sap.com/products.html)

Industries (https://www.sap.com/industries.html)

Support (https://www.sap.com/support.html)

Training (https://www.sap.com/training-certi cation.html)

Community (https://www.sap.com/community.html)

Developer (https://www.sap.com/developer.html)

Partner About
(https://www.sap.com/partner.html) About (https://www.sap.com/corporate/en.html)

 
Home (https://www.sap.com) / Community (https://www.sap.com/community.html) / Archives (/) / Discussions + Actions
Archive (/discussions) / Output Management (/discussions/space/output-management)

Archived discussions are read-only. Learn more about SAP Q&A


(https://go.sap.com/community/about/questions-and-answers.html)

How to print new table AT NEW comma


smartforms
This question is answered

Hi all,

I am sending a final table from my report program to smartforms to print the data in table. In that table I had pern
taken a table control and added that table in data->loop. Then my data was printing fine.

https://archive.sap.com/discussions/thread/3273036 1/11
9/5/2018 How to print new table AT NEW command in smartforms

My problem is I want to print the indiviudal tables or one after one employee wise. If one pernr number related re
completed in the first table again for next pernr number I want to start the same new table in the same page by g
each table.

I made selection for "on sort end" for the field pernr. Then an event come under main area. Shall I have to do any
employee wise in separate strips / employees.

Regards,

Praveen Chitturi.

Former Member
November 29, 2012 at 22:04 PM
0 Likes

https://archive.sap.com/discussions/thread/3273036 2/11
9/5/2018 How to print new table AT NEW command in smartforms

Correct Answer

Basar Ozgur Kahraman (https://people.sap.com/basarozgur.kahram


(https://people.sap.com/basarozgur.kahraman)
Nov
Hi Chitturi,

Before loop, fill an internal table(it_pernr) with collect


statement and sort this table. Set it_pernr for loop
data. and create a table inside loop, set visual design
of table whatever you need.

data: begin of it_pernr occurs 0,

pernr type pernr,

end of it_pernr.

loop at it_data.

it_pernr-pernr = it_data-pernr.

collect it_pernr.

clear it_pernr.

endloop.

0
View this answer in context (/discussions/message/13689084#13689084)

Not what you were looking for? View more on this topic (https://go.sap.com/community/tag.html
id=334558737810127171897316045257708) or

Ask a question (https://answers.sap.com/questions/ask.html?primaryTagId=3345587378101271718

https://archive.sap.com/discussions/thread/3273036 3/11
9/5/2018 How to print new table AT NEW command in smartforms

15 replies

Former Member replied November 29, 2012 at 05:12 AM

hi,

you must bring this logic inside the program and bring every values in the individual
internal tables and pass those into smartforms.

Former Member replied November 29, 2012 at 06:24 AM

From my program I can send only one final internal table to form. It may contain single
or multiple pernr details based on the selection made. So in that case how can i
handle this ?

Former Member replied November 29, 2012 at 06:37 AM

hi,

no you can send multiple table in smartform .

See in form interface in tables you can declare multiple tables..

handle those multiple tables by writing code inside the smartforms.

regards and hope this helps,

Vinoth Aruldass

Former Member replied November 29, 2012 at 07:33 AM

Hi,

Try this method.


https://archive.sap.com/discussions/thread/3273036 4/11
9/5/2018 How to print new table AT NEW command in smartforms

Sort the internal table by pernr before sending to the smartform function module. In
smartform in each loop pass check whether pernr is changed with the old value of
pernr. based on this you can put breaks.

You can also use on change of statement but it is obselete.

thanks.

Former Member replied November 29, 2012 at 09:20 AM

Hi aswath,

I had sorted the table and put the after sort end event then one default event was
triggered and appearing in after the main area of table. What can i mention there in
that event?

Former Member replied November 29, 2012 at 09:40 AM

Hi,

Inside the loop of the internal table itself do this.

using a variable, Put the old value of pernr in that variable and check it with new value
or pernr in the loop. Now when the value changes trigger the break. This will not be
applicable for the first time of the loop since there is no old value of pernr so use a flag
to control for the first times loop pass.

thanks.

(https://people.sap.com/rosenberg.eitan)

Eitan Rosenberg (https://people.sap.com/rosenberg.eitan)replied November 29, 2012 at 10:00 AM

Hi,

https://archive.sap.com/discussions/thread/3273036 5/11
9/5/2018 How to print new table AT NEW command in smartforms

Are you looking for somthing like this ?

Former Member replied November 29, 2012 at 13:27 PM

Yes Eitan,

I am expecting same type of output like that screenshot attached.

(https://people.sap.com/rosenberg.eitan)

Eitan Rosenberg (https://people.sap.com/rosenberg.eitan)replied November 29, 2012 at 13:57 PM

In your program:

https://archive.sap.com/discussions/thread/3273036 6/11
9/5/2018 How to print new table AT NEW command in smartforms

FORM get_data_1

CHANGING

it_scarr TYPE ty_scarr

it_sflight TYPE ty_flights .

SELECT * INTO TABLE it_sflight

FROM sflight

UP TO p_maxsel ROWS

WHERE

carrid IN s_carrid AND

connid IN s_connid AND

fldate IN s_fldate .

FIELD-SYMBOLS: <it_sflight> LIKE LINE OF it_sflight .

DATA: st_scarr LIKE LINE OF it_scarr .

LOOP AT it_sflight ASSIGNING <it_sflight> .

<it_sflight>-paymentsum = 0 .

st_scarr-carrid = <it_sflight>-carrid .

COLLECT st_scarr INTO it_scarr .

ENDLOOP .

FIELD-SYMBOLS: <st_scarr> LIKE LINE OF it_scarr .

LOOP AT it_scarr ASSIGNING <st_scarr> .

SELECT SINGLE * INTO <st_scarr>


https://archive.sap.com/discussions/thread/3273036 7/11
9/5/2018 How to print new table AT NEW command in smartforms

FROM scarr

WHERE

carrid EQ <st_scarr>-carrid .

ENDLOOP .

ENDFORM. "get_data_1

*---------------------------

In your form:

https://archive.sap.com/discussions/thread/3273036 8/11
9/5/2018 How to print new table AT NEW command in smartforms

Former Member replied November 29, 2012 at 10:27 AM

Hi Aswatha Narayana

My understanding of requirement is you have a table with some records and you want
to break at end of the key field and display it in the different boxes.

I tried to attche the document but it is taking lot of time if you can send your mail id i
will send it to you MY id G.sreekanthgoud@gmail.com
(mailto:G.sreekanthgoud@gmail.com)

https://archive.sap.com/discussions/thread/3273036 9/11
9/5/2018 How to print new table AT NEW command in smartforms

Former Member replied November 29, 2012 at 10:48 AM

Hi Sreekanth,

thanks for your concern. I understood it now after seeing the Image above......

Hi Praveen, you can achieve this in the way @Basar Ozgur Kahraman
(https://people.sap.com/basarozgur.kahraman) mentioned.

thanks.

Correct Answer

(https://people.sap.com/basarozgur.kahraman)

Basar Ozgur Kahraman (https://people.sap.com/basarozgur.kahraman)replied

November 29, 2012 at 10:23 AM

Hi Chitturi,

Before loop, fill an internal table(it_pernr) with collect


statement and sort this table. Set it_pernr for loop data.
and create a table inside loop, set visual design of table
whatever you need.

data: begin of it_pernr occurs 0,

pernr type pernr,

end of it_pernr.

loop at it_data.

it_pernr-pernr = it_data-pernr.

collect it_pernr.

clear it_pernr.

endloop.

https://archive.sap.com/discussions/thread/3273036 10/11
9/5/2018 How to print new table AT NEW command in smartforms

(https://people.sap.com/rosenberg.eitan)

Eitan Rosenberg (https://people.sap.com/rosenberg.eitan)replied November 29, 2012 at 10:44 AM

Hi Basar .

In my solution I did the same but I it did it in the calling program.

Then I passed the tables as parameters to the form. Much easier to debug

Former Member replied November 29, 2012 at 13:54 PM

Hi basar,

A little about confusion in the program lines.

Actually I am filling the final internal table (it_final) and sending this final internal table
to smartform table. There I kept a table control and printing the data.
Share & Follow
So the code what you mentioned where I have to declare and what it will does?
(https://www.facebook.com/sapcommunity) (https://twitter.com/SAPCommunity)
Please kindly take some patience for (https://www.linkedin.com/company/sap)
(https://www.youtube.com/c/SAPCommunities)
me. Thanks in advance boss.

Regards,
(https://plus.google.com/+SAPCommunities) (https://instagram.com/sap/) (http://www.slideshare.net/SAP)

Praveen chitturi.
Privacy (http://go.sap.com/about/legal/privacy.html) Terms of Use (http://go.sap.com/corporate/en/legal/terms-of-use.html)
Legal Disclosure (http://go.sap.com/about/legal/impressum.html)
0 Copyright (http://go.sap.com/about/legal/copyright.html)
Trademark (http://go.sap.com/about/legal/trademark.html) Cookie Preferences
Sitemap (http://www.sap.com/sitemap/index.html) Newsletter (https://go.sap.com/registration/newsletter.html)

https://archive.sap.com/discussions/thread/3273036 11/11

You might also like