cancel
Showing results for 
Search instead for 
Did you mean: 

Only the last line item is shown in main window...

aris_hidalgo
Contributor
0 Kudos

Hello Experts,

I created a custom form for the standard checque program RFFOUS_C. Now, in my MAIN window, I

called a subroutine in a custom program which loops through the line items but the problem is

only the last line item is being shown. I tried using CONTROL_FORM to create a new line

but it does not work. Note that I did not customize RFFOUS_C since it is being used by

multiple companies. Below is my code:


SAPSCRIPT:

510-C
Begin of insertion DEVK940799 11/10/2008 DEL_HIDALGO
DEFINE &LTYC_XBLNR& = ''
DEFINE &LTYC_BLDAT& = ''
DEFINE &LTYC_SGTXT& = ''
DEFINE &LTYC_DMBTR& = ''
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&
CHANGING &LTYC_XBLNR&
CHANGING &LTYC_BLDAT&
CHANGING &LTYC_SGTXT&
CHANGING &LTYC_DMBTR&
ENDPERFORM
PROTECT
	&LTYC_XBLNR&	&LTYC_BLDAT&	&LTYC_SGTXT&	&LTYC_DMBTR&
ENDPROTECT
End of insertion DEVK940799 11/10/2008 DEL_HIDALGO


PROGRAM:

IF gt_regup[] IS NOT INITIAL.
    CALL FUNCTION 'OPEN_FORM'
       EXPORTING
*         APPLICATION                       = 'TX'
*         ARCHIVE_INDEX                     =
*         ARCHIVE_PARAMS                    =
*         DEVICE                            = 'PRINTER'
*         DIALOG                            = 'X'
         form                              = lcc_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.
    LOOP AT gt_regup INTO lw_regup.
      m_line_items 'LTYC_XBLNR' lw_regup-xblnr.
      m_line_items 'LTYC_BLDAT' lw_regup-bldat.
      m_line_items 'LTYC_SGTXT' lw_regup-sgtxt.
      m_line_items 'LTYC_DMBTR' lw_regup-dmbtr.
      DELETE ex_output WHERE value IS INITIAL.

      CALL FUNCTION 'WRITE_FORM'
       EXPORTING
         element                        = '510-C'
         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.

      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command   = 'NEW-LINE'
        EXCEPTIONS
          unopened  = 1
          unstarted = 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.
    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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I think u might have skip to write the append statement before ending the loop for the line items.

U r looping all the line items so the last item record only getting printed.

For each line item u should append.

I think it can solve ur problem.

Plz check ur code.

Regards,

Farook

Edited by: farook shaik on Nov 24, 2008 7:10 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Write the at last event in the program and check if it works

At last.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-LINE'

EXCEPTIONS

unopened = 1

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

Regards,

Sravanthi

sangeetha_sk
Participant
0 Kudos

Hi,

In the Write_Form, i think u need to uncomment

TYPE = 'BODY'.

Also in I think, Control_form is not needed.

For ur reference, u can see about WRITE_FORM in

http://help.sap.com/saphelp_47x200/helpdata/en/d6/0db4f7494511d182b70000e829fbfe/frameset.htm

Pls try

Former Member
0 Kudos

HI Viray

Did u get all the line items.Plz If u solved the problem share with me how u have come across that prob.

Regards,

Fk.