cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Form LOOP statement generates unwanted blank page at the beginning

former_member210148
Participant
0 Kudos

Good day, all! Smart Form newbie here with another question. Yes, I've searched for answers to this issue, and I've found many that address blank pages at the end of a report, but nothing that seems to address my situation. I've tried all sorts of things to suppress this guy, but he just keeps popping up. Here's what I'm doing.

I have a table that I pass into my Smart Form. It contains rows of data that I want to spit out to a report. It's sorted by two fields, WERKS and ORGEH; if EITHER of these fields changes, then I want to do a page break because the report is to be distributed to different areas (and obviously they only want to receive the report for the people in their area).

My form is set up as follows; I'm using the dashes to try to indicate the indentation of how things are set up:

MAIN PAGE

---WINDOW report title

--- ---TEXT Title 1

--- ---TEXT Title 2

---MAIN main window

--- ---LOOP (loops at my internal table into a work area)

--- --- ---LOOP HEADER (Print Time: At Start of Table; At Page Break)

--- --- --- ---TEXT Section details (WERKS/ORGEH values)

--- --- --- ---TEXT Column headings

--- --- ---WERKS event on sort begin

--- --- --- --- CODE line of code to set my new page switch to TRUE

--- --- ---ORGEH event on sort begin

--- --- --- --- CODE line of code to set my new page switch to TRUE

--- --- ---COMMAND generate a new page if condition new page switch = TRUE

--- --- ---CODE reset new page switch to FALSE

--- --- ---TEXT display detail row

For the most part, my report works beautifully. I get a page listing the employees for that WERKS/ORGEH. When it changes, it page breaks and puts the next set of employees on the next page.

The problem is that the very first page has my report title (TEXT Title 1 and 2), a Section Details that has a blank org. code and "00000000" for org. unit, and no detail rows under my column headings. It's the page after this that my report runs properly.

I've tried juggling code around and experimented with temporary switches to somehow let the Smart Form know not to print this blank page, but I'm coming up empty-handed. I'm thinking my "newness" at Smart Forms is causing me to miss something easy, as this is a pretty straight-forward and simple report.

Any ideas? Thanks so much in advance for your help!

Edited by: Dave Packard on Apr 21, 2010 2:07 PM

Edited by: Dave Packard on Apr 21, 2010 2:08 PM

Accepted Solutions (1)

Accepted Solutions (1)

asik_shameem
Active Contributor
0 Kudos

Hello Dave,

Its nice to see such a explanatory question. As per my understanding of your problem, event on sort begin triggers for the first record of the internal table and making the flag as TRUE. So you just put another condition in the COMMAND node as SY-TABIX NE 1. So it skips for the first record.

COMMAND generate a new page if condition new page switch = TRUE " & SY-TABIX NE 1

former_member210148
Participant
0 Kudos

Thank you for your response, Asik! I hope to try that out later this week and see if it solves my problem! I'll be sure to post here with the results either way.

Thanks again, and have a great day.

Dave

former_member210148
Participant
0 Kudos

Okay, I tried it, and here's what happened:

I no longer got that blank first page. My first page had my 5 records as expected, with my second page having my remaining 4 records -- again, as expected.

However, there's a problem in the header info on the first page. It looks like the blank header information that used to be on my initial blank page with no records -- in other words, the Company and Org. Code fields are blank, and the Org. Unit field is all zeros. It's strange because the detail records do print under it, so I'm not sure why the Smart Form doesn't have the values to put in the header at that point.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please check if there is a check box related to 'Page protection' provided at this window. If yes, check that and see the output.

Asha

former_member210148
Participant
0 Kudos

I wasn't sure to which window you were referring, but I checked all of them and don't see "Page Protection" checked on the "Output Options" tab for any of them.

Edited by: Dave Packard on Apr 21, 2010 3:03 PM