cancel
Showing results for 
Search instead for 
Did you mean: 

RESERVE command alternative in ABAP report

former_member378318
Contributor
0 Kudos

We have a requirement to print article pricing data on a report (simple list, not ALV or SAP Script). If data for the next article does not fit on the remaining lines of the current page then a new page should be started. I know we can use the RESERVE command but this means working out how many lines the next article will use. Is there anything like the PROTECT/END PROTECT command used in SAP Script that we can use in the ABAP report? Or can anyone suggest another way?

Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member378318
Contributor
0 Kudos

Hi Andreas,

What do you mean by MAX? Do you mean the MAX any article will ever need, if this is the case then there will too much wasted space. For example if we reserve a MAX of 30 lines for each article and only ever use on average 10 lines.

Or did you mean something else.

Dhillon

andreas_mann3
Active Contributor
0 Kudos

ok - that's wasteful to reserve 30 lines.

Andreas

Former Member
0 Kudos

Hi,

I think that you should count the next article lines and if it is necessary to use NEW-PAGE.

Svetlin

former_member378318
Contributor
0 Kudos

I don't think there is anyway around this other than to count the number of lines for the article before starting to print and throw a new page if necessary. I was hoping to avoid doing this as counting the number of print lines for an article will be quite involved.

I think what I shall do is collect all required data for an article and then call a print routine. The print routine shall be called twice, the first time it shall not print the data but count each line that would be printed. On return from the first call to this routine I shall have available the total number of print lines for the article. Now I shall do a NEW-PAGE if needed and call the print routine a second time to actually print the data.

Each WRITE command in the print routine shall have to take the form:

IF print_on.

WRITE:/ ......

ELSE.

ADD 1 TO g_total_print_lines_for_article.

ENDIF.

The overhead to calling the print routine twice shall not be that great as all the data will already have been collected prior to the first call.

Messy but necessary I guess.

Cheers

andreas_mann3
Active Contributor
0 Kudos

Hi,

can't you calculate the (max) number of lines to reserve

before output ?

regards Andreas