Logic in updating a internal table...

Hello,
I have a internal table having values as follows:
I_TAB[]:
Doc-num..........Item-num.........amount........Doc-type
456..............01................4.26.................................
456..............02...............345.89..............................
456..............03..............-45.39................................
763...........and so on
After I loop at I_TAB[] is the sum of total amount > 0, the value in doc-type should get updated with 'PX' and if negative the, Doc-type should get updated with 'NX' for all the three records in internal table for whose amount were used in calculating net amount.
How can I achieve this ?
Regards,
Rajesh.

Hello,
When you populate the internal table, also populate another internal table with fields document number and amount. Use collect statement to populate the new internal table. i.e by using collect statement you will have only 1 record for the document number and the amount will have summation of all the line items for that document number.
When you loop at itab, just read the new internal table based on the document number. That way you will know whether the total amount is greater than 0 or negative.
Based on this you can update the document type.
Hope this helps.
Thanks,
Sushil Joshi

Similar Messages

  • Logic required for a Internal table  issue

    Hi All,
    I have 2 internal table. I need STLNR value to another internal table. Both having same field. But while reading from one internal table to another internal table using IDNRK key, One idnrk having 2 different stlnr value. But its taking only one. How to take both the values?
    The internal table value like below.
    it_stpo--> This is first table, Here one Idnrk having different stlnr value. I need the same in to next table. Here i read with idnrk field but its taking one stlnr value only into next table.
    How to change the logic ?
    Below is it_stpo table and next one is it_mbew_1
    it_stpo
    STLNR     IDNRK             MENGE
    17224     00439RM1     2.3
    17225     00439RM1     4.2
    172333     00849RM2     5.6
    172158     00432TM3     7.2
    152164     00583RM4     8.4
    176123     00583RM4     2.3
    it_mbew_1
    STLNR     IDNRK             STPRS
         00439RM1     111.22
         00439RM1     126.45
         00849RM2     3.3364
         00432TM3     15.5888
         00583RM4     0
         00583RM4     0.235
    My logic like below,
              SORT it_stpo BY idnrk.
              SORT it_mbew_1 BY matnr.
              LOOP AT it_mbew_1 INTO wa_mbew_1.
                READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr BINARY SEARCH.
                IF sy-subrc = 0.
                  wa_mbew_1-stlnr = wa_stpo-stlnr.
                  MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
                ENDIF.
              ENDLOOP.
    Kindly help us.
    Mohana

    Try below logic.
    add one more field to it_stpo flag type char01.
    update the field with value 'X'.
    SORT it_stpo BY idnrk.
              SORT it_mbew_1 BY matnr.
              LOOP AT it_mbew_1 INTO wa_mbew_1.
                CLEAR WA_STPO.
                READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr                                                                               
    flag = 'X'.
                if sy-subrc eq 0.
                         move ' ' to wa_stpo-flag.
                         modify it_stpo from wa_stpo index sy-tabix.
                          wa_mbew_1-stlnr = wa_stpo-stlnr.
                         MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
                 endif.
              ENDLOOP.
    Regards
    Vinod

  • File Format Mismatch while update into Internal table using RFC_REMOTE_FILE

    Hi All,
    I used RFC_REMOTE_FILE to communicate with the presentation server in Background Mode. I connected successfully and got output too.
    But my requirement is to update the .csv file into internal tables.
    With RFC_REMOTE_FILE i can get the data as single row. But I can't separate the fields and update into the corressponding table field.
    What is the solution for the above issue. Could anyone help me.
    For the above RFC Communication I followed the below link
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true

    Hi All,
    I used RFC_REMOTE_FILE to communicate with the presentation server in Background Mode. I connected successfully and got output too.
    But my requirement is to update the .csv file into internal tables.
    With RFC_REMOTE_FILE i can get the data as single row. But I can't separate the fields and update into the corressponding table field.
    What is the solution for the above issue. Could anyone help me.
    For the above RFC Communication I followed the below link
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2&overridelayout=true

  • Regarding logic in manipulation of internal table

    Hi All,
    I have one internal table as below:
    <b>I_TAB</b>.
    <b>VBELN  LIKE VBAP-VBELN,
    POSNR LIKE VBAP-POSNR,
    QTY      LIKE VBAP-KWMENG,
    SUM     LIKE VBAP-KWMENG,
    </b>
    Now i have filled in this internal table from select statement
    Data is:
    100, 10, 100
    100,  10, 200
    100,  10, 300
    100, 20, 50
    100, 30, 100
    100, 30, 200
    etc.
    Now what i want is i want t calculate SUM field in above internal table based on VBELN & POSNR
    Finally data should come as
    100, 10, QTY, 600
    100, 20, QTY, 50
    100, 30, QTY, 300
    (or)
    we can update QTY with SUM of all VBELN/POSNR.
    Can anybody tell me what is the logiic!
    Thanks,
    Deep.

    Hi,
    Declare on more table as ITAB, say JTAB.
    Loop at ITAB.
    JTAB-VBELN = ITAB-VBELN.
    JTAB-POSNR = ITAB-POSNR.
    JTAB-SUM = ITAB-QTY.
    COLLECT JTAB
    endloop.
    JTAB will have ur required output, But u cant put QTY in between since, the Qunattity is Integer field u cant place 'QTY', since it is a char.
    Sreedhar
    Message was edited by:
            Sreedhar Kanchanapalli

  • Update a internal table

    Hi
    I need a help..
    I Have a program ,which read data from three diferent tables. I create a inner join between two, but the field key to the third is diferent. At one case a need
    INNER JOIN vbkd AS d ON dvbeln = ivbeln_ncf
    on other I need INNER JOIN vbkd AS d ON dvbeln = ivbeln_rf
    How can i do this ?
    this is my abap code
    FORM get_data.
      DATA:aux_bstkd LIKE vbkd-bstkd,
           aux_bstdk LIKE vbkd-bstdk.
      SELECT cmandt czproc cgrund cfrbnr_dc czrejeic cbstnk izitem_dev imblnr_df
        ibudat_df ibldat_df cmatnr_dc imenge_df ikunnr imenge_drf i~vbeln_ncf
        ivbeln_rf ivbeln_ec igrund ivkaus iaugru iwerks ilgort ist_forn i~st_cli
        ist_glob itipo_ent "dbstkd dbstdk
        INTO CORRESPONDING FIELDS OF TABLE lt_tab
        FROM  ( zmm_trocas_devol AS c
               INNER JOIN zmm_trocdev_item AS i ON czproc = izproc )
              INNER JOIN vbkd AS d ON dvbeln = ivbeln_ncf )
         WHERE
               i~zitem_dev NE ' ' AND
               c~kunnr EQ s_kunnr AND
               c~werks EQ s_werks AND
               c~lgort EQ s_lgort AND
               c~st_glob EQ 'C'.
      BREAK-POINT.
    ENDFORM. 
    i think that a solution is after this select, put a loop at lt_tab and update the field bstdk one by one... but i don´t know how to do it.
    Thanks

    Hi,
    You will have to write 2 select queries and then merge the records
    SELECT c~mandt c~zproc c~grund c~frbnr_dc c~zrejeic c~bstnk i~zitem_dev i~mblnr_df
    i~budat_df i~bldat_df c~matnr_dc i~menge_df i~kunnr i~menge_drf i~vbeln_ncf
    i~vbeln_rf i~vbeln_ec i~grund i~vkaus i~augru i~werks i~lgort i~st_forn i~st_cli
    i~st_glob i~tipo_ent "d~bstkd d~bstdk
    into CORRESPONDING FIELDS OF TABLE lt_tab
    FROM ( zmm_trocas_devol AS c
    INNER JOIN zmm_trocdev_item AS i ON c~zproc = i~zproc )
    INNER JOIN vbkd AS d ON d~vbeln = i~vbeln_ncf )
    WHERE
    i~zitem_dev NE ' ' AND
    c~kunnr EQ s_kunnr AND
    c~werks EQ s_werks AND
    c~lgort EQ s_lgort AND
    c~st_glob EQ 'C'.
    SELECT c~mandt c~zproc c~grund c~frbnr_dc c~zrejeic c~bstnk i~zitem_dev i~mblnr_df
    i~budat_df i~bldat_df c~matnr_dc i~menge_df i~kunnr i~menge_drf i~vbeln_ncf
    i~vbeln_rf i~vbeln_ec i~grund i~vkaus i~augru i~werks i~lgort i~st_forn i~st_cli
    i~st_glob i~tipo_ent "d~bstkd d~bstdk
    into CORRESPONDING FIELDS OF TABLE lt_tab_2
    FROM ( zmm_trocas_devol AS c
    INNER JOIN zmm_trocdev_item AS i ON c~zproc = i~zproc )
    INNER JOIN vbkd AS d ON d~vbeln = i~vbeln_rf )
    WHERE
    i~zitem_dev NE ' ' AND
    c~kunnr EQ s_kunnr AND
    c~werks EQ s_werks AND
    c~lgort EQ s_lgort AND
    c~st_glob EQ 'C'.
    You can then loop at lt_tab and merge the entries from lt_tab_2
    regards,
    Advait

  • Updation of internal table from tableview

    Hi,
    I am using a tableview in which coloumn-3(last_days) is editable.After editing it when user pressess on the button SAVE I should capture the changes and update it in database.
    But here I am facing a problem.Always the field last_days is being filled with '000' irrespective of the value entered.
    The below is the piece of code which I had written:
    DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW,
    wa like line of  R_GT_VIEW.
    tv ?= CL_HTMLB_MANAGER=>GET_DATA(
    request = runtime->server->request
    name = 'tableView'
    id = 'tvx' ).
    IF tv IS NOT INITIAL.
    DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
    tv_data = tv->data.
    loop at R_GT_VIEW into wa .
    wa-last_days =  tv_data->get_cell_value( row_index = sy-tabix
                                       column_index = '3' ).
    modify R_GT_VIEW from wa index sy-tabix.
    endloop.
    ENDIF.
    Helpful answers will be rewarded.
    Thanks

    Hi,
    Sorry....coz I replied in a haste...
    Just to let you know....The method get_cell_value will not work if you are rendering a column as InputField.
    Use the below mentioned code and this it should work....
    DATA: tv TYPE REF TO cl_htmlb_tableview.
              wa like line of R_GT_VIEW.
    tv ?= cl_htmlb_manager=>get_data(
                        request = runtime->server->request
                        name = 'tableView'
                        id = 'tvx' ).
    IF tv IS NOT INITIAL.
      DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
      tv_data = tv->data.
      LOOP AT itab INTO wa .
        data : if_value type ref to cl_htmlb_inputfield.
        data : p_cell_id type string,       
               row_ix type string.
        clear p_cell_id.
        clear row_ix.
        row_ix = sy-tabix.
        condense row_ix.
        concatenate p_cell_id 'TV_' row_ix '_3' into p_cell_id.    "generating cell ID...Make Sure to use ur TableView Id instead of TV
        if_value ?= cl_htmlb_manager=>get_data( request = request
                                                name    = 'inputField'
                                                id      = p_cell_id
           if if_value->value is not initial.
             wa-last_days  = if_value->value.
           endif.
        MODIFY itab FROM wa INDEX sy-tabix.
      ENDLOOP.
    <i>Do reward each useful answer..!</i>
    Thanks,
    Tatvagna.

  • How to update value in internal table from cdpos taking fname n value_new?

    hello everyone,
              i want to insert  value in internal table from cdpos table taking field name  from fname and value from value_new.but the problem is i am not getting how to map the corresponding field of internal table with fname value  which is the field name.
    for example
    i
    fieldname
    value
    name1
    raj
    name2
    sharma
    i want to update field name1. this name1 is there in fname with updated value in value_new  how to make name1 with fname value
    thanks and regards
    laxmikant soni

    Hi Laxmikant,
    If I have understood your requirement correctly, you need to update an internal table with latest 'value_new' from cdpos table where  'fname' = 'fieldname' .
    Hope the below logic will help you:
    FIELD-SYMBOLS: <wa_intab> LIKE LINE OF lt_intab.  "the internal table you want to change
    LOOP AT lt_intab ASSIGNING <wa_intab> .
       READ TABLE lt_cdpos INTO wa_cdpos           "lt_cdpos contains latest data selected from CDPOS
        WITH KEY fname = <wa_intab>-fieldname.
       IF sy-subrc = 0.
         <wa_intab>-value = wa_cdpos-value_new.    
       ELSE.
         "//logic if the name is not there in CDPOS
       ENDIF.
       CLEAR  wa_cdpos.
    ENDLOOP.
    If you wish to improve performance, I suggest using
    1. "transporting value_new" addition in READ TABLE,
    2.  select only the data which you require from CDPOS,
    3.  create the internal tables with only fields which you require,
    4.  when you are using SELECT,LOOP AT statements, limit records by using WHERE condition
    Regards,
    Kavya

  • Updating internal table with CSV file

    I have a flat file as below:
    aaaa, bbbb, asdc, dfgfhg, sdfsg, sdf, sdf, sdf, dfg, sdf, sgf, drgftfgh, sgf, drgtf, swftgd, sgf,
    'sjhdfjhf','2003-10-11 07:52:37','167','alkjd',NULL,NULL,NULL,NULL,NULL,'MX1',NULL,NULL,'dkjffdj ,',NULL,NULL,NULL,'1',NULL,NULL,'AR, dfkj ',
    Where we can see it is separated by commas.I want to upload this one into onr internal table.I used GUI_UPLOAD and gave the logic as folows:
    TYPES: BEGIN OF ttab,
    rec(1000) TYPE c,
    END OF ttab.
    TYPES: BEGIN OF tdat,
    aaaa type char10
    bbbb type char10,
    asdc  type char10,
    dfgfhg  type char10,
    sdfsg  type char10,
    sdf  type char10,
    sdf  type char10,
    sdf  type char10,
    dfg   type char10,
    sdf    type char10,
    sgf  type char10,
    drgftfgh  type char10,
    sgf  type char10,
    drgtf  type char10,
    swftgd  type char10,
    sgf  type char10,
    END OF tdat.
    DATA: itab TYPE TABLE OF ttab WITH HEADER LINE.
    DATA: idat TYPE TABLE OF tdat WITH HEADER LINE.
    DATA: file_str TYPE string.
    PARAMETERS: p_file TYPE localfile.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    static = 'X'
    CHANGING
    file_name = p_file.
    START-OF-SELECTION.
    file_str = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_str
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    LOOP AT itab.
    CLEAR idat.
    SPLIT itab-rec AT ',' INTO idat-aaaa
    idat-bbbb ,
    idat-asdc  ,
    idat-dfgfhg  ,
    idat-sdfsg  ,
    idat-sdf  ,
    idat-sdf  ,
    idat-sdf  ,
    idat-dfg   ,
    idat-sdf    ,
    idat-sgf  ,
    idat-drgftfgh  ,
    idat-sgf  ,
    idat-drgtf  ,
    idat-swftgd  ,
    idat-sgf  ,
    APPEND idat.
    ENDLOOP.
    Now the issue is when I use the statement SPLIT itab-rec AT ',' this is not updating the table idat properly.Because the flat file contains the value as 'dkjffdj ,', too.
    Can anyone give me some solution to update the internal table.

    hI
    or you delete ' from csv file before uploading it or after uploading it, in this last case u can use statament replace:
    REPLACE ''' WITH SPACE INTO ITAB-FIELD.
    Max

  • BRFplus: Problem updating values in an internal table in a loop expression

    Hi
    I'm looking into the loop expression type of BRFplus and I have come across a problem updating an internal table, I'm trying to create and populate the table using a loop, here is the functionality I'm trying to achieve:
    In a rule set create an internal MONTH_TBL table containing 12 rows of two columns: MONTH_NUM containing values 1 through 12 and MONTH_VAL containing an amount (initially 0,00 EUR in all 12 rows).
    After initializing the table traverse through SFLIGHT table and for each row add PRICE from the table to MONTH_VAL in the row of MONTH_TBL corresponding to the month of FLDATE field in SFLIGHT.
    The initialization of MONTH_TBL works as intended, as does the traversal of and retrieval of values from SFLIGHT. The problem however is the update of the internal table MONTH_TBL (defined as result data object for the function). I don't get an error, but the tables does not get updated, and I cannot seem to find out what the problem is. I would have attached an XML extract of the function + ruleset for information, but it dosen't seem like that is possible, I could e-mail it on request (for SAP employees with access to system QU5 the function is LOOP_TEST in application Z_KLAUS_TEST).
    I hope that this is sufficient information to understand the issue that I'm dealing with.
    best regards
    Klaus Stenbæk, KMD

    Hi Klaus,
    The Loop expression is part of NW 7.02 which is not yet released. When you experience the problem as part of a test you should have a contact at SAP for dealing with problems/errors. Usually SAP-internal messages are used for this purpose. Please clarify with your SAP contact how the model is.
    BR,
    Carsten

  • Internal table logic issue

    Hi All,
    I have one logical issue related to internal table manipulation.
    I have one internal table :
    I_DAT - This is related to Loading/Unloading of Goods.
    for example with 3 fields
    VSTEL, KUNNA, KMMANG.
    Now suppose my data looks like this after sorting:
    VSTEL   KUNNA    KMMANG
    100       -        -
    200       -        -
    300       -        -
    400       -        -
    -         500      X
    -         600      X
    -         700      X
    -         800      X
    Here 100,200,300,400 are Loading points.
    ANd 500,600,700,800 are unloading points.
    Now what i want is For loading & Unloading points i need to pick up Address and print one after other.
    But how they need to print is:
    FOR INITIAL LOADING OF
    ADDRESS- For 100
    FIRST STOP: FOR LOADING OF
    ADDRESS- For 200
    SECOND STOP: FOR LOADING OF
    ADDRESS- For 300
    Etc .....
    Then
    FOR UNLOADING OF:
    ADDRESS- For 400
    FIRST STOP: FOR UNLOADING OF
    etc.
    FINAL STOP: FOR FINAL UNLOADING OF
    We might get as many records :
    Can any body give me the logic:
    Printing Address is not a problem:
    But Above every address we need to print FIRST STOP, SECOND etc like that.
    For this i need logic.
    Can anybody give the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Try this.I think you want output like this......
    DATA: BEGIN OF LINE,
            CARRID   TYPE SBOOK-CARRID,
            CONNID   TYPE SBOOK-CONNID,
            FLDATE   TYPE SBOOK-FLDATE,
            CUSTTYPE TYPE SBOOK-CUSTTYPE,
            CLASS    TYPE SBOOK-CLASS,
            BOOKID   TYPE SBOOK-BOOKID,
          END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
    SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
           FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB INTO LINE.
      AT FIRST.
        WRITE / 'List of Bookings'.
        ULINE.
      ENDAT.
        AT NEW CARRID.
          WRITE: / 'Carrid:', LINE-CARRID.
        ENDAT.
          AT NEW CONNID.
            WRITE: / 'Connid:', LINE-CONNID.
          ENDAT.
            AT NEW FLDATE.
              WRITE: / 'Fldate:', LINE-FLDATE.
            ENDAT.
              AT NEW CUSTTYPE.
                WRITE: / 'Custtype:', LINE-CUSTTYPE.
              ENDAT.
                   WRITE: / LINE-BOOKID, LINE-CLASS.
                AT END OF CLASS.
                  ULINE.
                ENDAT.
    ENDLOOP.
    This is also helpful......
    LOOP AT <itab>.
      AT FIRST. ... ENDAT.
        AT NEW <f1>. ...... ENDAT.
          AT NEW <f2 >. ...... ENDAT.
              <single line processing>
          AT END OF <f2>. ... ENDAT.
        AT END OF <f1>. ... ENDAT.
      AT LAST. .... ENDAT.
    ENDLOOP.
    Regards
    Abhishek

  • Logic in a internal table

    hi experts , i need a logic
    i have a internal table itab_equi in that i am getting 11 values when i pass this internal table to another table using for all entries i will get 4 values in int_bmgkobj . i need logic for how to get the deleted values  i.e 9 values deleted . i need that value 9 values ..
    SELECT matnr
               sernr
               kunde
               objnr FROM equi
               INTO TABLE itab_equi  " i am getting 11 values here
               WHERE kunde = kunde .
    IF itab_equi[] IS NOT INITIAL.
          SELECT j_objnr
                       gwldt
                       gwlen FROM bgmkobj
                       INTO TABLE itab_bgmkobj " i am getting 4 values here
                       FOR ALL ENTRIES IN itab_equi
                       WHERE j_objnr = itab_equi-objnr .
    i need the deleted 9 values in a seperate internal table ..
    plz help me for this logic
    regards
    chinnaiya P

    HI,
    Check this ..
    SELECT matnr
               sernr
               kunde
               objnr FROM equi
               INTO TABLE itab_equi  " i am getting 11 values here
               WHERE kunde = kunde .
    IF itab_equi[] IS NOT INITIAL.
          SELECT j_objnr
                       gwldt
                       gwlen FROM bgmkobj
                       INTO TABLE itab_bgmkobj " i am getting 4 values here
                       FOR ALL ENTRIES IN itab_equi
                       WHERE j_objnr NE itab_equi-objnr .  "--> Check here
    Or
    Select all the data from bgmkobj into internal table  itab_bgmkobj.
    Loop the  itab_bgmkobj and check the entry using entries in internal table itab_equi..if found delete ..the left entries are what you required

  • Updating internal table in dynamic way

    Hi,
    I want to update one internal table dynamically.I have two internal table.
    One internal table has the records which are field names of the 2nd internal table.
    suppose:
    Itab1 is as follows:
    F1                                           F2
    aaa                                        bbb
    Itab2 as follows:
    aaa                         bbb
    This means the ITAB1 records are the fields of ITB1.Now I want to update ITAB2 when I found ITAB1-F1 is the field of ITAB2 dynamically.
    Can anyone give some code hint to do so.

    you can use below code for this. I write it in notepad some changes may be necessary.
    data: lv_c(30).
    field-symbols: <f1> type any.
    loop at itab1.
    concatenate 'itab2' itab1-fieldname into lv_c.
    assign (lv_c) to <f1>.
    if assign successful this means this field exists
    if sy-subrc = 0
    move value to <f1>.
    *modify itab2.
    endif.
    endloop.
    Edited by: Gungor Ozcelebi on Jul 1, 2009 3:37 PM

  • Multiple checkbox selection in ALV and updating internal table

    Dear Expert,
    Can anyone tell me how to handle the multiple checkbox selection in ALV Grid report and then updating the internal table.
    I tried the option but it works only when i select only 1 row in ALV.
                    DO L_LINES TIMES.
                      read table icoas index rs_selfield-tabindex.
                      if sy-subrc = 0.
                        ICOAS-NOCHK = 'X'.
                        modify ICOAS INDEX rs_selfield-tabindex TRANSPORTING NOCHK.
                      ENDIF.
                    ENDDO.
    Requires help....
    Regards & Thanx,
    Bhupathi.

    Hi,
    Use this method to capture the check box event. Write this once you create your grid using CREATE OBJECT grid1.
    DATA:      GRID1 TYPE REF TO CL_GUI_ALV_GRID,
    CALL METHOD grid1->register_edit_event
      EXPORTING
        i_event_id = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
      EXCEPTIONS
        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.
      LOOP AT T_GRIDDETAILS INTO WA_GRIDDETAILS.
        IF WA_GRIDDETAILS-CHECKBOX = 'X'.
                  "Do your operation
        ENDIF.
        CLEAR WA_GRIDDETAILS.
      ENDLOOP.

  • How to read only particualr columns from excel sheet to internal table

    Hi,
    I have and excel sheet which has around 20 columns, in which i want to read only 6 columns. They are at different column positions, means the 1st column, 6thcolumn, 8th column so on..
    Can we do this in sap? do we have any FM to do this?
    Thanks.
    Praveena.

    hi,
    Use the below logic to fetch the data into internal table..You need to read the data cell by cell and update the internal table,
    DATA l_count TYPE sy-tabix.
       CONSTANTS: lc_begin_col TYPE i VALUE '1',
                  lc_begin_row TYPE i VALUE '2',
                  lc_end_col   TYPE i VALUE '2',
                  lc_end_row   TYPE i VALUE '3000'.
      CLEAR p_i_excel_data. REFRESH p_i_excel_data.
    * Function module to read excel file and convert it into internal table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_p_file
           i_begin_col             = lc_begin_col
           i_begin_row             = lc_begin_row
           i_end_col               = lc_end_col
           i_end_row               = lc_end_row
         TABLES
           intern                  = i_data
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
    * Error in file upload
       IF sy-subrc NE 0 .
         MESSAGE text-006 TYPE 'E'.
         EXIT.
       ENDIF.
       IF i_data[] IS INITIAL .
         MESSAGE text-007 TYPE 'E'.
         EXIT.
       ELSE.
         SORT i_data BY row col .
    * Loop to fill data in Internal Table
         LOOP AT i_data .
           MOVE i_data-col TO l_count .
           ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
           MOVE i_data-value TO <fs_source> .
           AT END OF row .
    * Append data into internal table
             APPEND p_i_excel_data.
             CLEAR p_i_excel_data.
           ENDAT .
         ENDLOOP .
       ENDIF .

  • Retrieve Filtered ALV output into Internal Table in Program

    Guys,
    I want to update my internal table with the filtered output that the user has selected in the output.
    Lets say my internal table had 6 entries which was outputted.
    Now the the user filters that output ( say where material is initial ) so that there are only 2 entries left on the output.
    How can i know which 2 entries are left on the output screen ?
    ( i need to know as i am deleting entries from a table )
    I came across this slis_filter_alv0 but could not use it in my user exit command routine.
    Any ideas would be very helpful.
    Cheers.....

    Try the method get_filtered_entries
    This method teturns a table with all indexes that are currently hidden on the screen using the standard "filter" function.
    CALL METHOD
    <ref.var. to CL_GUI_ALV_GRID>->get_filtered_entries
       IMPORTING
          ET_FILTERED_ENTRIES  = <int tbl of type LVC_T_FIDX >.
    Then by using this internal table you can find out the entries which are shown in the output.
    Hope this helps.
    Thanks,
    Balaji

Maybe you are looking for

  • How can I move my iPhone sync to another computer?

    I currently sync my iPhone to my laptop.    I'm not using the laptop anymore, and would like to sync to my desktop instead.   When I try to sync on my desktop, I get a warning that all my app data will be erased and replaced with the desktop version.

  • Help with photos that can't be imported

    Hello all, Every time I open iPhoto there is a message saying new photos have been found and asking if I want to import them to the library. I click "yes" and the same message is shown again. After that, I get a message saying the photos have been ad

  • KM Repository images,and XML Forms not displaying.

    Hello All, I am currently running NW04 SPS14 Portal with KM & Collaboration. However, the icons in the Content Management>> Explorer>> Documents repository are not displaying. Instead a little while box, with a red x sign appears in place of the imag

  • Can't update CC programs.  Stop at 42%

    Hi I am unable to update my apps on CC and have been for several months.  I contacted Adobe support several months ago and then just yesterday - and the issue still isn't resolved.  My programs that are old cc programs are on my computer but no longe

  • Won't boot Hardware Test

    I an using the Apple install disk 1 which contains OS X 10.4 even though I am running OS X 10.5. That is what is says to do. I have tried holding the "D" key before the computer makes the bong. During the Bong and after the Bong. No matter what I do