Inserting blank line in internal table

Hi
I am inserting a report  from a internal table for eg the content of my internal table is
data : abc
event initialization.
perform read_data.
Now I want  1 blank line after every line in the internal table for eg
data:abc
event initialization
perform read_data.
How to insert a blank line in an internal table?
Edited by: priya singh on Feb 4, 2009 9:37 AM

hi,
DATA: BEGIN OF i_pernr OCCURS 1 ,
pernr TYPE pa0002-pernr,
vorna TYPE pa0002-vorna,
nachn TYPE pa0002-nachn,
END OF i_pernr.
TYPES : BEGIN OF string1  ,
     a TYPE char100,
    END OF string1.
DATA : wa_string TYPE string1,
       it_stirng TYPE TABLE OF string1.
START-OF-SELECTION.
  SELECT pernr vorna nachn FROM pa0002 INTO TABLE i_pernr UP TO 20 ROWS.
  LOOP AT i_pernr.
    CONCATENATE i_pernr-pernr i_pernr-vorna i_pernr-nachn INTO wa_string-a SEPARATED BY '|'.
    APPEND wa_string TO it_stirng.
    APPEND INITIAL LINE TO it_stirng.
  ENDLOOP.
  BREAK-POINT.
Thanks

Similar Messages

  • Dynamically inserting new line in Internal table

    Hi,
      Can anyone help me how to insert a new line dynamically to the internal table.
    Assume there are 5 records that has been added to ITAB.
    In that if a particular field in that ITAB crosses the limit 10 then i have to split that line into two lines with the same data except that Par.field as 5 and the other record has 5.
    In the third record that particular field has value 10.
    Loop at ITAB.
       Once i found that field has 10 then how to insert a new line dynamically over here to add another record.
    endloop.

    Hi..
    Hi..
    try this..
    loop at itab.
    if  ( i found that field <f1> has 10 ).
        w_line2 = itab-f1+5(5).
        w_line3 = itab-f1.
    ***********First  line********   
        itab-f1 = itab-f1+0(5).
        modify itab index sy-tabix from itab transporting f1.
    ***********second  line********    Hi..
    try this..
    loop at itab.
    if  ( i found that field <f1> has 10 ).
        w_line2 = itab-f1+5(5).
        w_line3 = itab-f1.
    ***********First  line********   
        itab-f1 = itab-f1+0(5).
        modify itab index sy-tabix from itab transporting f1.
    ***********second  line********   
        itab-f1 = w_line2.
        insert itab INDEX SY-TABIX.
    **********third line**************
        itab-f1 = w_line3.
         insert itab INDEX SY-TABIX.
    endloop.  
        itab-f1 = w_line2.
        insert itab INDEX SY-TABIX.
    **********third line**************
        itab-f1 = w_line3.
         insert itab INDEX SY-TABIX.
    endloop.

  • @Inserting Records in an Internal Table

    Hi,
    How can I Insert records in an internal table..such that i can insert the records somewhere in the middle based on the entry in a field?

    INSERT wa INTO TABLE itab INDEX idx .
    Effect
    This variant can only be used for standard tables and sorted tables. Each line line_spec to be inserted into the line before the table index idx and the table index of the following lines is increased by one. A data object of the type i is expected for idx.
    If idx contains a value equal to the number of the existing table lines plus one, the new line is appended as the last line in the internal table. If idx contains a greater value, no line is inserted and sy-subrc is set to 4.
    An exception that cannot be handled is raised when:
    idx contains a value less than or equal to 0
    A line to be inserted would cause a duplicate entry in tables with a unique table key
    A line to be inserted would disrupt the sort order of sorted tables
    Within a LOOP loop, you can omit the addition INDEX. Each line to be inserted is inserted before the current table line of the LOOP loop. However, if the current line is deleted in the same loop pass, the response is undefined.

  • How to insert blank lines in the ALV output.

    Hi Friends,
    Could any body help me out How to insert blank lines in the ALV output.?? Any Code pls...
    Thank you,
    Vikram.C

    hi vikram
    do like this
    In the fieldcatalog table all the fields should be in editable mode
    ie lw_fcat-edit = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = lv_layout
    it_fieldcat = lt_fcat[]
    i_save = 'A'
    is_variant = lv_variant
    TABLES
    t_outtab = lt_license[]
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " display_data
    *& Form user_command
    FORM user_command USING r_ucomm TYPE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN 'ADD'. "
    data: lv_ind type i.
    data: lv_line type i.
    describe table lt_license lines lv_line.
    loop at lt_license into lw_license.
    lv_ind = sy-tabix.
    if lv_ind = lv_line.
    append initial line to lt_license.
    endif.
    endloop.
    ENDCASE.
    ENDFORM. "user_command
    reward points if useful
    Rohan

  • New Line after every 900 lines in internal table

    HI,
    I have an internal table and that is sorted by company code. i.e it is grouped according to company code.
    Now i want to check in particular groups of company code if the lines of internal table is > 900 or not.
    And if it > 900 i have to insert new line.
    How to do that?

    Hi
    Please check  the code..I think it will solve ur problem
    TYPES : BEGIN OF x_data,
             name TYPE char10,
            END OF x_data.
    data: i_data  TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
          wa_data TYPE x_data,
          counter TYPE n LENGTH 2 .
    DO 5 TIMES.
    CLEAR : wa_data.
      counter = counter + 1.
    CONCATENATE 'subha' counter INTO wa_data-name.
    APPEND wa_data to  i_data.
    ENDDO.
    CLEAR : counter,
            wa_data .
    DESCRIBE TABLE i_data LINES counter.
    IF counter > 4.
      counter = 5.
      wa_data-name = 'TEST'.
    INSERT wa_data INTO i_data INDEX counter.
    ENDIF.
    CLEAR: wa_data.
    LOOP at i_data INTO wa_data .
      WRITE : / wa_data-name.
    ENDLOOP.
    Use 900 instead  4 and 901 instead of 5.

  • Blank Lines in a table in Smartforms

    Hey fellas,
    Why m i getting 2 blank lines after each table line...?
    My Line Spacing Setting in Smartstyle is exactly 1 LN...if changed to less output is jumbled...
    And my internal table doesn't contain any blank line too...
    Plzz HELP !

    HI,
    Check the number of rows in main area of table.
    only one is required.
    Regards
    Sreekanth

  • How to insert  data from different internal  table  into a data base table

    hi all,
             I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
    in short i want to do something like the foll:
    INSERT  INTO ZMIS_CODES-CODE VALUE '1'.
    *INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)

    REPORT  ZINSERT.
    tables kna1.
    data: itab LIKE KNA1.
    data lv_kUNAG LIKE KNA1-KUNNR.
    lv_kuNAG =  '0000010223'.
    ITAB-kuNNR = lv_kuNAG.
    ITAB-name1 = 'XYZ'.
    INSERT INTO KNA1 VALUES ITAB.
    IF SY-SUBRC = 0.
    WRITE:/ 'SUCCESS'.
    ELSE.
    WRITE:/ 'FAILED'.
    ENDIF.
    Here lv_kunag is ref to kna1 kunnr passed in different name
    In internal table .
    Try and let me know if this logic dint work.

  • Report Painter insert blank line after report header

    Hi Expert,
    I have a problem to insert a blank line (a spacing) after the report header of my customized report painter.
    For example, in standard cost center report, S_ALR_87013611, there is a small box listed information like cost center/group ... and reporting period.
    Right after reporting period, the report header box ends, and there is a space line between it and the cost element data ...
    For my customized report painter, I cannot make this space line.
    I tried edit > row > insert blank line ... but not successful ... kindly advise.
    Thanks and regards,
    -CK

    Hi
    In KKO2 go to output tab, here under layout, tick header and then press pencil symbol and in the editor you write your header. I think this will give you desired result.
    Regards
    Rajneesh Saxena

  • How to insert record inside the internal table in below code

    Hi all,
    My requirement is to find the sub-total and need to insert in between the internal table.
    You can see the output ....where I want the sub-total F2 when 1 & 2 combindely , 3 , 4& 5 combindely .Please check it and let me know is it possible
    when i am using modification  it is not creating extra row inside the table instead it is modifying one row and putting the total there.
    For ex: the origianl output is
    F1   F2       F3
    A      1          1
    B      1          1
    F      2          1
    D      3          1
    E      4          1
    C      5          1
    We want to display all the total of f2 of 1-2 , 3 , 4-5
    so expcected output is
    F1   F2       F3
    A      1          1
    B      1          1
    F      2          1
         *              3  ->This is the sub-total of 1& 2 of f2
    D      3          1
            *           1 ->this is the sub-total of 3
    E      4          1
    C      5          1
          *             2 -> this is the sub-total of 4 & 5
    = space
    But coming output is
    A 1          1
    B 1          1
    *             3 -> it is modifying the F row and inserting the total .Total is comong correct but is shoule insert  instead of modifying the record!!
      *           1
    E  4          1
    *             2
    Please help how to insert the row total at the end of the chage of field
    Please find the below code ..Due to space problem i am attaching below
    Sas

    Here is the solution ....i Got the answer Thanks for your helping hands friends
    REPORT  YTEST_MODIFY.
    DATA: BEGIN OF ITAB OCCURS 1,
    TOT TYPE C,
    F1 TYPE C,
    F2 TYPE C,
    F3 TYPE I ,
    END OF ITAB.
    DATA: BEGIN OF JTAB OCCURS 1,
    F1 TYPE C,
    F2 TYPE C,
    F3 TYPE I ,
    END OF JTAB.
    START-OF-SELECTION.
      ITAB-F1 = 'A'.
      ITAB-F2 =  1.
      ITAB-F3 =  1.
      APPEND ITAB.
      ITAB-F1 = 'B'.
      ITAB-F2 =  1.
      ITAB-F3 =  1.
      APPEND ITAB.
      ITAB-F1 = 'C'.
      ITAB-F2 =  5.
      ITAB-F3 =  1.
      APPEND ITAB.
      ITAB-F1 = 'D'.
      ITAB-F2 =  3.
      ITAB-F3 =  1.
      APPEND ITAB.
      ITAB-F1 = 'E'.
      ITAB-F2 =  4.
      ITAB-F3 =  1.
      APPEND ITAB.
      ITAB-F1 = 'F'.
      ITAB-F2 =  2.
      ITAB-F3 =  1.
      APPEND ITAB.
      SORT ITAB BY F2.
      LOOP AT ITAB.
        WRITE:/1 ITAB-F1 ,
              8 ITAB-F2 ,
              10 ITAB-F3 .
      ENDLOOP.
      LOOP AT ITAB.
        IF ITAB-F2 = 1 OR ITAB-F2 = 2.
          ITAB-TOT = 1.
          MODIFY ITAB.
        ELSEIF ITAB-F2 = 3.
          ITAB-TOT = 3.
          MODIFY ITAB.
        ELSEIF ITAB-F2 = 4 OR ITAB-F2 = 5.
          ITAB-TOT = 4.
          MODIFY ITAB.
        ENDIF.
      ENDLOOP.
      SKIP 2.
      SORT ITAB BY TOT.
      DATA : L_SUM(2) TYPE C,
             L_ROW(2) TYPE C.
      LOOP AT ITAB.
        MOVE-CORRESPONDING ITAB TO JTAB.
        APPEND JTAB.
        L_SUM = L_SUM + ITAB-F3 .
        AT END OF TOT.
          CLEAR JTAB.
          JTAB-F3 = L_SUM .
          APPEND JTAB.
          CLEAR L_SUM.
        ENDAT.
      ENDLOOP.
      LOOP AT JTAB.
        WRITE:/1 JTAB-F1 ,
              8 JTAB-F2 ,
              10 JTAB-F3 .
      ENDLOOP.
    *  DATA: a TYPE i , b .
    *  LOOP AT itab.
    *    IF b = 0.
    *      a = a + itab-f3.
    *    ENDIF.
    *    AT END OF tot.
    *      MOVE space TO itab-f1.
    *      MOVE space TO itab-f2.
    *      MOVE a TO itab-f3.
    *      MODIFY itab .
    *      CLEAR a.
    *      b = 1.
    *    ENDAT.
    *    b = 0.
    *  ENDLOOP.
    *  LOOP AT itab.
    *    MOVE-CORRESPONDING itab TO jtab.
    *    APPEND jtab.
    *  ENDLOOP.
    *  ULINE.
    *  LOOP AT jtab.
    *    WRITE: / jtab-f1 , jtab-f2 , jtab-f3.
    *  ENDLOOP.

  • Large line to internal tables from  tab delimited file

    Dear All
    I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
    For e.g  (* indicates tab)
    1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
    1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
    1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
    1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
    1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
    1material*****************1**99888*****************************************************************************-->upto 5000 columns
    below upto 500 rows or more
    I want to read this file into a columner internal table.
    I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
    Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
    Amol

    Hi Amolsonaikar,
    you may try like this:
    TYPES:
      begin of line,
        t_field type table of string,
      end of line,
      t_line type table of line.
    DATA:
      lt_line  type t_line,
      lv_line type string,
      lt_field type table of string.
    open dataset 'XYZ' for input in text mode encoding default.
    while sy-subrc = 0.
      read dataset into lv_line.
      split lv_line at '|' into lt_field.
      append lt_field to lt_line.
    endwhile.
    Regards,
    Clemens

  • Sharepoint Designer 2010 inserting blank lines

    Sharepoint Designer (SP1) is intermittently inserting hundreds of thousands of rows as I am working with an .aspx document. This bug, which was first present in 2007, has been reported by many people over the years; it seems to remain in 2010.
    Does anyone have a solution for this issue? Is there something in my page, which contains a bunch of xsltlistviews, that could be blowing up this file?
    Thanks.

    All -- 
    FYI, here is a decent workaround to the problem of SPD 2013 (SharePoint Designer 2013) inserting blank lines into pages.
    Here are the steps.
    - Get CodeMaid (free) or similar coding-tool plugin/extension for Visual Studio 2013 (VS 2013) that can remove blank lines.
    - Check out the file in SPD.
    - From SPD, right click the file and choose open with, then choose VS.
    - Run CodeMaid clean processing in VS, which will remove multiple consecutive blank lines.
    - Save file in VS.
    - Close file in VS.
    - Check in file with SPD.
    - Done.
    It may seem like a lot of steps, and it is, and it odd the MS does not simply use the same code editor base for both VS and SPD, but using this workaround is actually pretty quick and easy, and easier still if you use the VS editor to code the files (instead
    of the SPD editor) because the VS has way better code-folding and code-completion and code-digging anyway.
    Just thought I would mention a (fairly) quick and easy way to workaround this SPD shortcoming.
    HTH.
    Thanks.
    -- Mark Kamoski

  • Insert statement in to internal table

    I have an editable ALV LIST report with the check box to it. When the user checks the check box on the report and hits a push Button it should copy the row from the internal table and insert the row to the same internal table in the next line.
    I had my code in this way,
        WHEN 'COPY'.
          LOOP AT t_output INTO wa_output.
            IF wa_output-chkbox = 'X'.
              wa_output-zactual = 0.
              wa_output-zqty = 0.
              INSERT wa_output INTO t_output INDEX sy-tabix.
            ENDIF.
          ENDLOOP.
    However the problem was,
    For e.g. let say I have only 3 rows in the internal table. So when the user selects the last, 3rd row and hits the push button the 3rd row copied and is inserted in the 3rd row. The user wanted the copied row in the next row, ie the 4th row.
    SO I changed the above code as below and now it goes to an endless loop.
        WHEN 'COPY'.
          LOOP AT t_output INTO wa_output.
            IF wa_output-chkbox = 'X'.
              wa_output-zactual = 0.
              wa_output-zqty = 0.
              Sy-tabix = sy-tabix + 1.
              INSERT wa_output INTO t_output INDEX sy-tabix.
            ENDIF.
          ENDLOOP.
    <b>I dont want to use another internal table.</b>
    I hope I am clear.
    Please suggest,
    Ster.

    Hi,
    Change the code as follows.
      data: lv_cnt type i.
        describe table t_output lines lv_cnt.
         LOOP AT t_output INTO wa_output where wa_output-chkbox = 'X'          
                                                                and  wa_output-zactual = 0
                                                                and  wa_output-zqty = 0.
              lv_cnt = lv_cnt + 1.
              INSERT wa_output INTO t_output INDEX lv_cnt.
          ENDLOOP.
    Regards
    Sailaja.

  • Updation of blank field in internal table

    Hi,
      I want to update the blank businees area field with the header item of that particular business area belnr.
    i am sending you the updation of business area code plz find out where rhe error and rectify please.
    points given
    REPORT zfir_vendorwise_grir_balances NO STANDARD PAGE HEADING
                            LINE-SIZE 142
                            LINE-COUNT 65.
    TABLES: bsis,bkpf,bseg,ekko,lfa1.
    TYPE-POOLS: slis.
    CONSTANTS:
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
          gs_layout   TYPE slis_layout_alv ,
          gs_print    TYPE slis_print_alv,
          gt_sort     TYPE slis_t_sortinfo_alv ,
          gt_filter   TYPE slis_t_filter_alv,
          gt_sp_group TYPE slis_t_sp_group_alv,
          gt_alv_graphics TYPE dtc_t_tc,
          gt_excluding  TYPE slis_t_extab ,
          gt_events   TYPE slis_t_event .
    DATA: g_repid LIKE sy-repid.
    DATA: gt_list_top_of_page TYPE slis_t_listheader.
    DATA:       g_boxnam TYPE slis_fieldname VALUE  'BOX',
                p_f2code LIKE sy-ucomm       VALUE  '&ETA',
                p_lignam TYPE slis_fieldname VALUE  'LIGHTS',
                g_save(1) TYPE c,
                g_default(1) TYPE c,
                g_exit(1) TYPE c,
                gx_variant LIKE disvariant,
                g_variant LIKE disvariant.
    DATA : g_user_command(30) VALUE 'USER_COMMAND'.
    DATA : g_status_set(30)  VALUE 'PF_STATUS_SET'.
    DATA: BEGIN OF it_final OCCURS 0,
          awkey TYPE awkey,
          grir(10) TYPE c,
          bukrs LIKE bsis-bukrs,
          hkont LIKE bsis-hkont,
          gjahr LIKE bsis-gjahr,
          belnr LIKE bsis-belnr,
          budat LIKE bsis-budat,
          waers LIKE bsis-waers,
          xblnr LIKE bsis-xblnr,
          blart LIKE bkpf-blart,
          buzei like bseg-buzei,
          bschl LIKE bseg-bschl,
          shkzg LIKE bseg-shkzg,
          gsber LIKE bseg-gsber,
          dmbtr LIKE bseg-dmbtr,
          wrbtr LIKE bsis-wrbtr,
          sgtxt LIKE bseg-sgtxt,
          ebeln LIKE bseg-ebeln,
          lifnr LIKE ekko-lifnr,
          ps_psp_pnr LIKE ekkn-ps_psp_pnr,
          name1 LIKE addr1_data-name1,
          END OF it_final.
    DATA : it_po LIKE it_final OCCURS 0 WITH HEADER LINE.
    DATA : it_ebeln LIKE it_final OCCURS 0 WITH HEADER LINE.
    DATA : it_awkey LIKE it_final OCCURS 0 WITH HEADER LINE.
    DATA : wa_final LIKE LINE OF it_final.
    DATA : BEGIN OF it_lifnr OCCURS 0,
            ebeln TYPE ebeln,
            lifnr TYPE lifnr,
    END OF it_lifnr.
    DATA : BEGIN OF it_name1 OCCURS 0,
            lifnr TYPE lifnr,
            name1 TYPE name1,
    END OF it_name1.
    DATA : hmin TYPE bseg-hkont.
    DATA : hmax TYPE bseg-hkont.
    DATA: idx TYPE sy-tabix.
    DATA:  temp_gsber TYPE bseg-gsber.
    DATA:  temp_ebeln TYPE bseg-ebeln.
    DATA : temp_gjahr TYPE bseg-gjahr.
    DATA : temp_belnr TYPE bseg-belnr.
    DATA : temp_lifnr TYPE bseg-lifnr.
    *DEFINING THE SELECTION-CRITERIA.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_bukrs LIKE skb1-bukrs OBLIGATORY.
    SELECT-OPTIONS: s_gsber FOR bseg-gsber OBLIGATORY.
    SELECT-OPTIONS: s_hkont FOR bseg-hkont OBLIGATORY.
    PARAMETERS: p_lifnr LIKE ekko-lifnr.
    PARAMETERS: p_budat LIKE bkpf-budat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON s_hkont.
      CHECK s_hkont-low LT 250301 OR s_hkont-high GT 250500.
      MESSAGE e000(zm) WITH 'PLEASE SELECT A GRIR CLEARING ACCOUNT BETWEEN'
                            '250301 AND 250500'.
    *INITIALIZATION.
    INITIALIZATION.
      g_repid = sy-repid.
    *START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM display_data.
      PERFORM list_display.
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    *selecting open item details
      SELECT bukrs  hkont  gjahr   belnr buzei
             budat  waers  xblnr   blart
             bschl  shkzg  gsber   dmbtr
             wrbtr  sgtxt
         FROM bsis
            INTO CORRESPONDING FIELDS OF TABLE it_final
            WHERE bukrs EQ p_bukrs
                  AND hkont BETWEEN  '0000250301' AND  '0000250500'
                  AND budat LE p_budat AND ( blart EQ 'WE' OR
                                             blart EQ 'RE' OR
                                             blart EQ 'SA' OR
                                             blart EQ 'EI').
    *selecting closed/cleared item details
      SELECT bukrs  hkont gjahr belnr buzei budat
             waers  xblnr blart bschl shkzg
             gsber  dmbtr wrbtr sgtxt
         FROM bsas
            APPENDING CORRESPONDING FIELDS OF TABLE it_final
            WHERE bukrs EQ p_bukrs
            AND hkont BETWEEN '0000250301' AND  '0000250500'
            AND budat LE p_budat
            AND blart IN ('WE', 'RE','SA','EI')
            AND augdt GE p_budat.
      SORT it_final BY belnr gsber DESCENDING.
      CLEAR: temp_belnr, temp_gsber.
    update blank business areas
    LOOP AT it_final .
    IF temp_gsber IN s_gsber AND it_final-belnr = temp_belnr.
         IF it_final-gsber = ' '.
           it_final-gsber = temp_gsber.
         ENDIF.
       ENDIF.
    if it_final-gsber eq space or it_final-gsber in s_gsber.
         wa_final-gsber = it_final-gsber.
         wa_final-belnr = it_final-belnr.
         modify it_final from wa_final transporting gsber.
    else.
         wa_final-gsber = it_final-gsber.
         wa_final-belnr = it_final-belnr.
         modify it_final from wa_final transporting gsber.
    endif.
    *clear wa_final.
    endloop.
    LOOP AT it_final.
       IF temp_gsber IN s_gsber AND it_final-belnr = temp_belnr.
         IF it_final-gsber = ' '.
           it_final-gsber = temp_gsber.
         ENDIF.
         IF it_final-lifnr = ' '.
           it_final-lifnr = temp_lifnr.
         ENDIF.
         IF it_final-belnr = ' '.
           it_final-belnr = temp_belnr.
         ENDIF.
       ENDIF.
       IF it_final-gsber EQ space OR it_final-gsber IN s_gsber.
         CLEAR: temp_belnr, temp_gsber,temp_lifnr.
         temp_belnr = it_final-belnr.
         temp_gsber = it_final-gsber.
         temp_lifnr = it_final-lifnr.
       ELSE.
         CLEAR : temp_belnr, temp_gsber,temp_lifnr.
       ENDIF.
       MODIFY it_final TRANSPORTING gsber.
    ENDLOOP.
      sort it_final by belnr buzei.
    loop at it_final.
    on change of it_final-belnr.
    clear temp_belnr.
    clear temp_gsber.
    clear temp_lifnr.
    temp_belnr = it_final-belnr.
    temp_gsber = it_final-gsber.
    temp_lifnr = it_final-lifnr.
    endon.
    if it_final-gsber is initial.
      it_final-gsber = temp_gsber.
    *modify it_final transporting gsber.
    endif.
    if it_final-lifnr is initial.
      it_final-lifnr = temp_lifnr.
    *modify it_final transporting lifnr.
    endif.
    modify it_final transporting gsber lifnr where belnr = temp_belnr.
    endloop.
    *deleting entries which are not as per input parameter for business area
    DELETE it_final WHERE  gsber NOT IN s_gsber .
    loop at it_final.
      if s_gsber-low ne '' and s_gsber-high ne ''.
      delete it_final where gsber not in s_gsber.
    elseif s_gsber-low ne '' and s_gsber-high eq ''.
    delete it_final  where gsber ne s_gsber-low.
    endif.
    endloop.
    *initialising internal tables
      it_awkey[] = it_final[].
      it_po[] = it_final[].
      it_ebeln[] = it_final[].
      IF it_final[] IS NOT INITIAL.
    *selecting purchase doc details
        SELECT bukrs  hkont  gjahr   belnr
                       bschl  shkzg  gsber   dmbtr
             wrbtr  sgtxt ebeln
               FROM bseg  INTO CORRESPONDING FIELDS OF TABLE it_ebeln
               FOR ALL ENTRIES IN it_final
                WHERE bukrs = p_bukrs
                  AND belnr = it_final-belnr
                  AND gjahr = it_final-gjahr
                  AND hkont = it_final-hkont.
    *selecting the GR/IR number from BKPF
        SELECT  bukrs    gjahr   belnr
             budat  waers  xblnr   blart
             awkey
            FROM bkpf
          INTO CORRESPONDING FIELDS OF  TABLE it_awkey
              FOR ALL ENTRIES IN it_final
        WHERE bukrs EQ it_final-bukrs
              AND gjahr EQ it_final-gjahr
              AND belnr EQ it_final-belnr.
      ENDIF.
      IF it_ebeln[] IS NOT INITIAL.
    *selecting WBS element
        SELECT   ebeln  gsber
              ps_psp_pnr
          FROM ekkn
          INTO CORRESPONDING FIELDS OF TABLE it_po
          FOR ALL ENTRIES IN it_ebeln
          WHERE ebeln = it_ebeln-ebeln.
    *selecting vendor
        SELECT bukrs ebeln lifnr
          FROM ekko
          INTO CORRESPONDING FIELDS OF TABLE it_lifnr
          FOR ALL ENTRIES IN it_ebeln
          WHERE ebeln = it_ebeln-ebeln.
      ENDIF.
      IF it_lifnr[] IS NOT INITIAL.
    *selecting vendor name
        SELECT lifnr name1
            FROM lfa1
            INTO CORRESPONDING FIELDS OF  TABLE  it_name1
            FOR ALL ENTRIES IN it_lifnr
            WHERE lifnr EQ it_lifnr-lifnr.
      ENDIF.
      LOOP AT it_final.
        idx = sy-tabix.
    *retrieving purchase doc
        READ TABLE it_ebeln WITH KEY belnr = it_final-belnr
                                     gjahr = it_final-gjahr
                                     hkont = it_final-hkont.
        IF sy-subrc EQ 0.
          READ TABLE it_final INDEX idx.
          it_final-ebeln = it_ebeln-ebeln.
          MODIFY it_final INDEX sy-tabix.
        ENDIF.
    *retrieving WBS element
        READ TABLE it_po WITH KEY ebeln = it_final-ebeln.
        IF sy-subrc EQ 0.
          READ TABLE it_final INDEX idx.
          it_final-ps_psp_pnr = it_po-ps_psp_pnr.
          MODIFY it_final INDEX sy-tabix.
        ENDIF.
    calculating amount based on debit/credit
        IF it_final-shkzg = 'H'.
          it_final-dmbtr = 0 - it_final-dmbtr.
          it_final-wrbtr = 0 - it_final-wrbtr.
        ENDIF.
        MODIFY it_final INDEX idx.
      ENDLOOP.
      CLEAR idx.
      SORT it_final BY belnr ebeln DESCENDING.
    *updating blank purchase doc numbers
      CLEAR: temp_belnr, temp_ebeln,temp_gjahr.
      DATA: w_idx LIKE sy-tabix.
      LOOP AT it_final.
        w_idx = sy-tabix.
    *updating blank purchase docs
        IF it_final-gjahr = temp_gjahr AND it_final-belnr = temp_belnr.
          IF it_final-ebeln = ' '.
            it_final-ebeln = temp_ebeln.
          ENDIF.
        ENDIF.
        IF it_final-ebeln NE ' ' .
          CLEAR: temp_belnr, temp_ebeln, temp_gjahr.
          temp_belnr = it_final-belnr.
          temp_ebeln = it_final-ebeln.
          temp_gjahr = it_final-gjahr.
        ELSE.
          CLEAR : temp_belnr, temp_ebeln, temp_gjahr.
        ENDIF.
        MODIFY it_final TRANSPORTING ebeln.
    *retrieving vendor
        READ TABLE it_lifnr WITH KEY ebeln = it_final-ebeln.
        IF sy-subrc EQ 0.
          READ TABLE it_final INDEX w_idx.
          it_final-lifnr = it_lifnr-lifnr.
          MODIFY it_final INDEX sy-tabix.
        ENDIF.
    *retrieving GRIR number
        READ TABLE it_awkey WITH KEY belnr = it_final-belnr
                                     gjahr = it_final-gjahr
                                     bukrs = it_final-bukrs.
        IF sy-subrc EQ 0.
          READ TABLE it_final INDEX w_idx.
          it_final-awkey = it_awkey-awkey.
          MODIFY it_final INDEX sy-tabix.
        ENDIF.
    *retrieving vendor name
        READ TABLE it_name1 WITH KEY lifnr = it_final-lifnr.
        IF sy-subrc EQ 0.
          READ TABLE it_final INDEX w_idx.
          it_final-name1 = it_name1-name1..
          MODIFY it_final INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
    *deleting entries which are not per input parameters
      DELETE it_final WHERE hkont NOT IN s_hkont.
      IF p_lifnr NE ' '.
        DELETE it_final WHERE lifnr NE p_lifnr.
      ENDIF.
    for selecting the grir number which is the first 10 digits of reference key and
    selecting vendor name
      LOOP AT it_final.
        MOVE it_final-awkey+0(10) TO it_final-grir.
        MODIFY it_final INDEX sy-tabix.
      ENDLOOP.
      SORT it_final BY hkont belnr.
    deleting entries where purchase doc is blank.
      DELETE it_final WHERE ebeln EQ ' '.
    ENDFORM.                    " select_data
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM e01_fieldcat_init  USING gt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'HKONT'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '1'.
      ls_fieldcat-seltext_l    = 'ACCOUNT'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BSCHL'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '2'.
      ls_fieldcat-seltext_l    = 'POSTING KEY'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BLART'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '3'.
      ls_fieldcat-seltext_l    = 'DOC TYPE'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BELNR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '4'.
      ls_fieldcat-seltext_l    = 'DOC NUMBER'.
      ls_fieldcat-hotspot(1)   = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'BUDAT'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '5'.
      ls_fieldcat-seltext_l    = 'POSTING DATE'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'XBLNR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '6'.
      ls_fieldcat-seltext_l    = 'REF. DOC NO'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'EBELN'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '7'.
      ls_fieldcat-seltext_l    = 'PURCHASE DOC NO'.
      ls_fieldcat-hotspot(1)   = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'GSBER'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '8'.
      ls_fieldcat-seltext_l    = 'BUSINESS AREA'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'DMBTR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '9'.
      ls_fieldcat-seltext_l    = 'AMOUNT(LC)'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'WRBTR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '10'.
      ls_fieldcat-seltext_l    = 'AMOUNT(DC)'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'WAERS'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '11'.
      ls_fieldcat-seltext_l    = 'CURRENCY'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'GJAHR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '14'.
      ls_fieldcat-seltext_l    = 'Fiscal year'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'GRIR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '14'.
      ls_fieldcat-seltext_l    = 'GR/IR Number'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'LIFNR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '12'.
      ls_fieldcat-seltext_l    = 'VENDOR NO'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'PS_PSP_PNR'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '13'.
      ls_fieldcat-seltext_l    = 'WBS Element'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'NAME1'.
      ls_fieldcat-tabname    = 'IT_FINAL'.
      ls_fieldcat-col_pos      = '14'.
      ls_fieldcat-seltext_l    = 'VENDOR NAME'.
      APPEND ls_fieldcat TO gt_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  LIST_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM list_display .
      gs_layout-colwidth_optimize(1)  = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_background_id         = 'ALV_BACKGROUND'
          i_callback_program      = g_repid
          i_callback_user_command = 'USER_COMMAND'
          i_structure_name        = 'IT_FINAL'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_special_groups       = gt_sp_group[]
          it_sort                 = gt_sort[]
          it_filter               = gt_filter[]
          i_save                  = g_save
          is_variant              = g_variant
          it_events               = gt_events[]
          is_print                = gs_print
          it_alv_graphics         = gt_alv_graphics[]
          it_excluding            = gt_excluding
        TABLES
          t_outtab                = it_final.
    ENDFORM.                    " LIST_DISPLAY
    *&      Form  USER_COMMAND
    FORM user_command USING i_ucomm  LIKE sy-ucomm
                            is_selfield TYPE slis_selfield.     "#EC CALLED
      CASE i_ucomm.
        WHEN '&IC1'.                        " Pick(Double-click)
          CASE is_selfield-fieldname.
            WHEN 'BELNR'.
              CLEAR it_final.
              READ TABLE it_final INDEX is_selfield-tabindex.
              IF sy-subrc EQ 0.
              FI Document number
                SET PARAMETER ID 'BLN' FIELD it_final-belnr.
              Display Document
                CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
              ENDIF.
            WHEN 'EBELN'.
              CLEAR it_final.
              READ TABLE it_final INDEX is_selfield-tabindex.
              IF sy-subrc EQ 0.
              PO number
                IF it_final-ebeln NE ' '.
                  SET PARAMETER ID 'BES' FIELD it_final-ebeln.
              Display Document
                  CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
                ENDIF.
              ENDIF.
          ENDCASE.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM display_data .
      g_repid = sy-repid.
      PERFORM e01_fieldcat_init  USING gt_fieldcat[].
      PERFORM eventtab_build CHANGING gt_events.
      PERFORM e04_comment_build USING gt_list_top_of_page[].
    ENDFORM.                    " display_data
    *&      Form  eventtab_build
          text
         <--P_GT_EVENTS  text
    FORM eventtab_build CHANGING lt_events TYPE slis_t_event.
      CONSTANTS:
        gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = lt_events.
      READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
      INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO lt_events.
      ENDIF.
    ENDFORM.                    " eventtab_build
    *&      Form  e04_comment_build
          text
         -->P_GT_LIST_TOP_OF_PAGE[]  text
    FORM e04_comment_build  USING e04_lt_top_of_page TYPE slis_t_listheader.
      DATA : v_time(10) TYPE c.
      DATA: ls_line TYPE slis_listheader.
      DATA : v_text(50) TYPE c.
      DATA : v_date_low(10)  TYPE c,
             v_date_high(10)  TYPE c.
      CONCATENATE 'GR/IR Report' ' '
      INTO v_text SEPARATED BY space.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = v_text.
      APPEND ls_line TO e04_lt_top_of_page.
    ENDFORM.                    " e04_comment_build
    *&      Form  top_of_page
          text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM   .                    "TOP_OF_PAGE
    regards,
    Amit teja
    Message was edited by: amit teja
    Message was edited by: amit teja
    Message was edited by: amit teja

    Hello,
    <b>Sort it_final by belnr.</b>
    loop at it_final.
    on change of it_final-belnr.
    clear temp_gsber.
    clear temp_lifnr.
    <b>temp_belnr = it_final-belnr.</b>
    temp_gsber = it_final-gsber.
    temp_lifnr = it_final-lifnr.
    if it_final-gsber eq ' '.
    it_final-gsber = temp_gsber.
    endif.
    if it_final-lifnr eq ' '.
    it_final-lifnr = temp_lifnr.
    endif.
    modify it_final transporting gsber lifnr where <b>belnr = temp_belnr</b>.
    <b>endon.</b>
    endloop.
    Regards,
    Naimesh

  • MODIFY ALL LINES IN INTERNAL TABLE

    Hi,
    How to modify more than one line in an internal table? I tried using update, failed as update is not for internal tables. Your help is appriciated .
    thank you,
    surya.

    To change one or more lines using a condition, use the following statement:
    <b>MODIFY itab FROM wa TRANSPORTING f1 f2 ... WHERE cond.</b>
    This processes all of the lines that meet the logical condition cond. The logical expression cond can consist of more than one comparison. In each comparison, the first operand must be a component of the line structure. If the table lines are not structured, the first operand can also be the expression TABLE_LINE. The comparison then applies to the entire line. If the line type of the internal table contains object reference variables as component comp or if the entire line type is a reference variable, the attributes of the attr object to which the respective line reference points can be specified as comparison values using comp->attr or table_line->attr.
    The work area wa, which must be compatible with the line type of the internal table, contains the new contents, which in turn will be assigned to the relevant table line using the TRANSPORTING addition. Unlike the above MODIFYstatement, the TRANSPORTING addition is not optional here. Furthermore, you can only modify the key fields of the internal table if it is a standard table. If at least one line is changed, the system sets sy-subrc to 0, otherwise to 4.
    REPORT demo_int_tables_modify .
    DATA: BEGIN OF line,
            col1 TYPE i,
            col2 TYPE i,
          END OF line.
    DATA itab LIKE HASHED TABLE OF line WITH UNIQUE KEY col1.
    DO 4 TIMES.
      line-col1 = sy-index.
      line-col2 = sy-index ** 2.
      INSERT line INTO TABLE itab.
    ENDDO.
    line-col1 = 2.
    line-col2 = 100.
    MODIFY TABLE itab FROM line.
    LOOP AT itab INTO line.
      WRITE: / line-col1, line-col2.
    ENDLOOP.
    The list output is:
             1        1
             2      100
             3        9
             4       16
    The program fills a hashed table with a list of square numbers. The MODIFY statement changes the line of the table in which the key field col1 has the value 2.
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Grid using - GL_GUI_ALV_GRID inserting blank line

    Hi experts ...
    I am creating report using grid instance of class GL_GUI_ALV_GRID  ...
    its displaying results output table say itab[] ... I want to insert one blank line in display ...
    if i append work area of type itab to itab ... in that case the column which showing amount displays 0.0
    instead i want complete blank row ...
    Thanks & Regards  ...
      Ashish

    Hi,
    check this link;[Blank Row in ALV Grid Display;
    hope u'll get some idea.
    Regards,
    Sneha.

Maybe you are looking for

  • IDVD Stops Responding when Exporting from iMovie

    I'm using iDVD and iMovie (from iLife 06 and fully up to date) on a MacPro (also up to date on all software, MacOSX, Quicktime etc). This proceedure has worked before several times but now results in a non-responding iDVD every time I try it, includi

  • Printing with FF 4.0 is slow and generated print files are huge

    I tried the RC and released versions of Firefox 4.0 and found the printer module(?) doesn't work as it did in version 3.x If I print to my laser printer it generates each page slowly (I'm guessing it turns it into graphics) or if I print to a PDF fil

  • Photosmart printer not printing straight

    I have recently purchased a HP Photosmart 5515 e All-in-One printer (model no. B111h). I managed to set it up with no problems, however, when I try to print out documents I notice the images are not straight - they all seem to be skewed slightly. It 

  • Elements 9 start up page in black/grey fonts

    Does anyone know where one can download the classic work page with white background with classic toolbars rather than black ground/ grey fonts which are very hard( for me) to see. There should be a choice for customers - this aspect is becoming a pro

  • Need help on incremental backup

    Hi, I am running a rman backup using 10g DBCONSOLE. I selected level 0 backup and it's running. this is the command. >> backup incremental level 0 cumulative device type disk filesperset = 5 tag 'BACKUP_DHAVA.SOS.S_081507014538' database; >> my quest