Application Development 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: 

CL_DD_DOCUMENT add page-break

kim_ternstrm
Explorer
0 Kudos
592

I have made a stand alone report using CL_DD_DOCUMENT to output the report on the screen (could not be solved by ALV, and using WRITE was to old school......)

The report shows yield for process orders, and each order has 3 table (Header/Body/footer).

Now a print is needed for the people on the shop floor and I therefore need to be able to insert a page-break after each process order (after the footer table).

Only solution I can see is to manipulate the html that is being generated (HTML_TABLE is public attribute of class CL_DD_AREA)

I have little/no knowledge of coding HTML, but I found that there is CSS page-break-after Property that could be used for this. But where to place this.

While generating the output a "template" is generated before data are merged into the HTML file by calling MERGE_DOCUMENT.

The HTML code generated looks like there is a style defined which is used to all tables, where it could be placed, but then I would get a page-break after each table. But that would result in a order being split over 3 pages. It is only after the 3th table (footer) I want a page-break.

Here is a link to the HTML, with 2 process order. I would like a page-break after the "A1T3" table

A link to the HTML file before MERGE document : https://www.dropbox.com/s/syzht2hqqlb1nfj/HTML%20template%202%20orders.html?dl=0

HTLM after MERGE_DOCUMENT (sorry download resultet in some errores) https://www.dropbox.com/s/lps6mk8x3ihgvy4/HTML%202%20orders.html?dl=0

Anyone that can come up with a hint on how/where to "inject" code. If this can't be solved, I might end up writing a SmartForm to handle the print out for the shop floor, but would really like to avoid this

5 REPLIES 5

Sandra_Rossi
Active Contributor
0 Kudos
310

It's better to post the code within the question instead of external hyperlink, otherwise the question will have no interest for future visitors if the external hyperlink disappears.

Sandra_Rossi
Active Contributor
0 Kudos
310

To be honest, those DD classes are just horrible. If I have to create HTML again from ABAP program, I would create my own classes.

Concerning your question, the easiest way to overcome this kind of limitation is to generate fake text where you need, retrieve the final HTML_TABLE attribute from the document instance (after running MERGE_DOCUMENT), and replace manually this text with the HTML code you want.

kim_ternstrm
Explorer
0 Kudos
310

It's not code - it's HTML

<html><head><!--750:UDV -->
<meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-style-type" content="text/css">
<style> body{ background-color:#FFFFFF; color:#000000; font-family:Tahoma,helvetica,sans-serif; font-size:10pt; }
table{ font-family:Tahoma,helvetica,sans-serif; font-size:10pt; } table.dd{ border-width:2px; border-style:solid; border-collapse:collapse; border-color:#4F556A; }
table.dd th{ border-width:1px; padding:2px; border-style:solid; background:#6780B8; color:#FFFFFF; } table.dd td{ border-width:1px; padding:2px; border-style:solid; }
table.trans{ border-style:none } table.trans td{ border-style:none; padding:0 } table.trans table.dd table.trans td{ border-style:none; padding:0 }
table.trans table.dd td{ border-style:solid; padding:2px; }
button{ font-family:Tahoma,helvetica,sans-serif; font-size:10pt; background-color:#FFFFFF; margin:0px; width:100%; cursor:pointer; height:20px; text-align:center;
 background-image:url(back.gif); padding-left:5px; padding-right:5px; border-left:1px solid gray; border-right:1px solid gray; border-top:0; border-bottom:0; }
button span{ white-space:nowrap; vertical-align:top; } .imgButtonLabel{ padding-left:5px; }
input{ font-family:Tahoma,helvetica,sans-serif; font-size:10pt; } select{ font-family:Tahoma,helvetica,sans-serif; font-size:10pt; }
a{ text-decoration:none; color:#0063A4; } a:hover{ text-decoration:underline; } a:visited{ color:#666666; }
.HEADING{ font-size:18pt; } .KEY{ background-color:#CCE3E3; } .SUCCESS{ background-color:#C6F9C1; } .WARNING{ background-color:#FF988C; }
.HEADER1{ background:#6780B8; font-family:Tahoma,helvetica,sans-serif; color:#FFFFFF; }
</style><script language="JavaScript">
 var enter_pressed = " ";
 function ButtonClick(form,button) { if(enter_pressed == " "){ fname=form.name; form.sapbu_cl.value=button.id; form.sapse_cl.value=" "; form.sapin_cl.value=" "; document[fname].submit();} else{enter_pressed = " "; } }
function SelectChange(form,select) { fname=form.name; form.sapbu_cl.value=" "; form.sapse_cl.value=select.id; form.sapin_cl.value=" "; document[fname].submit();}
function InputHelpF1(form,input) { fname=form.name; form.sapbu_cl.value=" "; form.sapse_cl.value=" "; form.sapin_cl.value=input.id + "sapHELPF1"; document[fname].submit();}
function InputKeyDown(form,input) {form.sapbu_cl.value=" "; form.sapse_cl.value=" "; if(event.keyCode == 115) {form.sapin_cl.value=input.id+"sapHELPF4"; fname=form.name; document[fname].submit();}
 if(event.keyCode == 13 || event.keyCode == 10) { form.sapin_cl.value=input.id+"sapENTER"; enter_pressed="X"; fname=form.name; document[fname].submit();} }
function toggle(areaname) { target = document.all(areaname); if (target.style.display == "none") { target.style.display = "";} else { target.style.display = "none"; } }
</script></head><body
>
<!%_BODYSTART>
 <span class="HEADING">Header</span> <span class="HEADING">Input:</span> <br>
<!%_A1T1!> <table class="dd" id="A1T1"


</tr></tbody></table><!%_/A1T1!>
 <br> <span class="HEADING">Output quantity:</span>
<!%_A1T2!> <table class="dd" id="A1T2"


</tr></tbody></table><!%_/A1T2!>
 <span class="HEADING">Footer:</span> <br>
<!%_A1T3!> <table class="dd" id="A1T3"


</tr></tbody></table><!%_/A1T3!>
 <span class="HEADING">Header</span> <span class="HEADING">Input:</span> <br>
<!%_A1T4!> <table class="dd" id="A1T4"


</tr></tbody></table><!%_/A1T4!>
 <br> <span class="HEADING">Output quantity:</span>
<!%_A1T5!> <table class="dd" id="A1T5"


</tr></tbody></table><!%_/A1T5!>
 <span class="HEADING">Footer:</span> <br>
<!%_A1T6!> <table class="dd" id="A1T6"


</tr></tbody></table><!%_/A1T6!>


<!%_CURSOR!><!A1>


<br>

Sandra_Rossi
Active Contributor
310

What I call "HTML code" is what you call "HTML" (if you prefer I may call that "HTML tags").

And you don't want to insert your HTML "page break" (whatever it means for you/whatever HTML code it corresponds to) directly inside this HTML?

kim_ternstrm
Explorer
0 Kudos
310

I'm just an old ABAP dinosaur trying to learn new tricks, without even knowing the right terms 😉

I thought that the page-break only could be used in the top where the style and the DD classes are defined.

But as you wrote - I tried to put in a "fake" text after the 3. table, and replaced the fake text with this:

<p style="page-break-before: always">

Now I have a page-break when the list is printed