cancel
Showing results for 
Search instead for 
Did you mean: 

New-page in main window does not trigger...

aris_hidalgo
Contributor
0 Kudos

Hello Experts,

IN my MAIN window in sapscript, I created an element called NEXT_PAGE which will call the next page 'NEXT'.

In this element, I want to write the line items in it but in the NEXT page. Below is my code:


FIRST PAGE:


/E	510-C
/	We are sending you a separate payment advice for document &REGUH-VBLNR&
/	from &REGUH-ZALDT& to explain the invoice items.

/:	PERFORM WRITE_LINE_ITEMS IN PROGRAM Z9999RFI_Z2574FFI_RA
/:	USING &REGUH-LAUFD&
/:	USING &REGUH-LAUFI&
/:	USING &REGUH-XVORL&
/:	USING &REGUH-ZBUKR&
/:	USING &REGUH-LIFNR&
/:	USING &REGUH-VBLNR&
/:	ENDPERFORM

/E	NEXT_PAGE
/:	NEW-PAGE NEXT
/:	PROTECT
T1	&REGUP-XBLNR&	&REGUP-BLDAT&	&REGUP-SGTXT&	&REGUP-DMBTR&
/:	ENDPROTECT

The logic is this, the element 510-C will only be called ONCE from standard program RFFOUS_C then from there

I will call my custom routine WRITE_LINE_ITEMS in my custom program. This program only contains the subroutines

and is NOT a copy of RFFOUS_C. Below is the code of the subroutine:


FORM write_line_items TABLES im_input STRUCTURE itcsy
                             ex_output STRUCTURE itcsy.

  CONSTANTS: lcc_laufd TYPE char11 VALUE 'REGUH-LAUFD',
             lcc_laufi TYPE char11 VALUE 'REGUH-LAUFI',
             lcc_xvorl TYPE char11 VALUE 'REGUH-XVORL',
             lcc_zbukr TYPE char11 VALUE 'REGUH-ZBUKR',
             lcc_lifnr TYPE char11 VALUE 'REGUH-LIFNR',
             lcc_vblnr TYPE char11 VALUE 'REGUH-VBLNR'.

  DATA: ltyd_laufd TYPE reguh-laufd,
        ltyc_laufi TYPE reguh-laufi,
        ltyc_xvorl TYPE reguh-xvorl,
        ltyc_zbukr TYPE reguh-zbukr,
        ltyc_lifnr TYPE reguh-lifnr,
        ltyc_vblnr TYPE reguh-vblnr.

  DATA: ltyc_date TYPE char10.

  LOOP AT im_input INTO gw_input.
    CASE gw_input-name.
      WHEN lcc_laufd.
        ltyc_date = gw_input-value.
        REPLACE ALL OCCURRENCES OF '.' IN ltyc_date WITH space.
        CONCATENATE ltyc_date+4(4) ltyc_date+2(2) ltyc_date+0(2)
               INTO ltyc_date.

        ltyd_laufd = ltyc_date.
      WHEN lcc_laufi.
        ltyc_laufi = gw_input-value.
      WHEN lcc_xvorl.
        ltyc_xvorl = gw_input-value.
      WHEN lcc_zbukr.
        ltyc_zbukr = gw_input-value.
      WHEN lcc_lifnr.
        ltyc_lifnr = gw_input-value.
      WHEN lcc_vblnr.
        ltyc_vblnr = gw_input-value.
    ENDCASE.
  ENDLOOP.

  SELECT *
    FROM regup
    INTO TABLE gt_regup
   WHERE laufd = ltyd_laufd
     AND laufi = ltyc_laufi
     AND xvorl = ltyc_xvorl
     AND zbukr = ltyc_zbukr
     AND lifnr = ltyc_lifnr
     AND vblnr = ltyc_vblnr.

  IF gt_regup[] IS NOT INITIAL.
    CALL FUNCTION 'OPEN_FORM'
     EXPORTING
*       APPLICATION                       = 'TX'
*       ARCHIVE_INDEX                     =
*       ARCHIVE_PARAMS                    =
*       DEVICE                            = 'PRINTER'
*       DIALOG                            = 'X'
       form                              = 'Z2574FFI_RA'
*       LANGUAGE                          = SY-LANGU
*       OPTIONS                           =
*       MAIL_SENDER                       =
*       MAIL_RECIPIENT                    =
*       MAIL_APPL_OBJECT                  =
*       RAW_DATA_INTERFACE                = '*'
*       SPONUMIV                          =
*     IMPORTING
*       LANGUAGE                          =
*       NEW_ARCHIVE_PARAMS                =
*       RESULT                            =
     EXCEPTIONS
       canceled                          = 1
       device                            = 2
       form                              = 3
       OPTIONS                           = 4
       unclosed                          = 5
       mail_options                      = 6
       archive_error                     = 7
       invalid_fax_number                = 8
       more_params_needed_in_batch       = 9
       spool_error                       = 10
       codepage                          = 11
       OTHERS                            = 12.

    IF sy-subrc <> 0.
*      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    DO 3 TIMES.
      CALL FUNCTION 'WRITE_FORM'
       EXPORTING
         element                        = 'NEXT_PAGE'
         function                       = 'APPEND'
         type                           = 'BODY'
         window                         = 'MAIN'
*     IMPORTING
*       PENDING_LINES                  =
       EXCEPTIONS
         element                        = 1
         function                       = 2
         type                           = 3
         unopened                       = 4
         unstarted                      = 5
         window                         = 6
         bad_pageformat_for_print       = 7
         spool_error                    = 8
         codepage                       = 9
         OTHERS                         = 10.

      IF sy-subrc <> 0.
*      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDDO.

    CALL FUNCTION 'CLOSE_FORM'
*     IMPORTING
*       RESULT                         =
*       RDI_RESULT                     =
*     TABLES
*       OTFDATA                        =
     EXCEPTIONS
       unopened                       = 1
       bad_pageformat_for_print       = 2
       send_error                     = 3
       spool_error                    = 4
       codepage                       = 5
       OTHERS                         = 6.

    IF sy-subrc <> 0.
*      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  ENDIF.
ENDFORM.                    "write_line_items

There are no data coming in the NEXT page. Hope you can help me guys. Thank you and take care!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

The easiest way would be to debug the program and script together.

u are printing the variables

&REGUP-XBLNR& &REGUP-BLDAT& &REGUP-SGTXT& &REGUP-DMBTR&

check if the values are populated in them

because u are using an internal table to store the data so ideally u should have internal table name i.e gt_regup

hope it helps

Answers (1)

Answers (1)

Former Member
0 Kudos

Write the below code in a new window and place that window in "NEXT" page not in this window.

/: PROTECT

T1 &REGUP-XBLNR& &REGUP-BLDAT& &REGUP-SGTXT& &REGUP-DMBTR&

/: ENDPROTECT