Skip to Content

new page in smartforms

Hi All,

I have created a smartform for excise invoice.

In the program for smartform, I have used select-options to select excise invoice number from and to range.

My requirement is that when we give excise invoice number from and to it should display each excise number and its details on a perticular page , and on next page it should display next invoice number and its details and so on.

currently it displays last excise invoice number and in main window it displays the list of materials of all excise invoise documents and continues it to rest of pages.

Please solve my problem its urgent.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 28, 2007 at 12:53 PM

    Hi Bharat,

    You need to do a few changes in your smartform. I am assuming you have only one internal table which has all the line items of all the invoices. and another internal table which has all the header information of all the invoices. With this assumption, please do the following:

    - Create LOOP for the header internal table inside your main window.

    - Create (You should have it) table to display the line items of the same Invoice Number by just comparing Invoice Number of the LOOP.

    - After finishing the processing of your table, just check whether the record being processed by the LOOP (Invoice Header) is last record or not. If not, write the COMMAND and give NEW-PAGE command.

    - One more thing to take care here is, you must need to display header information which are not part of your MAIN window. To display the header data for the first invoiice, in your initialization, just read the first record fo your Invoice header internal table, and display all the information from that work area. And use the same work area in your LOOP as well.

    This will solve your problem.

    Regards,

    Sandip

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Sandip,

      Just check the above code, this is the code i have written for the smartform.

      In that you will find that i have used different internal tables for the line items as well as header information <b>and not a single internal table</b>.

      so can you please provide me solution as per my current scenario.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 28, 2007 at 11:51 AM

    Hi

    After getting all data related to ITAB do like this

    sort itab by EXNo.

    loop at itab.

    at new exno.

    new-page.

    call function start_form....

    endat.

    call function WRITE_FORM...using ..window..textelement.

    at end of exno.

    call function end_form.

    endat.

    endloop.

    <b>this will print each excise no(exno) in a new page and with its own data.

    Reward points for useful Answers</b>

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

    • I have used <b>smart form</b> and <b>NOT SAPSCRIPT</b>.

      In smartform I have fetched data using different tables and <b>not a single table</b>.

      please give me solution for smartform.

      this is the main code for the smartform i have developed.

      &----


      *& Include ZSF_EXCISE_PRINT_FORM *

      &----


      &----


      *& Form data_retrival

      &----


      • text

      ----


      FORM data_retrival.

      ***Get data in it_j_1iexchdr

      SELECT *

      FROM j_1iexchdr

      INTO CORRESPONDING FIELDS OF TABLE it_j_1iexchdr

      WHERE trntyp EQ 'DLFC'

      AND werks EQ p_werks

      AND exgrp EQ p_exgrp

      AND exnum IN s_exnum

      AND exyear EQ p_exyear .

      ***Get data in it_j_1iexcdtl for all entries in it_j_1iexcdtl

      IF NOT it_j_1iexchdr[] IS INITIAL.

      SELECT *

      FROM j_1iexcdtl

      INTO CORRESPONDING FIELDS OF TABLE it_j_1iexcdtl

      FOR ALL ENTRIES IN it_j_1iexchdr

      WHERE trntyp = it_j_1iexchdr-trntyp

      AND werks = it_j_1iexchdr-werks

      AND exnum = it_j_1iexchdr-exnum

      AND exyear = it_j_1iexchdr-exyear

      AND exgrp = it_j_1iexchdr-exgrp.

      ENDIF.

      ***Get data in VBRP

      IF NOT it_j_1iexchdr[] IS INITIAL.

      SELECT *

      FROM vbrp

      INTO CORRESPONDING FIELDS OF TABLE it_vbrp

      FOR ALL ENTRIES IN it_j_1iexchdr

      WHERE vbeln EQ it_j_1iexchdr-rdoc.

      DELETE it_vbrp WHERE fkimg = space.

      SORT it_vbrp BY vbeln posnr.

      ENDIF.

      ***retrieving the data for condition no customer no

      IF NOT it_j_1iexchdr[] IS INITIAL.

      SELECT *

      FROM vbrk

      INTO CORRESPONDING FIELDS OF TABLE it_vbrk

      FOR ALL ENTRIES IN it_j_1iexchdr

      WHERE vbeln EQ it_j_1iexchdr-rdoc.

      ENDIF.

      ***Address

      IF NOT it_vbrk[] IS INITIAL.

      SELECT *

      FROM kna1

      INTO CORRESPONDING FIELDS OF TABLE it_kna1

      FOR ALL ENTRIES IN it_vbrk

      WHERE kunnr EQ it_vbrk-kunrg.

      ENDIF.

      ***Retrieve the po number and podate

      IF NOT it_vbrp[] IS INITIAL.

      SELECT *

      FROM vbkd

      INTO CORRESPONDING FIELDS OF TABLE it_vbkd

      FOR ALL ENTRIES IN it_vbrp

      WHERE vbeln EQ it_vbrp-aubel.

      ENDIF.

      ***TVZBT TEXT RETRIEVING

      IF NOT it_vbrk[] IS INITIAL.

      SELECT *

      FROM tvzbt

      INTO CORRESPONDING FIELDS OF TABLE it_tvzbt

      FOR ALL ENTRIES IN it_vbrk

      WHERE spras = 'EN'

      AND zterm EQ it_vbrk-zterm .

      ENDIF.

      ***reconcillation account

      IF NOT it_j_1iexchdr[] IS INITIAL.

      SELECT *

      FROM knb1

      INTO CORRESPONDING FIELDS OF TABLE it_knb1

      FOR ALL ENTRIES IN it_j_1iexchdr

      WHERE kunnr EQ it_j_1iexchdr-kunwe

      AND bukrs EQ it_j_1iexchdr-bukrs.

      ENDIF.

      ***chapter description

      IF NOT it_j_1iexcdtl[] IS INITIAL.

      SELECT *

      FROM j_1ichidtx

      INTO CORRESPONDING FIELDS OF TABLE it_j_1ichidtx

      FOR ALL ENTRIES IN it_j_1iexcdtl

      WHERE j_1ichid EQ it_j_1iexcdtl-chapid.

      ENDIF.

      ***ecc number and cst number

      IF NOT it_vbrk[] IS INITIAL.

      SELECT *

      FROM j_1imocust

      INTO CORRESPONDING FIELDS OF TABLE it_j_1imocust

      FOR ALL ENTRIES IN it_vbrk

      WHERE kunnr EQ it_vbrk-kunrg.

      ENDIF.

      ***Drawing number and revision

      IF NOT it_j_1iexcdtl[] IS INITIAL.

      SELECT *

      FROM mara

      INTO CORRESPONDING FIELDS OF TABLE it_mara

      FOR ALL ENTRIES IN it_j_1iexcdtl

      WHERE matnr EQ it_j_1iexcdtl-matnr.

      ENDIF.

      ***rate filed retrieving

      IF NOT it_vbrk[] IS INITIAL.

      SELECT *

      FROM konv

      INTO CORRESPONDING FIELDS OF TABLE it_konv

      FOR ALL ENTRIES IN it_vbrk

      WHERE knumv EQ it_vbrk-knumv

      AND kschl EQ 'PR00'.

      DELETE it_konv WHERE kawrt = space.

      ENDIF.

      ***Retrieving the kdmat

      IF NOT it_vbrp[] IS INITIAL.

      SELECT *

      FROM lips

      INTO CORRESPONDING FIELDS OF TABLE it_lips

      FOR ALL ENTRIES IN it_vbrp

      WHERE vbeln EQ it_vbrp-vgbel.

      ENDIF.

      ENDFORM. "data_retrival

      &----


      *& Form calculation

      &----


      • text

      ----


      FORM calculation.

      ***Tax Calculation.

      SELECT knumv

      kposn

      kschl

      krech

      kawrt

      kbetr

      kwert

      kvsl1

      FROM konv

      INTO TABLE it_tax_konv

      FOR ALL ENTRIES IN it_vbrk

      WHERE knumv EQ it_vbrk-knumv.

      LOOP AT it_tax_konv INTO wa_tax_konv.

      CASE wa_tax_konv-kvsl1.

      WHEN 'CST'.

      gv_tax = wa_tax_konv-kbetr / 10. "percentage value

      WHEN 'LST'.

      gv_tax = wa_tax_konv-kbetr / 10. "percentage value

      WHEN 'VAT'.

      gv_tax = wa_tax_konv-kbetr / 10. "percentage value

      ENDCASE.

      ENDLOOP.

      LOOP AT it_tax_konv INTO wa_tax_konv

      WHERE kschl GE 'ZFR'

      AND kschl LE 'ZFR1'.

      IF wa_tax_konv-krech = 'A'.

      ***FOC Percentage.

      gv_freight_rate = wa_tax_konv-kbetr / 10.

      ***FOC Value.

      gv_freight_value = gv_freight_value + wa_tax_konv-kbetr.

      ENDIF.

      IF wa_tax_konv-krech = 'B'.

      ***FOC Value.

      gv_freight_value = gv_freight_value + wa_tax_konv-kbetr.

      ENDIF.

      ENDLOOP.

      LOOP AT it_tax_konv INTO wa_tax_konv

      WHERE kschl GE 'ZFCG'

      AND kschl LE 'ZFCS'.

      gv_foc_value = wa_tax_konv-kwert.

      ENDLOOP.

      LOOP AT it_vbrk INTO wa_vbrk.

      gv_total = wa_vbrk-netwr + wa_vbrk-mwsbk.

      ENDLOOP.

      CALL FUNCTION 'SPELL_AMOUNT'

      EXPORTING

      amount = gv_total

      currency = 'INR'

      • FILLER = ' '

      language = sy-langu

      IMPORTING

      in_words = total_text

      EXCEPTIONS

      not_found = 1

      too_large = 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.

      CONCATENATE 'Rs' total_text-word 'AND'

      INTO gv_amt_text SEPARATED BY space.

      CONCATENATE gv_amt_text total_text-decword 'PAISE ONLY'

      INTO gv_amt_text SEPARATED BY space.

      LOOP AT it_j_1iexchdr INTO wa_j_1iexchdr.

      CALL FUNCTION 'SPELL_AMOUNT'

      EXPORTING

      amount = wa_j_1iexchdr-exbed

      currency = 'INR'

      • FILLER = ' '

      language = sy-langu

      IMPORTING

      in_words = exbed_text

      EXCEPTIONS

      not_found = 1

      too_large = 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.

      CALL FUNCTION 'SPELL_AMOUNT'

      EXPORTING

      amount = wa_j_1iexchdr-cess

      currency = 'INR'

      • FILLER = ' '

      language = sy-langu

      IMPORTING

      in_words = ecess_text

      EXCEPTIONS

      not_found = 1

      too_large = 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.

      ENDLOOP.

      CONCATENATE 'Rs' exbed_text-word 'AND'

      INTO gv_exbed_text SEPARATED BY space.

      CONCATENATE gv_exbed_text exbed_text-decword 'PAISE ONLY'

      INTO gv_exbed_text SEPARATED BY space.

      CONCATENATE 'Rs' ecess_text-word 'AND'

      INTO gv_ecess_text SEPARATED BY space.

      CONCATENATE gv_ecess_text ecess_text-decword 'PAISE ONLY'

      INTO gv_ecess_text SEPARATED BY space.

      LOOP AT it_j_1iexchdr INTO wa_j_1iexchdr.

      v_text = wa_j_1iexchdr-rdoc.

      ***Vehicle No.

      PERFORM read_text TABLES it_tdline USING '3030' sy-langu v_text 'VBBK'.

      LOOP AT it_tdline WHERE tdline NE ' '.

      veh_no = it_tdline-tdline.

      ENDLOOP.

      REFRESH it_tdline.

      ***Carriers Name

      PERFORM read_text TABLES it_tdline USING '3028' sy-langu v_text 'VBBK'.

      LOOP AT it_tdline WHERE tdline NE ' '.

      carr_no = it_tdline-tdline .

      ENDLOOP.

      REFRESH it_tdline.

      ***LR/RR No.

      PERFORM read_text TABLES it_tdline USING '0102' sy-langu v_text 'VBBK'.

      LOOP AT it_tdline WHERE tdline NE ' '.

      lr_no = it_tdline-tdline .

      ENDLOOP.

      REFRESH it_tdline.

      ***LR Date.

      PERFORM read_text TABLES it_tdline USING '0100' sy-langu v_text 'VBBK'.

      LOOP AT it_tdline WHERE tdline NE ' '.

      lr_date = it_tdline-tdline.

      ENDLOOP.

      REFRESH it_tdline.

      ENDLOOP.

      ENDFORM. "calculation

      &----


      *& Form display_print

      &----


      • text

      ----


      FORM display_print.

      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

      EXPORTING

      formname = 'ZSF_EXCISE_INVOICE'

      • VARIANT = ' '

      • DIRECT_CALL = ' '

      IMPORTING

      fm_name = fname

      EXCEPTIONS

      no_form = 1

      no_function_module = 2

      OTHERS = 3

      .

      IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      CALL FUNCTION fname

      EXPORTING

      • ARCHIVE_INDEX =

      • ARCHIVE_INDEX_TAB =

      • ARCHIVE_PARAMETERS =

      • CONTROL_PARAMETERS =

      • MAIL_APPL_OBJ =

      • MAIL_RECIPIENT =

      • MAIL_SENDER =

      • OUTPUT_OPTIONS =

      • USER_SETTINGS = 'X'

      gv_tax = gv_tax

      gv_total = gv_total

      gv_amt_text = gv_amt_text

      gv_freight_rate = gv_freight_rate

      gv_freight_value = gv_freight_value

      gv_fov_value = gv_foc_value

      gv_exbed_text = gv_exbed_text

      gv_ecess_text = gv_ecess_text

      veh_no = veh_no

      carr_no = carr_no

      lr_no = lr_no

      lr_date = lr_date

      • IMPORTING

      • DOCUMENT_OUTPUT_INFO =

      • JOB_OUTPUT_INFO =

      • JOB_OUTPUT_OPTIONS =

      TABLES

      it_j_1iexcdtl = it_j_1iexcdtl

      it_lips = it_lips

      it_vbrp = it_vbrp

      it_konv = it_konv

      it_j_1iexchdr = it_j_1iexchdr

      it_vbkd = it_vbkd

      it_j_1ichidtx = it_j_1ichidtx

      it_tvzbt = it_tvzbt

      it_kna1 = it_kna1

      it_knvv = it_knvv

      it_vbrk = it_vbrk

      it_j_1imocust = it_j_1imocust

      EXCEPTIONS

      formatting_error = 1

      internal_error = 2

      send_error = 3

      user_canceled = 4

      OTHERS = 5

      .

      IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      ENDFORM. "display_print

      &----


      *& Form READ_TEXT

      &----


      FORM read_text TABLES p_it_tdline

      USING p_id p_langu p_text p_obj.

      CALL FUNCTION 'READ_TEXT'

      EXPORTING

      • CLIENT = SY-MANDT

      id = p_id

      language = p_langu

      name = p_text

      object = p_obj

      • ARCHIVE_HANDLE = 0

      • LOCAL_CAT = ' '

      • IMPORTING

      • HEADER =

      TABLES

      lines = p_it_tdline

      EXCEPTIONS

      id = 1

      language = 2

      name = 3

      not_found = 4

      object = 5

      reference_check = 6

      wrong_access_to_archive = 7

      OTHERS = 8 .

      check sy-subrc <> 0.

      • MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

      • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      • continue.

      • ENDIF.

      ENDFORM. " READ_TEXT

  • author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2007 at 04:03 AM

    Hi,

    Pass the ITAB to the smartform and Use loop comand in form and then check the value by putting initial and check the current value with previous and use command statement to break the page this will work

    Regards

    Sihva

    Add a comment
    10|10000 characters needed characters exceeded

    • thanks for your suggestion

      can you please explain it to me in details.

      i have used loop IT_J_1IEXCDTL into wa_J_1IEXCDTL for the table in main window.

      where i have to pass current value and previous value and where i have to put command statement and wht is the command for page break.

      please explain it to me.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.