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

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.

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

Similar Messages

  • Final total cannot appear when the last line item reached the page end

    Hi All,
    My report included 2 pages. Problem is the final total cannot appear when the last line item reached the page end. (page 2)
    final total will appear on the middle of last page (page 3) when i comment (type    = 'BOTTOM').
    Below is the program.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          dialog   = 'X'
          form     = 'ZBOTM_VOUCHER'
          language = sy-langu.
      sort itab by vblnr.
      LOOP AT itab INTO wa_itab.
        move wa_itab-vblnr to reguh-vblnr.
        move wa_itab-lifnr to reguh-lifnr.
        move wa_itab-rbetr to reguh-rbetr.
        reguh-rbetr = reguh-rbetr * -1.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            window  = 'MAIN'
            element = 'DETAIL'.
        t_rbetr = reguh-rbetr + t_rbetr.
        AT LAST.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              window = 'LINE'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TOTAL'.
              type    = 'BOTTOM'
              WINDOW  = 'MAIN'.
        ENDAT.
    Thanks.

    Hi,
    Where should I include the code for bottom?
    How to open text editor?
    Thanks.
    Edited by: Alice8 on Feb 7, 2011 9:09 AM

  • Problem with line items print in Script MAIN window.

    Dear Friends,
    I am facing a problem with display the line items in main window.
    Here i have created my form with 2 pages,
    in first page i have created header window(my header information is full length of page), in second page i have created 2 windows, one for MAIN window and second for FOOTER window,
    i am having the Footer information about to off the page.
    and in my main window total 3 line items are coming, if i am having 3 line items then it is displaying properly (first 3 line items then immediately footer information on same page) but if am having more then 3 line items say four, then in my second page first it is printing 3 line items then it is switching into another page. After that footer is coming but. in previous page after printing 3 line items the remaining page is empty..
    my client want me to remove that place also. he wants to display continue..
    i think so u people r understand what is my problem...pls advice me what i want to do to solve this problem.
    Thanks
    Sridhar.

    Hi Sridher,
    If you want to display the footer information only on the last page why dont you use a table to display your details and place the footer details in the table footer instead of a seperate footer window.
    Regards,
    Vidya.

  • Display  6 line items and total in main window

    Hi,
    I want to display only 6 line items in main window( on first page and also total of the main window of first page), and consecutively in all the apges i want to display only 6 line itms and total in each page of main window, how to write logic for this.
    Thanks,
    Donlad

    Hi r u talking about Snmartform if yes
    Let us take the page you are using as PAGE1, you can achuve this using the Command Node. call the same page after 6 items as follows
    1.create Table.--->Main area , Header and footer.
    2.Declare a variable V_count type sy-tabix.
    a.Now click on the table tab>Main Area>right Create>Command (insert a command node after the Line type you r using to print the data), in this COMMAND node give the condition V_COUNT = 6. GOTO>PAGE1 (it maens you r  triggering the new page after the 6 lines.
    b. after this command noder insert the Program lines heate increase the value of V_COUNT.
    Maintain another variable the use that for page totals...
    total can be doneautomatically by using the TABle-->CALCULATION TAB.
    let me know if you more clear info, iam sure u r problem willbe solved.

  • SAPScript:  why the window only show the LAST line

    Dears,
    In my form, one of the window only show the LAST line of the it.
    I have set the window enough space,  also when  debuging the program , open_form, write_form,
    all of those sy-subrc = 0.
    both static texts and dynamic texts are set  in the window,   but only the last line shown.
    Anyone could help me?
    Thanks a lot.
    Sincerely,
    Julie Lv

    Hi,
    There are several possibilities to resolve your problem.
    You can work with 2 main windows on in1 page.
    With NEW-WINDOW you switch to the next main-window
    How to use it.
    make an item in main window with that /: NEW-WINDOW command
    if you are ready with first loop call a WRITE_FORM with that NEW-WINDOW statement.
    to cojntinue in the other main.
    Other possibility is. (in case there are not ot many lines)
    Use for every line other variable names.
    Fill these in the loop. And after loop WRITE FORM
    eg. (if maximum is 3 lines)
    &VAR1_1& &VAR1_2& &VAR1_3& &VAR1_4&
    &VAR2_1& &VAR2_2& &VAR2_3& &VAR2_4&
    &VAR3_1& &VAR3_2& &VAR3_3& &VAR3_4&
    Hope this helps.
    Gr., Frank

  • Select last line item from VBAP

    Dear SAP experts,
    This might sound very silly question but I am new to SAP world.
    is there a simple select statement to select only higest line item.
    Say for example in VBAP, I have 9 line items.
    then my select statement should find the last line item. ie. 9th item.
    Actually, I have a situation where a custom table has 2 key fields and I want to select the only 1 line with higest number in 2nr column. Thank you.
    Anitha.

    Hi,
    types: BEGIN OF ls_vbap,
             vbeln TYPE vbap-vbeln,
             posnr TYPE vbap-posnr,
           END OF ls_vbap.
    DATA : t_vbap TYPE STANDARD TABLE OF vbap WITH HEADER LINE,
           wa_vbap type ls_vbap.
    data: lv_line type int4.
    SELECT vbeln posnr FROM kna1 INTO TABLE t_vbap.
    *****If you just need the last record then write the code  as shown below:
    DESCRIBE TABLE t_vbap LINES lv_line.
    READ TABLE t_vbap INTO wa_vbap INDEX lv_line.
    if sy-subrc = 0.
    write:/ wa_vbap-vbeln.
    endif.
    If you the need the last record after sorting then use the below code:
    SORT t_vbap by vbeln posnr DESCENDING.
    READ TABLE t_vbap into wa_vbap index 1.
    if sy-subrc = 0.
    write:/ wa_vbap-vbeln.
    endif.

  • Capture last line item

    I have a requirement where in i have to display a pop up with all the line items given by user in ME21N . The pop up has to display when user presses CHECK .
    I written the code in the exit EXIT_SAPMM06E_017 . its working fine for single line item.
    In case of multiple line items the popup appears for every line item instead of showing all the line items in a single pop up since in the user exit there is no provision of capturing the LAST LINE ITEM . The field EKKO-LPONR which captures the last line item , is populated only after the exit is triggered which captures the value of EKPO-EBELP( line-item). I manage to capture the line items in internal table but unable to capture last line item and then display the internal table in pop up .
    If the user gives two line items say 10 , 20 .
    Line item 10 is populated to field EKPO-EBELP . After the control comes out of the exit the value of EBELP is assigned to LPONR . At next control LPONR = 10 and EBELP = 20.
    Thanks .

    Hi Priya,
    To show popup for the last line item, try with this logic:
    You have an internal table with all line items, take an internal table with same structure. Take the number of lines and read the line iten into work area and append this work area into another table. after that read this second internal table with EBELN and EBELP, if it is matching then show the popup for all line items from first internal table.
    Put this code:
    <b>dsescribe int_first into ws_lines.
    if ws_lines gt 0.
    read table int_first into wa_first index ws_lines.
    if sy-subrc eq 0.
      append wa_first to int_second.
    endif.
    endif.
    if not int_second is initial.
    read int_second into wa_first with key EBELN = 'structure ebeln value'
                                                            EBELP = 'structure ebelp value'
      if sy-subrc eq 0.
       " put POPUP code
      endif.
    endif.</b>
    Hope it will solve ur problem.

  • How to set a JScrollPane always display the last line?

    I have put a JTextArea in a JScrollPane.
    Whenever I append a new line of sentence to the JTextArea, the JScrollPane only shorten the vertical scroll bar.
    Is there any command that can scroll down to the last line whenever I append a new sentence to the JTextArea?

    I have tried to add the line you shown, but it can just show the second last line. It cannot scroll down to the last line.
    e.g. I have these message:
    AAA
    BBB
    CCC
    If the message board can only show 3 lines and I enter one more line "DDD", then the last line will be shown is CCC. I need to scroll down a bit more myself to see DDD. If I scroll to the top and enter another line"EEE", it will scroll down to show "DDD" but not "EEE".

  • Printing in only last line item printing in main window

    Hi All,
    My requiremnet is to print same data in two blocks for F110 payment cheque
    Iam using 2 main windows to print same data if block exceeds it will go to next page
    iam calling the windows as shown below
    CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            window   = 'MAIN00'
            element  = hlp_ep_element
            function = 'APPEND'
          EXCEPTIONS
            window   = 1
            element  = 2.
        IF sy-subrc EQ 2.
          err_element-fname = t042e-zforn.
          err_element-fenst = 'MAIN00'.
          err_element-elemt = hlp_ep_element.
          err_element-text  = text_525.
          COLLECT err_element.
        ENDIF.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            window   = 'MAIN01'
            element  = hlp_ep_element
            function = 'APPEND'
          EXCEPTIONS
            window   = 1
            element  = 2.
        IF sy-subrc EQ 2.
          err_element-fname = t042e-zforn.
          err_element-fenst = 'MAIN01'.
          err_element-elemt = hlp_ep_element.
          err_element-text  = text_525.
          COLLECT err_element.
        ENDIF.
    Iam getting only last line item printing in main window
    Please provide the inputs.
    Thanks,
    Kamalakar.
    Please use code tags.
    Edited by: Rob Burbank on Nov 25, 2011 11:51 AM

    Hi,
    My requirement was to print same block twice in cheque printing of F110.
    I have used the function module  'WRITE_FORM_LINES' to print more than one line item in secondary window in the script .
    fill the Lines internal table as shown below.
    Example :
        lines-tdformat = 'TM'.
        CONCATENATE regup-xblnr ',,' w_date ',,'  w_bsak-sgtxt ',,' w_gross ',,' w_dis ',,'
        w_net INTO lines-tdline.
    APPEND lines.
    CALL FUNCTION 'WRITE_FORM_LINES'
          EXPORTING
           function                       = 'APPEND'
           header                         =  header_t
           type                           = 'BODY'
           window                         = 'MAIN01'
        IMPORTING
          FROMPAGE                       =
          PENDING_LINES                  =
          TABLES
            lines                          = lines
         EXCEPTIONS
           function                       = 1
           type                           = 2
           unopened                       = 3
           unstarted                      = 4
           window                         = 5
           bad_pageformat_for_print       = 6
           spool_error                    = 7
           codepage                       = 8
           OTHERS                         = 9
        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.

  • HT4075 I don't have any problems merging the documents by dragging, but when I try to save and open afterwards, only the last shown doc was saved, not the combined files I wanted to merge. I tried save and export, how can I create the file after merging?

    Hi, I'm having trouble saving the documents when merging in Preview. I don't have any problems merging the pdf documents by dragging them in preview, but when I try to save and open afterwards, only the last shown doc was saved, not the combined files I wanted to merge. I've tried save and export, but none merge the documents after saving... how can I create the file (with all the pdf files) after merging?

    That's a comment in the file. It has no effect at all.

  • Fields only to be displayed for last line item

    I copied WESCHEINVERS3( goods receipt form) script to zxxxx and placed some fields  in Main window using Perform statement. When i am displaying the output these fields are getting displayed under each line item. but i want them to be displayed under last line item.Please suggest how can i do this.
    Thanks
    K Srinivas

    data: v_cnt1 type i, v_cnt2 type i.
    count the number line item using describe lines statement in V_cnt1
    and in the table loop count the number of item into V_cnt2.
    place the field that you want at the end of all line item in the footer of the table and put  a condition in the condition tab v_cnt1 = v_cnt2.

  • How to only read the last line in the text file by using BufferedReader ?

    Dear all,
    Hello, I am new to Java. Do anybody know how to read the last line (this is the last record) in the text file.The method I am now using is reading from the first line until I reach the last line in the text file. Thank you!!
    BufferedReader br = new BufferedReader(new FileReader("c:\\sdk1.4.1\\bin\\dbExport.txt"));
    DataInputStream in = new DataInputStream(new FileInputStream("c:\\sdk1.4.1\\bin\\dbExport.txt"));
    String input;
    String firstinput;
    String secondinput;
    int count=90;
    int year=1955;
    while ((input = br.readLine()) != null) {
    firstinput = input.substring(0, 10);
    secondinput = input.substring(10);
    String insertStore1 = ("INSERT INTO AUTHORS " +
    "VALUES ('" + count + "', '" + firstinput + "', '" + secondinput + "', 1955)");
    System.out.println(insertStore1);
    int result = stmt.executeUpdate(insertStore1);

    I suppose you could use a java.io.RandomAccessFile.

  • How to upload CSV file w/o ,, for the last line

    Hi Experts,
    As part of one interface uploading the csv file (4coulmns) manually using the TCODE: CSCA_FILE_COPY.
    After uploading when i see in the AL11 as it is csv file it is filling the , in each space.
    But my issue while running the interface (because of logic in it) checking for the hash total in the last line where (record count, hash total) only 2 items should come but because of manual upload adding the (record count, hash total, , ,) another two spaces.
    Where program not moving further becasue the it is alway comparing the amounts (1000.00 not matching with 1000.00, , ) it is not processing. In production files directly load in to unix server so no issues and i can't ask to change the program code...because iam not following the process. As part of testing i've to do manually only.
    Please suggest the workaround for this.
    Is it possible to change the contents directly in AL11 directly....then HOW ?
    or
    How to create a csv file w/o , , in the last line (may be it is not possible) ?
    Thanks for your replies in advance.
    Regards
    VVR

    I don't think you can edit from AL11, nor creating a CSV without those commas at the end because are created to state fields with empty value.
    You have 6 columns filled with values but for the last line you only fill the first four. It is expected to appear , , for the last 2 columns on the last line.
    I can only suggest keep doing it manually before uploading the CSV file... or... you are saying you can't change the program.
    How about upload all CSV files... then writing another program to get those files from AL11 and delete the spare commas at the end line?
    Cheers,
    Andres.

  • Looping over CFFILE only writes last line

    Here is the code in question:
    <CFSET LINECOUNT = 0>
    <cfloop list="#populate#" index="CL">
          <CFOUTPUT>#CL#:<input type="text" name="#CL#"><BR></CFOUTPUT>
          <CFSET LINECOUNT = LINECOUNT + 1>
          <CFSET ThisNewLine = '<input type="text" name="#CL#">#CL#'>
          <cffile action="append" file="#Application.BaseRef#Temp\#URL.Field#.CFM" output="#ThisNewLine#" addnewline="Yes">
    </cfloop>
    Linecount = <CFOUTPUT>#LineCount#</CFOUTPUT>
    The list populate# has 28 items in it, the output to the screen is 28 lines of input boxes, the line count variable value is 28 but only one line (The last line) is written to the file.
    What is the world am I overlooking?
    Thanks,
    Kev

    Well, I went to clean up my code to get rid of all the debug "stuff" I put in there trying to determine the root cause so I could post the whole shebang for you and after I removed all the "stuff" I executed it again to make sure that I didn't introduce a new error and whatever was causing the problem is now no longer there.  I apologize to the community for wasting the bandwidth.
    If ignorance is bliss, why am I not happy?

  • I cant't read the last line in the grid

    hello,
    I use a grid to display a SQL query with a field-entry
    When I loop through the grid, I manage to read all lines except the line or the cursor, it keeps the old value
    Do you have an idea
    Thank you

    It's my code
            Shared Sub ItemEvent_Maj_emplacement_lot(ByRef FormUID, ByRef pVal, ByRef BubbleEvent)
                Dim EventEnum As SAPbouiCOM.BoEventTypes
                EventEnum = pVal.EventType
                If pVal.ItemUID = "1" Then
                    Dim jj As Integer
                    EventEnum = pVal.EventType
                    If EventEnum = BoEventTypes.et_CLICK Then
                        oform = SBO_application.Forms.Item(FormUID)
                       oitem = oform.Items.Item("MyGrid")
                        oGrid = oitem.Specific
                        Dim ColNum = oGrid.Columns.Count
                        Dim OgridCodeItem As Long
                        Dim OgridCodeMag As String
                        Dim OgridCodeLot As String
                        Dim OgridEmplacement As String
                        If oGrid.Columns.Count = 0 Then
                            Exit Sub
                        End If
                        For jj = 0 To oGrid.Columns.Count
                            Try
                                OgridCodeItem = oGrid.DataTable.GetValue(1, jj)
                                OgridCodeMag = oGrid.DataTable.GetValue(2, jj)
                                OgridCodeLot = oGrid.DataTable.GetValue(3, jj)
                                OgridEmplacement = oGrid.DataTable.GetValue(5, jj)
      ' This field OgridEmplacement is This field keeps the old value only on the last line before
    ' On the other lines, it works well
                            Catch oEx As Exception
                                '                          MessageBox.Show(oEx.Message & " jj = " & CStr(jj))
                                ' Exit Sub
                            End Try
                        Next jj
                    End If
                End If
            End Sub

Maybe you are looking for

  • Extreme vs Express Card/34

    Hi. Driving around town to test out Airport Extreme on my MBP, I found several hotspots, including T-Mobile at a Starbucks. I didn't connect as I only wanted to see what's out there. My question is what purpose does the expansion slot for an Express

  • Shared Services 11.1.2 + Provisioned Roles for Business Rules not reflectin

    Hi, I have provisioned users to have 'Basic' role in shared services for Business rules. We are using Calc manager + classic planning app. However users are unable to see the business rules associated with the forms due to which the rules dont run on

  • Will Restore in Leopard Disk Utility reliably copy a drive with bootcamp?

    I have a drive partitioned part OS X and part Bootcamp (with Windows XP installed). If I use Apple's Disk Utility to 'Restore' the drive (to copy the drive to a larger drive) will this work reliably for bootcamp as well as the OS X content? Presumabl

  • Is It possible to load Html page inside Adobe Flash...?

    Hi Everyone! Is It possible to load Html page Inside Adobe Flash CS5. Any help would be a great help...! Originally, i wanted to bring in through <IFRAME> but i don't see that flash understands that. Thanks in advance! -yajiv

  • I downloaded a track but it stops playing before the end?

    Using iTunes I purchased and downloaded a track that says it is 1hr 18mins long.  However when I play it, it stops abruptly after 42mins and 22secs.  Would really appreciate any advice on how to get the full track!