Need to move the data to final internal Table

Hi all,
TYPES: BEGIN OF TY_MARA,
       MATNR       TYPE  MATNR,         " Material Number
       ZZBASE_CODE TYPE  ZBASE_CODE,    " Base Code
       END OF TY_MARA,
       BEGIN OF TY_MAKT,
       MAKTX       TYPE  MAKTX,         " Material Description
       END OF TY_MAKT,
       BEGIN OF TY_MARC,
       WERKS       TYPE  WERKS_D,      " Plant
       END OF TY_MARC,
       BEGIN OF TY_QMAT,
       ART           TYPE  QPART,         " Inspection Type
       END OF TY_QMAT,
       BEGIN OF TY_MAPL,
       MATNR        TYPE  MATNR,        " Material
       PLNTY        TYPE  PLNTY,        " Task List Type
       END OF TY_MAPL,
       BEGIN OF TY_PLKO,
       VERWE             TYPE     PLN_VERWE,     "     Task list usage
       END OF TY_PLKO,
      BEGIN OF TY_FINAL,
       MATNR          TYPE    MATNR,          " Material Number
       MAKTX          TYPE    MAKTX,          " Material Description
       ZZBASE_CODE    TYPE    ZBASE_CODE,     " Base Code
       WERKS          TYPE    WERKS_D,        " Plant
       CLASS          TYPE    KLASSE_D,       "     Class Number
       ART             TYPE    QPART,           " Inspection Type
       VERWE             TYPE    PLN_VERWE,       " Task list usage
     END OF TY_FINAL.
DATA: I_MARA  TYPE  STANDARD TABLE OF TY_MARA  ,
      I_MAKT  TYPE  STANDARD TABLE OF TY_MAKT  ,
      I_MARC  TYPE  STANDARD TABLE OF TY_MARC  ,
      I_QMAT  TYPE  STANDARD TABLE OF TY_QMAT  ,
      I_MAPL  TYPE  STANDARD TABLE OF TY_MAPL  ,
      I_PLKO  TYPE  STANDARD TABLE OF TY_PLKO  ,
      I_KLAH  TYPE  STANDARD TABLE OF TY_KLAH  ,
      I_FINAL TYPE  STANDARD TABLE OF TY_FINAL ,
      WA_MARA  TYPE  TY_MARA,
      WA_MAKT  TYPE  TY_MAKT,
      WA_MARC  TYPE  TY_MARC,
      WA_QMAT  TYPE  TY_QMAT,
      WA_MAPL  TYPE  TY_MAPL,
      WA_PLKO  TYPE  TY_PLKO,
      WA_KLAH  TYPE  TY_KLAH,
     WA_FINAL TYPE  TY_FINAL.
data: v_mtart         type    mara-mtart,
      v_matnr         type    mara-matnr,
      v_zzbase_code   type    mara-zzbase_code,
      v_werks         type    t001w-werks,
      v_beskz         type    marc-beskz.
selection-screen skip 1.
selection-screen begin of block b1 with frame title text-001.
select-options: s_mtart    for v_mtart default 'halb' to 'zraw',
                s_matnr    for v_matnr,
                s_zzbase   for v_zzbase_code,
                s_werks    for v_werks obligatory,
                s_beskz    for v_beskz.
selection-screen end of block b1.
start-of-selection.
select matnr
       zzbase_code
       from  mara into table i_mara
       where mtart in s_mtart       "Material Type
       and   matnr in s_matnr        "Material
       and   zzbase_code in s_zzbase."Base Code
select maktx
       from makt into table i_makt for all entries in i_mara
       where matnr = i_mara-matnr.
select werks
       from marc into table i_marc for all entries in i_mara
       where matnr = i_mara-matnr
       and werks in s_werks "plant
       and beskz in s_beskz."Procurement Type
select art
       from qmat into table i_qmat for all entries in i_mara
       where matnr = i_mara-matnr
       and werks in s_werks.
select matnr
       plnty from mapl into table i_mapl for all entries in i_mara
       where matnr = i_mara-matnr.
select verwe
       from plko into table i_plko for all entries in i_mapl
       where plnty = i_mapl-plnty.
this is my logic . i need to move this to final internal table i_final. how can do it. will anybody tell me with coding.
Thanks,

Hi,
Include matnr field in all your type declaration and plnty in the ty_plko,  type declaration.
loop at the internal table i_mara.
read the other tables with read statement.
assign the the required fields to the work area wa_final. Append it to i_final.
start-of-selection.
  select matnr  zzbase_code
    from mara   into table i_mara
   where mtart in s_mtart "Material Type   and matnr in s_matnr "Material  and zzbase_code in s_zzbase. "Base Code
  select matnr  maktx        
    from makt   into table i_makt
     for all entries in i_mara   where matnr = i_mara-matnr.
  select matnr  werks
    from marc  into table i_marc
     for all entries in i_mara  where matnr = i_mara-matnr   and werks in s_werks "plant   and beskz in s_beskz."Procurement Type
  select matnr  art
    from qmat  into table i_qmat
     for all entries in i_mara where matnr = i_mara-matnr   and werks in s_werks.
  select matnr plnty
    from mapl into table i_mapl
    for all entries in i_mara  where matnr = i_mara-matnr.
  select plnty verwe
    from plko  into table i_plko
     for all entries in i_mapl  where plnty = i_mapl-plnty.
Loop at i_mara into wa_mara.
read table i_makt into wa_makt with key matnr = wa_mara-matnr.
(do this for all the internal tables.)
read table i_plko into wa_plko with key plnty = wa_mapl-plnty.
wa_final-MATNR = wa_mara-matnr.
wa_final-MAKTX = wa_makt-maktx.
wa_final-ZZBASE_CODE = wa_mara-ZZBASE_CODE.
wa_final-WERKS = wa_marc-werks.
wa_final-ART = wa_qmat-art.
wa_final-VERWE = wa_plko-verve.
append i_final from wa_final.
endloop.
Hope this helps.
Regards,
Dhasarathy. K

Similar Messages

  • Problem in move the data to final internal table.

    hi,
    iam having 3 internal table.
    1. g_t_vbrk  (having data for vbrk table)
    2. g_t_vbak (having data for vbak table)
    3. g_t_likp   (having data for likp table.)
    actually i have written the loop like below .
    LOOP AT g_t_vbrk.
        READ TABLE g_t_vbfa WITH KEY vbeln = g_t_vbrk-vbeln.
        IF sy-subrc = 0.
          MOVE : g_t_vbrk-vbeln TO g_t_output_raw_header_data-vbeln,
                 g_t_vbrk-taxk1 TO g_t_output_raw_header_data-taxk1,
                 g_t_vbrk-taxk4 TO g_t_output_raw_header_data-taxk4,
                 g_t_vbrk-fkart TO g_t_output_raw_header_data-fkart,
                 g_t_vbrk-inco1 TO g_t_output_raw_header_data-inco1,
                 g_t_vbrk-inco2 TO g_t_output_raw_header_data-inco2,
                 g_t_vbrk-zterm TO g_t_output_raw_header_data-zterm,
                 g_t_vbrk-kunag TO g_t_output_raw_header_data-kunag.
          READ TABLE g_t_vbak WITH KEY vbeln = g_t_vbfa-vbelv.
          IF sy-subrc = 0.
            MOVE : g_t_vbak-vkorg TO g_t_output_raw_header_data-vkorg,
                   g_t_vbak-auart TO g_t_output_raw_header_data-auart,
                   g_t_vbak-spart TO g_t_output_raw_header_data-spart,
                   g_t_vbak-vtweg TO g_t_output_raw_header_data-vtweg.
          ENDIF.
          APPEND  g_t_output_raw_header_data.
    endloop.
    my question is i want to move likp table lfdat field to that final internal table with same loop.
    i want to write move statement with same loop.
    pls help with coding wise.
    thanks
    santhosh

    Hi
    In the loop.
    SELECT VBELN FROM VBFA
                  INTO V_VBELN
                  WHERE VBELV = G_I_VBRK-VBELN
                   AND VBTYP_N = 'M'
                   AND VBTYP_V = 'J'.
    Now READ from your LIKP internal table.
    READ TABLE G_I_LIKP WITH KEY VBELN = V_VBELN.
    Write your MOVE statements here.
    Regards
    Surya.

  • Problem in moving the data into final internal table

    Hello all,
    I am stuck in apeculair situation.
    I have a internal table having header record and a internal table having its line items.
    Header record ::    90006103  A   20080110   ALBERTA    3456
    Detail   record ::    90006103  D2  2219CR1710441
                               90006103  D2  2219M11710443
                               90006103  D2  2219M21710442
                               90006103  A    20080115   ALBERTA    3456
                               90006103  D2  2219CR1710441
                               90006103  D2  2219M11710443
                               90006103  D2  2219M21710442
    I collected the header record in one internal table and another internal table having all the line items.But the problem is when i am moving the values to the final inernal table i am getting the same payment date
    20080110 (Date field in first record of header internal table) for all the line items .
    But my requirement is that date should be 20080110 for the first 3 line items of first header record and similarly date should be 20080115 for all the line items of the next header record.
    Kindly suggest.
    Regards,
    Arun

    assumption: some mistake in ur posting that, How belnr and date r same for both header records, so i guess, either one is different.
    try with AT NEW - ENDAT.
    AT NEW belnr.
    here use looping, READing of ur itabs.---> so, u need to build couple of itabs to move forth and back.
    ENDAT.
    pls. note that, when u use this AT NEW all the CHAR fileds of itab wuld show as STARS **.....so, this is the necessity behind building new itabs.
    thanq
    Edited by: SAP ABAPer on Dec 30, 2008 6:24 PM

  • Sending data from final internal table  to application server in xml format

    hi to all ,
    can anyone send details about send data from final internal table to application server in xml format.right now i am able to download data to presentation server in xml format . love to here soon from all the abap gigs.

    welcome to SDN.
    are you using call transformation to convert itab to XML? the XML string is in which format?
    convert it to xstring and then use the following code to store it in application server.
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    TRANSFER XML_content TO FNAME.
    CLOSE DATASET FNAME.
    where fname is the path to the file name.
    Regards
    Raja

  • Can we get the data from two internal tables in ALV.

    hi friends i would like to display the data using two internal tables using alv grid.please guide me.

    Hi,
    ALV would be having a specific layout say :
    MATNR
    MAKTX
    QTY
    Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
    If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
    Best regards,
    Prashant

  • Moving the data from multiple internal tables into a single one

    Hello everyone,
    I am creating a classical report which uses the following tables.
    tables : ekko, ekpo, mara, makt,lfa1.
    my input parameter is 
    Select-options Purchase Order number
    Following fields are getting used.
    Doc no                  EKKO-EBELN
    Material              EKPO-MATNR
    Item number          EKPO-EBELP
    Quantity             EKPO-MENGE
    Material Group          MARA-MATKL
    Vendor                  EKKO-LIFNR
    Old Material code   MARA-BISMT
    Material Desc.           MAKT-MAKTX
    Vendor name         LFA1-NAME1
    Now i need to do the following task.
    1 Select record from EKKO Using document number.
    2 Select record from EKPO using EKKO record using Document no as key.
    3 Find out Old Material code of each and every material from Material master.
    4 Find out Material description for each and every material from MAKT.
    5 Sort record on Vendor, Purchase Order number and Material.
    I have defined seperate internal tables for these operation.
    Once i have fetched records into these individual internal tables  from the corresponding DB tables i need to move these values into a new internal tables which has all the above fields mentioned
    I need to move these values into a new internal table because to display the values on the report.
    Any idea for the above ? Plz help with a sample example or some relevant.
    Regards,
    Ranjith Nambiar

    Hi
    1 Select record from EKKO Using document number.
    2 Select record from EKPO using EKKO record using Document no as key.
    Use inner join and retrive data into one internal table.for Ex ITAB1
    3 Find out Old Material code of each and every material from Material master.
    Use ITAB1 with for allentries in MARA table to get the onl materil number populate in to one table.
    4 Find out Material description for each and every material from MAKT.
    Get the Material desc with the same manner as above,
    5 Sort record on Vendor, Purchase Order number and Material.
    now sort the ITAB1 as you req.
    now Loop on the ITAB1.
    and read above 2 tables for old matnr and matner deac and append into another table as you want.
    Hope this will help.
    Regards,
    Hiren Patel

  • Proble in moving two internal table data to final internal table.

    Hi All,
    I am having 3 internal table
    itab1
    having field a1
                     a2
    itab2  
    having fields  b1
                           b2
    itba3
    having fields aa1 like  a1
                          aa2  like a2
                          bb1 like b1
                          bb2  like b2
    this itab3 is the final table which contain the data of other two table
    I tried in this way :
    loop at itab1
    move itab1-a1 to  itab3-a1
    move itab1-a2 to  itab3-a2
    append itab3.
    clear itab3.
    endloop.
    loop at itab2.
    move itab2-a1 to  itab3-a1.
    move itab2-a2 to  itab3-a2.
    modify itab3.
    clear itab3.
    endloop.
    please help in transferring the all the data of itab1 and itab2 to itab3. I used tried as mention above but I am getting dump error for loop at itab2 --- endloop. (second case)
    Thanks

    Debug and check what is the value of SY-TABIX...
    Also check the field names you are referring to wrong field names...
    Transporting simply means that we have to modify only those fields which are mentioned in it.
    e.g. TRANSPORTING bb1 bb2...should be in your case...
    Check the below codes...
    loop at itab1
    move itab1-a1 to itab3-aa1
    move itab1-a2 to itab3-aa2
    append itab3.
    clear itab3, itab1.
    endloop.
    loop at itab2.
    move itab2-b1 to itab3-bb1.
    move itab2-b2 to itab3-bb2.
    MODIFY itab3 index sy-tabix transporting bb1 bb2.
    clear itab3, itab1.
    endloop.

  • Moving the fields to final internal table

    hi experts,
       i have a single field in an internal table and i want to move it to final internal table.
    i tried this code but its not working.
      IF NOT it_ymmessr IS INITIAL.
        LOOP AT it_ymmessr into it_final..
          move it_ymmessr-srvpos to it_final-srvpos.
        ENDLOOP.
      ENDIF.
    there is dat in the it_ymmessr.
    i have five to six similar internal tables with 1 to 3 records and i have to move them to final internal table.
    regards,
    vinay

    Hi,
    IF NOT it_ymmessr IS INITIAL.
    LOOP AT it_ymmessr into it_final..
    <b>Have one more firld which is the common field for both the tables into it_ymmessr so that u can fill the record correctly.</b>
    READ TABLE it_ymmessr WITH key XXXX = it_final-XXXX.
    IF sy-subrc = 0.
    it_final-srvpos = it_ymmessr-srvpos.
    <b>MODIFY it_final.</b>
    ENDIF.
    CLAER it_final.
    ENDLOOP.
    ENDIF.

  • How to read a table and transfer the data into an internal table?

    Hello,
    I try to read all the data from a table (all attribute values from a node) and to write these data into an internal table. Any idea how to do this?
    Thanks for any help.

    Hi,
    Check this code.
    Here i creates context one node i.e  flights and attributes are from SFLIGHT table.
    DATA: lo_nd_flights TYPE REF TO if_wd_context_node,
            lo_el_flights TYPE REF TO if_wd_context_element,
            ls_flights TYPE if_main=>element_flights,
            it_flights type if_main=>elements_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
      lo_nd_flights = wd_context->get_child_node( 'FLIGHTS' ).
    CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE
      IMPORTING
        TABLE  = it_flights.
    now the table data will be in internal table it_flights.

  • I need to move the data from several cells in an excel spreadsheet to another computer's excel spreadsheet.

    I have a data aquisition program on computer #1(not labview)  that writes to an excel spread sheet and I would like to have a row of data transfered to another excel spreadsheet running labview(computer #2)on the same network. I would like to make this transfer of data either over the network or some other method to link these two computers (they are two feet apart). I'm not sure that datasocket would help , as it seems that the data to be moved must be written for datasocket in labview.  My other alternative is to write drivers for the device that provides the data for computer #1. This is a new one for me as the user doesn't want to give up the non-labview program on #1.
    Solved!
    Go to Solution.
    Attachments:
    Read_Value_From_Excel.vi ‏83 KB

    I would write a LabVIEW VI to read the Excel file(s) on computer n°1 and publish the data in a shared variable over the network.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Moving the data of five internal tables to one internal tables.

    iam having the five internal table. like below
    g_t_vbfa
    g_t_vbrk
    g_t_vbpa
    g_t_kna1
    g_t_vbak    
    this are the five internal tables. each tables having the datas . but each table having the number of records is different. one table having 100 records means another table having 50 records.
    previously i used   index sys-tabix  concept it was not working properly...
    my output table is  g_t_output_header_data  ..
    i want to move that output table....
    please coding wise give some solution...
    thanks
    santhosh

    hi,
    chk a sample.
    data : begin of itab1 occurs 0. "itab with work area.
    key_field1 like ztable1-key_field1,
    field1 like ztable1-field1,
    field2 like ztable1-field2,
    endof itab1.
    data : begin of itab2 occurs 0. "itab with work area.
    key_field2 like ztable2-key_field2,
    field3 like ztable2-field3,
    field4 like ztable2-field4,
    endof itab2.
    data : begin of itab_final occurs 0.
    key_field1 like ztable1-key_field1,
    field1 like ztable1-field1,
    field2 like ztable1-field2,
    field3 like ztable2-field3,
    field4 like ztable2-field4,
    endof itab_final.
    put the date final(merged) internal table
    1. loop at itab1.
    read table itab2 with key keyfield2 = itab1-keyfield1.
    if sy-surc = 0.
    itab_final-key_field1 = itab1-keyfield1
    itab_final-field1 = itab1-field1.
    itab_final-field2 = itab1-keyfield2.
    itab_final-field3 = itab2-field2.
    itab_final-field4 = itab2-keyfield2.
    append itab_final.
    clear itab_final.
    endif.
    endloop.
    or
    LOOP AT ITAB1.
    MOVE-CORRESPONDING TO ITAB1 to ITAB_FINAL.
    READ TABLE ITAB2 WITH KEY FILED1 = ITAB1-FIELD1.
    if sy-subrc = 0.
    MOVE-CORRESPONDING TO ITAB2 to ITAB_FINAL.
    endif,
    READ TABLE ITAB3 WITH KEY FILED1 = ITAB1-FIELD1.
    if sy-subrc = 0.
    MOVE-CORRESPONDING TO ITAB2 to ITAB_FINAL.
    endif,
    append itab_final.
    clear itab_final.
    endloop
    rgds
    Anver

  • How to get the data in one internal table? with 3 different tables..

    Hi,
      i need to get the all the ff data to put in an internal table. I'm using these data to my ALV. Thanks
       vkorg TYPE a005-vkorg,
       vtweg TYPE a005-vtweg,
       kschl TYPE a005-kschl,
       kondm TYPE mvke-kondm,
       matnr TYPE a005-matnr,
       kdgrp TYPE knvv-kdgrp,
       konda TYPE knvv-konda,
       kunnr TYPE a005-kunnr,
       datab TYPE a005-datab,

    hi,
    try this
    *& Report  ZPROGRAM
    REPORT  ZPROGRAM.
    table declaration.
    tables : zemployee, zdepartment,zproject.
    *type-pools declaration
    type-pools : slis , icon.
    type specification
    types : begin of ty_emp,
            empid type zempid,
            empname type zempname,
            empaddress type zempaddress,
            city type zcity,
            ponumber type zponumber,
            detid type zdeptid,
            end of ty_emp.
    types : begin of ty_dept,
            detid type zdeptid,
            deptname type zdeptname,
            designation type zdesignation,
            projectid type zprojectid,
            end of ty_dept.
    types : begin of ty_project,
            projectid type zprojectid,
            technology type ztechnology,
            clientname type zclientname,
            end of ty_project.
    types : begin of ty_final,
            empid type zempid,
            empname type zempname,
            empaddress type zempaddress,
            city type zcity,
            ponumber type zponumber,
            detid type zdeptid,
            deptname type zdeptname,
            designation type zdesignation,
            projectid type zprojectid,
            technology type ztechnology,
            clientname type zclientname,
           average type p decimals 2,
            end of ty_final.
    table type specification.
    types : tt_emp type standard table of ty_emp,
            tt_dept type standard table of ty_dept,
            tt_project type standard table of ty_project,
            tt_final type standard table of ty_final.
    work area creation.
    data : wa_emp type ty_emp,
           wa_dept type ty_dept,
           wa_project type ty_project,
           wa_final type ty_final.
    internal table declaration
    data : itab_emp type tt_emp,
            itab_dept type tt_dept,
            itab_project type tt_project,
            itab_final type tt_final.
    layout declaration
      data : gd_layout type slis_layout_alv.
    assigning current program name.
      data : gd_repid like sy-repid.
             gd_repid = sy-repid.
    fieldcatalog declaration.
      data : d_fieldcat type slis_t_fieldcat_alv,
             d_fieldcat_wa type slis_fieldcat_alv.
    header declaration.
      data : t_header type slis_t_listheader,
             wa_header type slis_listheader,
             linecount(10) type c,
             line(10) type c.
    selection-screen.
    selection-screen : begin of block blk1 with frame title text-001.
    select-options : s_empid for zemployee-empid.
    parameters : p_dname like zdepartment-deptname.
    parameters : p_proid like zproject-projectid.
    selection-screen : begin of line.
    parameters : p_rad1 radiobutton group r1.
    selection-screen comment 3(10) text-002.
    parameters : p_rad2 radiobutton group r1.
    selection-screen comment 16(10) text-003.
    selection-screen : end of line.
    parameters : chk1 as checkbox.
    selection-screen : end of block blk1.
    end of selection screen.
    start of selection.
    select empid empname empaddress city ponumber detid from zemployee into corresponding fields of table itab_emp where empid in s_empid.
    if not itab_emp is initial.
    select detid deptname designation projectid from zdepartment into corresponding fields of table itab_dept for all entries in itab_emp where detid = itab_emp-detid .
    if not itab_dept is initial.
    select projectid technology clientname from zproject into corresponding fields of table itab_project for all entries in itab_dept where projectid = itab_dept-projectid.
    endif.
    endif.
    *end of selection.
    populating data into itab_final from itab_emp.
    loop at itab_emp into wa_emp.
    wa_final-empid = wa_emp-empid.
    wa_final-empname = wa_emp-empname.
    wa_final-empaddress = wa_emp-empaddress.
    wa_final-ponumber = wa_emp-ponumber.
    wa_final-city = wa_emp-city.
    wa_final-detid = wa_emp-detid.
    append wa_final to itab_final.
    clear wa_final.
    endloop.
    *populating data into itab_final from itab_dept and itab_project
    loop at itab_final into wa_final.
    read table itab_dept into wa_dept with key detid = wa_final-detid.
    if sy-subrc = 0.
    wa_final-deptname = wa_dept-deptname.
    wa_final-designation = wa_dept-designation.
    wa_final-projectid = wa_dept-projectid.
    modify itab_final from wa_final transporting deptname designation projectid .
    endif.
    read table itab_project into wa_project with key projectid = wa_final-projectid.
    if sy-subrc = 0.
    wa_final-technology = wa_project-technology.
    wa_final-clientname = wa_project-clientname.
    modify itab_final from wa_final transporting technology clientname.
    endif.
    endloop.
    if p_rad1 = 'X' or chk1 = 'X'.
    d_fieldcat_wa-fieldname = 'EMPID'.
    d_fieldcat_wa-seltext_l = 'Employee Id'.
    d_fieldcat_wa-emphasize = 'X'.
    d_fieldcat_wa-col_pos = 1.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'EMPNAME'.
    d_fieldcat_wa-seltext_l = 'Employee Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 2.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'EMPADDRESS'.
    d_fieldcat_wa-seltext_l = 'Employee Address'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 3.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'CITY'.
    d_fieldcat_wa-seltext_l = 'City'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 4.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'PONUMBER'.
    d_fieldcat_wa-seltext_l = 'Postal Number'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 5.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DETID'.
    d_fieldcat_wa-seltext_l = 'Department Id'.
    d_fieldcat_wa-emphasize = 'X'.
    d_fieldcat_wa-col_pos = 6.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DEPTNAME'.
    d_fieldcat_wa-seltext_l = 'Department Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 7.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DESIGNATION'.
    d_fieldcat_wa-seltext_l = 'Designation'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 8.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'PROJECTID'.
    d_fieldcat_wa-seltext_l = 'Project Id'.
    d_fieldcat_wa-emphasize = 'X'.
    d_fieldcat_wa-col_pos = 9.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'TECHNOLOGY'.
    d_fieldcat_wa-seltext_l = 'technology'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 10.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'CLIENTNAME'.
    d_fieldcat_wa-seltext_l = 'Client Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 11.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    endif.
    if p_rad2 = 'X' or chk1 = 'X'.
    refresh itab_emp.
    d_fieldcat_wa-fieldname = 'DETID'.
    d_fieldcat_wa-seltext_l = 'Department Id'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 6.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DEPTNAME'.
    d_fieldcat_wa-seltext_l = 'Department Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 7.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'DESIGNATION'.
    d_fieldcat_wa-seltext_l = 'Designation'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 8.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'PROJECTID'.
    d_fieldcat_wa-seltext_l = 'Project Id'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 9.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'TECHNOLOGY'.
    d_fieldcat_wa-seltext_l = 'technology'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 10.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    d_fieldcat_wa-fieldname = 'CLIENTNAME'.
    d_fieldcat_wa-seltext_l = 'Client Name'.
    d_fieldcat_wa-emphasize = 'C710'.
    d_fieldcat_wa-col_pos = 11.
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    endif.
    Grid display function module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
       I_INTERFACE_CHECK                 = ' '
       I_BYPASSING_BUFFER                = ' '
       I_BUFFER_ACTIVE                   = ' '
        I_CALLBACK_PROGRAM                = gd_repid
        I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = ' '
        I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE '
       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
       I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  =
       I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      = 'EMPLOYEE DETAILS'
       I_GRID_SETTINGS                   =
        IS_LAYOUT                         = gd_layout
        IT_FIELDCAT                       = d_fieldcat
       IT_EXCLUDING                      =
       IT_SPECIAL_GROUPS                 =
       IT_SORT                           =
       IT_FILTER                         =
       IS_SEL_HIDE                       =
       I_DEFAULT                         = 'X'
       I_SAVE                            = ' '
       IS_VARIANT                        =
       IT_EVENTS                         =
       IT_EVENT_EXIT                     =
       IS_PRINT                          =
       IS_REPREP_ID                      =
       I_SCREEN_START_COLUMN             = 0
       I_SCREEN_START_LINE               = 0
       I_SCREEN_END_COLUMN               = 0
       I_SCREEN_END_LINE                 = 0
       I_HTML_HEIGHT_TOP                 = 0
       I_HTML_HEIGHT_END                 = 0
       IT_ALV_GRAPHICS                   =
       IT_HYPERLINK                      =
       IT_ADD_FIELDCAT                   =
       IT_EXCEPT_QINFO                   =
       IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
       TABLES
         T_OUTTAB                          = itab_final
      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.
    set pf_status for creating client specified icons.
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWSTATUS'.
    endform.
    populating data into header using top_of_page
    form top_of_page.
    wa_header-typ = 'H'.
    wa_header-info = 'ALV REPORT'.
    append wa_header to t_header.
    clear wa_header.
    wa_header-typ = 'S'.
    wa_header-key = 'Date :'.
    Concatenate sy-datum+6(2) '.'
                 sy-datum+4(2) '.'
                 sy-datum(4) into wa_header-info.
      append wa_header to t_header.
      clear wa_header.
      wa_header-typ = 'S'.
    wa_header-key = 'Time :'.
    Concatenate sy-Uzeit(2) '.'
                 sy-datum+2(2) '.'
                 sy-datum+4(2) into wa_header-info.
      append wa_header to t_header.
      clear wa_header.
      describe table itab_final lines line.
      wa_header-typ = 'A'.
      linecount = line.
      Concatenate 'Total number of records :' linecount into wa_header-info separated by space.
      append wa_header to t_header.
      clear wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = t_header
         I_LOGO                   = 'VMCADMIN'
        I_END_OF_LIST_GRID       =
        I_ALV_FORM               =
      endform.
    *designing layout.
      form gd_layout.
      gd_layout-zebra = 'X'.
      gd_layout-edit = 'X'.
      gd_layout-no_hotspot = ''.
      gd_layout-no_colhead = ''.
      gd_layout-colwidth_optimize = 'X'.
      endform.
    Reward with points if helpful.

  • How to read the data from an internal table,when column names are known

    Hi All
    I have a specific requirement. I got an internal table with many fields (let it be my_tab).  Some of the fieldnames (column names in internal table my_tab) are stored in separate internal table(let it be my_fields).
    I need to store/read data corresponding to the fields (whose name is stored in my_fields) from my_tab.
    I am able to build dynamic table (referred by field-symbol) with respect to the given field names in my_fields.
    But i am unable to read the data corresponding to the fieldnames from my_tab.
    Please provide  me some pointer in this regard.
    Regards
    Swetabh Shukla

    HI All
    Thanks for the prompt response. I got solution for my question. Please check below thread. For quick reponse i posted my question in one more category. Thanks to all of you.
    How to read internal table w.r.t. fieldnames stored in other table

  • How to determine most recent date from the date column of internal table

    Dear friends
    would you like to tell me. how i determine the most recently changed record by looking at date and time from internal table i am not supposed to sort the table by date and time... I must check date and time with other records date and time to determine which record is most recently changed...
    here the scenario is.
    id idnumber chdate chtime
    1 123456 20060606 135312
    2 123456 20060606 135900
    3 123456 20060606 132300
    4 123457 20060606 140000
    5 123457 20060606 142500
    in the above scenario i must keep in my mind that the most recently changed record is identical to its idnumber i can say that:
    the record should be fetched this way
    id idnumber chdate chtime
    3 123456 20060606 132300
    5 123457 20060606 142500
    because here the id 3 is the most recently changed in the idnumber 123456
    where id 5 is the most recently changed in the idnumber 123457
    please help me to determin how i am supposed to carry out this task any suggestion, code will be great help of mine.
    regards
    Naim

    After testing my suggestion above, I realized that it doesn't work because the delete adjacent actually will keep the first one and delete the rest.  I'm working with Srinivas's code a bit now,  I think it is almost what you want.  I am under the impression that you dont' want to HIGHest date/time, but just the last record of the sequence, if this is the case, then this code will help.  Here we will assign an index to each record per the idnumber, that way we can sort it and get the lastest record.
    report zrich_0001.
    types: begin of itab_type,
            id       type i,
            idnumber type i,
            chdate   like sy-datum,
            chtime   like sy-uzeit.
    types: end of itab_type.
    types: begin of itab_type2,
            id       type i,
            idnumber type i,
            index    type i,
            chdate   like sy-datum,
            chtime   like sy-uzeit.
    types: end of itab_type2.
    data: itab     type table of itab_type with header line,
          itab2    type table of itab_type2 with header line,
          prev_rec type itab_type.
    data: v_id type i.
    start-of-selection.
      itab-id       = 1.
      itab-idnumber = 123456.
      itab-chdate   = '20060606'.
      itab-chtime   = '135312'.
      append itab. clear itab.
      itab-id       = 2.
      itab-idnumber = 123456.
      itab-chdate   = '20060606'.
      itab-chtime   = '135900'.
      append itab. clear itab.
      itab-id       = 3.
      itab-idnumber = 123456.
      itab-chdate   = '20060606'.
      itab-chtime   = '142500'.
      append itab. clear itab.
      itab-id       = 4.
      itab-idnumber = 123457.
      itab-chdate   = '20060606'.
      itab-chtime   = '140000'.
      append itab. clear itab.
      itab-id       = 5.
      itab-idnumber = 123457.
      itab-chdate   = '20060606'.
      itab-chtime   = '120000'.
      append itab.
      clear itab.
    <b>  data: counter type i.
    * Assign an index to each row per idnumber
      loop at itab.
        on change of itab-idnumber.
        if sy-tabix > 1.
          clear counter.
          endif.
        endon.
        clear itab2.
        move-corresponding itab to itab2.
        counter = counter + 1.
        itab2-index = counter.
        append itab2.
      endloop.
    * Sort it and get rid of older records.
      sort itab2  by idnumber ascending
                     index descending.
      delete adjacent duplicates from itab2 comparing idnumber.</b>
      read table itab2 with key idnumber = '123456'.
      write:/ itab2-chdate, itab2-chtime.
      read table itab2 with key idnumber = '123457'.
      write:/ itab2-chdate, itab2-chtime.
    Regards,
    Rich Heilman

  • To pass the value to final internal table

    hi all,
    in the report i have a select query has below
    SELECT SINGLE belnr
              INTO (l_belnr)
              FROM bkpf
              WHERE bukrs = ls_bseg-bukrs
               AND gjahr = ls_bseg-gjahr.
    i have an internal table gt_values , in this almost i have 1500 entries.
    with field  has BELNR.
    now i need to check l_belnr exists in GT_VALUES-BELNR OR NOT.
    IF EXISTS i need to pass the belnr to GV_BELNR.
    do we need to use LOOP and ENDLOOP or we have any other option.
    PLEASE help me how to proceed in writing code for this.

    Use read table statement.
    Read table GT_VALUES with key belnr = l_belnr.
    if sy-subrc = 0.
    move l_belnr to GV_BELNR.
    endif.

Maybe you are looking for

  • How to reformat a USB flash drive?

    I have 1.33 GB available on my Buffalo USB 2.0 GB Flash Drive that is formatted as MS-DOS File System (FAT 16). Suddenly, every time I try to copy a MS Word document from my iMac to the flash drive I get the following message. +"The item cannot be co

  • GETTING UPSET

    I cant get a single jar to work on my computer!! They ALL get the error: Could not find the main class, the manifest file looks like this: Manifest-Version: 1.0 Created-By: 1.4.0_01 (Sun Microsystems Inc.) Main-Class: hello

  • I have to update my Iphone5S to IOS8 but do not have space due to pix/videos. Will I lose them if I delete them?

    I need to  free up space to allow for the ios8 update, but my phone is filled with pix/videos. Will I lose them if I delete them?

  • Depressed keys on Macbook Pro 15" C2D

    Hi All, I've had a new Macbook Pro for about 3 weeks and I already have, what seems to be, semi-permanently depressed keys; in affect the keys I've used most (e.g. R for reloading a page in Safari) are noticably lower than others - when pressing thes

  • Cannot find Display in the Others list

    I am at step 5 of the tutorial and Display is not shown in the Others list only Visability