Report using internal table events

Hi,
i have an internal table with  the fields 1. profitcenter 2. company code 3. gl account 4. amount
for each profit center i need to seggregate accounts based on company code.
the report should look like the one below.
please suggest some code using internal table events at new , at end etc. as im not using alv. your help will be rewarded
regards,
ravi.
-Profitcenter-companycodeglaccount-amount---
-pfcenter1----
glaccount1-1000---
glaccount2-2000---
4444-total--3000---
glaccount1-4000---
glaccount2-1000---
3333-total--5000---
-profitcentre1*total8000---
profitcentre2.........

Hi.
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.

Similar Messages

  • Submit report using internal table

    Hi Experts!!,
    REPORT 1
    TYPES:   BEGIN OF ty_out_table,
             partner LIKE /sapsll/pntbp-partner,
             bpvsy   LIKE /sapsll/pntbp-bpvsy,
             country LIKE adrc-country,
            END OF ty_out_table.
    internal table declaration & definition
    DATA:  gt_out_table TYPE STANDARD TABLE OF ty_out_table
                   WITH KEY partner
                            bpvsy.
    I have data in internal table gt_out_table.
    I want to pass data gt_out_table in report 2. using SUBMIT REPORT.
    How to do that ?
    REPORT 2
    select-options: s_partnr  for  /sapsll/pntbp-bpvsy.
    parameters: p_upd,
                      p_value .
    please suggest.
    Thanks
    Anee

    hai,
    ... WITH SELECTION-TABLE rspar
    Effect
    If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:
    SELNAME (length 8),
    KIND (length 1),
    SIGN (length 1),
    OPTION (length 2),
    LOW (length 45),
    HIGH (length 45).
    To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:
    SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals
    KIND must contain the type of selection screen component (P for parameters, S for selection criteria)
    SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.
    If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.
    The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.
    Notes
    In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.
    When entering values, you must ensure that these are entered in the internal format of the ABAP values, and not in the output format of the screen display.

  • Internal table events

    hai ,
         how  i can use  internal table events in ALV's please send me example code
          also .

    Hi Sathish,
    According you your query, You want to display the data in Hierarchical format. I am attaching the code of hierarchical format. You just create a Z report and test this report. So that can solve your problem easily with the help of this code.
    REPORT BALVHD01 NO STANDARD PAGE HEADING.
    ALV
    TYPE-POOLS: SLIS.
    DB-Table
    TABLES: SCARR, SPFLI.
    Includes
    INCLUDE .
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          GS_LAYOUT   TYPE SLIS_LAYOUT_ALV,
          GS_KEYINFO  TYPE SLIS_KEYINFO_ALV,
          GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
          GT_EVENTS   TYPE SLIS_T_EVENT.
    Data to be displayed
    DATA: BEGIN OF GT_SPFLI OCCURS 0.
            INCLUDE STRUCTURE SPFLI.
    DATA:
          BOX,
          WERT(4) TYPE P,
          LIGHTS.
    DATA: END OF GT_SPFLI.
    DATA: BEGIN OF GT_SCARR OCCURS 0.
            INCLUDE STRUCTURE SCARR.
    DATA: BOX,
          LIGHTS.
    DATA: END OF GT_SCARR.
    DATA: G_REPID LIKE SY-REPID.
    DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    Report Selections
    SELECT-OPTIONS CARRID FOR SCARR-CARRID.
    SELECTION-SCREEN SKIP 1.
    Parameters
    PARAMETERS: P_MAXROW TYPE I DEFAULT 50.
    SELECTION-SCREEN SKIP 1.
    Variante
    SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-064.
    PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK 0.
    Layout
    SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-060.
    PARAMETERS:
                P_ZEBRA AS CHECKBOX DEFAULT ' ',
                P_NOCOLH AS CHECKBOX DEFAULT ' ',
                P_COLOPT AS CHECKBOX DEFAULT ' ',
                P_KEYHOT AS CHECKBOX DEFAULT ' ',
                P_NOINPT AS CHECKBOX DEFAULT ' '.
    SELECTION-SCREEN END OF BLOCK A.
    SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-061.
    PARAMETERS:
                P_LIGHTN  RADIOBUTTON GROUP LIG ,
                P_LIGHTH  RADIOBUTTON GROUP LIG ,
                P_LIGHTI  RADIOBUTTON GROUP LIG ,
                P_LIGHTC AS CHECKBOX DEFAULT ' '.
    SELECTION-SCREEN END OF BLOCK B.
    SELECTION-SCREEN BEGIN OF BLOCK C WITH FRAME TITLE TEXT-062.
    PARAMETERS:
                P_TOTONL AS CHECKBOX DEFAULT ' ',
                P_TOTEXT(60),
                P_STTEXT(60).
    SELECTION-SCREEN END OF BLOCK C.
    SELECTION-SCREEN BEGIN OF BLOCK D WITH FRAME TITLE TEXT-063.
    PARAMETERS:
                CHCKBOXN  RADIOBUTTON GROUP BOX ,
                CHCKBOXH  RADIOBUTTON GROUP BOX ,
                CHCKBOXI  RADIOBUTTON GROUP BOX ,
              P_GROUPB AS CHECKBOX DEFAULT ' ',
                P_DETPOP AS CHECKBOX DEFAULT 'X',
                P_GROUPS AS CHECKBOX DEFAULT ' '.
    SELECTION-SCREEN END OF BLOCK D.
    DATA:       G_BOXNAM TYPE SLIS_FIELDNAME VALUE  'BOX',
                P_F2CODE LIKE SY-UCOMM       VALUE  '&ETA',
                P_LIGNAM TYPE SLIS_FIELDNAME VALUE  'LIGHTS',
                G_SAVE(1) TYPE C,
                G_TABNAME_HEADER TYPE SLIS_TABNAME,
                G_TABNAME_ITEM   TYPE SLIS_TABNAME,
                G_DEFAULT(1) TYPE C,
                G_EXIT(1) TYPE C,
                GX_VARIANT LIKE DISVARIANT,
                G_VARIANT LIKE DISVARIANT.
    INITIALIZATION.
      G_REPID = SY-REPID.
      G_TABNAME_HEADER = 'GT_SCARR'.
      G_TABNAME_ITEM   = 'GT_SPFLI'.
    define keyinfo
      CLEAR GS_KEYINFO.
      GS_KEYINFO-HEADER01 = 'CARRID'.
      GS_KEYINFO-ITEM01   = 'CARRID'.
      GS_KEYINFO-HEADER02 = SPACE.
      GS_KEYINFO-ITEM02   = 'CONNID'.
      PERFORM E01_FIELDCAT_INIT  USING GT_FIELDCAT[].
      PERFORM E03_EVENTTAB_BUILD USING GT_EVENTS[].
      PERFORM E04_COMMENT_BUILD  USING GT_LIST_TOP_OF_PAGE[].
      PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
    Schalter Varianten benutzerspezifisch/allgemein speicherbar setzen
    Set Options: save variants userspecific or general
      G_SAVE = 'A'.
      PERFORM VARIANT_INIT.
    Get default variant
      GX_VARIANT = G_VARIANT.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                I_SAVE     = G_SAVE
           CHANGING
                CS_VARIANT = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND  = 2.
      IF SY-SUBRC = 0.
        P_VARI = GX_VARIANT-VARIANT.
      ENDIF.
    Process on value request
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
      PERFORM F4_FOR_VARIANT.
    PAI
    AT SELECTION-SCREEN.
      PERFORM PAI_OF_SELECTION_SCREEN.
    START-OF-SELECTION.
      PERFORM SELECTION.
    END-OF-SELECTION.
      PERFORM E05_LAYOUT_BUILD USING GS_LAYOUT.     "wg. Parameters
    Call ABAP/4 List Viewer
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = G_REPID
              I_CALLBACK_PF_STATUS_SET = ' '
              I_CALLBACK_USER_COMMAND  = ' '
                IS_LAYOUT                = GS_LAYOUT
                IT_FIELDCAT              = GT_FIELDCAT[]
              IT_EXCLUDING             =
                IT_SPECIAL_GROUPS        = GT_SP_GROUP[]
              IT_SORT                  =
              IT_FILTER                =
              IS_SEL_HIDE              =
              I_SCREEN_START_COLUMN    = 0
              I_SCREEN_START_LINE      = 0
              I_SCREEN_END_COLUMN      = 0
              I_SCREEN_END_LINE        = 0
              i_default                = g_default
                I_SAVE                   = G_SAVE
                IS_VARIANT               = G_VARIANT
                IT_EVENTS                = GT_EVENTS[]
              IT_EVENT_EXIT            =
                I_TABNAME_HEADER         = G_TABNAME_HEADER
                I_TABNAME_ITEM           = G_TABNAME_ITEM
                IS_KEYINFO               = GS_KEYINFO
              IS_PRINT                 =
         IMPORTING
              E_EXIT_CAUSED_BY_CALLER  =
           TABLES
                T_OUTTAB_HEADER          = GT_SCARR
                T_OUTTAB_ITEM            = GT_SPFLI.
          FORM E01_FIELDCAT_INIT                                        *
    -->  E01_LT_FIELDCAT                                               *
    FORM E01_FIELDCAT_INIT USING E01_LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'DISTANCE'.
      LS_FIELDCAT-TABNAME      = G_TABNAME_ITEM.
      LS_FIELDCAT-NO_OUT       = 'X'.
      LS_FIELDCAT-NO_SUM       = 'X'.
      LS_FIELDCAT-SP_GROUP = 'A'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'DISTID'.
      LS_FIELDCAT-TABNAME      = G_TABNAME_ITEM.
      LS_FIELDCAT-NO_OUT       = 'X'.
      LS_FIELDCAT-NO_SUM       = 'X'.
      LS_FIELDCAT-SP_GROUP = 'A'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'CARRID'.
      LS_FIELDCAT-TABNAME      = G_TABNAME_ITEM.
      LS_FIELDCAT-TECH         = 'X'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'FLTYPE'.
      LS_FIELDCAT-TABNAME      = G_TABNAME_ITEM.
      LS_FIELDCAT-NO_OUT       = 'X'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
              I_PROGRAM_NAME         =
                I_INTERNAL_TABNAME     = G_TABNAME_HEADER
                I_STRUCTURE_NAME       = 'SCARR'
              I_CLIENT_NEVER_DISPLAY = 'X'
           CHANGING
                CT_FIELDCAT            = E01_LT_FIELDCAT[].
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
              I_PROGRAM_NAME         =
                I_INTERNAL_TABNAME     = G_TABNAME_ITEM
                I_STRUCTURE_NAME       = 'SPFLI'
              I_CLIENT_NEVER_DISPLAY = 'X'
           CHANGING
                CT_FIELDCAT            = E01_LT_FIELDCAT[].
    Nachbessern!!!
    CLEAR LS_FIELDCAT.
    LS_FIELDCAT-FIELDNAME    = 'CARRID'.
    LS_FIELDCAT-TABNAME      = G_TABNAME_HEADER.
    LS_FIELDCAT-REF_FIELDNAME = 'CARRID'.
    LS_FIELDCAT-REF_TABNAME   = 'SCARR'.
    LS_FIELDCAT-KEY           = 'X'.
    APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    geht am Anfang nicht !!!!
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-COL_POS       = 99.
      LS_FIELDCAT-FIELDNAME    = 'WERT'.
      LS_FIELDCAT-TABNAME      = G_TABNAME_ITEM.
      LS_FIELDCAT-REPTEXT_DDIC = 'Wert'(070).
      LS_FIELDCAT-OUTPUTLEN    = 4.
      LS_FIELDCAT-DATATYPE    = 'CURR'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    ENDFORM.
          FORM E02_DATA_ADD                                             *
    FORM E02_DATA_ADD TABLES E02_LT_SPFLI STRUCTURE GT_SPFLI
                             E02_LT_SCARR STRUCTURE GT_SCARR.
      LOOP AT E02_LT_SPFLI.
        IF SY-TABIX > 10.
          E02_LT_SPFLI-BOX  = 'X'.
          E02_LT_SPFLI-LIGHTS = '3'.
        ELSE.
          IF SY-TABIX = 1.
            E02_LT_SPFLI-LIGHTS = '2'.
          ELSE.
            E02_LT_SPFLI-LIGHTS = '1'.
          ENDIF.
        ENDIF.
        E02_LT_SPFLI-WERT = SY-TABIX MOD 5.
        MODIFY E02_LT_SPFLI.
      ENDLOOP.
      LOOP AT E02_LT_SCARR.
        IF SY-TABIX > 10.
          E02_LT_SCARR-BOX  = 'X'.
          E02_LT_SCARR-LIGHTS = '3'.
        ELSE.
          IF SY-TABIX = 1.
            E02_LT_SCARR-LIGHTS = '2'.
          ELSE.
            E02_LT_SCARR-LIGHTS = '1'.
          ENDIF.
        ENDIF.
        MODIFY E02_LT_SCARR.
      ENDLOOP.
    ENDFORM.
          FORM E03_EVENTTAB_BUILD                                       *
    -->  E03_LT_EVENTS                                                 *
    FORM E03_EVENTTAB_BUILD USING E03_LT_EVENTS TYPE SLIS_T_EVENT.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = E03_LT_EVENTS.
      READ TABLE E03_LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO E03_LT_EVENTS.
      ENDIF.
    ENDFORM.
          FORM E04_COMMENT_BUILD                                        *
    -->  E04_LT_TOP_OF_PAGE                                            *
    FORM E04_COMMENT_BUILD USING E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: LS_LINE TYPE SLIS_LISTHEADER.
    Listenüberschrift: Typ H
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'H'.
    LS_LINE-KEY:  not used for this type
      LS_LINE-INFO = TEXT-001.
      APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
    Kopfinfo: Typ S
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = TEXT-050.
      LS_LINE-INFO = TEXT-010.
      APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
      LS_LINE-KEY  = TEXT-051.
      APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
    Aktionsinfo: Typ A
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'A'.
    LS_LINE-KEY:  not used for this type
      LS_LINE-INFO = TEXT-002.
      APPEND LS_LINE TO  E04_LT_TOP_OF_PAGE.
    ENDFORM.
          FORM E05_LAYOUT_BUILD                                         *
    <->  E05_LS_LAYOUT                                                 *
    FORM E05_LAYOUT_BUILD USING E05_LS_LAYOUT TYPE SLIS_LAYOUT_ALV.
      IF P_LIGHTI = 'X'.
        E05_LS_LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.
        E05_LS_LAYOUT-LIGHTS_TABNAME   = G_TABNAME_ITEM.
        E05_LS_LAYOUT-LIGHTS_CONDENSE  = P_LIGHTC.
      ENDIF.
      IF P_LIGHTH = 'X'.
        E05_LS_LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.
        E05_LS_LAYOUT-LIGHTS_TABNAME   = G_TABNAME_HEADER.
        E05_LS_LAYOUT-LIGHTS_CONDENSE  = P_LIGHTC.
      ENDIF.
      IF P_LIGHTN = 'X'.
        CLEAR E05_LS_LAYOUT-LIGHTS_FIELDNAME.
        CLEAR E05_LS_LAYOUT-LIGHTS_TABNAME.
        CLEAR E05_LS_LAYOUT-LIGHTS_CONDENSE.
      ENDIF.
      IF CHCKBOXN = 'X'.
        E05_LS_LAYOUT-BOX_FIELDNAME = SPACE.
        E05_LS_LAYOUT-BOX_TABNAME   = SPACE.
      ENDIF.
      IF CHCKBOXH = 'X'.
        E05_LS_LAYOUT-BOX_FIELDNAME     = G_BOXNAM.
        E05_LS_LAYOUT-BOX_TABNAME       = G_TABNAME_HEADER.
      ENDIF.
      IF CHCKBOXI = 'X'.
        E05_LS_LAYOUT-BOX_FIELDNAME     = G_BOXNAM.
        E05_LS_LAYOUT-BOX_TABNAME       = G_TABNAME_ITEM.
      ENDIF.
      E05_LS_LAYOUT-HEADER_TEXT       = TEXT-071.
      E05_LS_LAYOUT-ITEM_TEXT         = TEXT-072.
      E05_LS_LAYOUT-DEFAULT_ITEM      = 'X'.
      E05_LS_LAYOUT-F2CODE            = P_F2CODE.
      E05_LS_LAYOUT-ZEBRA          = P_ZEBRA.
      E05_LS_LAYOUT-COLWIDTH_OPTIMIZE = P_COLOPT.
      E05_LS_LAYOUT-NO_INPUT          = P_NOINPT.
      E05_LS_LAYOUT-NO_COLHEAD        = P_NOCOLH.
      E05_LS_LAYOUT-TOTALS_TEXT       = P_TOTEXT.
      E05_LS_LAYOUT-SUBTOTALS_TEXT    = P_STTEXT.
      E05_LS_LAYOUT-TOTALS_ONLY       = P_TOTONL.
      E05_LS_LAYOUT-KEY_HOTSPOT       = P_KEYHOT.
      E05_LS_LAYOUT-DETAIL_POPUP      = P_DETPOP.
      E05_LS_LAYOUT-GROUP_CHANGE_EDIT = P_GROUPS.
    E05_LS_LAYOUT-GROUP_BUTTONS     = P_GROUPB.
      E05_LS_LAYOUT-GROUP_BUTTONS     = SPACE.
    ENDFORM.
          FORM E07_SP_GROUP_BUILD                                       *
    -->  E07_LT_SP_GROUP                                               *
    FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = TEXT-005.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    ENDFORM.
          FORM SELECTION                                                *
    FORM SELECTION.
      SELECT * FROM SCARR INTO CORRESPONDING FIELDS OF TABLE GT_SCARR
                                                  WHERE CARRID IN CARRID.
      SELECT * FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE GT_SPFLI
                                                  UP TO P_MAXROW ROWS
                                                  WHERE CARRID IN CARRID.
      LOOP AT GT_SCARR.
        READ TABLE GT_SPFLI WITH KEY CARRID = GT_SCARR-CARRID.
        IF SY-SUBRC NE 0.
          DELETE GT_SCARR.
        ENDIF.
      ENDLOOP.
      PERFORM E02_DATA_ADD TABLES GT_SPFLI GT_SCARR.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
    ENDFORM.
          FORM F4_FOR_VARIANT                                           *
    FORM F4_FOR_VARIANT.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                IS_VARIANT          = G_VARIANT
                I_SAVE              = G_SAVE
                I_TABNAME_HEADER    = G_TABNAME_HEADER
                I_TABNAME_ITEM      = G_TABNAME_ITEM
              it_default_fieldcat =
           IMPORTING
                E_EXIT              = G_EXIT
                ES_VARIANT          = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND = 2.
      IF SY-SUBRC = 2.
        MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        IF G_EXIT = SPACE.
          P_VARI = GX_VARIANT-VARIANT.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    FORM PAI_OF_SELECTION_SCREEN.
      IF NOT P_VARI IS INITIAL.
        MOVE G_VARIANT TO GX_VARIANT.
        MOVE P_VARI TO GX_VARIANT-VARIANT.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  I_SAVE     = G_SAVE
             CHANGING
                  CS_VARIANT = GX_VARIANT.
        G_VARIANT = GX_VARIANT.
      ELSE.
        PERFORM VARIANT_INIT.
      ENDIF.
    ENDFORM.                               " PAI_OF_SELECTION_SCREEN
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT_INIT.
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = G_REPID.
    ENDFORM.                               " VARIANT_INIT
    Thanks and Best Regards,
    Vijay

  • Selecting records from DB table with out using internal tables

    hi,
    i need to retrieve values from a database table based on few fields and date as well. however, i need to check whether the date is less or equal to the current date and along with that i should get the appropriate record. how can i do that with out using internal table.
    field1-----date---
    11111----
    20070219
    11111--20070214 <---
    11111----
    20070205
    in the above scenario i should get the second record
    Regards,
    Kranthi.

    Try:
    REPORT ztest MESSAGE-ID 00.
    TABLES bkpf.
    SELECT * FROM bkpf
      UP TO 1 ROWS
      WHERE budat <= sy-datum
      ORDER BY budat DESCENDING.
    ENDSELECT.
    Rob

  • Submititng the program to another program  using internal table values

    Hi All,
    How to Submit from one program to another program using internal table values minimum 7 int tables without using the seletion screen
    thanks
    raj

    Hi All,
    Thank you very much for your inputs.
    i am facing another issue:
    For each 10,000 records it should trigger a job  (we are trying to call a program)  were the validation will be done only through the other program.
    please find the code mentioned below :
    TABLES : but000.
    DATA:  int_bp LIKE but000 OCCURS 0 WITH HEADER LINE.
    data released like BTCH0000-CHAR1.
    DATA: jobnumber LIKE tbtcjob-jobcount, " Job ID and
          jobname LIKE tbtcjob-jobname, " job name.
          startdate LIKE tbtcjob-sdlstrtdt, " Start-time
          starttime LIKE tbtcjob-sdlstrttm, " window specs.
          laststartdate LIKE tbtcjob-laststrtdt,
          laststarttime LIKE tbtcjob-laststrttm,
          job_released LIKE btch0000-char1. " JOB_CLOSE: Was job released?
    DATA : l1 TYPE i,
           b_size TYPE i,
           b_cursor TYPE cursor.
    INITIALIZATION.
      b_size = 5000.
    START-OF-SELECTION.
      OPEN CURSOR WITH HOLD b_cursor
         FOR
         SELECT *
         FROM but000
         WHERE bpkind = 'AA'.
      IF sy-subrc = 0.
        DO.
          FETCH NEXT CURSOR b_cursor INTO TABLE int_bp
                                               PACKAGE SIZE b_size.
    Note : here in this point  we are getting a dump for the second job trigger.
          IF sy-subrc = 0.
            CLEAR jobname.
            CONCATENATE sy-repid sy-datum sy-uzeit INTO jobname.
    export int_bp to memory id 'ABC'.
            CALL FUNCTION 'JOB_OPEN'
                 EXPORTING
                      jobname          = jobname
                 IMPORTING
                      jobcount         = jobnumber.
                EXCEPTIONS
                     cant_create_job  = 1
                     invalid_job_data = 2
                     jobname_missing  = 3
                     OTHERS           = 4
    CALL FUNCTION 'JOB_SUBMIT'
          EXPORTING
               authcknam = sy-uname
               jobname   = jobname
               jobcount  = jobnumber
               report    = 'YTEST_RRR'.
               variant   = lv_variant.
       SUBMIT ytest_rrr
          VIA JOB jobname NUMBER jobnumber
          AND RETURN.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
           event_periodic                    = 'X'
            jobcount                          = jobnumber
            jobname                           = jobname
            strtimmed                         = 'X'
          IMPORTING
            job_was_released                  = released
            else.
            EXIT.
          ENDIF.
        ENDDO.
    calling program :
    REPORT YTEST_RRR .
    data itab1 like but000 occurs 0 with header line.
    data l type i.
    import itab1 from memory id 'ABC' .
    describe table itab1 lines l.
    free memory id 'ABC'.
    write:/ 'total records are:', l.
    Please give your suggestion why its going for  dump in the second iteration.
    thanks in advance.

  • What are the internal table events

    hi experts
    can u help me for this

    Hi ramesh,
    There are basically internal table events are as below...
    at first / endat
    at last / endat
    at new / endat
    at end of / endat
    sum
    on change of / endon
    Use the at first and at last statements to perform processing during the first or last loop pass of an internal table.
    Use the at new and at end of statements to detect a change in a column from one loop pass to the next. These statements enable you to execute code at the beginning and end of a group of records.
    Use the sum statement to calculate totals for the rows of a control level.
    Another statement you can use to perform control break processing is on change of. It behaves in a manner similar to at new.
    on change of differs from at new in the following respects:
    It can be used in any loop construct, not just loop at. For example, it can be used within select and endselect, do and enddo, or while and endwhile, as well as inside get events.
    A single on change of can be triggered by a change within one or more fields named after of and separated by or. These fields can be elementary fields or field strings. If you are within a loop, these fields do not have to belong to the loop.
    When used within a loop, a change in a field to the left of the control level does not trigger a control break.
    When used within a loop, fields to the right still contain their original values; they are not changed to contain zeros or asterisks.
    You can use else between on change of and endon.
    You can use it with loop at it where . . ..
    You can use sum with on change of. It sums all numeric fields except the one(s) named after of.
    Any values changed within on change of remain changed after endon. The contents of the header line are not restored as they are for at and endat.
    <b>Reward Points if it useful....</b>
    Thanks and Regards
    Sreenivasa sharma k.

  • Abap Logic for performance tuning not working when using Internal tables

    Hi,
    I wrote this piece of code that is working correctly that is select SUM of cost from DSO where Plant is the same for Sales Items.
    LOOP AT RESULT_PACKAGE INTO rp.
    SELECT SUM( /N/S_STRDCOST ) FROM /N/ADSP_DPIT00 INTO
    rp-/N/S_STRDCOST
    WHERE /N42/S_SALESITEM = rp-/N42/S_ITEMID AND /N42/S_PLPLANT EQ
    rp-/N42/S_SOURCE.
    MODIFY RESULT_PACKAGE FROM rp.
    Clear rp.
    ENDLOOP.
    Now I try to rewrite it for performance tunning using internal table  but I am getting 0 values. can't figure out whats the problem and been struggling fixing it.
    TYPES : begin of ty_DSO_TABLE,
             /N42/S_STRDCOST TYPE /N/ADSP_DSPC00-/N/S_STRDCOST,
             /N42/S_ITEMID TYPE /N/ADSP_DSPC00-/N/S_ITEMID,
           end of ty_DSO_TABLE.
    DATA: it_DSO_TABLE type hashed table of ty_DSO_TABLE with unique key
    /N/S_ITEMID,
         wa_DSO_TABLE type ty_DSO_TABLE.
    Field-symbols:  <rp> TYPE tys_TG_1.
    LOOP AT RESULT_PACKAGE assigning <rp>.
      clear wa_DSO_TABLE.
    Read table IT_DSO_TABLE into wa_DSO_TABLE with table key /N/S_ITEMID
      = <rp>-/N/S_ITEMID.
      if sy-subrc ne 0.
          select SUM( /N/S_STRDCOST )  into CORRESPONDING
          FIELDS OF wa_DSO_TABLE from
          /N/ADSP_DPIT00 WHERE /N/S_SALESITEM =  <rp>-/N/S_ITEMID AND
          /N/S_PLPLANT EQ <rp>-/N/S_SOURCE.
         if sy-subrc eq 0.
              <rp>-/N/S_STRDCOST = wa_DSO_TABLE-/N/S_STRDCOST.
         endif.
    endif.
    ENDLOOP.
    Any idea whats wrong with the code
    thanks

    Hi Vaidya,
    According to the code which you have written, there is no value in table IT_DSO_TABLE when you are trying to read the values.And after the read statement you have given a condition for sy-subrc. Hence the select statement is actually not even getting executed. *Also you have not assigned the final value back to the ResultPackage.*_
    So Kindly correct your code as follows:
    Data: wa_dso type ty_DSO_TABLE.
    LOOP AT RESULT_PACKAGE assigning <rp>.
    clear wa_DSO_TABLE.
    select SUM( /N/S_STRDCOST ) into CORRESPONDING
    FIELDS OF wa_DSO_TABLE from
    /N/ADSP_DPIT00 WHERE /N/S_SALESITEM = <rp>-/N/S_ITEMID AND
    /N/S_PLPLANT EQ <rp>-/N/S_SOURCE.
    if sy-subrc eq 0.
    <rp>-/N/S_STRDCOST = wa_DSO_TABLE-/N/S_STRDCOST.
    MODIFY RESULT_PACKAGE FROM <rp>.
    endif.
    ENDLOOP.
    Hope this helps you.
    Regards,
    Satyam

  • Using internal tables in BI 7 Start routines

    Hi All
    I tried searching for using internal tables in a start routine in BI 7 could not find the right pointers.
    This is what I am trying to do is the following:
    In a DSO ZSD_O01  I have a sales order and sales order item number and this DSO also contains the Contract number and the contract Item number.
    The DSO structure is as follows:
    /BIC/AZSD_O0100
    DOC_NUMBER
    ITEM
    CONTRACT
    CITEMNUM
    I want to read the data in this DSO into a internal table. But the key fields in this DSO is DOC_NUMBER and ITEM so I want to read this data into a internal table only for the first data package into the internal table. Thereafter I want to lookup into the internal table given the doc_number and ITEM to find the CONTRACT and CITEMNUM.
    Can any of you kindly show me how to :
    - Read data from a DSO into a internal table
    - Read the internal table for the first data package
    - How do I make the access in the internal table fast when my lookup in the internal table is not on the
      DSO key columns but on a different key column
    Appreciate your help
    Thanks
    Karen

    Hi Karen ,
    It will be helpful if you tell your requirement  as the approach you suggested is not looks convincing .May be their is some easy way and we can suggest you better approach
    -how to check for source_package = 1
    You need to hard code it .
    We decide package size at DTP level so you can declare a global variable .let say you have 50000 size of your  package then use global variable as counter and read only when record_count is <= 50000 .
    -how to declare the internal table so the values in it exists between different data packages
    Declare a global table and select data into it .A global table retain data across  the packages .
    - The key on which I need to lookup in the internal table is not the key fields as in the DSO
    Its ok .Let say you are doing lookup on A B and C field of DSO1 and the values may duplicate  in your source .then you just need to read the internal table having data from DSO2  with key field  A B C .
    Better if you set them as semantic keys at DTP level so that all  duplicate entries of A B  C will appear in same package .
    global Declarations
    In your start routine you will have this following code :
      TYPES:
          tyt_SC_1        TYPE STANDARD TABLE OF tys_SC_1
                            WITH NON-UNIQUE DEFAULT KEY.
    $$ begin of global - insert your declaration only below this line  -
    ...   insert your code here
    $$ end of global - insert your declaration only before this line   -
    One question
    Why you want to populate values for 1 source package only not for all ?This will be helpful to understand your requirement and may be we can fulfill it in some other manner .
    Regards,
    Jaya Tiwari

  • Is there any other option for using internal table in badi

    hi
    i know we cannot use internal table in badi
    but is der any other option
    plz write in d codez too
    with Regards
    Rohan Shetty
    Edited by: Rohan Shetty on May 6, 2008 2:14 PM

    of course you can use internal table in BAdi, do like this.
    data: itab type table of ....
    data: wa type ...
    Example:
    data: itab type (standard, sorted, hashed) table of mara.
    data: wa type mara.
    Or create your own type within the badi.
    types: begin of ty_xxx,
                fielda  type c,
                fieldb  type n,
                fieldc  type d.
    types: end   of ty_xxx
    data: itab type table of ty_xxx.
    data: wa type ty_xxx.
    Edited by: Micky Oestreich on May 6, 2008 2:16 PM

  • To find which reports uses the tables MKFP & MSEG

    Hi Experts,
    I have a list predeof reports. I just want to know if these reports uses the table MKFP & MSEG. Is there any predefined function or report available in order to find this one?
    Valuable answers will be rewarded.
    Thanks,
    Satish.

    user for
    MKFP  header masater document
    mseg  docu segment material
    Billing Document not released to accounting / Accounts determination:
    To resolve the error, you can analyze account determination in the billing document. Process:
    Goto T.Code: VF02 & Enter Invoice number
    Next (On the top most strip) goto Environment
    Next (Select Environment) go to Account determination
    Next (In Account Determination) select Revenue Account Determination (first option)
    This will list all the condition types in the Billing document & analyze each condition & check for which G/L accounts is not determined.
    Possible errors:
    1. VKOA not maintained for required combination
    Solution: Maintain the combination in VKOA.
    2. Account Assignment of Customer / material not maintained in Customer / Material Master (If maintained in combination in VKOA).
    Solution:
    Option 1 (Standard solution):
    step 1: Cancel Billing Document --> Reverse PGI --> cancel Delivery --> Cancel Sales Order
    step 2: Maintain Customer master / Material Master correctly.
    step 3: Recreate sales Order --> Delivery --> PGI --> Invoicing.
    Option 2:
    Force the Account Assignment Group of Customer / Material through Debug in change mode of Billing document, which will release Billing Document to Accounting.
    3. Account Key not maintained in Pricing Procedure:
    Impact: This may create accounting document, but if condition type, which are to be posted to account, but do not have account key maintained in pricing procedure, it will not be post the relevant condition type to G/L account.
    4. Billing Document not being released to accounting --
    In Material Master, there is some link between Profit Centre & MRP Type. If one of it is not maintained, erratically few documents get stuck while releasing Billing Document to accounting. Few of course get posted.
    Solution1: Cancel Billing Document --> Reverse PGI --> Cancel Delivery --> Block the sales Order & Create new sales Cycle all over again after rectifying Material master.
    Solution 2: (Temporary Solution) In Debug mode in Billing, force the Profit Center in Billing Document with the help of Abaper. But ensure Material master is rectified.
    From FI Side, you require to check that all the G/L account has been maintained through T.Code: FS00. G/L account being Master data has to be created in each client to upload through LSMW / SCATT / BDC.
    In Billing Document in change mode (in the first screen where we enter Billing Document number), on the top most left hand corner, take a dropdown on Billing Document & select Release to accounting. Here you can get the under mentioned possible message:
    1. G/L account not found
    2. Cost Element not maintained for G/L account.
    In both the above cases, FI consultant requires to take corrective action.
    Pricing:
    This is very specific & differs from client to client & may also differ based on scenario.
    Write-up on Pricing -
    In SD, Pricing Procedure is determined based on Sales Area (Sales Organization + Distribution Centre + Division) + Customer Pricing Procedure + Document Pricing Procedure. Sales Area is determined in Sales Order Header Level. Customer Pricing Procedure is determined from Customer Master. Document Pricing Procedure is determined from Sales Document Type / Billing Type (if configured). Once the pricing procedure is determined, Condition records are fetched. If appropriate condition records are found, the price is determined. If Mandatory pricing condition is missing, system will through an error message.
    In SD, the steps to configure Pricing procedure are as under:
    Step 1:
    Condition table: If existing condition table meets the requirement, we need not create a new condition table. Considering the requirement for new condition table, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Table (select the required fields combination, which will store condition record).
    Step 2:
    Access Sequence: If existing access sequence meets the requirement, we need not create a new access sequence. Considering the requirement for new sequence, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Access Sequence (Access sequence is made up of Accesses (Tables) & the order of priority in which it is to be accessed. Here we assign the condition table to access sequence.
    Step 3:
    Condition Type: If existing condition type meets the requirement, we need not create a new condition type. Considering the requirement for new condition type, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Type. It is always recommended to copy an existing similar condition type & make the necessary changes. Here we assign Access sequence to Condition type.
    Step 4:
    a. Pricing Procedure: It is recommended to copy a similar pricing procedure & make the necessary changes in new pricing procedure. Pricing Procedure is a set of condition type & arranged in the sequence in which it has to perform the calculation. Considering the requirement for new Pricing Procedure, the configuration will be done in spro as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Maintain Pricing Procedure.
    b. Pricing Procedure: After maintaining the pricing procedure the next step will be determination of pricing procedure. Configuration for determining pricing procedure in SPRO is as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Determine Pricing Procedure.
    5. Condition record: Condition record is a master data, which is required to be maintained by Core team / person responsible from the client. During new implementation, the condition records can be uploaded using tools like SCAT, LSMW, etc.
    It is assumed that document pricing procedure, customer pricing procedure , ... are in place.
    Sales Document not assigned to Sales Area:
    SPRO --> Sales & Distribution --> Sales --> Sales Documents --> Sales Document Header --> Assign Sales Area To Sales Document Types --> Assign sales order types permitted for sales areas (do ensure to maintain combined Sales organization, combined Distribution channel & combined division. for eg: Sales org 1000 & sales org 1000, Sales org 2000 & sales org 2000, & so on ....
    similarly for distribution channel & Division, so that the Sales area combination is available for assignment to Sales Document Type.)
    Issues related to Customer Master data:
    1. what is the impact of leaving customer pricing procedure & customer statistic group blank in customer master --> sales area data --> sales tab:
    If Customer Pricing Procedure is left blank, Pricing will not be determined.
    If customer statistic group is left blank, then data will not flow to standard reports.
    2. Who maintains reconciliation account in customer master?
    Ideally, reconciliation account is maintained by FI person, but if SD person is authorized & has the knowledge of which reconciliation account to be maintained, then even SD person can maintain the same.
    3. Terms of payment appear in Company Code Data & sales Area Data. What is the impact of each? why is it not populated automatically, once it is maintained at either field?
    Terms of payment from company code data is for reporting purpose & it is from sales area data that it flows to sales order.
    It is a standard feature of SAP that it is not populated automatically if maintained at either of the field, but it is a must in sales area data & can be skipped in company code data.
    4. Unable to select Sales Area for Customer Master Creation?
    Most Probably either sales area is not defined or customization not done for common Sales Org & Common Distribution Channel. To maintain this configuration: SPRO --> Sales & Distribution --> Master Data --> Define Common Distribution Channels / Define Common Divisions

  • DESKI Report using Temp tables in MS- SQL server 2005

    Hi,
    I am trying to create a Free hand SQL DESKI report using temp tables in MS SQL Server-2005, I am using ODBC connection.
    When I run the report, I am getting the error
    u201CConnection or SQL sentence error (DA0005) No column or data to fetchu201D
    Ex:
    Select *
    into #t1
    from region
    select * from #t1
    drop table #t1
    Please help.
    Regards,
    Pratik

    Pratik, the SQL does not seem right. BTW you can only retreive data via Deski Free hand SQL. Also try to use OLE DB connection.

  • Best way to declare and use internal table

    Hi all,
    As per my knoledge there are various techeniques (Methods) to declare and use the internal tables.
    Please Suggest me the Best way to declaring and using internal table ( WITH EXAMPLE ).
    Please Give the reason as well how the particular method is good ?
    What are benefits of particular method ?
    Thanks in advance.
    Regards
    Raj

    Hello Raj Ahir,
    There are so many methods to declare an internal table.
    Mainly I would like to explain 2 of them mostly used.
    1. Using Work Area and
    2. With header line.
    This with header line concept is not suggestable, because, when we shift the code to oops concept.. it doesn't work... Because OOPS doesn't support the Headerline concept...
    But it all depends on the situation.
    If you are sure that your program doen't make use of the OOPs concept, you can use HEADER LINE concept. If it invols OOPs use WORK AREA concept.
    Now I'l explain these two methods with an example each...
    1. Using Work area.
    TABLES: sflight.
    DATA: it_sflight TYPE TABLE OF sflight.
    DATA: wa_sflight LIKE LINE OF it_sflight.
    SELECT *
      FROM sflight
      INTO it_sflight
      WHERE <condition>.
      LOOP AT it_sflight INTO wa_sflight.
        WRITE / wa_sflight.
      ENDLOOP.
      In this case we have to transfer data into work area wa_sflight.
    We can't access the data from the internal table direclty without work
    area.
    *<===============================================
    2. Using Header line.
      DATA: BEGIN OF it_sflight OCCURS 0,
              carrid LIKE sflight-carrid,
              connid LIKE sflight-connid,
              fldate LIKE sflight-fldate,
            END OF it_sflight.
      SELECT *
        FROM sflight
        INTO it_sflight
        WHERE <condition>.
        LOOP AT it_sflight INTO wa_sflight.
          WRITE / wa_sflight.
        ENDLOOP.
    In this case we can directly access the data from the internal table.
    Here the internal table name represents the header. for each and every
    interation the header line will get filled with new data. If you want to
    represnent the internal table body you can use it_sflight[].
    *<======================================================
    TYPES: BEGIN OF st_sflight,
             carrid LIKE sflight-carrid,
             connid LIKE sflight-connid,
             fldate LIKE sflight-fldate,
           END OF st_sflight.
    DATA: it_sflight TYPE TABLE OF st_sflight,
          wa_sflight LIKE LINE OF it_sflight.
    This is using with work area.
    DATA: it_sflight LIKE sflight OCCURS 0 WITH HEADER LINE.
    This is using header line.
    <b>REWARD THE POINTS IF IT IS HELPFUL.</b>
    Regards
    Sasidhar Reddy Matli.
    Message was edited by: Sasidhar Reddy Matli
            Sasidhar Reddy Matli

  • Compare the elements data of the 2 context nodes using internal table

    Hi,
    How can i compare the elements data of the 2 context nodes using internal table?
    Regards,
    Ronita

    hi ronita,
    just get the nodes data into internal tables and just compare them......
    node1->get_static_attributes_table(importing table = ITAB_node1)
    node2->get_static_attributes_table(importing table = ITAB_node2)
    now u have the data of ur 2 context nodes in 2 different internal tables ..
    just compare them like
    if  ITAB_node1[ ] = ITAB_node2[ ].
    write: / 'itab1 is equal to itab2'..
    endif.
    and u can use as many as comparision operators between these 2 tables to compare them....
    regards....
    srini,,,,

  • Population of sales orders using internal tables

    I am trying to execute a program, where my requirement is to populate all the
    sales orders number using internal tables concept
    I am not sure, whether I am missing portion of logic or logic is incorrect
    Followed is the source code of my program
    tables: vbak.
    data: ztab like standard table of vbak with header line.
    parameters: z_vbeln like vbak-vbeln.
    select * from vbak into ztab where vbtyp = 'c'.
    append ztab.
    endselect.
    write: 30 'sales order' , 50 'order type', 60 'date' , 75 'time'.
    loop at ztab.
    write: /30 ztab-vbeln, 50 ztab-vbtyp, 60 ztab-erdat, 75 ztab-erzet.
    endloop.
    Thanks In Advance!!

    Hi Eshwer,
    Try following code. Use into table concept. It performancewise better than select ...endselect.
    TABLES : vbak.
    DATA : ztab LIKE STANDARD TABLE OF vbak WITH HEADER LINE.
    PARAMETERS : z_vbeln LIKE vbak-vbeln.
    SELECT  *
        INTO TABLE  ztab
        FROM vbak
       WHERE vbtyp = 'c'.
    ***You can add parameter z_vbeln in where clause if required****
    IF sy-subrc EQ 0.
    write: 30 'sales order' , 50 'order type', 60 'date' , 75 'time'.
    LOOP AT ztab.
    write: /30 ztab-vbeln,
              50 ztab-vbtyp,
              60 ztab-erdat,
              75 ztab-erzet.
    ENDLOOP.
    Regards,
    Anil Salekar

  • Report using three tables on group basis

    Hi,
    I wish to know a clue for the follwing report among three tables either using join or sub-query or PL/SQL Script as per the below desired output.
    Top 10 games by uniques / by volume
    It should produce something like this:
    Game     Uniques     Volumes     Game Start     Game End     Mins on Air     
    Top 5 movies beginning with "D"     2734     7924     9/24/06 9:59 PM     9/24/06 10:41 PM     42     
    Top 5 One Hit Wonders     2355     6471     9/24/06 9:07 PM     9/24/06 9:48 PM     41     
    Things you find in The Kitchen     1336     3600     9/24/06 10:41 PM     9/24/06 10:59 PM     18     
    Twisted Title Men in Black     770     1435     9/24/06 9:53 PM     9/24/06 9:59 PM     6     
    Anagram Lance Armstrong     884     1350     9/24/06 9:48 PM     9/24/06 9:53 PM     5     
    A.Bucks Jack and Jill...     593     824     9/24/06 8:59 PM     9/24/06 9:04 PM     4     
    Missing link ANY101     649     815     9/24/06 9:04 PM     9/24/06 9:07 PM     3     
    Parameters should be startDate and endDate.
    This query can be obtained from using the following tables: Calls, Games, Events, Event_Types
    Calls have a timestamp.
    Every game has event, such as start game or end game (see Event_Types), with its timestamp
    Volumes: Number of calls received for each game between start game date and end date
    Uniques: Unique Number of calls received for each game between start game date and end date
    (distinct cli)
    Mins on air: differences between start call and end call
    Relationship:
    The ID column from games table and game_id from events table is common.
    Assume if the event type id is 2 then it starts game and if 3 then game ends. Other type is irrelevant for this query.
    The id from event_type is mentioned in another table event_types as master with description. But it is not required to establish relationship with this table. As this code ( 2 or 3) is alredy availbel with event_type_id in the events table.
    Please assume the CLI number as dummy data.
    I have provided the structure and query to generate tables and populate testing data to sort out this issue at the earliest.
    I tried to perform this query but I wish to compare the result with the script given by experts as I’m not a core developer.
    1) desc calls
    Name Null? Type
    CLI NOT NULL VARCHAR2(255)
    CALL_DATE NOT NULL TIMESTAMP(6)
    insert into values('&CLI','&call_date')
    select substr(CLI,1,10),substr(call_date,1,22) from calls
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0662740929 22-SEP-06 05.22.44.123
    0662740973 22-SEP-06 05.22.47.123
    0662740956 22-SEP-06 05.22.46.123
    0662740980 22-SEP-06 05.22.47.123
    0662740936 09-MAY-06 05.22.44.123
    0762740954 22-SEP-06 05.22.45.123
    0762740936 09-MAY-06 05.22.47.123
    0762740921 22-SEP-06 05.22.44.123
    0113456789 22-SEP-06 05.47.04.082
    0987654321 22-SEP-06 06.16.29.727
    0 22-SEP-06 06.17.28.141
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0123456789 09-MAY-06 06.27.51.224
    0112740929 22-SEP-06 06.28.43.398
    0123456789 09-MAY-06 06.30.10.830
    0044791475 24-SEP-06 04.38.08.564
    0044791475 24-SEP-06 04.40.05.777
    0123456789 24-SEP-06 05.32.22.267
    0147258369 24-SEP-06 05.34.25.652
    0852147963 24-SEP-06 05.52.56.992
    0123456789 25-SEP-06 01.34.17.157
    0683379112 25-SEP-06 01.35.19.461
    0 25-SEP-06 03.09.12.347
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0141411683 25-SEP-06 03.21.07.402
    0141411683 25-SEP-06 03.21.38.519
    0618769562 02-JUN-06 03.22.12.807
    0123456789 02-JUN-06 03.24.11.387
    0 25-SEP-06 03.25.13.152
    0141412179 25-SEP-06 03.25.38.424
    0123456789 02-JUN-06 03.26.57.687
    0607069617 02-JUN-06 03.27.02.720
    0014141168 26-SEP-06 03.30.55.290
    0618769562 25-SEP-06 03.31.21.141
    0141411683 25-SEP-06 03.31.45.952
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0607069617 25-SEP-06 03.32.14.542
    0618769562 25-SEP-06 03.32.30.433
    0 25-SEP-06 03.32.43.292
    0141412179 25-SEP-06 03.33.07.166
    0 25-SEP-06 03.33.56.086
    0 25-SEP-06 03.34.03.918
    0123456789 26-SEP-06 03.34.21.193
    0 25-SEP-06 03.34.25.484
    0 25-SEP-06 03.34.39.126
    0 25-SEP-06 03.34.40.354
    0 25-SEP-06 03.34.51.231
    2)
    SQL> desc events
    Name Null? Type
    EVENT_TYPE_ID NOT NULL NUMBER(19)
    EVENT_DATE NOT NULL TIMESTAMP(6)
    GAME_ID NUMBER(19)
    insert into events values ('&EVENT_TYPE_ID','&EVENT_DATE',&GAME_ID')
    SQL> select substr(event_type_id,1,10),substr(event_date,1,20),substr(game_id,1,10) from events where game_id in (1918,1919,1920,1939,1958,1979,1999,2018,2040,2041,2061)
    SUBSTR(EVE SUBSTR(EVENT_DATE,1, SUBSTR(GAM
    3 26-APR-06 06.11.50.8 1939
    4 26-APR-06 06.12.05.6 1939
    5 26-APR-06 06.16.13.5 1939
    3 09-MAY-06 06.18.59.7 1920
    4 09-MAY-06 06.22.43.7 1920
    3 12-MAY-06 04.24.46.2 1920
    4 12-MAY-06 04.46.22.5 1920
    3 12-MAY-06 04.29.07.4 1920
    4 12-MAY-06 04.39.31.1 1920
    3 12-MAY-06 04.29.35.3 1920
    4 12-MAY-06 04.30.02.8 1920
    SUBSTR(EVE SUBSTR(EVENT_DATE,1, SUBSTR(GAM
    3 26-SEP-06 12.19.27.6 1958
    4 26-SEP-06 12.29.37.9 1958
    5 01-JUN-06 12.26.37.2 1958
    3 02-JUN-06 11.53.49.0 1979
    6 02-JUN-06 11.54.00.5 1979
    4 02-JUN-06 11.54.55.5 1979
    3 02-JUN-06 11.55.03.7 1979
    4 02-JUN-06 11.57.40.7 1979
    3 02-JUN-06 11.57.43.5 1979
    4 02-JUN-06 11.59.47.2 1979
    3 14-SEP-06 02.24.13.8 1999
    SUBSTR(EVE SUBSTR(EVENT_DATE,1, SUBSTR(GAM
    4 14-SEP-06 02.55.18.7 1999
    3 14-SEP-06 06.44.40.1 1999
    4 14-SEP-06 06.52.57.9 1999
    3 22-SEP-06 04.05.09.5 2018
    4 22-SEP-06 05.24.14.7 2018
    5 22-SEP-06 05.24.25.0 2018
    4 24-SEP-06 03.17.54.8 2018
    3 24-SEP-06 03.19.00.1 2018
    3) INSERT INTO games VALUES ('&ID'.'&NAME')
    SQL> desc games
    Name Null? Type
    ID NOT NULL NUMBER(19)
    NAME NOT NULL VARCHAR2(255)
    select substr(id,1,10),substr(name,1,25) from games;
    SUBSTR(ID, SUBSTR(NAME,1,25)
    1918 Copy of QN27030628
    1919 Copy of Copy of QN0104061
    1920 Copy of Copy of Copy of Q
    1939 Alex Game 8
    1958 QN27030628 Lee
    1979 Copy of QN01040611 9
    1999 Ale's Game
    2018 TF1 Game test 1
    2040 Test Game TF1sarah
    2041 BTAgilemedia Game Test
    2061 Copy of Copy of QN0104060
    Your help would be highly appreciated.
    Thanks
    Jayesh

    Hi,
    I am sending herewith SQL statement for populating data into the concern tables
    To make easier for further testing your script.
    insert into calls values (0772740929, 22-SEP-06 05.22.44.123)
    insert into calls values (0882740929, 22-SEP-06 05.22.44.123)
    insert into calls values (0772740929, 25-SEP-06 05.22.44.123)
    insert into calls values (0662740929, 27-SEP-06 05.22.44.123)
    insert into calls values (0452740929, 22-SEP-06 05.22.44.123)
    insert into calls values (0992740929, 24-SEP-06 05.22.44.123)
    insert into calls values (0992740929, 26-SEP-06 05.22.44.123)
    insert into events values (3, 22-SEP-06 05.22.44.123,1918)
    insert into events values (4, 22-SEP-06 05.32.44.123,1918)
    insert into events values (3, 24-SEP-06 05.22.44,1920)
    insert into events values (4, 24-SEP-06 05.42.44,1920)
    insert into events values (3, 26-SEP-06 05.22.44,1958)
    insert into events values (4, 26-SEP-06 05.52.44,1958)
    Insert into games values (1918,’ Copy of QN27030628’)
    Insert into games values (1920,’ Test Game TF1sarah’)
    Insert into games values (1958,’ Test Car Race’)
    Thanks
    jayesh

Maybe you are looking for

  • Cache Connect in cluster

    Hi!!! We have 4-nodes linux cluster based on MC Service Guard. T10 works as a standalone in the packet "pack1" with other apps. Apps uses t10. Packet "pack1" (with t10 and apps) can be moved to any of 4 cluster nodes, and it doesn't have a home node

  • Can't run updates

    I get this when trying to update: [davek@arch64 ~]$ su Password: [root@arch64 davek]# pacman -Syu :: Synchronizing package databases... core                      33.4K  149.6K/s 00:00:00 [#####################] 100% extra                    412.8K  5

  • Does the RSS feeder built-in client work offline??...

    Hi everybody! Does anybody know if it is possible to work offline with the built-in Nokia's feeder client? Thanks in advance, Regards.

  • Alternative to RealPlayer on E71x

    Hi, The RealPlayer installed on my E71x other than the fact that movies get stuck all the time, doesn't have fast forward, which becomes really annoying as I stopped watching somthing and then want to continue from the middle or fast forward the piec

  • How to create idoc in sap-crm?

    hi all, I want to send data from SAP CRM Server to it's own port so that SAP Adapter read data from SAP CRM port .so pls anyone give the process for this with screen shots so that i can do my work successfully. Thank pankaj goyal