Regarding tables work area,events in reporting,LSMW

Hai to All,
1. Sequence of events in classical & interactive reporting.
2. Why call transaction does not support LSMW
                              (Legasy System Migration Workbench)
3. We have to provide tables work area in the declaration when select-options logic is used but it is not mandatory in parameters selection screen logic why?
4. what is the reason for maintaining <b>loop ... endloop</b> logic under PAI in the case of  table control
please provide answers for these quections
regards,
suryanarayana k.

Hi
1. Sequence of events in classical & interactive reporting.
Events in ABAP Programming
Classical Reporting:
INITIALIZATION
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN
START-OF–SELECTION.
TOP-OF-PAGE
END-OF-PAGE
END-OF-SELECTION.
Events in Interactive Report
TOP-OF-PAGE DURING LINE-SELECTION
AT USER-COMMAND.
AT LINE-SELECTION
AT PF-FUNCTION KEY
2. Why call transaction does not support LSMW
(Legasy System Migration Workbench)
http://www.sapbrain.com/TOOLS/LSMW/SAP_LSMW_steps_introduction.html
http://esnips.com/doc/8e732760-5548-44cc-a0bb-5982c9424f17/lsmw_sp.ppt
http://esnips.com/doc/f55fef40-fb82-4e89-9000-88316699c323/Data-Transfer-Using-LSMW.zip
http://esnips.com/doc/1cd73c19-4263-42a4-9d6f-ac5487b0ebcb/LSMW-with-Idocs.ppt
http://esnips.com/doc/ef04c89f-f3a2-473c-beee-6db5bb3dbb0e/LSMW-with-BAPI.ppt
http://esnips.com/doc/7582d072-6663-4388-803b-4b2b94d7f85e/LSMW.pdf
for Long texts Upload
Please take a look at this..
http://help.sap.com/saphelp_erp2005/helpdata/en/e1/c6d30210e6cf4eac7b054a73f8fb1d/frameset.htm
3. We have to provide tables work area in the declaration when select-options logic is used but it is not mandatory in parameters selection screen logic why?
When youd eclarae select-options by default it creates a selection table with 4 fields called SIGN,OPTIOn,LOW and HIGH fields
Paramters its' not like that
4. what is the reason for maintaining loop ... endloop logic under PAI in the case of table control
Table control means handling multiple records , so to process/handle them it is a must to use loop.endloop.
Reward points for useful Answers
Regards
Anji

Similar Messages

  • I am getting problem with internal table & work area declaration.

    I am working with 'makt' table ..with the table makt i need to work with styles attributes ..so i declared like this
    TYPES : BEGIN OF ty_makt,
             matnr TYPE makt-matnr,
             spras TYPE makt-spras,
             maktx TYPE makt-maktx,
             maktg TYPE makt-maktg,
             celltab TYPE lvc_t_styl,
           END OF ty_makt.
    DATA : i_makt TYPE TABLE OF ty_makt.
    DATA : wa_makt TYPE ty_makt .
        But end of program i need to update dbtable "makt"...i am getting problem with internal table & work area declaration.
    i think makt table fields mapping and internal table/work area mapping is not correct. so please help me to get out from this.

    Hi Nagasankar,
    TYPES : BEGIN OF TY_MATNR,
                  MATNR TYPE MAKT-MATNR,
                  SPRAS TYPE MAKT-SPRAS,
                  MAKTX TYPE MAKT-MAKTX,
                  MAKTX TYPE MAKT-MAKTG,
                  CELLTAB TYPE LVC_T_STYL,  " Its Working perfectly fine..
                 END OF TY_MAKT.
    DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
              WA_MAKT TYPE TY_MAKT.
    Its working perfectly fine. if still you are facing any issue post your complete code.
    Thanks,
    Sandeep

  • Internal Table - Work Area issue

    Guru's:
    I am selecting the mentioned fields from TVAKT into t_itt1 (internal table) - I however an encountering "you canot use an internal table as a work area" as an error.
    DATA: s_bezei LIKE tvakt-bezei,
          s_auart LIKE tvakt-auart.
    DATA t_itt1 LIKE tvakt OCCURS 0.
    DATA z_itt LIKE tvakt.
    its at this stage of the code that I am facing this problem
    SELECT spras auart bezei FROM tvakt
    INTO t_itt1
    WHERE bezei IN s_bezei
    AND auart IN s_auart.
    would appreciate your help.

    Hello,
    You need to change the declaration of the s_spras to use the IN clause:
    See these for more informations: http://help.sap.com/saphelp_nw04/helpdata/en/18/a1f251e28b11d295f500a0c929b3c3/frameset.htm and Create a Ranges Table Type.
    Regards.

  • Internal table - work area not long enough

    Subject changed by moderator.  Please try to use a more meaningful subject in future
    The work area "ITAB" is not long enough. how to solve this problem.
    Edited by: Matt on Nov 14, 2008 10:20 AM

    please check the order of the fields you are passing to your internal table.
    Their can be many  possible cases .
    a)
    internal table has less number of fields and u are passing more fields.
    b)
    suppose Itab has field Vbeln and it`s length is 10 and u are passing filed having length
    12.
    Please check that.
    Regards
    Neha

  • Internal table & Work area

    Hi Experts,
    I am a novice to ABAP. Can anyone tell me whats the difference b/w internal table and work area. In writing function modules how these will be utilized and in what way.
    Regards
    ss

    HI,
    Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
    Difference between Work Area and Header Line
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table.  The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table.  It depends on how the internal table is declared that the itab will have the header line or not.
    e.g.
    data: begin of itab occurs 10,
               ab type c,
               cd type i,
            end of itab.  " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table.  It is the default work area for the internal table
    1) The difference between
    whih header line and with out heater line of internal table.
    ex:-
    a) Data : itab like mara occurs 0 with header line.
    b) Data: itab like mara occurs 0.
    -While adding or retrieving records to / from internal table we have to keep the record temporarily.
    -The area where this record is kept is called as work area for the internal table.
    -The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    -Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    a) Data : itab like mara occurs 0 with header line.
    table is with header line
    b) Data: itab like mara occurs 0.
    table is without header line
    2)work area / field string and internal table
    which one is prefarable for good performance any why ?
    -The header line is a field string with the same structure as a row of the body, but it can only hold a single row , whereas internal table can have more than one record.
    In short u can define a workarea of an internal table which means that area must have the same structure as that of internal table and can have one record only.
    Example code:
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    http://www.allsaplinks.com/faq_abap_internaltables.html
    Do reward if it helps,
    Regards,
    Laxmi

  • Moving internal table work area data to string

    Hi, I am running a program  with unicode enable.I am moving data from work area to string where i am getting a error like String & work area are not mutually convertable in Uni code program.
    Can any one help me how to resolve this problem.
    Thanks & Regards,
    Pratap.

    Hi Pratap kumar,
    sorry, need to do some redesign:
    You could poiibly concatenate the components of the structure into a string - if they are all character-like. And you will loose leading and trailing spaces.
    Non-character-componets must be converted (WRITE TO) into character-like fields.
    If you need the exact position in your string, you have to place all values at calculatzed offset in a (big enough) character field like CHAR1024.
    Altogether it might be easier to re-think and re-build according to results required. As you did not mention where you have this question, I have no special idea on how to solve.
    Regards,
    Clemens

  • Basic query regarding work-area and select query

    hi
    dear sdn members,
    thanks too all for solving all my query's up till now
    i am stuck in a problem need help
    1)  why basically work-area has been used ? the sole purpose
    2)  different types of select query ? only coding examples
    note: no links pls
    regards,
    virus

    hi,
    Work Area
    Description for a data object that is particularly useful when working with internal tables or database tables as a source for changing operations or a target for reading operations.
    WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
    Each row in a table is a record and each column is a field.
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    .g.
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.
    With header line
    SELECT.
    Put the curson on that word and press F1 . You can see the whole documentation for select statements.
    select statements :
    SELECT result
    FROM source
    INTO|APPENDING target
    [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
    Effect
    SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects.
    The select statement reads a result set (whose structure is determined in result ) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set.
    The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops.
    Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions.
    System Fields
    The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Relevance
    0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.
    4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.
    8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.
    After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.
    Notes
    Outside classes, you do not need to specify the target area with INTO or APPENDING if a single database table or a single view is specified statically after FROM, and a table work area dbtab was declared with the TABLES statement for the corresponding database table or view. In this case, the system supplements the SELECT-statement implicitly with the addition INTO dbtab.
    Although the WHERE-condition is optional, you should always specify it for performance reasons, and the result set should not be restricted on the application server.
    SELECT-loops can be nested. For performance reasons, you should check whether a join or a sub-query would be more effective.
    Within a SELECT-loop you cannot execute any statements that lead to a database commit and consequently cause the corresponding database cursor to close.
    SELECT - result
    Syntax
    ... lines columns ... .
    Effect
    The data in result defines whether the resulting set consists of multiple rows (table-like structure) or a single row ( flat structure). It specifies the columns to be read and defines their names in the resulting set. Note that column names from the database table can be changed. For single columns, aggregate expressions can be used to specify aggregates. Identical rows in the resulting set can be excluded, and individual rows can be protected from parallel changes by another program.
    The data in result consists of data for the rows lines and for the columns columns.
    SELECT - lines
    Syntax
    ... { SINGLE }
    | { { } } ... .
    Alternatives:
    1. ... SINGLE
    2. ... { }
    Effect
    The data in lines specifies that the resulting set has either multiple lines or a single line.
    Alternative 1
    ... SINGLE
    Effect
    If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.
    An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE. The SELECT command is used in this case only if all primary key fields in logical expressions linked by AND are checked to make sure they are the same in the WHERE condition. Otherwise, the resulting set is empty and sy-subrc is set to 8. If the lock causes a deadlock, an exception occurs. If the FOR UPDATE addition is used, the SELECT command circumvents SAP buffering.
    Note
    When SINGLE is being specified, the lines to be read should be clearly specified in the WHERE condition, for the sake of efficiency. When the data is read from a database table, the system does this by specifying comparison values for the primary key.
    Alternative 2
    Effect
    If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
    If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
    If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
    If the system tries to access pool or cluster tables and single columns are specified in columns.
    Note
    When specifying DISTINCT, note that you have to carry out sort operations in the database system for this.
    SELECT - columns
    Syntax
    | { {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ... }
    | (column_syntax) ... .
    Alternatives:
    1. ... *
    2. ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    3. ... (column_syntax)
    Effect
    The input in columns determines which columns are used to build the resulting set.
    Alternative 1
    Effect
    If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views. Only one data object can be specified after INTO.
    Note
    If multiple database tables are specified after FROM, you cannot prevent multiple columns from getting the same name when you specify *.
    Alternative 2
    ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    Effect
    A list of column labels col1 col2 ... is specified in order to build the resulting list from individual columns. An individual column can be specified directly or as an argument of an aggregate function aggregate. The order in which the column labels are specified is up to you and defines the order of the columns in the resulting list. Only if a column of the type LCHAR or LRAW is listed does the corresponding length field also have to be specified directly before it. An individual column can be specified multiple times.
    The addition AS can be used to define an alternative column name a1 a2 ... with a maximum of fourteen digits in the resulting set for every column label col1 col2 .... The system uses the alternative column name in the additions INTO|APPENDING CORRESPONDING FIELDS and ORDER BY. .
    Column labels
    The following column labels are possible:
    If only a single database table or a single view is specified after FROM, the column labels in the database table - that is, the names of the components comp1 comp2... - can be specified directly for col1 col2 ... in the structure of the ABAP Dictionary.
    If the name of the component occurs in multiple database tables of the FROM addition, but the desired database table or the view dbtab is only specified once after FROM, the names dbtab~comp1 dbtab~comp2 ... have to be specified for col1 col2 .... comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    If the desired database table or view occurs multiple times after FROM, the names tabalias~comp1 tabalias~comp2 ... have to be specified for col1 col2 .... tabalias is the alternative table name of the database table or view defined after FROM, and comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    The data type of a single column in the resulting list is the datatype of the corresponding component in the ABAP Dictionary. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note
    If multiple database tables are specified after FROM, you can use alternative names when specifying single columns to avoid having multiple columns with the same name.
    Example
    Read specific columns of a single row.
    DATA wa TYPE spfli.
    SELECT SINGLE carrid connid cityfrom cityto
    INTO CORRESPONDING FIELDS OF wa
    FROM spfli
    WHERE carrid EQ 'LH' AND connid EQ '0400'.
    IF sy-subrc EQ 0.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDIF.
    Alternative 3
    ... (column_syntax)
    Effect
    Instead of static data, a data object column_syntax in brackets can be specified, which, when the command is executed, either contains the syntax shown with the static data, or is initial. The data object column_syntax can be a character-type data object or an internal table with a character-type data type. The syntax in column_syntax, like in the ABAP editor, is not case-sensitive. When specifying an internal table, you can distribute the syntax over multiple rows.
    If column_syntax is initial when the command is executed, columns is implicitly set to * and all columns are read.
    If columns are specificied dynamically without the SINGLE addition, the resulting set is always regarded as having multiple rows.
    Notes
    Before Release 6.10, you could only specify an internal table with a flat character-type row type for column_syntax with a maximum of 72 characters. Also, before Release 6.10, if you used the DISTINCT addition for dynamic access to pool tables or cluster tables, this was ignored, but since release 6.10, this causes a known exception.
    If column_syntax is an internal table with header line, the table body and not the header line is evaluated.
    Example
    Read out how many flights go to and from a city. The SELECT command is implemented only once in a sub-program. The column data, including aggregate function and the data after GROUP BY, is dynamic. Instead of adding the column data to an internal l_columns table, you could just as easily concatenate it in a character-type l_columns field.
    PERFORM my_select USING `CITYFROM`.
    ULINE.
    PERFORM my_select USING `CITYTO`.
    FORM my_select USING l_group TYPE string.
    DATA: l_columns TYPE TABLE OF string,
    l_container TYPE string,
    l_count TYPE i.
    APPEND l_group TO l_columns.
    APPEND `count( * )` TO l_columns.
    SELECT (l_columns)
    FROM spfli
    INTO (l_container, l_count)
    GROUP BY (l_group).
    WRITE: / l_count, l_container.
    ENDSELECT.
    ENDFORM.
    SELECT - aggregate
    Syntax
    ... { MAX( col )
    | MIN( col )
    | AVG( col )
    | SUM( col )
    | COUNT( DISTINCT col )
    | COUNT( * )
    | count(*) } ... .
    Effect
    As many of the specified column labels as you like can be listed in the SELECT command as arguments of the above aggregate expression. In aggregate expressions, a single value is calculated from the values of multiple rows in a column as follows (note that the addition DISTINCT excludes double values from the calculation):
    MAX( col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
    MIN( col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
    AVG( col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    SUM( col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    COUNT( DISTINCT col ) Determines the number of different values in the column col in the resulting set or in the current group.
    COUNT( * ) (or count(*)) Determines the number of rows in the resulting set or in the current group. No column label is specified in this case.
    If you are using aggregate expressions, all column labels that are not listed as an argument of an aggregate function are listed after the addition GROUP BY. The aggregate functions evaluate the content of the groups defined by GROUP BY in the database system and transfer the result to the combined rows of the resulting set.
    The data type of aggregate expressions with the function MAX, MIN or SUM is the data type of the corresponding column in the ABAP Dictionary. Aggregate expressions with the function AVG have the data type FLTP, and those with COUNT have the data type INT4. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note the following points when using aggregate expressions:
    If the addition FOR ALL ENTRIES is used in front of WHERE, or if cluster or pool tables are listed after FROM, no other aggregate expressions apart from COUNT( * ) can be used.
    Columns of the type STRING or RAWSTRING cannot be used with aggregate functions.
    When aggregate expressions are used, the SELECT command makes it unnecessary to use SAP buffering.
    Null values are not included in the calculation for the aggregate functions. The result is a null value only if all the rows in the column in question contain the null value.
    If only aggregate expressions are used after SELECT, the results set has one row and the addition GROUP BY is not necessary. If a non-table type target area is specified after INTO, the command ENDSELECT cannot be used together with the addition SINGLE. If the aggregate expression count( * ) is not being used, an internal table can be specified after INTO, and the first row of this table is filled.
    If aggregate functions are used without GROUP BY being specified at the same time, the resulting set also contains a row if no data is found in the database. If count( * ) is used, the column in question contains the value 0. The columns in the other aggregate functions contain initial values. This row is assigned to the data object specified after INTO, and unless count( * ) is being used exclusively, sy-subrc is set to 0 and sy-dbcnt is set to 1. If count( *) is used exclusively, the addition INTO can be omitted and if no data can be found in the database, sy-subrc is set to 4 and sy-dbcnt is set to 0.
    if helpful reward points

  • About WORK AREA

    PLS TELL ME FUNDA BEHIND ....DEFINING .WORK AREA IN A REPORT ....I DONT THINK THERE IS MUCH OF THE USE OF......... AND WHAT R THE BASIC STEPS OF THIS ........

    Hi Guru
             Work area is structutre means collection of fields and at a time can hold single record.
    it is used whenever working with internal table.
    data : begin of itab occurs 0,
              matnr like mara-matnr,
             end of itab.
    it is an internal table with header line , whatever the operations performed on internal table r through headerline itself.here at declaration itself we r specifying size of internal table.
    instead u can use types stt to declare itab.
    types: begin of itab1,
             matnr like mara-matnr,
           end of itab1.
    data: itab type table of itab1,
            wa type itab1.
    itab is internal table with out header line.
    ex how to use this work area is
    to print records of itab first every record moved to wa and then from that it is get printed in output
    loop at itab into wa.
      write:/20 wa-matnr.
    endloop.
    Reward if useful
    regards
    sandhya

  • Regarding table  maintenance generator

    hi
    i have one scenario . supppose there are 4 fields in a table. user enters data into it using table maintenance generator. he enters data only for 2 fields remaining 2 fields should get populated automatically.
    is it possible?

    Go to SE11->Table Maintenance generator -> Environment->Modification-> Events
    Here you can define events and the form routines that will be invoked on that particular event.
    Say for example you want to populate details for the user who created the records, define the form FRM_CR_DATE (any form routine name) for populating the Create Details using event 05.
    Event 05 is fired for "Creating a new entry".
    Click on the EDITOR Button and write the following code for saving the user details while creating a new record.
    *       FORM FRM_CR_DATE                                              *
    form frm_cr_date .
      ztablename-created_by      = sy-uname .
      ztablename-created_on      = sy-datum .
      ztablename-create_time     = sy-uzeit.
    endform .
    The current username, system date and time will be moved to the table work area for each record created.

  • Work Centre wise Wastage Report

    Dear All,
    Kindly let me know if there is a standard/zreport available on net, that provides work centre wise wastage in plant.
    Regards,
    Alok.

    There are some standard reports for Work centers available like -
    MCPQ - Work Center Analysis Quantities
    MCPH - Work Center Analysis Dates
    MCPY - Work Center Analysis Lead Times
    CM01 - Work Center Analysis Load
    CM05 - Work Center Analysis Over Load
    There are many more reports.
    Hope this helps you.

  • Events of reports

    hi gurus,
           what are events in reports and when there are triggering.

    HI
    Event related to reports are not triggered based on any statements in ABAP.  
    The event are triggered depended on the way the output is generated . 
    Initialization : triggered when the report is loaded in memory.
    At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
    At selection-screen / <field> : before leaving the selection screen.
    start-of-selection : the first event for displaying the report.
    end-of-selection : after the start-of-selection is completed.
    classiscal report events.
    top-of-page : every time a new page is started in the list.
    end-of-page : every time the list data reaches the footer region of the page.
    <b>interactive report events.</b>
    top of page during line selection : top of page event for secondary list.
    at line-selection : evey time user dbl-clicks(F2) on the list data.
    at pF<key> : function key from F5 to F12 to perform interactive action on the list.
    Initialization : triggered when the report is loaded in memory.
    At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
    At selection-screen / <field> : before leaving the selection screen.
    start-of-selection : the first event for displaying the report.
    end-of-selection : after the start-of-selection is completed.
    classiscal report events.
    top-of-page : every time a new page is started in the list.
    end-of-page : every time the list data reaches the footer region of the page.
    interactive report events.
    top of page during line selection : top of page event for secondary list.
    at line-selection : evey time user dbl-clicks(F2) on the list data.
    at pF<key> : function key from F5 to F12 to perform interactive action on the list.
    events in reports
    events of reports
    check the above threads
    Sail

  • Regarding events in reports

    Hi guys,
    i got a doubt in reports on events
    how many events are there in reports.....
    and what's the function of them...can any one help me plzzzz
    regards
    venu

    hi,
    events:
    http://www.sap-img.com/abap/events-related-to-reporting.htm
    Events in Classical Reports
    Initialization.
    At selection-screen.
    At selection-screen on <field>.
    Start-of-selection.
    Top-of-page.
    End-of-page.
    End-of-selection.
    Initialization.
    We can initialize the selection-screen with calculated default values under this event.
    Initialization.
    s_date-high = sy-datum.
    s_date-low = sy-datum - 15.
    Append s_date.
    At selection-screen.
    We can validate all the inputs on selection screen fields under this event.
    At selection-screen.
    If s_carrid-low is initial or s_connid-low is initial or s_date is initial.
    < ... code for validation... >.
    Endif.
    At selection-screen on <field>.
    We can validate a particular field input on selection screen under this event.
    At selection-screen on s_carrid.
    If s_carrid-low < > &#37521;H&#12539;
    <&#12539;code for validation&#12539;
    Endif.
    Start-of-selection.
    By default the program is under this event.
    If any of the other event comes before
    &#20840;elect&#12539;ndselect.&#12539;statements, then to break
    that event, we require this S-O-S event.
    Start-of-selection.
    Select * from &#12539;
    &#12539;&#12539;
    Endselect.
    Top-of-page.
    If we need some portion of the output (like
    column headings) to appear in all the pages,
    then we use this event.
    Top-of-page.
    Write:/ &#33307;arrier&#12539;10 &#33307;onnection&#12539;20 &#33337;ate&#12539;
    If there is no external output statement before
    &#31109;op-of-page&#12539;event, then this event will not
    work.
    End-of-page.
    Once the cursor reaches the last line of the
    page, automatically this event will be triggered.
    Report Zxxx line-count 25(3).
    In this case line numbers 23, 24 and 25 are
    reserved for footer.
    Once the cursor reaches 23rd line, this event
    will be triggered.
    End-of-page.
    Write:/ sy-uline(75).
    Write:/ &#31109;his is end of page:&#12539;sy-pagno.
    Write:/ sy-uline(75).
    End-of-selection.
    This event is used for concluding part of List.
    End-of-selection.
    Write:/ &#31109;his is end of the Report&#12539;
    Additional events in interactive reports
    The following additional events are applicable to secondary lists.
    Top-of-page during line-selection.
    At line-selection.
    At user-command.
    These additional events are triggered when u perform some action on the basic lists.
    example:
    REPORT zwk22671 LINE-COUNT 40(3)
    LINE-SIZE 200
    NO STANDARD PAGE HEADING.
    TABLES : mkpf , "MATERIAL DOCUMENT
    mseg , "DOCUMENT SEGMENT : MATERIAL
    t156t , "MOVEMENT TYPE TEXT
    makt. "MATERIAL DESCRIPTIONS
    *STRUCTURE OF INTERNAL TABLES
    DATA : BEGIN OF xtab,
    mblnr TYPE mkpf-mblnr , "DOCUMENT NUMBER
    mjahr TYPE mkpf-mjahr , "YEAR
    budat TYPE mkpf-budat , "POST DATE
    blart TYPE mkpf-blart , "DOCUMENT TYPE
    END OF xtab.
    DATA : BEGIN OF ytab,
    mblnr TYPE mseg-mblnr , "DOCUMENT NUMBER
    mjahr TYPE mseg-mjahr , "YEAR
    zeile TYPE mseg-zeile , "ITEM NUMBER
    bwart TYPE mseg-bwart , "MOVEMENT TYPE
    btext TYPE t156t-btext , "MOVEMENT DESCRIPTION
    matnr TYPE mseg-matnr , "MATERIAL NUMBER
    maktx TYPE makt-maktx , "MATERIAL DESCRIPTION
    meins TYPE mseg-meins , "UNIT OF MEASURE
    menge TYPE mseg-menge , "QUANTITY
    dmbtr TYPE mseg-dmbtr , "AMOUNT
    END OF ytab.
    *INTERNAL TABLE DECLARATION
    DATA : i_tab1 LIKE STANDARD TABLE OF xtab WITH HEADER LINE. "INTERNAL TABLE 1 : CONTAINS MATERIAL DETAILS
    DATA : i_tab2 LIKE STANDARD TABLE OF ytab WITH HEADER LINE. "INTERNAL TABLE 2 : CONTAINS ITEMWISE MATERIAL DETAILS
    *VARIABLES
    DATA : v_color TYPE sy-tabix , "FOR SETTING COLOR FORMATS DURING GENERATING REPORT
    v_field(20) , "FOR STORING THE CLICKED FIELD NAME
    v_value(20) , "FOR STORING THE CLICKED FIELD VALUE
    v_mblnr TYPE mkpf-mblnr , "FOR VALIDATING DOCUMENT NUMBER
    v_mjahr TYPE mkpf-mjahr , "FOR VALIDATING DOCUMENT YEAR
    v_bwart TYPE mseg-bwart , "FOR VALIDATING MOVEMENT TYPE
    v_matnr TYPE mseg-matnr . "FOR VALIDATING MATERIAL NUMBER
    **SELECTION-SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_mblnr FOR mkpf-mblnr , "DOCUMENT NUMBER
    s_mjahr FOR mkpf-mjahr OBLIGATORY, "DOCUMENT YEAR
    s_bwart FOR mseg-bwart NO INTERVALS NO-EXTENSION, "MOVEMENT TYPE
    s_matnr FOR mseg-matnr . "MATERIAL NUMBER
    SELECTION-SCREEN : END OF BLOCK blk1.
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN.
    PERFORM validation. "PERFORMS VALIDATION OF SELECTION-SCREEN FIELDS
    *TOP-OF-PAGE
    TOP-OF-PAGE.
    PERFORM header. "CREATES HEADER FOR THE BASIC LIST
    *END-OF-PAGE
    END-OF-PAGE. "CREATES FOOTER FOR THE BASIC AND SECONDARY LIST
    PERFORM footer.
    *START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM generation_basic. "GENERATES REPORT FOR BASIC LIST WHICH CONTAINS DOCUMENT NO , DOCUMENT YEAR
    "POST DATE , DOCUMENT TYPE.
    *END-OF-SELECTION
    END-OF-SELECTION.
    PERFORM report_basic. "DISPLAY REPORT FOR BASIC LIST
    *AT LINE-SELECTION
    AT LINE-SELECTION.
    PERFORM generation_secondary. "GENERATES REPORT FOR SECONDARY LIST BASED ON THE DOCUMENT NUMBER AND DOCUMENT YEAR
    "WHICH CONTAINS DOCUMENT NO , YEAR , ITEM NO , MOVEMENT TYPE , MOVEMENT DESCRIPTION ,
    "MATERIAL NUMBER , MATERIAL DESC , UNIT OF MEASURE , QUANTITY AND AMOUNT
    *TOP-OF-PAGE DURING LINE-SELECTION
    TOP-OF-PAGE DURING LINE-SELECTION.
    PERFORM header_secondary. "CREATES HEADER FOR THE SECONDARY LIST
    *AT USER-COMMAND
    AT USER-COMMAND.
    PERFORM user_secondary. "SUBROUTINE FOR HANDLING USER EVENTS
    FORM validation .
    *VALIDATING MATERIAL DOCUMENT NUMBER
    SELECT SINGLE mblnr
    INTO v_mblnr
    FROM mkpf
    WHERE mblnr IN s_mblnr.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT DOCUMENT NUMBER' TYPE 'E'.
    ENDIF.
    *VALIDATING MATERIAL DOCUMENT YEAR
    SELECT SINGLE mjahr
    INTO v_mjahr
    FROM mkpf
    WHERE mjahr IN s_mjahr.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT MATERIAL DOCUMENT YEAR' TYPE 'E'.
    ENDIF.
    *VALIDATING MOVEMENT TYPE
    SELECT SINGLE bwart
    INTO v_bwart
    FROM mseg
    WHERE bwart IN s_bwart.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT MOVEMENT TYPE' TYPE 'E'.
    ENDIF.
    *VALIDATING MATERIAL NUMBER
    SELECT SINGLE matnr
    INTO v_matnr
    FROM mseg
    WHERE matnr IN s_matnr.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT MATERIAL NUMBER' TYPE 'E'.
    ENDIF.
    ENDFORM. " VALIDATION
    FORM header .
    WRITE :/30 'MATERIAL DOCUMENTS' COLOR 1. "TITLE OF BASIC LIST
    WRITE :/1(89) sy-uline.
    FORMAT COLOR 1.
    WRITE :/1 sy-vline ,
    3 'DOCUMENT NUMBER' ,
    23 sy-vline ,
    25 'YEAR' ,
    45 sy-vline ,
    47 'POST DATE' ,
    67 sy-vline ,
    69 'DOCTYP' ,
    89 sy-vline .
    FORMAT RESET.
    WRITE :/1(89) sy-uline.
    ENDFORM. " HEADER
    FORM footer .
    IF sy-lsind EQ 0. "CHECKS WHICH LIST IS IT BASIC LIST OR SECONDARY (AND NO. OF SECONDARY LIST)
    WRITE :/1(89) sy-uline.
    ELSEIF sy-lsind EQ 1.
    WRITE :/1(192) sy-uline.
    ENDIF.
    ENDFORM. " FOOTER
    FORM generation_basic .
    SELECT mkpf~mblnr "DOCUMENT NUMBER
    mkpf~mjahr "DOCUMENT YEAR
    mkpf~budat "POST DATE
    mkpf~blart "DOCUMENT TYPE
    INTO TABLE i_tab1
    FROM mkpf INNER JOIN mseg ON mkpfmjahr EQ msegmjahr AND
    mkpfmblnr EQ msegmblnr
    WHERE mkpf~mblnr IN s_mblnr
    AND mkpf~mjahr IN s_mjahr
    AND mseg~bwart IN s_bwart
    AND mseg~matnr IN s_matnr.
    IF sy-subrc NE 0.
    WRITE :/ 'MATERIAL DATA NOT FOUND'.
    ENDIF.
    DELETE ADJACENT DUPLICATES FROM i_tab1 COMPARING mblnr mjahr.
    ENDFORM. " GENERATION_BASIC
    FORM report_basic .
    LOOP AT i_tab1.
    v_color = sy-tabix MOD 2.
    IF v_color EQ 0.
    FORMAT COLOR 1 INTENSIFIED OFF.
    ELSE.
    FORMAT COLOR 2 INTENSIFIED OFF.
    ENDIF.
    WRITE :/1 sy-vline ,
    3 i_tab1-mblnr ,
    23 sy-vline ,
    25 i_tab1-mjahr ,
    45 sy-vline ,
    47 i_tab1-budat ,
    67 sy-vline ,
    69 i_tab1-blart ,
    89 sy-vline .
    HIDE : i_tab1-mblnr , i_tab1-mjahr. "STORING THE VALUE OF FIELDS CLICKED IN SYSTEM AREA
    ENDLOOP.
    FORMAT RESET.
    WRITE :/1(89) sy-uline.
    ENDFORM. " REPORT_BASIC
    FORM generation_secondary .
    IF sy-lsind EQ 1.
    SET PF-STATUS 'DISPLAY'.
    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED
    CASE v_field.
    WHEN 'I_TAB1-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED
    SELECT mseg~mblnr "DOCUMENT NUMBER
    mseg~mjahr "DOCUMENT YEAR
    mseg~zeile "ITEM NUMBER
    mseg~bwart "MOVEMENT TYPE
    t156t~btext "MOVEMENT DESCRIPTION
    mseg~matnr "MATERIAL NUMBER
    makt~maktx "MATERIAL DESCRIPTION
    mseg~meins "UNIT OF MEASURE
    mseg~menge "QUANTITY
    mseg~dmbtr "AMOUNT
    INTO TABLE i_tab2
    FROM ( ( mseg INNER JOIN t156t
    ON msegbwart EQ t156tbwart )
    INNER JOIN makt
    ON msegmatnr EQ maktmatnr )
    WHERE mseg~mblnr EQ i_tab1-mblnr
    AND mseg~mjahr EQ i_tab1-mjahr
    AND t156t~spras EQ sy-langu
    AND makt~spras EQ sy-langu.
    DELETE ADJACENT DUPLICATES FROM i_tab2 COMPARING mblnr mjahr.
    WHEN OTHERS.
    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.
    ENDCASE.
    LOOP AT i_tab2.
    v_color = sy-tabix MOD 2.
    IF v_color EQ 0.
    FORMAT COLOR 1 INTENSIFIED OFF.
    ELSE.
    FORMAT COLOR 2 INTENSIFIED OFF.
    ENDIF.
    WRITE :/1 sy-vline ,
    3 i_tab2-mblnr ,
    12 sy-vline ,
    14 i_tab2-mjahr ,
    19 sy-vline ,
    21 i_tab2-zeile ,
    30 sy-vline ,
    32 i_tab2-bwart ,
    40 sy-vline ,
    42 i_tab2-btext ,
    72 sy-vline ,
    74 i_tab2-matnr ,
    94 sy-vline ,
    96 i_tab2-maktx ,
    146 sy-vline ,
    148 i_tab2-meins ,
    153 sy-vline ,
    155 i_tab2-menge ,
    170 sy-vline ,
    172 i_tab2-dmbtr ,
    192 sy-vline .
    ENDLOOP.
    WRITE :/1(192) sy-uline.
    FORMAT RESET.
    ELSEIF sy-lsind EQ 2.
    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED
    CASE v_field.
    WHEN 'I_TAB2-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED
    SET PARAMETER ID : "SETTING PARAMETER ID FOR DOCUMENT NUMBER AND YEAR.
    'MBN' FIELD i_tab2-mblnr ,
    'MJA' FIELD i_tab2-mjahr.
    CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN. "CALLING TRABSACTION CODE 'MBO3'.
    WHEN OTHERS.
    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.
    ENDCASE.
    ENDIF.
    ENDFORM. " GENERATION_SECONDARY
    FORM header_secondary .
    WRITE :/50 'ITEMWISE MATERIAL DOCUMENTS' COLOR 1.
    WRITE :/1(192) sy-uline.
    FORMAT COLOR 1.
    WRITE :/1 sy-vline ,
    3 'DOCUMENT NO' ,
    12 sy-vline ,
    14 'YEAR' ,
    19 sy-vline ,
    21 'ITEM NO.' ,
    30 sy-vline ,
    32 'MOV TYP' ,
    40 sy-vline ,
    42 'MOV DESCRIPTION' ,
    72 sy-vline ,
    74 'MATERIAL NO' ,
    94 sy-vline ,
    96 'MATERIAL DESCRIPTION' ,
    146 sy-vline ,
    148 'UOM' ,
    153 sy-vline ,
    155 'QUANTITY' ,
    170 sy-vline ,
    172 'AMOUNT' ,
    192 sy-vline .
    WRITE :/1(192) sy-uline.
    FORMAT RESET.
    ENDFORM. " HEADER_SECONDARY
    *FORM user_secondary .
    IF sy-ucomm EQ 'DISPLAY'. "EXECUTES ONLY IF 'DISPLAY DOCUMENTS' ITEM IS CLICKED ON APPLICATION TOOL BAR.
    IF sy-lsind EQ 2.
    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED
    CASE v_field.
    WHEN 'I_TAB2-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED
    SET PARAMETER ID :
    'MBN' FIELD i_tab2-mblnr ,
    'MJA' FIELD i_tab2-mjahr.
    CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.
    ENDCASE.
    ENDIF.
    LEAVE PROGRAM.
    ENDIF.
    ENDFORM. " USER_SECONDARY

  • WHAT ARE EVENTS IN AN ALV REPORT ?

    WHAT ARE EVENTS IN AN ALV REPORT ? PLEASE EXPLAIN HOW TO MAKE AN ALV REPORT AND WHAT THE EVENTS DO ?
    BEST REGARDS,
    RYAN

    Events are driven by user interaction...Like...
    DATA_CHANGED
    DOUBLE_CLICK
    ONF4
    Here's a sample code of OO ALV using events...
    *& Report  ZDUMMY_ATG_2
    REPORT zdummy_atg_2.
    TYPES: BEGIN OF ty_scarr,
           carrid TYPE scarr-carrid,
           carrname TYPE scarr-carrname,
           currcode TYPE scarr-currcode,
           END OF ty_scarr.
    DATA: t_spfli TYPE STANDARD TABLE OF spfli,
          w_spfli LIKE LINE OF t_spfli,
          lt_f4 TYPE lvc_t_f4 WITH HEADER LINE,
          return_tab TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE,
          t_custom_scarr TYPE STANDARD TABLE OF ty_scarr WITH HEADER LINE,
          t_stable TYPE STANDARD TABLE OF lvc_s_stbl WITH HEADER LINE.
    FIELD-SYMBOLS: <fs_spfli> LIKE LINE OF t_spfli,
                   <fs_scarr> LIKE LINE OF t_custom_scarr.
    CLASS cl_gui_object DEFINITION LOAD.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    INCLUDE <cl_alv_control>.
    DATA: ok_code LIKE sy-ucomm,
          gt_fieldcat TYPE lvc_t_fcat,
          gt_sort TYPE lvc_t_sort,
          event_receiver TYPE REF TO lcl_event_receiver,
          gs_layout TYPE lvc_s_layo,
          mycontainer TYPE scrfname VALUE 'CUSTOM_ALV',
          custom_container TYPE REF TO cl_gui_custom_container,
          grid1 TYPE REF TO cl_gui_alv_grid,
          gs_variant TYPE disvariant,
          x_save,
          w_error TYPE c,
          l_valid(1) TYPE c.
    *       CLASS LCL_EVENT_RECEIVER DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed,
          handle_f4_help
          FOR EVENT onf4 OF cl_gui_alv_grid
          IMPORTING e_fieldname es_row_no er_event_data.
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        PERFORM data_changed USING er_data_changed.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
      METHOD handle_f4_help.
        PERFORM handle_onf4 USING e_fieldname es_row_no.
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.                    "HANDLE_F4_HELP
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    *&      START-OF-SELECTION                                             *
    START-OF-SELECTION.
      PERFORM cargar_customs.
      PERFORM cargar_datos.
      PERFORM fill_layout.
      PERFORM fill_catalog.
      PERFORM llamar_alv.
      CALL SCREEN 0100.
    *&      Form  CARGAR_DATOS                                             *
    FORM cargar_datos.
      SELECT mandt carrid connid countryfr cityfrom
             airpfrom countryto cityto airpto
             fltime deptime arrtime distance
             distid fltype period
      INTO TABLE t_spfli
      FROM spfli.
    ENDFORM.                    " CARGAR_DATOS
    *&      Form  CARGAR_CUSTOMS                                           *
    FORM cargar_customs.
      SELECT carrid carrname currcode
      INTO TABLE t_custom_scarr
      FROM scarr.
    ENDFORM.                    " CARGAR_DATOS
    *&      Form  FILL_LAYOUT                                              *
    FORM fill_layout.
      gs_layout-sel_mode = 'A'.
    ENDFORM.                    " FILL_LAYOUT
    *&      Form  FILL_CATALOG                                             *
    FORM fill_catalog.
      DATA: gs_fieldcat TYPE lvc_s_fcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 1.
      gs_fieldcat-fieldname = 'CARRID'.
      gs_fieldcat-reptext   = 'Compañia'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-f4availabl = 'X'.
      gs_fieldcat-outputlen = '8'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 2.
      gs_fieldcat-fieldname = 'CONNID'.
      gs_fieldcat-reptext   = 'Conexión'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '8'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 3.
      gs_fieldcat-fieldname = 'COUNTRYFR'.
      gs_fieldcat-reptext   = 'País'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '4'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 4.
      gs_fieldcat-fieldname = 'CITYFROM'.
      gs_fieldcat-reptext   = 'Ciudad Salida'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = space.
      gs_fieldcat-outputlen = '20'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 5.
      gs_fieldcat-fieldname = 'AIRPFROM'.
      gs_fieldcat-reptext   = 'Arp. Salida'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '10'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 6.
      gs_fieldcat-fieldname = 'COUNTRYTO'.
      gs_fieldcat-reptext   = 'País'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '4'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 7.
      gs_fieldcat-fieldname = 'CITYTO'.
      gs_fieldcat-reptext   = 'Ciudad Llegada'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = space.
      gs_fieldcat-outputlen = '20'.
      APPEND gs_fieldcat TO gt_fieldcat.
    ENDFORM.                    " FILL_CATALOG
    *&      Form  LLAMAR_ALV                                               *
    FORM llamar_alv.
      IF custom_container IS INITIAL.
        CREATE OBJECT custom_container
          EXPORTING
            container_name              = mycontainer
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
      ENDIF.
      CREATE OBJECT grid1
        EXPORTING
          i_parent = custom_container.
      CREATE OBJECT event_receiver.
      lt_f4-fieldname = 'CARRID'.
      lt_f4-register = 'X' .
      lt_f4-getbefore = 'X' .
      lt_f4-chngeafter = 'X' .
      APPEND lt_f4.
      SET HANDLER event_receiver->handle_data_changed FOR grid1.
      SET HANDLER event_receiver->handle_f4_help FOR grid1.
      CALL METHOD grid1->register_f4_for_fields
        EXPORTING
          it_f4 = lt_f4[].
      IF sy-batch IS INITIAL.
        CALL METHOD grid1->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      ENDIF.
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          is_variant      = gs_variant
          i_save          = x_save
          i_default       = 'X'
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_sort         = gt_sort[]
          it_outtab       = t_spfli[].
      CALL METHOD grid1->set_ready_for_input
        EXPORTING
          i_ready_for_input = 1.
    ENDFORM.                    " LLAMAR_ALV
    *&      Form  HANDLE_ONF4                                              *
    FORM handle_onf4 USING p_e_fieldname
                           p_es_row_no STRUCTURE lvc_s_roid.
      CASE p_e_fieldname.
        WHEN 'CARRID'.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield        = 'CARRID'
              value_org       = 'S'
            TABLES
              value_tab       = t_custom_scarr
              return_tab      = return_tab
            EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
              OTHERS          = 3.
          IF NOT return_tab[] IS INITIAL.
            READ TABLE return_tab INDEX 1.
            READ TABLE t_spfli INDEX p_es_row_no-row_id
            ASSIGNING <fs_spfli>.
            <fs_spfli>-carrid = return_tab-fieldval.
            CALL METHOD grid1->refresh_table_display
              EXPORTING
                is_stable = t_stable.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " HANDLE_ONF4
    *&      Module  STATUS_0100  OUTPUT                                    *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MAIN_STATUS'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT                               *
    MODULE user_command_0100 INPUT.
      ok_code = sy-ucomm.
      CASE ok_code.
        WHEN 'BACK' OR 'STOP' OR 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN 'SAVE'.
          CALL METHOD grid1->check_changed_data
            IMPORTING
              e_valid = l_valid.
          IF l_valid EQ 'X'.
            PERFORM grabar_datos.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  DATA_CHANGED                                             *
    FORM data_changed USING rr_data_changed TYPE REF TO
                                            cl_alv_changed_data_protocol.
      DATA: w_new,
            ls_mod_cells TYPE lvc_s_modi,
            ls_cells TYPE lvc_s_modi.
      DATA: l_carrid TYPE spfli-carrid.
      CLEAR l_carrid.
      LOOP AT rr_data_changed->mt_good_cells INTO ls_mod_cells.
        CASE ls_mod_cells-fieldname.
          WHEN 'CARRID'.
            CALL METHOD rr_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_mod_cells-row_id
                i_fieldname = ls_mod_cells-fieldname
              IMPORTING
                e_value     = l_carrid.
            IF l_carrid IS INITIAL.
              CALL METHOD rr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = 'Seleccione algún código'
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
              w_error = 'X'.
            ELSE.
              READ TABLE t_custom_scarr WITH KEY carrid = l_carrid
              ASSIGNING <fs_scarr>.
              IF sy-subrc NE 0.
                CALL METHOD rr_data_changed->add_protocol_entry
                  EXPORTING
                    i_msgid     = '0K'
                    i_msgno     = '000'
                    i_msgty     = 'E'
                    i_msgv1     = 'Código ingresado no existe'
                    i_fieldname = ls_mod_cells-fieldname
                    i_row_id    = ls_mod_cells-row_id.
                w_error = 'X'.
              ENDIF.
            ENDIF.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " DATA_CHANGED
    *&      Form  GRABAR_DATOS                                             *
    FORM grabar_datos.
      LOOP AT t_spfli ASSIGNING <fs_spfli>.
        w_spfli = <fs_spfli>.
        MODIFY spfli FROM w_spfli.
        IF sy-subrc EQ 0.
          COMMIT WORK.
        ELSE.
          ROLLBACK WORK.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GRABAR_DATOS
    Greetings,
    Blag.

  • Internal table with and with out work area.

    Hi all,
    in performance terms which one is better 1) internal table with header line or 2) itab w/o header line and explicit work area for that itab.
    which one is better and how?
    Thanks in advance.
    SAI

    Hai Sai Ram
    Internal Table with header Line Improves the Performence
    1)
    TABLES CUSTOMERS.
    Defining an internal table with header line
    DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
                       WITH HEADER LINE.
    Reading all entries of the database table into the internal table
    SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.
    2)
    Check the following code for the Difference
    REPORT ZWRITEDOC LINE-SIZE 124 NO STANDARD PAGE HEADING.
       TABLES: DD03L, "
               DD04T, "R/3-DD: Textos de los elementos de datos
               DD02T. "R/3-DD: Textos de tablas SAP
    Tabla temporal con las lineas de cada tabla
       DATA: BEGIN OF I_LINEAS OCCURS 100,
                LINEA(80),
             END OF I_LINEAS.
    Tabla con las caracteristicas de la tabla
       DATA: BEGIN OF I_TABLA OCCURS 100,
                CAMPO(12),
                TIPO(4),
                LONG(5) TYPE I,
                REF(20),
                DESCR(40),
             END OF I_TABLA.
       DATA: D_NOMBRE(80),
             D_DESCRIPCION(80).
       DATA :  BEGIN OF SOURCE OCCURS 1000,
            LINE(72),
       END OF SOURCE.
       PARAMETERS: PROGRAM LIKE SY-REPID DEFAULT SY-REPID.
       AT USER-COMMAND.
         CASE SY-UCOMM.
           WHEN 'GRAB'.
             PERFORM GRABAR.
         ENDCASE.
       START-OF-SELECTION.
         SET PF-STATUS  'ZSTATUS1'.
         READ REPORT PROGRAM INTO SOURCE.
         DATA L_GRAB.
         CLEAR L_GRAB.
    LOOP AT SOURCE.
       translate source to upper case.
           IF L_GRAB IS INITIAL.
             D_DESCRIPCION = I_LINEAS-LINEA.
           ENDIF.
           I_LINEAS = SOURCE.
           SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
           IF SY-SUBRC = 0.
             SEARCH I_LINEAS-LINEA FOR 'DATA'.
             IF SY-SUBRC = 0.
               L_GRAB = 'X'.
               FREE I_LINEAS.
             ENDIF.
           ENDIF.
           IF L_GRAB = 'X'.
             I_LINEAS = SOURCE.
             APPEND I_LINEAS.
             SEARCH I_LINEAS-LINEA FOR 'END OF'.
             IF SY-SUBRC = 0.
               CLEAR L_GRAB.
               PERFORM PROCESAR_FICHERO.
               PERFORM IMPRIMIR.
               FREE I_LINEAS.
               CLEAR D_DESCRIPCION.
             ENDIF.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
           IF SY-SUBRC = 0.
             APPEND I_LINEAS.
             PERFORM PROCESAR_FICHERO.
             PERFORM IMPRIMIR.
           ENDIF.
         ENDLOOP.
    *&      Form  GRABAR
          Graba el fichero en c:\temp\p.rtf y lo abre con word.
       FORM GRABAR.
         CALL FUNCTION 'LIST_DOWNLOAD'
             EXPORTING
            LIST_INDEX = SLIST_INDEX_DEFAULT
                  METHOD     = 'RTF'
              EXCEPTIONS
                   OTHERS     = 1.
         CALL FUNCTION 'EXECUTE_WINWORD'
              EXPORTING
                   I_FILE = 'C:\TEMP\P.RTF'
              EXCEPTIONS
                   OTHERS = 1.
       ENDFORM.                               " GRABAR
    *&      Form  PROCESAR_FICHERO
       FORM PROCESAR_FICHERO.
         DATA: L_AUX1(80),
              L_AUX2(80).
         FREE I_TABLA.
         LOOP AT I_LINEAS.
           CLEAR I_TABLA.
       translate i_lineas-linea to upper case.
           SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'BEGIN OF' INTO L_AUX1 D_NOMBRE.
             SPLIT D_NOMBRE AT 'OCCURS' INTO D_NOMBRE L_AUX1.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR '('.
           IF SY-SUBRC = 0.
              SPLIT I_LINEAS-LINEA AT '(' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-CAMPO = L_AUX1.
             SPLIT L_AUX2 AT ')' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             IF L_AUX1 CO '0123456789 '.
               I_TABLA-LONG = L_AUX1.
             ENDIF.
             I_TABLA-TIPO = 'CHAR'.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'LIKE'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'LIKE' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-CAMPO = L_AUX1.
               SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-REF = L_AUX1.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'TYPE'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'TYPE' INTO L_AUX1 L_AUX2.
             IF I_TABLA-CAMPO IS INITIAL.
               CONDENSE L_AUX1.
               I_TABLA-CAMPO = L_AUX1.
             ENDIF.
                 SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
            CONDENSE L_AUX1.
             CASE L_AUX1.
               WHEN 'I'.
                 I_TABLA-TIPO = 'INT'.
                 I_TABLA-LONG = 4.
               WHEN 'C'.
                 I_TABLA-TIPO = 'CHAR'.
               WHEN 'N'.
                 I_TABLA-TIPO = 'NUMC'.
               WHEN 'T'.
                 I_TABLA-TIPO = 'TIME'.
                 I_TABLA-LONG = 8.
               WHEN OTHERS.
                 I_TABLA-TIPO = L_AUX1.
             ENDCASE.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR '"'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT '"' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX2.
             I_TABLA-DESCR = L_AUX2.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'INCLUDE STRUCTURE'.
           IF SY-SUBRC = 0.
             SPLIT I_LINEAS-LINEA AT 'INCLUDE STRUCTURE' INTO L_AUX1 L_AUX2.
             SPLIT L_AUX2 AT '.' INTO L_AUX1 L_AUX2.
             CONDENSE L_AUX1.
             I_TABLA-CAMPO = 'INCLUDE STR'.
             I_TABLA-REF   = L_AUX1.
           ENDIF.
           SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
             IF SY-SUBRC = 0.
               IF NOT I_LINEAS-LINEA CA '"'.
                 SPLIT I_LINEAS-LINEA AT 'OCCURS' INTO L_AUX1 L_AUX2.
                 IF SY-SUBRC = 0.
                   SPLIT L_AUX1 AT 'LIKE' INTO L_AUX1 L_AUX2.
                   IF SY-SUBRC = 0.
                     CONDENSE L_AUX2.
                     IF NOT L_AUX2 IS INITIAL.
                       I_TABLA-CAMPO = '...'.
                       I_TABLA-TIPO  = 'TABI'.
                       I_TABLA-REF   = L_AUX2.
                       SELECT SINGLE * FROM DD02T
                        WHERE TABNAME = L_AUX2
                          AND DDLANGUAGE = SY-LANGU.
                       IF SY-SUBRC = 0.
                       I_TABLA-TIPO  = 'TABE'.
                       I_TABLA-DESCR   = DD02T-DDTEXT.
                       ENDIF.
                       IF L_AUX1 CA ':'.
                         SPLIT L_AUX1 AT 'DATA:' INTO L_AUX1 L_AUX2.
                       ELSE.
                         SPLIT L_AUX1 AT 'DATA' INTO L_AUX1 L_AUX2.
                       ENDIF.
                       D_NOMBRE = L_AUX2.
                     ENDIF.
                   ENDIF.
                 ENDIF.
               ENDIF.
             ENDIF.
           IF NOT I_TABLA-CAMPO IS INITIAL.
             APPEND I_TABLA.
           ENDIF.
         ENDLOOP.
         LOOP AT I_TABLA WHERE NOT REF IS INITIAL.
            SPLIT I_TABLA-REF AT '-' INTO L_AUX1 L_AUX2.
           SELECT SINGLE * FROM DD03L
            WHERE TABNAME = L_AUX1
              AND FIELDNAME = L_AUX2.
           IF SY-SUBRC = 0.
             I_TABLA-TIPO = DD03L-DATATYPE.
             I_TABLA-LONG = DD03L-INTLEN.
             IF I_TABLA-DESCR IS INITIAL.
               SELECT SINGLE * FROM DD04T
                WHERE ROLLNAME = DD03L-ROLLNAME
                  AND DDLANGUAGE = SY-LANGU.
               IF SY-SUBRC = 0.
                 I_TABLA-DESCR = DD04T-DDTEXT.
               ENDIF.
             ENDIF.
             MODIFY I_TABLA.
           ENDIF.
         ENDLOOP.
       ENDFORM.                               " PROCESAR_FICHERO
    *&      Form  IMPRIMIR
       FORM IMPRIMIR.
       DATA L_AUX(80).
         FORMAT COLOR COL_NORMAL INTENSIFIED ON.
         ULINE AT 1(80).
         WRITE: / SY-VLINE,
                 (76)     D_NOMBRE CENTERED,
                  SY-VLINE.
         SPLIT D_DESCRIPCION AT '*' INTO L_AUX D_DESCRIPCION.
         WRITE: / SY-VLINE,
                 (76)     D_DESCRIPCION CENTERED,
                  SY-VLINE.
         NEW-LINE.
         ULINE AT 1(80).
         DETAIL.
         FORMAT COLOR OFF.
         WRITE: /
               SY-VLINE,
             (10) 'CAMPO',
               SY-VLINE,
             (4)  'TIPO',
               SY-VLINE,
             (4) 'LONG',
               SY-VLINE,
             (16)  'REFERENCIA',
               SY-VLINE,
             (30)  'DESCRIPCION',
               SY-VLINE.
         NEW-LINE.
         ULINE AT 1(80).
         DETAIL.
         LOOP AT I_TABLA.
           WRITE: /
                 SY-VLINE,
              (10)   I_TABLA-CAMPO,
                 SY-VLINE,
                 I_TABLA-TIPO,
                 SY-VLINE,
              (4)   I_TABLA-LONG,
                 SY-VLINE,
              (16)   I_TABLA-REF,
                 SY-VLINE,
              (30)   I_TABLA-DESCR,
                 SY-VLINE.
         ENDLOOP.
         NEW-LINE.
         ULINE AT 1(80).
         SKIP 2.
       ENDFORM.                               " IMPRIMIR
    Thanks & regards
    Sreeni

  • Wt are events of internal tables?

    wt are events of internal tables?
    all helpfull ans will be rewarded

    Hi kishore kumar,
    Yep that's True that Internal tables are not having any events...
    and can be accessed in program by read or loop at statements...
    I think you wanted to know abt the controle break statements which can be used in internal tables...
    The Control-Break Stmts are...
    1. AT NEW.
    2. AT FIRST.
    3. AT LAST.
    4. AT END OF.
    5  ON CHANGE OF.
    See below example for the use of it...
    REPORT ILE_ZCTRL_BRK_STMT.
    TYPES: BEGIN OF G_I_DATA,
    PROFIT(4) TYPE C,
    COMPANY(4) TYPE C,
    ACCOUNT(10) TYPE C,
    AMOUNT TYPE P,
    END OF G_I_DATA.
    DATA: G_IT_DATA TYPE TABLE OF G_I_DATA,
    G_WA_DATA TYPE G_I_DATA.
    DATA: G_SUM_COMPANY TYPE P,
    G_SUM_PROFIT TYPE P,
    G_AMOUNT TYPE P.
    G_WA_DATA-PROFIT = '0001'.
    G_WA_DATA-COMPANY = '1111'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT1'.
    G_WA_DATA-AMOUNT = 2000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0001'.
    G_WA_DATA-COMPANY = '1111'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT2'.
    G_WA_DATA-AMOUNT = 3000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0001'.
    G_WA_DATA-COMPANY = '2222'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT1'.
    G_WA_DATA-AMOUNT = 4000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0001'.
    G_WA_DATA-COMPANY = '2222'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT2'.
    G_WA_DATA-AMOUNT = 5000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0002'.
    G_WA_DATA-COMPANY = '1111'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT1'.
    G_WA_DATA-AMOUNT = 2000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0002'.
    G_WA_DATA-COMPANY = '1111'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT2'.
    G_WA_DATA-AMOUNT = 3000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0002'.
    G_WA_DATA-COMPANY = '2222'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT1'.
    G_WA_DATA-AMOUNT = 4000.
    APPEND G_WA_DATA TO G_IT_DATA.
    G_WA_DATA-PROFIT = '0002'.
    G_WA_DATA-COMPANY = '2222'.
    G_WA_DATA-ACCOUNT = 'ACCOUNT2'.
    G_WA_DATA-AMOUNT = 5000.
    APPEND G_WA_DATA TO G_IT_DATA.
    SORT G_IT_DATA BY PROFIT COMPANY ACCOUNT.
    WRITE: /6 'ProfitCenter', 20 'CompanyCode',
    34 'Glaccount', 48 'Amount'.
    WRITE: /6 SY-ULINE(50).
    LOOP AT G_IT_DATA INTO G_WA_DATA.
    AT NEW PROFIT.
    WRITE: /6 G_WA_DATA-PROFIT.
    ENDAT.
    G_AMOUNT = G_WA_DATA-AMOUNT.
    AT NEW ACCOUNT.
    WRITE: /34 G_WA_DATA-ACCOUNT,
    48 G_AMOUNT.
    ENDAT.
    G_SUM_PROFIT = G_SUM_PROFIT + G_WA_DATA-AMOUNT.
    G_SUM_COMPANY = G_SUM_COMPANY + G_WA_DATA-AMOUNT.
    AT END OF COMPANY.
    WRITE: /20 G_WA_DATA-COMPANY,
    34 'Totle',
    48 G_SUM_COMPANY.
    CLEAR G_SUM_COMPANY.
    WRITE: /6 '*******'.
    ENDAT.
    AT END OF PROFIT.
    WRITE: /6 G_WA_DATA-PROFIT,
    20 'Totle',
    48 G_SUM_PROFIT.
    CLEAR G_SUM_PROFIT.
    WRITE: /6 '*************************************'.
    ENDAT.
    ENDLOOP.
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7

Maybe you are looking for