Spools created from Smartform - Issue with Sequence of Spools
I have a Custom SmartForm called in a Custom Program creates Spool for each SmartForm. I have an internal table sorted before it calls the SmartForm. Between Loop & Endloop, each time it calls the SmartForm, it generates the Spool. Even though the Spools numbers created are in Sequence, the SmartForms are not in line with the SORT order in the Internal table i.e., The Internal table is SORTed for Material Number and I expect the SmartForms (Spools) to be generated for the same Order with that of Internal table. Do I have to include a Commit Statement for each and every call to the Smatform inside the Loop/Endloop?
I hope I have made my posting understandable. Please let me know if you have any solutions.
I Appreciate Your Help!
Naimesh Patel replied
It is hard to tell why system is not processing Smartform in given sequence. But you can link the spool with its genertor's number.
To link between your material number and generated spool you can one more field in the SPOOL table.
DATA: BEGIN OF IT_SPOOL OCCURS 0, MATNR TYPE MATNR, SPOOL TYPE I, END OF IT_SPOOL. LOOP AT ITAB. * CALL OF SMARTFORM * GET THE SPOOL NUMBER FORM RETURN IT_SPOOL-MATNR = ITAB-MATNR IT_SPOOL-SPOOL = <SPOOL_NO>. APPEND IT_SPOOL. CLEAR IT_SPOOL. ENDLOOP.