cancel
Showing results for 
Search instead for 
Did you mean: 

Problem while calling a smartform

Former Member
0 Kudos

Hi friends,

when iam calling the generated function module in my driver program its giving an error saying that "No ouptput request open Documnet processing not possible"

how can i correct it..

actually iam looping my internal table and calling the smartform

loop at it_data into wa_data

call function < smart form name >

endloop.

but its rasing sy-subrc = 2

saying that internal_error.

How can i correct it...

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

If you really want to call the smartform in a Loop , then use NO_OPEN NO_CLOSE parameters in the control paramters of the SSF FM ,so that u will generate only one spool and print at the end of the loop .

But it is best to pass the Table to the Smartform and print the Page /window as per the entries in the Table rather than calling the smartform in a loop , this will degrade the performance......as this will call SSF n times based on the entries in the TABLE..

surya

Former Member
0 Kudos

Actaully iam facing a problem here

Iam looping the internal table ITAB

Loop at itab into wa_itab

append wa_itab to ITAB2.

AT end of particular field only the smart form function module will be triggered

ie say i have 40 records in the itab2 and iam passing those 4o records to the function module

CALL FUNCTION MODULE < FM N >

endloop.

it should collect all the records and print at last...

ie: it should colect all the records of First internal table ITAB and should send all the records to only one spool at last

How can i correct it..

Regards

Kumar

venkat_o
Active Contributor
0 Kudos

Hi Kumar, You need to set NO_OPEN, NO_CLOSE properly to get records printed on smartform. Just try to simulate like my program which has been developed to test your situation. It works.


REPORT  ztest_smartform.
DATA:it_nfal        TYPE nfal       OCCURS 0 WITH HEADER LINE.
DATA:it_nfal_final  TYPE nfal       OCCURS 0 WITH HEADER LINE.
DATA:fm_name        TYPE rs38l_fnam.
DATA:wa_control_par TYPE ssfctrlop.
DATA:output_options	TYPE ssfcompop.
DATA:flag           TYPE c.
DATA:no_of_records  TYPE i.

"START-OF-SELECTION.
START-OF-SELECTION.
  "select data
  SELECT * FROM nfal INTO TABLE      it_nfal UP TO 10 ROWS WHERE einri = 'CGH'.
  SELECT * FROM nfal APPENDING TABLE it_nfal UP TO 10 ROWS WHERE einri = 'SGH'.
  SELECT * FROM nfal APPENDING TABLE it_nfal UP TO 10 ROWS WHERE einri = 'KKH'.
  SORT it_nfal BY einri.
  DESCRIBE TABLE it_nfal LINES no_of_records.
  LOOP AT it_nfal.
    AT FIRST.
      "Get Function module name for given smartform
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname = 'ZTEST_SMARTFORM'
        IMPORTING
          fm_name  = fm_name.
    ENDAT.
    IF sy-tabix = no_of_records.
      flag = 'Y'.
    ENDIF.
    APPEND it_nfal TO it_nfal_final.
    AT END OF einri.
      "Set Control parameters
      IF flag = space.
        "Set the below one before we call smartform for the first time.
        wa_control_par-no_open  = space.
        wa_control_par-no_close = 'X'.
        flag = 'X'.
      ELSEIF flag = 'X'.
        "Set the below one for remaining calls to smartform
        wa_control_par-no_open  = 'X'.
        wa_control_par-no_close = 'X'.
      ELSEIF flag = 'Y'.
        "Set the below one for last call to smartform.
        wa_control_par-no_open  = 'X'.
        wa_control_par-no_close = space.
      ENDIF.
      "Call Smartform function module.
      CALL FUNCTION fm_name
        EXPORTING
          control_parameters = wa_control_par
        TABLES
          it_nfal            = it_nfal_final.
    ENDAT.
  ENDLOOP.
I hope that it solves. Thanks Venkat.O

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

No nedd to call the Smartform Inside the loop. Aftert the Loop u can call the smart form.

Former Member
0 Kudos

HI,

Try the following



  DESCRIBE TABLE g_t_itab LINES sy-tfill.
      CLEAR g_count.
      g_count = sy-tfill.

      CLEAR g_t_itab.
      LOOP AT g_t_itab INTO g_w_itab.

        IF g_count NE 1.
          IF sy-tabix EQ 1.
            g_ctrl_op-no_close = c_x.
          ELSE.
            CLEAR: g_ctrl_op-no_close.
            g_ctrl_op-no_open = c_x.
          ENDIF.
        ENDIF.

here g_t_itab is the table you need to loop at. and g_t_ctrl is the work area type teh control structure of ur smartforms.

This would work...Let em know in case youi need more assistance!

Cheers,

Varna

Former Member
0 Kudos

Hi,

I did not get your requirement.

First of all, why there is a need to call a smartform in a loop.

Moreover, the output records for the document to be printed may have to be in sync with the number of times you are trying to call the smartforms.

So, if the number of copies you require for a document is 5 then you need to loop and call the smartform five times.

However, in your case you are trying to loop your data table and passing each record to the smartform.

Why dont you pass the entire internal table to the smartform interface and then loop the internal table inside the smartform.

Also the required number of copies you can mention in the output records and do loop so many times to call the smartforms in your driver program.

Regards,

Ram