cancel
Showing results for 
Search instead for 
Did you mean: 

smartforms printing problem

Former Member
0 Kudos

Hi Expart,

I am creating smartform . per vendor name wise printing different different page . when vendor have 2 line item data . it is printing 2different page .but my requirment is it is printing one page .

2item data store in Internel table .i m using loop.

itab into wa_itab .

then i am using tamplate .then i m using command line .

when 1st data is comming in loop . it is display 1st line item data ..then it is going to next page same vendor name display different itam data .

How to display 2line item data in same page .page ll change when vendor no . change...

Plz tell me anybody...Its urj......

regards

razz

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

>

> Hi Expart,

>

> I am creating smartform . per vendor name wise printing different different page . when vendor have 2 line item data . it is printing 2different page .but my requirment is it is printing one page .

> 2item data store in Internel table .i m using loop.

> itab into wa_itab .

> then i am using tamplate .then i m using command line .

> when 1st data is comming in loop . it is display 1st line item data ..then it is going to next page same vendor name display different itam data .

> How to display 2line item data in same page .page ll change when vendor no . change...

>

> Plz tell me anybody...Its urj......

>

>

> regards

> razz

Hi please check my reply in this thread.

[]

Former Member
0 Kudos

Hi,

Instead of displaying in template use table .

In footer of table create command line to goto new page when new vendor.

in template u can display fix rows and not variable.

if u have created only one row in template with hight 1 Ln then it will show only one line item & hense ur getting tht problem.

so just use table.

Try.

Regards

Former Member
0 Kudos

Hi Vishal

Thanx for replying ...but smartform format is different...so i am n't using table . smartforms requirment is suitable for tamplate .n't table.

how to solve prb...Plz. tell me .

Regards

Razz

Former Member
0 Kudos

Hi,

can u explore ur problem? I am not getting wht do u mean by smartform is not suitable for table & for template.

Template is fixed structure with fixed no.of rows & columns.Also rows & columns dimensions are fixed.

So as per my knowledge it cant display no. of records at run time which ur trying using loop.

regards

Former Member
0 Kudos

well it has nothing to do within the smartforms.

It is how you are calling the smartform function module.

Check the following code. It will print the output in a new page for every customer.. you can do similar for your layout


LOOP AT it_acct.
    AT NEW kunnr.
      READ TABLE it_acct INDEX sy-tabix.
      READ TABLE it_kna1 WITH KEY kunnr = it_acct-kunnr.
      READ TABLE  it_adrc WITH KEY addrnumber = it_kna1-adrnr.
      IF sy-subrc = 0.
        wa_adrc = it_adrc.
        READ TABLE it_landx WITH KEY land1 = it_adrc-country.
        IF sy-subrc = 0.
          l_landx = it_landx-landx.
        ENDIF.
      ENDIF.
      CALL FUNCTION 'ZSDG_COMPANY_ADDRESS'
        EXPORTING
          i_bukrs     = it_acct-bukrs
        IMPORTING
          o_comp_addr = g_comp.
      REFRESH it_acct1.
 
      IF g_over = 'X'.
        r_duedt-sign = 'I'.
        r_duedt-option = 'LE'.
        r_duedt-low = date.
        APPEND r_duedt.
      ENDIF.
 
      LOOP AT it_acct WHERE kunnr = it_acct-kunnr AND duedt IN r_duedt.
        MOVE-CORRESPONDING it_acct TO it_acct1 .
        APPEND it_acct1.
        CLEAR: it_acct,it_acct1.
      ENDLOOP.
 
      c_nofopr = c_nofopr + 1.
*        t_control_parameters-DEVICE = 'LP01'.
      t_control_parameters-no_dialog = 'X'.
      t_control_parameters-preview = 'X'.
      IF c_nop  1.
        CASE c_nofopr.
          WHEN 1.
            t_control_parameters-no_open = ' '.
            t_control_parameters-no_close = 'X'.
          WHEN c_nop.
            t_control_parameters-no_open = 'X'.
            t_control_parameters-no_close = ' '.
          WHEN OTHERS.
            t_control_parameters-no_open = 'X'.
            t_control_parameters-no_close = 'X'.
        ENDCASE.
      ENDIF.
 
      IF doct = 'X'.
        doc = 'X'.
      ELSE.
        doc = 'Y'.
      ENDIF.
 
 
      CALL FUNCTION lf_fm_name
        EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
     control_parameters         = t_control_parameters
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
          g_comp                     = g_comp
          wa_adrc                    = wa_adrc
          landx                      = l_landx
          p_seldate                  = date
          waers                      = waers
          doc                        = doc
          intrvl1 = intrvl1
          intrvl2 = intrvl2
          intrvl3 = intrvl3
          intrvl4 = intrvl4
          g_over = g_over
         TABLES
          it_acct                    = it_acct1
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR             = 2
*   SEND_ERROR                 = 3
*   USER_CANCELED              = 4
*   OTHERS                     = 5
                .
      IF sy-subrc  0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDAT.
  ENDLOOP.

Former Member
0 Kudos

also the following example.


data: v_pages type i,
      v_page type i.
describe table i_vbrk.
v_pages = sy-tfill.

data: lf_formname type tdsfname,
      lf_fm_name  type rs38l_fnam.

lf_formname = 'ZSDGF_LB_BIL_INVOICE_CM1'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    FORMNAME                 = lf_formname
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
  IMPORTING
    FM_NAME                  = lf_fm_name
  EXCEPTIONS
    NO_FORM                  = 1
    NO_FUNCTION_MODULE       = 2
    OTHERS                   = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

loop at i_vbrk assigning <f_nast>.

  v_page = v_page + 1.
  t_control_parameters-no_dialog = 'X'.
  t_control_parameters-preview = 'X'.
  if v_rows <> 1.
    case v_page.
      when 1.
        t_control_parameters-no_open = ' '.
        t_control_parameters-no_close = 'x'.
      when v_rows.
        t_control_parameters-no_open = 'x'.
        t_control_parameters-no_close = ' '.
      when others.
        t_control_parameters-no_open = 'x'.
        t_control_parameters-no_close = 'x'.
    endcase.
  endif.

  CALL FUNCTION lf_fm_name
    EXPORTING
*     ARCHIVE_INDEX              =
*     ARCHIVE_INDEX_TAB          =
*     ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         = t_control_parameters
*     MAIL_APPL_OBJ              =
*     MAIL_RECIPIENT             =
*     MAIL_SENDER                =
*     OUTPUT_OPTIONS             =
*     USER_SETTINGS              = 'X'
      IS_BIL_INVOICE             = es_bil_invoice
*     IS_NAST                    =
*     IS_REPEAT                  =
      G_TOTDS                    = g_totds
    IMPORTING
*     DOCUMENT_OUTPUT_INFO       =
*     JOB_OUTPUT_INFO            = 
*     JOB_OUTPUT_OPTIONS         =
    TABLES
      GIT_PRTXT_FS               = git_prtxt_fs
      GIT_PRTXT_DC               = git_prtxt_dc
      IT_TKOMV                   = it_tkomv
      IT_TKOMVD                  = it_tkomvd
      IT_VBPLK                   = xvbplk
      IT_VBPLP                   = xvbplp
      IT_VBPLS                   = xvbpls
      IT_FINALT                  = it_final
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


endloop.

Former Member
0 Kudos

Hi,

Try like this :

Use Table node, with in that use Command node and put a condition when a new customer is encountering goto new page.