Hi Experts,
I'm trying to print multiple smartforms using FMs SSF_OPEN and SSF_CLOSE. Inside the main program RBDAPP01 (Inbound processing for IDOCS) there is a loop at the IDOCS to be processed. Deep within the processing, we have a custom FM being called which prints smartforms. Since there is a loop at the calling main program, I have organized the code in the custom FM such that the first IDOC calls SSF_OPEN and the last IDOC calls SSF_CLOSE, so that all IDOCS in between will be able to print their smartforms. Here is the call stack:
8 | SAPLZCUSTOM | ZCUSTOMPROGRAM | 113 | FUNCTION | ZCUSTOMPROGRAM |
7 | SAPLPPC1 | ZCUSTOMPROGRAM | 136 | FUNCTION | KK2A_GET_DATA_FROM_IDOC |
7 | SAPLPPC1 | LPPC1U01 | 1 | FUNCTION | KK2A_GET_DATA_FROM_IDOC |
6 | SAPLBD20 | LBD20F0A | 454 | FORM | IDOCS_PASS_TO_APPLICATION |
5 | SAPLBD20 | LBD20F0B | 69 | FORM | IDOCS_PROCESS |
4 | SAPLBD20 | LBD20U05 | 260 | FUNCTION | IDOC_INPUT |
3 | SAPLEDIR | LEDIRU02 | 182 | FUNCTION | IDOC_START_INBOUND |
2 | SAPLBD12 | LBD12U04 | 37 | FUNCTION | APPLICATION_IDOC_POST_IMMEDIAT |
1 | RBDAPP01 | RBDAPP01 | 388 | EVENT | START-OF-SELECTION |
The problem is:
1. When I only have 1 IDOC being processed, SSF_OPEN and SSF_CLOSE happens in the custom FM at the same time. This creates a successful spool.
2. Whereas, when I have 2 or more IDOCS, SSF_OPEN happens in the first IDOC, but then it goes back to the calling program, and then when the last IDOC is encountered SSF_CLOSE is called. The FM SSF_CLOSE in this scenario calls the exception INTERNAL_ERROR (sy-subrc = 2).
The system message is SSFCOMPOSER - 154 - No output request open. End not possible.
Why is this happening? Is it because that other programs (calling programs) may have affected the status of SSF_OPEN? It seems that the SSF_OPEN is no longer open.
Thanks in Advanced,
Jack