To create an alv, using more than one table

Hello,
I'm new to abap. I want to create an alv. I have to use two  internal table, first ( say ibkpf ) as a header and display corresponding detail from another internal table ( say ibseg ).
I intend to use
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' in my program.
Can this be done and if yes how?
Thanks.
Ushma

Hi ,
Check the following code...
*REPORT  zdemo_alvgrid                 .
TABLES:     EKKO.
TYPE-POOLS: SLIS.                                 "ALV Declarations
*Data Declaration
TYPES: BEGIN OF T_EKKO,
  EBELN TYPE EKPO-EBELN,
  EBELP TYPE EKPO-EBELP,
  STATU TYPE EKPO-STATU,
  AEDAT TYPE EKPO-AEDAT,
  MATNR TYPE EKPO-MATNR,
  MENGE TYPE EKPO-MENGE,
  MEINS TYPE EKPO-MEINS,
  NETPR TYPE EKPO-NETPR,
  PEINH TYPE EKPO-PEINH,
  LINE_COLOR(4) TYPE C,     "Used to store row color attributes
END OF T_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF T_EKKO INITIAL SIZE 0,
      WA_EKKO TYPE T_EKKO.
*ALV data declarations
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
      GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
      GD_LAYOUT    TYPE SLIS_LAYOUT_ALV,
      GD_REPID     LIKE SY-REPID.
*Start-of-selection.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
*&      Form  BUILD_FIELDCATALOG
      Build Fieldcatalog for ALV Report
FORM BUILD_FIELDCATALOG.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you  more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
              I.e. Field type may be required in-order for
                   the 'TOTAL' function to work.
  FIELDCATALOG-FIELDNAME   = 'EBELN'.
  FIELDCATALOG-SELTEXT_M   = 'Purchase Order'.
  FIELDCATALOG-COL_POS     = 0.
  FIELDCATALOG-OUTPUTLEN   = 10.
  FIELDCATALOG-EMPHASIZE   = 'X'.
  FIELDCATALOG-KEY         = 'X'.
fieldcatalog-do_sum      = 'X'.
fieldcatalog-no_zero     = 'X'.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'EBELP'.
  FIELDCATALOG-SELTEXT_M   = 'PO Item'.
  FIELDCATALOG-COL_POS     = 1.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'STATU'.
  FIELDCATALOG-SELTEXT_M   = 'Status'.
  FIELDCATALOG-COL_POS     = 2.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'AEDAT'.
  FIELDCATALOG-SELTEXT_M   = 'Item change date'.
  FIELDCATALOG-COL_POS     = 3.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'MATNR'.
  FIELDCATALOG-SELTEXT_M   = 'Material Number'.
  FIELDCATALOG-COL_POS     = 4.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'MENGE'.
  FIELDCATALOG-SELTEXT_M   = 'PO quantity'.
  FIELDCATALOG-COL_POS     = 5.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'MEINS'.
  FIELDCATALOG-SELTEXT_M   = 'Order Unit'.
  FIELDCATALOG-COL_POS     = 6.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'NETPR'.
  FIELDCATALOG-SELTEXT_M   = 'Net Price'.
  FIELDCATALOG-COL_POS     = 7.
  FIELDCATALOG-OUTPUTLEN   = 15.
  FIELDCATALOG-DATATYPE     = 'CURR'.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'PEINH'.
  FIELDCATALOG-SELTEXT_M   = 'Price Unit'.
  FIELDCATALOG-COL_POS     = 8.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
ENDFORM.                    " BUILD_FIELDCATALOG
*&      Form  BUILD_LAYOUT
      Build layout for ALV grid report
FORM BUILD_LAYOUT.
  GD_LAYOUT-NO_INPUT          = 'X'.
  GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  GD_LAYOUT-TOTALS_TEXT       = 'Totals'(201).
Set layout field for row attributes(i.e. color)
  GD_LAYOUT-INFO_FIELDNAME =      'LINE_COLOR'.
gd_layout-totals_only        = 'X'.
gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                        "click(press f2)
gd_layout-zebra             = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text       = 'helllllo'.
ENDFORM.                    " BUILD_LAYOUT
*&      Form  DISPLAY_ALV_REPORT
      Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
  GD_REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM      = GD_REPID
           i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
           i_callback_user_command = 'USER_COMMAND'
           i_grid_title           = outtext
            IS_LAYOUT               = GD_LAYOUT
            IT_FIELDCAT             = FIELDCATALOG[]
           it_special_groups       = gd_tabgroup
           IT_EVENTS                = GT_XEVENTS
            I_SAVE                  = 'X'
           is_variant              = z_template
       TABLES
            T_OUTTAB                = IT_EKKO
       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_ALV_REPORT
*&      Form  DATA_RETRIEVAL
      Retrieve data form EKPO table and populate itab it_ekko
FORM DATA_RETRIEVAL.
DATA: LD_COLOR(1) TYPE C.
SELECT EBELN EBELP STATU AEDAT MATNR MENGE MEINS NETPR PEINH
UP TO 10 ROWS
  FROM EKPO
  INTO TABLE IT_EKKO.
*Populate field with color attributes
LOOP AT IT_EKKO INTO WA_EKKO.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
          i.e. wa_ekko-line_color = 'C410'
  LD_COLOR = LD_COLOR + 1.
Only 7 colours so need to reset color value
  IF LD_COLOR = 8.
    LD_COLOR = 1.
  ENDIF.
  CONCATENATE 'C' LD_COLOR '10' INTO WA_EKKO-LINE_COLOR.
wa_ekko-line_color = 'C410'.
  MODIFY IT_EKKO FROM WA_EKKO.
ENDLOOP.
ENDFORM.                    " DATA_RETRIEVAL
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 10, 2008 5:30 PM

Similar Messages

  • Value Set Use More Than One table

    folks, is there a way to use more than one table in the value set of type table?

    ok if i want to create a view and then when i'm trying to create a table value set. what application should i be selecting? i have created my view in apps schema. if i look in application object library then i do not see it in the list. So i need to register this view? and i think we could not register the views. We could only register tables in apps.Yes you can -- In the Value Sets form (Edit Information button), you can set the view name in the "Table Name" field, and write a (Where/Order by) condition in the same window.
    Oracle Applications Flexfields Guide -- R12
    http://download.oracle.com/docs/cd/B53825_03/current/acrobat/121flexug.pdf
    Oracle Applications Flexfields Guide -- 11i
    http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115flexug.pdf
    Thanks,
    Hussein

  • How to create Search Help using more than 1 table

    Hi all,
    I need to create a search help using more than 1 table.
    Eq:-   Itable1 contains the data and Table2 contains the description of a field.
    In my search help i require A field from Table1 and For the corresponding field description from Table2.

    Hi,
    You can do this with the help of collective search help.
    Collective search helps:- Combination of elementary search helps. When we need to fetch data based on multiple selection criteriau2019s. More than one tables are Selection from multiple tables 
    Steps for creating collective search help.
    1) Enter the search help name and click on create.
    2) Choose Collective search help radio button option as the search help type.
    3) Enter the search help parameters.
    Note that there is no selection method to be entered for a collective search help.
    4) Instead of the selection method, we enter the included search helps for the collective search help.
    5)We need to assign parameters for each of the included search helps.
    6) Complete the parameter assignment by clicking on the push button.
    7) Collective search help offers the user to obtain F4 help using any of the included search helps.
    Hope this will help you:
    Reagrds:
    Alok

  • Can i create report using more than one Business Area ?

    Hi Gurus,
    Can i create report using more than one Business Area?.Could anybody tell me that report will work?.
    Vikram

    You should have no problem creating a report using more than one Business Area, we share folders across BAs all the time for ease of management. As long as your joins exist its not a problem.
    Matt Topper
    TUSC, The Oracle Experts
    [email protected]

  • Crystal Report - More than one table from MySql

    Hello, I am in need of help big time.
    I have am using Visual Studio 2010 and Crystal Report 10.
    The problem that I am incounting is that I am unable to retreive data from more than one table from a MySql database. I have been stuck on this for too long and need to hjump the hurdle.
    I am using a MySql connection string, a dataset and a crystal report which is based on the dataset.
    The main error that I am having is, the browser opens and a form appears saying "The report you requetsed requires further information" With the Server name: DataSetPropertiesDetials, while the User name and Password fields are then enabled.
    I am guessing I am missing something in my code.
    When I retreive data from one table the report is fine, but when I try to use more than one table it throws the error.
    My Code is below and also attached:
    Imports System.Data.SqlClient
    Imports System.Configuration
    Imports MySql.Data.MySqlClient
    Imports CrystalDecisions.ReportSource
    Imports CrystalDecisions.Web
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim con As MySqlConnection
    Dim rpt As New CrystalReport3()
    Dim myReport As New ReportDocument
    Dim myData As New DataSet
    Dim cmd As New MySqlCommand
    Dim cmdUser, cmdProperty, cmdBranch As New MySqlCommand
    Dim daBranch, daProperty, daUser As New MySqlDataAdapter
    con = New MySqlConnection()
    'Connection String
    con.ConnectionString = "Server=****;Database=***;UID=***;Password=****"
    Try
    con.Open()
    cmdBranch.CommandText = "SELECT branch FROM tblbranch"
    cmdBranch.Connection = con
    daBranch.SelectCommand = cmdBranch
    daBranch.Fill(myData)
    cmdProperty.CommandText = "SELECT ref, keys_held, key_no, keys_out, no_name, address_line1, address_line2,key_label FROM tblproperty"
    cmdProperty.Connection = con
    daProperty.SelectCommand = cmdProperty
    daProperty.Fill(myData)
    cmdUser.CommandText = "SELECT known_name FROM tbluser"
    cmdUser.Connection = con
    daUser.SelectCommand = cmdUser
    daUser.Fill(myData)
    myReport.Load("REPORT LOCATION")
    myReport.SetDataSource(myData)
    myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
    CrystalReportViewer1.ReportSource = myReport '
    Catch myerror As MySqlException
    MsgBox(myerror.Message)
    End Try
    End Sub
    End Class

    Hi, 
    You have 3 SQL commands but you are calling SetDataSource only once.  You need to look through for each of the SQL Commands. 
    Good luck,
    Brian

  • Trigger for more  than One table

    Hi,
    is it possible to create a trigger for more than one table?
    I need a trigger that fires when anyone of the users updates a special value in one of the DB tables.
    this value is in about 8 or 10 tables, or must i create a trigger for each table?
    thanx
    marcel

    You would wrap the functionality required into a packaged procedure and then have a trigger on each of these tables that simply call this packaged procedure.
    Yes, you would have one trigger per table.

  • Can I use more than one transition when creating a slideshow in IDVD

    I want to use more than one transition in IDVD when creating a slideshow, is this possible?

    Not so. Under Windows select Photos.
    That will show the Media Browser in the lower right hand corner of iMovie.
    Use the File ➙ New Project to create a new project.  Select the photos from iPhoto you want to create a movie from and drag into the new project area.
    From there add your transitions, music, etc.

  • Can I create and use more than one repository on OVM 2.1.5

    The version of Oracle VM I am using is 2.1.5 .
    I wonder can I create and use more than one repository on OVM 2.1.5. Because I want to install different GOS on different disks.
    I know in Oracle VM 2.2 we can use following commands to realize that.
    a. #/opt/ovs-agent-2.3/utils/repos.py –n /dev/mapper/mpathxp1
    b. #/opt/ovs-agent-2.3/utils/repos.py –r UUID
    c. #/opt/ovs-agent-2.3/utils/repos.py –i
    And other repositories can also be mounted and found under /var/ovs/mount/UUID.
    But in Oracle VM 2.1.5, seems just one repository can be created and mounted. For example:
    At first, I create a repository using mpath1p1:
    a. # mkfs.ocfs2 /dev/mapper/mpath1p1
    b. #/usr/lib/ovs/ovs-makerepo /dev/mapper/mpath1p1 C "cluster root"
    c. I can find the repository has been mounted under /OVS.
    But if I want to use "/usr/lib/ovs/ovs-makerepo /dev/mapper/mpath2p1 C "cluster root" to create another repository, and check the mount status using command "mount", these two disks are all have been mounted under /OVS.
    "# cat /etc/ovs/repositories", only mpath1p1 with UUID was recorded there.
    After reboot, only repository with mpath1p1 was mounted under OVS.
    Can anyone tell me how to use more than one repositories on OVM 2.1.5. Do I have to install all the GOSs on the same disk and repository.
    Thank you very much.

    Now I've known how to create different repository. They will be mounted under /OVS/UUID. Thanks.

  • Creating SQL-Loader script for more than one table at a time

    Hi,
    I am using OMWB 2.0.2.0.0 with Oracle 8.1.7 and Sybase 11.9.
    It looks like I can create SQL-Loader scripts for all the tables
    or for one table at a time. If I want to create SQL-Loader
    scripts for 5-6 tables, I have to either create script for all
    the tables and then delete the unwanted tables or create the
    scripts for one table at a time and then merge them.
    Is there a simple way to create migration scripts for more than
    one but not all tables at a time?
    Thanks,
    Prashant Rane

    No there is no multi-select for creating SQL-Loader scripts.
    You can either create them separately or create them all and
    then discard the one you do not need.

  • I keep my library on an external hard drive 4TB.  It's full.  Can I use more than one hard drive to keep my library on?

    I keep my iTunes library on an external hard drive 4TB.  It's full.  Can I use more than one hard drive to keep my library on? Like two 4TB next to each other.

    Create a concatenated disk set
    Increase storage space with a concatenated RAID set (also called “Just a Bunch of Disks” or JBOD). If you need one large disk, but you have only several smaller disks, you can create a concatenated disk set to use several small disks as one large disk.
    Open Disk Utility, in the Utilities folder in Launchpad.
    Select one of the disks that you want in the set, and then click RAID.
    Click Add (+), and type a name for the RAID set.
    Choose a format from the Format pop-up menu. Usually you’ll choose the Mac OS Extended (Journaled) format.
    Choose Concatenated Disk Set from the RAID Type pop-up menu.
    Drag the disks you want to add to the set to the list on the right.
    Click Create.
    Exerpt from:
    Disk Utility 12.x: Create a RAID set - Apple - Support
    Note that the biggest CON to concatenated RAID configurations is vulnerability to volume failure. If either disk fails, the whole volume fails. If you choose this option, I would highly recommend backing up your music to a cloud service. There are very cheap per GB/storage, and some of the most reputable actually offer unlimited storage:
    Five Best Cloud Storage Providers - Lifehacker

  • Using more than one input device at the same time

    Is it possible to use more than one input device at the saem time in logic express. For example I have a fire wire input device and a usb input device can I get Express to recognize both of these at once and so have a total of 4 ins which would be great since Im transfering tracks off my ADAT and it would be less track to have to line up.
    Thanks

    Hi,
    yes, it should be possible by creating an aggregate device. Google for it or search this forum. There are many tutorials how to set it up.
    Have fun!
    Fox

  • How to create Criterian For more than one table

    Hi,
    I have one problem how to create criteria for more than one table in that using one criteria hot to get the values from database in that more than onetable for getting these values .Please send me the exampke code.
    reagrds,
    raghu

    Hi,
    I don't think its possible to create fieldcatalog for different tables,
    but if you want to do so create a dummy table which has all the fields which you want in fieldcatalog.
    populate the data from different table to that dummy table
    then create fieldcatalog for that table and pass it in the function module...
    Regards,
    Siddarth

  • Creation of prompt section using more than one sunject areas.

    Hi Everybody,
    Can we create prompt section in the dashbaord using more than one subject area?. I am using OBIEE 11g
    Please put your thoughts/suggestions.
    Thanks,
    Govardhana

    Hi Govardhana,
    Do you want to create same dashboard prompt using multiple SA's ?
    How to reuse Filters/Dashboard Prompts from one Subject Area to another?
    Thanks,
    Saichand.v

  • Use more than one transition in the same time between two video clips?

    Dear Premiere Pro programmers,
    Could you please create a way to use more than one transition in the same time between two video clips without exporting to media, or creating new sequence, or using another layer (adjustment or transparent)?
    Message was edited by: Kevin Monahan
    Reason: Next time, create a more descriptive title.

    Hi Aqsa Nori,
    I'm not sure what you are imagining, but it might be possible to achieve by key framing effects. Can you tell us what you want to do? Also, please feel free to file a feature request: http://adobe.ly/feature_request
    Thanks,
    Kevin

  • Use more than one DB in InfiniteInsight

    Hi,
    I want to know if is it possible to use more than one Data Base for create a Data Source in InfiniteInsgiht and how.
    Thank you very much.

    Hi Daniel and Edouard,
    I would first like to clarify one point: SAP InfiniteInsight can read data from the database directly.
    If your data are in a table or view, you can select the option "Use a File or a Database Table".
    With this same option, you can also enter a SQL query in "Data Set" :
    Now, as Edouard mentioned, you can also use Explorer to create a more complex dataset for your analysis.
    Technically, you will need to enter either one database connection or file as input for your different analyses. That being said, if you need to access 2 databases, (let's call them A and B) there is a way.
    It's called heterogeneous database system. You have to configure your database A to enable an access to database B.
    SAP InfiniteInsight will be connected to A which has access to B. Thus, you will be able to use data from 2 different databases. 
    I am unfortunately no a database specialist, I am not sure all DB enable this and the procedures might be complex.
    Hope this helps,
    Armelle

Maybe you are looking for

  • Modal page opening from link

    Hello, I would like to open a modal page (Skillbuilders) via a link. That is why I have  created a button with a dynamic action that opens the modal page. This REGION button is hidden (not rendering). I have this code as regions source: {code} <a hre

  • English dictionary has disappeared with mountain lion (a complaint from Spain)

    Hi, I'm a Spanish Mac user and was a fond user of the excellent built-in English dictionary that came with Lion and with former operating systems. A couple of days ago I installed the new Mountain Lion and noticed that the former English dictionary h

  • Qmaster Suddenly Stopped Working... ***!!!!!

    Ok.. So I set up Qmaster yesterday to work across three macs.... two MBPs and one MacPro as the controller. Was working beautifully until this afternoon. Not sure what has changed, but now I can't set up the cluster in Qadministrator. I just did a fu

  • Processing ABAP Idocs in SAP Java AS CE 7.1 web service client applicatin

    I am trying to build a Java web service client which would call a web service in a non-SAP system.  I am trying to send  Idocs from the back-end CRM system to my Java web service client using a Jco RFC Provider.  I have already created the RFC Destin

  • Library cash statistic in trace file

    Hello! I'm get ora-00600, and in one of trace files I see library cash statistic : LIBRARY CACHE STATISTICS: namespace gets hit ratio pins hit ratio reloads invalids My question - is this statistic cumulative or current ? Please advise . Thanks and r