Reports like Sales Order Print, Invoice Print, Purchase Order Print often have the requirement to print the Page Numbers inline with the Orders. For e.g. each order should have Page numbers starting from 1. It becomes even complex when you have to reset page numbers like Page X of Y (like Page 1 of 3, Page 2 of 3 and Page 3 of 3) where X is the concurrent page number and Y is the total page count for an order.
To Reset Page the number is easy, where you just have to call the B9800580-Set Report Page Number BSFN to reset to the page number you need. But when you need to show the Total pages for an order or so, this BSFN does not satisfy the requirement. The B9800580 uses the API – ubeReport_SetpageNumber. To reset the Y value (Total number of pages), use a different API called ubeReport_SetPageNumberEx :
ubeReport_SetPageNumberEx(lpBhvrCom, lpDS->nPageNumber, lpDS->nResetTotalPages);
Where nPageNumber: set the page number to any number you want
nResetTotalPages: 1: resets the total pages to 1, 0: leaves it alone
Following is how you achieve the requirement.
- Create Data structure D5598058:
- PAGN – Page Number
- PGNF – Page Number Report (pass only 1 or 0)
- SUPPS – Suppress Error Message
- DTAI – Error Message ID
- Create a Custom BSFN : B5598058 – Set Report Page Number Ex
/************************************************************************ * Variable declarations ************************************************************************/ int nPageNumber; //PAGN int nResetTotalPages; //PGNF /************************************************************************ * Main Processing ************************************************************************/ jdeStrcpy (lpDS->szErrorMessageID, _J(" ")); MathNumericToInt (&lpDS->mnPageNumber, &nPageNumber); MathNumericToInt (&lpDS->mnPageNumberReport, &nResetTotalPages); if ((nNumber < 0) || (nNumber > 9999) || (!ubeReport_SetPageNumberEx (lpBhvrCom, nPageNumber, nResetTotalPages))) { jdeStrcpy (lpDS->szErrorMessageID, _J("0279")); } /************************************************************************ * Function Clean Up ************************************************************************/ if (lpDS->szErrorMessageID[0] != _J(' ')) { return (ER_ERROR); } else { return (ER_SUCCESS); }
- On the Level Break Header of Order Number, call the Custom BSFN to reset the Page Number.
Hope this helps many!

![[Google]]( http://www.jdesource.com/wp-content/plugins/easy-adsense-lite/google-light.gif)

Nice one…
You can check this also
http://peoplesoft.ittoolbox.com/groups/technical-functional/jdedwards-l/resolved-issue-with-y-portion-of-page-x-of-y-947563
Deepesh,
Does this API ubeReport_SetPageNumberEx supported in higher releases like 9.0? I guess its working only XE. Can u please confirm the same?
Regards,
Sankarguru Mani
Sankarguru,
This API applies to JD Edwards EnterpriseOne Tools – Version S23 and later.
Deepesh
Deepesh,
nNumber is not declared anywhere, what is the value its holding? or is it referring to mnPageNumber?
Regards,
Sankar
Hi Sankarguru,
I have formatted the code for readability. The Variable’s being typecasted to int.
Deepesh
good one