Problem with Fetching Million Records from Table COEP into an Internal Tabl

Hi Everyone ! Hope things are going well.
       Table : COEP has 6 million records.
I am trying to get records based on certain criteria, that is, there are atleast 5 conditions in the WHERE clause.
I've noticed it takes about 15 minutes to populate the internal table. How can i improve the performance to less than a minute for a fetch of 500 records from a database set of 6 million?
Regards,
Owais...

The first obvious sugession would be to use the proper indexes. I had a similar Issue with COVP which is a join of COEP and COBK. I got substanstial performance improvement by adding "where LEDNR EQ '00'" in the where clause.
Here is my select:
          SELECT kokrs
                 belnr
                 buzei
                 ebeln
                 ebelp
                 wkgbtr
                 refbn
                 bukrs
                 gjahr
            FROM covp CLIENT SPECIFIED
            INTO TABLE i_coep
             FOR ALL ENTRIES IN i_objnr
           WHERE mandt EQ sy-mandt
             AND lednr EQ '00'
             AND objnr = i_objnr-objnr
             AND kokrs = c_conarea.

Similar Messages

  • How to extract data from info cube into an internal table using ABAP code

    HI
    Can Anyone plz suggest me
    How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
    Thankx in advance
    regds
    AJAY

    HI Dinesh,
    Thankq for ur reply
    but i ahve already tried to use the function module.
    When I try to Use the function module RSDRI_INFOPOV_READ
    I get an information message "ERROR GENERATION TEST FRAME".
    can U plz tell me what could be the problem
    Bye
    AJAY

  • How can i add two table data into third internal table see below

    hi i insert diffferent table data into different internal table i did try to insert two different internal table data into third internal table by using move
    but only single data is coming please help me
    i want this two internal table data inot third internal table.
    sELECT  * FROM J_1IEXCHDR INTO CORRESPONDING FIELDS OF ITAB1 WHERE STATUS = 'P'.
    SELECT * FROM J_1IEXCDTL INTO CORRESPONDING FIELDS OF ITAB2  WHERE LIFNR = J_1IEXCHDR-LIFNR.
                             AND DOCYR  = J_1IEXCHDR-DOCYR,
                             AND DOCNO  = J_1IEXCHDR-DOCNO.
    WRITE: /  ITAB1-LIFNR,
              ITAB1-DOCNO,
              ITAB1-EXYEAR,
              ITAB1-BUDAT,
              ITAB2-EXBED,
              ITAB2-RDOC,
              ITAB2-ECS.
    ENDSELECT.
    ENDSELECT.
    thank you .

    hi
      Two add two internal tables data.  first we need to create third internal table with all the fields of first two internal tables.
    later u move the two internal tables data to third internal table
    by looping the internal table which have more records or depending on the requirement and move the corresponding fields of first internal table to the third internal table and use the read statement with condition based on primary key of first itab and get the corresponding data of 2table into 3table.
    i am sending the sample code to u.
    check it out. i think u will understand how to move.
    select vbeln waerk netwr erdat audat kunnr
       into table it_vbeln
       from vbak
       where vbeln in s_vbeln
         and erdat in s_erdat.
      if not it_vbeln[] is initial.
      select kunnr name1
       into table it_kunnr
       from  kna1
       for all entries in it_vbeln
         where kunnr = it_vbeln-kunnr.
      endif.
      loop at it_vbeln.
      clear it_final.
       it_final-vbeln = it_vbeln-vbeln.
       it_final-waerk = it_vbeln-waerk.
       it_final-netwr = it_vbeln-netwr.
       it_final-erdat = it_vbeln-erdat.
       it_final-audat = it_vbeln-audat.
      read table it_kunnr with key kunnr = it_vbeln-kunnr.
       it_final-name1 = it_kunnr-name1.
      append it_final.
      endloop.

  • How to read data in correct format from EXCEL file into an internal table??

    Hi Experts,
    My requirement is to upload data from an excel file on presentation server into an internal table on <b>SRM</b> server.
    I used 'GUI_UPLOAD' function module to achieve the same but all the the data is getting uploaded in # only.I had set in the 'HAS_FIELD_SEPARATOR' to 'X' to overcome this problem.
    But all the efforts are in vain. The function module 'ALSM_EXCEL_TO_INTERNAL_TABLE' doesn't exist on SRM Server and I am not getting any other function module having similar functionality available on SRM server.
    I have written the following code:-
    TYPES: BEGIN OF ty_addr_loc,
             userid    TYPE xubname,      "User Id
             addr_code TYPE char4,        "3 Digit Site Location Code/4 Digit
                                                       "Alternate Address
             loc_id    TYPE bbp_location, "Indicator: Address is standard address
            END OF ty_addr_loc.
    *Retrieving file name
    parameters: p_file type rlgrap-filename.
      DATA:
        Local variable holding file name
          l_file TYPE string,
        Local Variable holding the file type,
          l_type TYPE filetype VALUE 'ASC',
        Local Variable holding the field separator
          l_sep  TYPE char01,
          i_tab type standard table of ty_addr_loc.
    Clearing local variables
      CLEAR:
            l_file,
            l_sep.
    Initializing the local variables
      MOVE p_file TO l_file.
      l_sep = 'X'.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = l_file
          filetype                      = l_type
          has_field_separator           = l_sep
       HEADER_LENGTH                 = 0
       READ_BY_LINE                  = 'X'
       DAT_MODE                      = ' '
       CODEPAGE                      = ' '
       IGNORE_CERR                   = ABAP_TRUE
       REPLACEMENT                   = '#'
       CHECK_BOM                     = ' '
       VIRUS_SCAN_PROFILE            =
       NO_AUTH_CHECK                 = ' '
    IMPORTING
       FILELENGTH                    =
       HEADER                        =
        TABLES
          data_tab                     = i_tab
       EXCEPTIONS
         file_open_error               = 1
         file_read_error               = 2
         no_batch                      = 3
         gui_refuse_filetransfer       = 4
         invalid_type                  = 5
         no_authority                  = 6
         unknown_error                 = 7
         bad_data_format               = 8
         header_not_allowed            = 9
         separator_not_allowed         = 10
         header_too_long               = 11
         unknown_dp_error              = 12
         access_denied                 = 13
         dp_out_of_memory              = 14
         disk_full                     = 15
         dp_timeout                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
      Throwing an information message
        MESSAGE i003. "Data Upload Failed
        LEAVE LIST-PROCESSING.
      ENDIF.
    Please tell me a way out. I have to make a delivery urgently.
    Thanks in advance,
    Swati Gupta

    Hi
    Try the FM <b>KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    Sample:
      call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
           exporting
                filename                = i_filename
                i_begin_col             = l_begin_col
                i_begin_row             = l_begin_row
                i_end_col               = l_end_col
                i_end_row               = l_end_row
           tables
                intern                  = xt_intern
           exceptions
                INCONSISTENT_PARAMETERS = 201
                UPLOAD_OLE              = 201.
      if sy-subrc <> 0.
        e_subrc = sy-subrc.
        exit.
      endif.
    <b>reward if Helpful.</b>

  • Data from field symbol into an internal table or workarea

    Hi Experts,
    I have field symbol in which i get the data. I want to get this data into an internal table of type any or into an work area. How is this possible.
    My declaration for field symbol is as follow:
    FIELD-SYMBOLS: <l_t_data> TYPE any.
    DATA l_r_data TYPE REF TO data.
        CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
        ASSIGN l_r_data->* TO <l_t_data>.
    I get the data in this field symbol <l_t_data>. by passing into a funtion module. and I get the data into it. Now i have to assign the values of this field symbol to any internal table or to a work are how do i do it. Please help.
    Regards,
    Prashant.

    Not exactly sure what you need here, but.....
    FIELD-SYMBOLS: <l_t_data> TYPE TABLE.   "<<-- Change this
    FIELD-SYMBOLS: <l_s_data> TYPE ANY.      "<<---Add This
    DATA l_r_data TYPE REF TO data.
    CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
    ASSIGN l_r_data->* TO <l_t_data>.
    Loop at <l_t_data> assigning <l_s_data>.
    * Do what ever using <l_s_data>
    Endloop.
    Regards,
    Rich Heilman
    Edited by: Rich Heilman on Feb 28, 2008 2:42 PM

  • Download the KTOPL  field data and GLT0 table data into one Internal table

    Hi,
    I have downloaded GLT0 table fields  data to PC file . But i need to download KTOPL(Chart Of Accounts) data also. in GLT0 table there is no KTOPL field.
    But in SKA1 table have KTOPL field. Then what is the issue is GLT0 data & KTOPL field data needs to download into one Internal Table.
    anybody could you please solve this problem. immediately need to solve this.
    Below is the code.
    REPORT ZFXXEABL_1 NO STANDARD PAGE HEADING
                    LINE-SIZE 200.
    Tables Declaration
    TABLES : GLT0.
    Data Declaration
    DATA :   FP(8)           TYPE C,
             YEAR           LIKE GLT0-RYEAR,
             PERIOD(3)       TYPE C,
             DBALANCE         LIKE VBAP-NETWR VALUE 0 ,
             CBALANCE         LIKE VBAP-NETWR VALUE 0.
    *Internal table for for final data..
    DATA : BEGIN OF REC1 OCCURS 0,
           BAL             LIKE GLT0-TSLVT value 0,
           COAREA          LIKE GLT0-RBUSA,
          CA(4)           TYPE C,
           KTOPL           LIKE ska1-ktopl, 
           CCODE           LIKE GLT0-BUKRS,
           CREDIT          LIKE  VBAP-NETWR,
           CURRENCY        LIKE GLT0-RTCUR,
           CURTYPE(2)      TYPE N,
           DEBIT           LIKE VBAP-NETWR,
           YEAR(8)         TYPE C,
           FY(2)           TYPE C,
           ACCOUNT         LIKE GLT0-RACCT,
           VER             LIKE GLT0-RVERS,
           VTYPE(2)        TYPE N,
           CLNT            LIKE SY-MANDT,
           S_SYS(3)        TYPE C,
           INDICATOR      LIKE GLT0-DRCRK,
           END OF REC1.
    DATA : C(2) TYPE N,
           D(2) TYPE N.
    DATA REC1_H LIKE REC1.
    Variable declarations
    DATA :
           W_FILES(4) TYPE N,
           W_DEBIT LIKE GLT0-TSLVT,
           W_CREDIT LIKE GLT0-TSLVT,
           W_PCFILE LIKE RLGRAP-FILENAME ,
           W_UNIXFILE LIKE RLGRAP-FILENAME,
           W_PCFILE1 LIKE RLGRAP-FILENAME,
           W_UNIXFIL1 LIKE RLGRAP-FILENAME,
           W_EXT(3) TYPE C,
           W_UEXT(3) TYPE C,
           W_PATH LIKE RLGRAP-FILENAME,
           W_UPATH LIKE RLGRAP-FILENAME,
           W_FIRST(1) TYPE C VALUE 'Y',
           W_CFIRST(1) TYPE C VALUE 'Y',
           W_PCFIL LIKE RLGRAP-FILENAME.
    DATA: "REC LIKE GLT0 OCCURS 0 WITH HEADER LINE,
          T_TEMP LIKE GLT0 OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF REC3 OCCURS 0.
          INCLUDE STRUCTURE GLT0.
    DATA: KTOPL LIKE SKA1-KTOPL,
          END OF REC3.
    DATA: BEGIN OF T_KTOPL OCCURS 0,
          KTOPL LIKE SKA1-KTOPL,
          SAKNR LIKE SKA1-SAKNR,
          END OF T_KTOPL.
    Download data.
    DATA: BEGIN OF I_REC2 OCCURS 0,
           BAL(17),        "             like GLT0-TSLVT value 0,
           COAREA(4),      "          like glt0-rbusa,
           CA(4),          "  chart of accounts
           CCODE(4),       "           like glt0-bukrs,
           CREDIT(17),     "          like  vbap-netwr,
           CURRENCY(5),    "       like glt0-rtcur,
           CURTYPE(2),     "      type n,
           DEBIT(17),      "           like vbap-netwr,
           YEAR(8),        "  type c,
           FY(2),          " type c, fiscal yr variant
           ACCOUNT(10),    " like glt0-racct,
           VER(3),         "    like glt0-rvers,
           VTYPE(3),       " type n,
           CLNT(3),        "like sy-mandt,
           S_SYS(3),       "like sy-sysid,
           INDICATOR(1),   "   like glt0-drcrk,
          END OF I_REC2.
    Selection screen.                                                    *
    SELECTION-SCREEN BEGIN OF BLOCK BL1  WITH FRAME TITLE TEXT-BL1.
    SELECT-OPTIONS : COMPCODE FOR GLT0-BUKRS,
                      GLACC FOR GLT0-RACCT,
                      FISYEAR   FOR GLT0-RYEAR,
                    no intervals no-extension,      "- BG6661-070212
                       FISCPER FOR GLT0-RPMAX,
                     busarea   for glt0-rbusa,
                      CURRENCY  FOR GLT0-RTCUR.
    SELECTION-SCREEN END   OF BLOCK BL1.
    SELECTION-SCREEN BEGIN OF BLOCK BL2  WITH FRAME TITLE TEXT-BL2.
    PARAMETERS:
      P_UNIX AS CHECKBOX,                  "Check box for Unix Option
      P_UNFIL LIKE RLGRAP-FILENAME,        " Unix file Dnload file name
       default '/var/opt/arch/extract/GLT0.ASC',  "- BG6661-070212
      P_PCFILE AS CHECKBOX,                "Check box for Local PC download.
      P_PCFIL LIKE RLGRAP-FILENAME         " PC file Dnload file name
                 default 'C:\GLT0.ASC'.           "- BG6661-070212
          DEFAULT 'C:\glt0_gl_balance_all.asc'.     "+ BG6661-070212
    SELECTION-SCREEN END   OF BLOCK BL2.
    *eject
    Initialization.                                                     *
    INITIALIZATION.
    Try to default download filename
    p_pcfil = c_pcfile.
    p_unfil = c_unixfile.
    if sy-sysid eq c_n01.
       p_unfil =   c_unixfile.
    endif.
    if sy-sysid eq c_g21.
       p_unfil =   c_g21_unixfile.
    endif.
    if sy-sysid eq c_g9d.
       p_unfil =   c_g9d_unixfile.
    endif.
    Default for download filename
    *{ Begin of BG6661-070212
      CONCATENATE C_UNIXFILE
                  SY-SYSID C_FSLASH C_CHRON C_FILENAME INTO P_UNFIL.
    *} End of BG6661-070212
    AT SELECTION-SCREEN OUTPUT.
    loop at screen.
       if screen-name = 'P_PCFIL'.        "PC FILE
         screen-input = '0'.
         modify screen.
       endif.
       if screen-name = 'P_UNFIL'.        "UN FILE
         screen-input = '0'.
         modify screen.
       endif.
    endloop.
      if w_first = 'Y'.
        perform path_file.
        w_first = 'N'.
      endif.
    if w_cfirst = 'Y'.
       perform cpath_file.
       w_cfirst = 'N'.
    endif.
    Start-of-Selection.                                                 *
    START-OF-SELECTION.
    *COLLECT DATA
      PERFORM COLLECT_DATA.
    *BUILD FILENAMES
      PERFORM BUILD_FILES.
    *LOCAL
      IF P_PCFILE = C_YES.
       PERFORM LOCAL_DOWNLOAD.
      ENDIF.
    *UNIX
      IF P_UNIX = C_YES.
        PERFORM UNIX_DOWNLOAD.
      ENDIF.
      IF P_PCFILE IS INITIAL AND P_UNIX IS INITIAL.
        MESSAGE I000(ZL) WITH 'Down load flags both are unchecked'.
      ENDIF.
    END-OF-SELECTION.
    IF P_PCFILE = C_YES.
    WRITE :/ 'PC File'  , C_UNDER, P_PCFIL.
    ENDIF.
    *&      Form  DOWNLOAD
          Download                                                       *
    FORM DOWNLOAD.
      P_PCFIL =  W_PATH.
      DATA LIN TYPE I.
      DESCRIBE TABLE I_REC2 LINES LIN.
      WRITE:/ 'No of Records downloaded = ',LIN.
      CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
               FILENAME            =  P_PCFIL
               FILETYPE            =  C_ASC   "c_dat   "dat
           TABLES
                DATA_TAB            = I_REC2  " t_str
               fieldnames          = t_strhd
           EXCEPTIONS
                FILE_OPEN_ERROR     = 1
                FILE_WRITE_ERROR    = 2
                INVALID_FILESIZE    = 3
                INVALID_TABLE_WIDTH = 4
                INVALID_TYPE        = 5
                NO_BATCH            = 6
                UNKNOWN_ERROR       = 7
                OTHERS              = 8.
      IF SY-SUBRC EQ 0.
      ENDIF.
    ENDFORM.
    *&      Form  WRITE_TO_SERVER
          text                                                           *
    -->  p1        text
    <--  p2        text
    FORM WRITE_TO_SERVER.
      DATA : L_MSG(100) TYPE C,
             L_LINE(5000) TYPE C.
      P_UNFIL =  W_UPATH.
      DATA LIN TYPE I.                           
      DESCRIBE TABLE I_REC2 LINES LIN.           
      WRITE:/ 'No of Records downloaded = ',LIN. 
      OPEN DATASET P_UNFIL FOR OUTPUT IN TEXT MODE.        " message l_msg.
      IF SY-SUBRC <> 0.
        WRITE: / L_MSG.
      ENDIF.
    perform header_text1.
      LOOP AT I_REC2.
        TRANSFER I_REC2 TO P_UNFIL.
      ENDLOOP.
      CLOSE DATASET P_UNFIL.
      WRITE : / C_TEXT , W_UPATH.
      SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
      CLEAR W_UPATH.
      IF NOT W_UEXT IS INITIAL.
        CONCATENATE W_UNIXFIL1  C_DOT W_UEXT INTO W_UPATH.
      ELSE.
        W_UEXT = C_ASC. " c_csv.
        CONCATENATE W_UNIXFIL1 C_DOT W_UEXT INTO W_UPATH.
      ENDIF.
    ENDFORM.                               " WRITE_TO_SERVER
    *&      Form  BUILD_FILES
    FORM BUILD_FILES.
      IF P_PCFILE = C_YES.
        W_PCFILE = P_PCFIL.
    ***Split path at dot**
        SPLIT W_PCFILE AT C_DOT INTO W_PCFILE1 W_EXT.
        IF NOT W_EXT IS INITIAL.
          CONCATENATE W_PCFILE1 C_DOT W_EXT INTO W_PATH.
        ELSE.
          W_PATH = W_PCFILE1.
        ENDIF.
      ENDIF.
      IF P_UNIX = C_YES.
        W_UNIXFILE = P_UNFIL.
        SPLIT W_UNIXFILE AT C_DOT INTO W_UNIXFIL1 W_UEXT.
        IF NOT W_UEXT IS INITIAL.
          CONCATENATE W_UNIXFIL1  C_DOT W_UEXT INTO W_UPATH.
        ELSE.
          W_UPATH = W_UNIXFIL1.
        ENDIF.
      ENDIF.
    ENDFORM.
    FORM CPATH_FILE.
    CLEAR P_PCFIL.
       CONCATENATE C_PCFILE
                   C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
                   C_DOT C_ASC INTO  P_PCFIL.
    ENDFORM.                    " CPATH_FILE
    FORM PATH_FILE.
    CLEAR P_UNFIL.
      if sy-sysid eq c_n01.
       CONCATENATE C_UNIXFILE
                   C_COMFILE SY-SYSID C_UNDER SY-DATUM SY-UZEIT
                    C_DOT C_ASC INTO  P_UNFIL.
      endif.
      if sy-sysid eq c_g21.
      concatenate c_g21_unixfile
                  c_comfile sy-sysid c_under sy-datum sy-uzeit
                   c_dot c_asc into  p_unfil.
      endif.
      if sy-sysid eq c_g9d.
      concatenate c_g9d_unixfile
                  c_comfile sy-sysid c_under sy-datum sy-uzeit
                   c_dot c_asc into  p_unfil.
      endif.
    ENDFORM.                    " PATH_FILE
    Local_Download                                                       *
          Local                                                          *
    FORM LOCAL_DOWNLOAD.
    perform header_text.
    LOOP AT REC1.
    REC1-CLNT = SY-MANDT.
    REC1-S_SYS = SY-SYSID.
    MOVE:  REC1-BAL TO I_REC2-BAL,
            REC1-COAREA TO I_REC2-COAREA,
           REC1-CA TO I_REC2-CA,         
            REC1-KTOPL TO I_REC2-CA,       
            REC1-CCODE TO I_REC2-CCODE,
            REC1-CREDIT TO I_REC2-CREDIT,
            REC1-CURRENCY TO I_REC2-CURRENCY,
            REC1-CURTYPE TO I_REC2-CURTYPE,
            REC1-DEBIT TO I_REC2-DEBIT,
            REC1-YEAR TO I_REC2-YEAR,
            REC1-FY TO I_REC2-FY,
            REC1-ACCOUNT TO I_REC2-ACCOUNT,
            REC1-VER TO I_REC2-VER,
            REC1-VTYPE TO I_REC2-VTYPE,
            REC1-CLNT TO I_REC2-CLNT,
            REC1-S_SYS TO I_REC2-S_SYS,
            REC1-INDICATOR TO I_REC2-INDICATOR.
    APPEND I_REC2.
    CLEAR  I_REC2.
    ENDLOOP.
      IF NOT I_REC2[] IS INITIAL.
        PERFORM DOWNLOAD .
        CLEAR I_REC2.
        REFRESH I_REC2.
       ELSE.
       WRITE : / ' no record exist due to unavailability of data'.
      ENDIF.
    ENDFORM.                               " LOCAL_DOWNLOAD
    *&      Form  UNIX_DOWNLOAD
    FORM UNIX_DOWNLOAD.
    LOOP AT REC1.
    REC1-CLNT = SY-MANDT.
    REC1-S_SYS = SY-SYSID.
    MOVE:  REC1-BAL TO I_REC2-BAL,
            REC1-COAREA TO I_REC2-COAREA,
          REC1-CA TO I_REC2-CA,         
            REC1-KTOPL TO I_REC2-CA,       
            REC1-CCODE TO I_REC2-CCODE,
            REC1-CREDIT TO I_REC2-CREDIT,
            REC1-CURRENCY TO I_REC2-CURRENCY,
            REC1-CURTYPE TO I_REC2-CURTYPE,
            REC1-DEBIT TO I_REC2-DEBIT,
            REC1-YEAR TO I_REC2-YEAR,
            REC1-FY TO I_REC2-FY,
            REC1-ACCOUNT TO I_REC2-ACCOUNT,
            REC1-VER TO I_REC2-VER,
            REC1-VTYPE TO I_REC2-VTYPE,
            SY-MANDT TO I_REC2-CLNT,
            SY-SYSID TO I_REC2-S_SYS,
            REC1-INDICATOR TO I_REC2-INDICATOR.
    APPEND I_REC2.
    CLEAR  I_REC2.
    ENDLOOP.
      IF NOT I_REC2[] IS INITIAL.
        PERFORM WRITE_TO_SERVER.
        CLEAR I_REC2.
        REFRESH I_REC2.
      ELSE.
       WRITE : / ' no record exist due to unavailability of data'.
      ENDIF.
    ENDFORM.                               " UNIX_DOWNLOAD
    *&      Form  HEADER_TEXT
          text                                                           *
    -->  p1        text
    <--  p2        text
    *form header_text.
      concatenate c_bal c_ba c_ca c_cc  c_credit c_currency c_curtype
         c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
               into t_strhd
               separated by c_comma.
      append t_strhd.
    *endform.                               " HEADER_TEXT
    *&      Form  HEADER_TEXT1
          text                                                           *
    *form header_text1.
      concatenate c_bal c_ba c_ca c_cc  c_credit c_currency c_curtype
        c_debit c_fisyear c_fisvar c_acct c_ver c_vtype c_indicator
               into t_strhd1
               separated by c_comma.
      append t_strhd1.
      transfer t_strhd1 to p_unfil.
    *endform.                    " HEADER_TEXT1
    *&      Form  COLLECT_DATA
          Collect Data                                                   *
    FORM COLLECT_DATA.
    SELECT * FROM GLT0 INTO  TABLE REC3
                        WHERE   BUKRS IN COMPCODE
                        AND     RYEAR IN FISYEAR
                        AND     RPMAX IN FISCPER
                        AND     RACCT IN GLACC
                        AND     RTCUR IN  CURRENCY.
    SELECT KTOPL FROM SKA1
                 INTO TABLE T_KTOPL
                 FOR ALL ENTRIES IN REC3
                 WHERE SAKNR = REC3-RACCT.
    LOOP AT REC3 .
       select *
       from glt0
       into table t_temp
       where rldnr = rec-rldnr
         and rrcty  = rec-rrcty
          and rvers  = rec-rvers
         and bukrs = rec-bukrs
         and ryear = rec-ryear
          and racct  = rec-racct
           and rbusa  = rec-rbusa
           and rtcur <> 'ZAR'
         and rpmax  = rec-rpmax.
    if sy-subrc = 0.
            rec1-bal = '0.00'.
    else.
      rec1-bal = rec-hslvt.
      endif.
    *READ TABLE T_KTOPL WITH KEY SAKNR = REC-RACCT BINARY SEARCH.
    MOVE T_KTOPL-KTOPL TO REC3-KTOPL.
    CLEAR:  CBALANCE, DBALANCE.
    REC1-BAL = REC3-HSLVT.
    IF REC3-DRCRK = 'S'.
    IF REC3-HSLVT NE C_ZERO.
           YEAR   = REC-RYEAR.
           PERIOD = '000'.
           CONCATENATE PERIOD C_DOT YEAR INTO FP.
           REC1-INDICATOR = REC-DRCRK.
           REC1-DEBIT = C_ZERO.
           REC1-CREDIT = C_ZERO.
           REC1-CCODE = REC-BUKRS.
           REC1-YEAR  = FP.
           REC1-CURRENCY = REC-RTCUR.
           REC1-ACCOUNT  = REC-RACCT.
           rec1-bal      = rec-hslvt.
           dbalance = rec1-bal.
           REC1-CURTYPE = C_CTYPE.
           REC1-FY      = C_FY.
           REC1-COAREA   = REC-RBUSA.
           REC1-VER     = REC-RVERS.
           REC1-VTYPE   = C_CTYPE.
           REC1-CA      = C_CHART.
           APPEND REC1.
            C = 0.
          PERFORM D.
    ENDIF.
    IF REC3-HSL01 NE C_ZERO.
            YEAR   = REC3-RYEAR.
            PERIOD = '001'.
            CONCATENATE PERIOD C_DOT YEAR INTO FP.
            REC1-INDICATOR = REC3-DRCRK.
            REC1-DEBIT = REC3-HSL01 .
            REC1-CCODE = REC3-BUKRS.
            REC1-YEAR  = FP.
            REC1-CURRENCY = REC3-RTCUR.
            REC1-ACCOUNT  = REC3-RACCT.
           rec1-bal      = REC3-hsl01 + dbalance.
           dbalance = rec1-bal.
            REC1-CURTYPE = C_CTYPE.
            REC1-FY      = C_FY.
            REC1-COAREA   = REC3-RBUSA.
            REC1-VER     = REC3-RVERS.
            REC1-VTYPE   = C_CTYPE.
          REC1-CA      = C_CHART. 
            REC1-KTOPL = REC3-KTOPL. 
            APPEND REC1.
            C = 1.
         PERFORM D.
    ENDIF.
    IF  REC3-HSL02 NE C_ZERO.
          REC1-DEBIT = REC3-HSL02.
       YEAR   = REC3-RYEAR.
       PERIOD = '002'.
      CONCATENATE PERIOD C_DOT YEAR INTO FP.
         REC1-INDICATOR = REC3-DRCRK.
       REC1-DEBIT = REC3-HSL02.
       REC1-CCODE = REC3-BUKRS.
       REC1-YEAR  = FP.
       REC1-CURRENCY = REC3-RTCUR.
       REC1-ACCOUNT  = REC3-RACCT.
      rec1-bal      = REC3-hsl02 + dbalance.
      dbalance = rec1-bal.
            REC1-CURTYPE = C_CTYPE.
            REC1-FY      = C_FY.
            REC1-COAREA   = REC3-RBUSA.
            REC1-VER     = REC3-RVERS.
            REC1-VTYPE   = C_CTYPE.
          REC1-CA      = C_CHART. "-BF7957-070503
            REC1-KTOPL = REC3-KTOPL.  "+BF7957-070503
       APPEND REC1.
       C = 2.
    PERFORM D.
    ENDIF.
    IF  REC3-HSL03 NE C_ZERO.
            YEAR   = REC3-RYEAR.
            PERIOD = '003'.
            CONCATENATE PERIOD C_DOT YEAR INTO FP.
               REC1-INDICATOR = REC3-DRCRK.
            REC1-DEBIT = REC3-HSL03.
            REC1-CCODE = REC3-BUKRS.
            REC1-YEAR  = FP.
            REC1-CURRENCY = REC3-RTCUR.
            REC1-ACCOUNT  = REC3-RACCT.
           rec1-bal      = REC3-hsl03 + dbalance .
           dbalance =  rec1-bal.
            REC1-CURTYPE = C_CTYPE.
            REC1-FY      = C_FY.
            REC1-COAREA   = REC3-RBUSA.
            REC1-VER     = REC3-RVERS.
            REC1-VTYPE   = C_CTYPE.
           REC1-CA      = C_CHART. "-BF7957-070503
             REC1-KTOPL = REC3-KTOPL. "+BF7957-070503
            APPEND REC1.
          C = 3.
    PERFORM D.
    ENDIF.
    IF  REC3-HSL04 NE C_ZERO.
           REC1-DEBIT = REC3-HSL04.
              YEAR   = REC3-RYEAR.
              PERIOD = '004'.
             CONCATENATE PERIOD C_DOT YEAR INTO FP.
                REC1-INDICATOR = REC3-DRCRK.
             REC1-DEBIT = REC3-HSL04.
              REC1-CCODE = REC3-BUKRS.
              REC1-YEAR  = FP.
              REC1-CURRENCY = REC3-RTCUR.
              REC1-ACCOUNT  = REC3-RACCT.
             rec1-bal      = REC3-hsl04 + dbalance .
            REC1-CURTYPE = C_CTYPE.
            REC1-FY      = C_FY.
            REC1-COAREA   = REC3-RBUSA.
            REC1-VER     = REC3-RVERS.
            REC1-VTYPE   = C_CTYPE.
          REC1-CA      = C_CHART.  "-BF7957-070503
            REC1-KTOPL = REC3-KTOPL.  "+BF7957-070503
            APPEND REC1.
             dbalance = rec1-bal.
              C = 4.
              PERFORM D.
    ENDIF.
    Thanks and Regards,
    Ram

    use logical database SDF, nodes ska1 and  skc1c
    A.

  • Issue with fetching a record from IHPA table with PARNR value as condition

    Hi All,
    I am trying to fetch a particular record from IHPA table where i am giving the OBJNR number, PARVW and PARNR as customer no. , But I am not getting any record  but if i will give OBJNR and PARVW it will generate a record with having same PARNR value.
    Example :
    case 1st :-
    when i am passing following values in IHPA table,
    OBJNR  = IE000000000010070910
    PRAVW = BP                 
    PARNR  = 620000562   
    it is not generating any record  
    case 2nd:-
    But if i will pass  
    OBJNR  = IE000000000010070910
    PRAVW = BP
    it will generate a record?(one row) which will include PARNR as same 620000562 along with other value.
    Q1 -  Why it's not generating in case 1st,
    Q2 - How I will resolve this issue ? as i have to link some table as EQUI -
    IHPA -
    VCKUN
    VCNUM ?
          I have written a code for this to join :
         SELECT A~EQUNR
           B~PARVW
           C~CCNUM
           D~CCNUM
           FROM EQUI AS A JOIN IHPA AS B ON AOBJNR = BOBJNR
           INNER JOIN VCKUN AS C ON BPARNR = CKUNNR
           INNER JOIN VCNUM AS D ON CCCNUM = DCCNUM
           APPENDING CORRESPONDING FIELDS OF TABLE IT_OBSO
           WHERE A~EQUNR IN S_EQN.
                 AND PARVW  = 'BP'.
          But it is not generating any record but when i am commenting the PARVW i am getting the mixed record of PARVW as (BP,SP,SH)
    Let me know if any more clarification required.
    Highly appreciate your help
    Thanks & Regards
    Shaw

    Hi Santosh,
    Thanks for your quick response.
    But I am Sorry, I already checked with putting Zero before PARNR.
    The issue is still as it is.
    Thanks
    Shaw

  • Urgent: Problem in Fetching the records from ITAB3

    hi,
    here's d code,and the bold is dere where i am facing the problem i.e. whne i append lines of ITAB2 to ITAB3 it takes 32,234 records but in reality in ITAB2 there are 39 records,ITFINAL contains 45 records which is displaying the coreect data.
    But why ITAB3 conatins 32,234 records in it.
    it might hit th eperformance of the report.
    TABLES: RSEG.
    ***********DECLARATION OF TABLES*************
    ************TABLE BKPF - ACCOUNTING HEADER ***********
    DATA: BEGIN OF ITBKPF OCCURS 0,
    BUKRS LIKE BKPF-BUKRS,
    BELNR LIKE BKPF-BELNR,
    GJAHR LIKE BKPF-GJAHR,
    AWKEY LIKE BKPF-AWKEY,
    BUDAT LIKE BKPF-BUDAT,
    XBLNR LIKE BKPF-XBLNR,
    AWTYP LIKE BKPF-AWTYP,
    END OF ITBKPF.
    *********TABLE BSIK - ACCOUNTING OPEN ITEMS********
    DATA: BEGIN OF ITAB2 OCCURS 0,
    LFBNR LIKE RSEG-LFBNR,
    BUKRS LIKE BSIK-BUKRS,
    GJAHR LIKE BSIK-GJAHR,
    BELNR LIKE BSIK-BELNR,
    AWKEY LIKE BKPF-AWKEY,
    WRBTR LIKE BSIK-WRBTR,
    LIFNR LIKE BSIK-LIFNR,
    AUGBL LIKE BSAK-AUGBL,
    AUGDT LIKE BSAK-AUGDT,
    END OF ITAB2.
    **********TABLE BSAK - ACCOUNTING CLEAR ITEMS*******
    DATA: BEGIN OF ITAB3 OCCURS 0,
    LFBNR LIKE RSEG-LFBNR,
    BUKRS LIKE BSAK-BUKRS,
    GJAHR LIKE BSAK-GJAHR,
    BELNR LIKE BSAK-BELNR,
    AWKEY LIKE BKPF-AWKEY,
    WRBTR LIKE BSIK-WRBTR,
    LIFNR LIKE BSIK-LIFNR,
    AUGBL LIKE BSAK-AUGBL,
    AUGDT LIKE BSAK-AUGDT,
    END OF ITAB3.
    DATA: BEGIN OF ITDEMO OCCURS 0,
    BELNR LIKE RSEG-BELNR,
    GJAHR LIKE RSEG-GJAHR,
    LFBNR LIKE RSEG-LFBNR,
    XBLNR LIKE RSEG-XBLNR,
    END OF ITDEMO.
    *****FINAL TABLE TO GATHER N DISPLAY OUTPUT*****
    DATA: BEGIN OF ITFINAL OCCURS 0,
    LFBNR LIKE RSEG-LFBNR,
    BUKRS LIKE BKPF-BUKRS,
    GJAHR LIKE BKPF-GJAHR,
    BELNR LIKE BKPF-BELNR,
    AWKEY LIKE BKPF-AWKEY,
    WRBTR LIKE BSIK-WRBTR,
    LIFNR LIKE BSIK-LIFNR,
    AUGBL LIKE BSAK-AUGBL,
    AUGDT LIKE BSAK-AUGDT,
    END OF ITFINAL.
    **********END OF DECLARATIONS*************
    SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
    *************FETCHING OF THE DATA*************
    START-OF-SELECTION.
    BKPF
    SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
    FROM BKPF
    INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
    ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
    WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
              o
                    + MKPF*
    ************BEGIN OF TRY CODE FOR A MATERIAL DOCUMENT************
    ITDEMO-BELNR = ITBKPF-AWKEY(10).
    ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
    ITDEMO-XBLNR = ITBKPF-XBLNR.
    SELECT LFBNR FROM RSEG INTO
    (ITDEMO-LFBNR) WHERE
    BELNR EQ ITBKPF-AWKEY(10) AND
    GJAHR EQ ITBKPF-AWKEY+10(4) AND
    XBLNR EQ ITBKPF-XBLNR AND LFBNR > 0.
    CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
    ************END OF TRY CODE FOR A MATERIAL DOCUMENT***************
    ITAB2-BUKRS = ITBKPF-BUKRS.
    ITAB2-GJAHR = ITBKPF-GJAHR.
    ITAB2-BELNR = ITBKPF-BELNR.
    ITAB3-BUKRS = ITBKPF-BUKRS.
    ITAB3-GJAHR = ITBKPF-GJAHR.
    ITAB3-BELNR = ITBKPF-BELNR.
              o
                    + BSIK*
    SELECT WRBTR LIFNR FROM BSIK
    INTO (ITAB2-WRBTR, ITAB2-LIFNR)
    WHERE BUKRS EQ ITBKPF-BUKRS
    AND GJAHR EQ ITBKPF-GJAHR
    AND BELNR EQ ITBKPF-BELNR.
    APPEND ITAB2.
    EXIT.
    ENDSELECT.
              o
                    +
    BSAK*
    SELECT WRBTR LIFNR AUGBL AUGDT
    FROM BSAK
    INTO (ITAB3-WRBTR,ITAB3-LIFNR,ITAB3-AUGBL,ITAB3-AUGDT)
    WHERE BUKRS EQ ITBKPF-BUKRS
    AND GJAHR EQ ITBKPF-GJAHR
    AND BELNR EQ ITBKPF-BELNR.
    APPEND ITAB3.
    EXIT.
    ENDSELECT.
    APPEND ITDEMO.
    EXIT.
    ENDSELECT.
    APPEND ITBKPF.
    ENDSELECT.
    Fields Found?
    READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
    IF sy-subrc NE 0.
    MESSAGE i000(zmm1) WITH 'No documents found!'.
    ENDIF.
    Prepare Output
    LOOP AT ITBKPF.
    CLEAR ITAB2.
    READ TABLE ITAB2
    WITH KEY BUKRS = ITBKPF-BUKRS
    BELNR = ITBKPF-BELNR
    GJAHR = ITBKPF-GJAHR.
    CHECK sy-subrc EQ 0?
    CLEAR ITAB3.
    READ TABLE ITAB3
    WITH KEY BUKRS = ITBKPF-BUKRS
    BELNR = ITBKPF-BELNR
    GJAHR = ITBKPF-GJAHR. .
    CHECK sy-subrc EQ 0?
    READ TABLE ITDEMO
    WITH KEY BELNR = ITBKPF-AWKEY(10).
    CHECK sy-subrc EQ 0?
    APPEND LINES OF ITAB2 TO ITAB3.
    CHECK sy-subrc EQ 0?
    ITFINAL-LFBNR = ITDEMO-LFBNR.
    ITFINAL-BUKRS = ITBKPF-BUKRS.
    ITFINAL-BELNR = ITBKPF-BELNR.
    ITFINAL-GJAHR = ITBKPF-GJAHR.
    ITFINAL-AWKEY = ITBKPF-AWKEY.
    ITFINAL-WRBTR = ITAB3-WRBTR.
    ITFINAL-LIFNR = ITAB3-LIFNR.
    ITFINAL-AUGBL = ITAB3-AUGBL.
    ITFINAL-AUGDT = ITAB3-AUGDT.
    DELETE ITFINAL WHERE WRBTR = 0.
    APPEND ITFINAL.
    CLEAR ITFINAL.
    ENDLOOP.
    SORT ITFINAL BY AUGBL AUGDT .
    END-OF-SELECTION
    END-OF-SELECTION.
    Output
    LOOP AT ITFINAL.
    WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR, ITFINAL-GJAHR,ITFINAL-AWKEY, ITFINAL-WRBTR, ITFINAL-LIFNR,ITFINAL-AUGBL,ITFINAL-AUGDT.
    ENDLOOP.

    hi,
    actually i have to display the open n clear items with respect to the MATERIAL DOCUMENT.
    try to execute the code which i am displaying below:-
    TABLES: RSEG.
    **********DECLARATION OF TABLES************
    ***********TABLE BKPF  - ACCOUNTING HEADER **********
    DATA: BEGIN OF ITBKPF OCCURS 0,
          BUKRS LIKE BKPF-BUKRS,
          BELNR LIKE BKPF-BELNR,
          GJAHR LIKE BKPF-GJAHR,
          AWKEY LIKE BKPF-AWKEY,
          BUDAT LIKE BKPF-BUDAT,
          XBLNR LIKE BKPF-XBLNR,
          AWTYP LIKE BKPF-AWTYP,
          END OF ITBKPF.
    ********TABLE BSIK - ACCOUNTING OPEN ITEMS*******
    DATA: BEGIN OF ITAB2 OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BSIK-BUKRS,
          GJAHR LIKE BSIK-GJAHR,
          BELNR LIKE BSIK-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITAB2.
    *********TABLE  BSAK - ACCOUNTING CLEAR ITEMS******
    DATA: BEGIN OF ITAB3 OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BSAK-BUKRS,
          GJAHR LIKE BSAK-GJAHR,
          BELNR LIKE BSAK-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITAB3.
    *********TABLE BSIS - MIRO NOT PERFORMED*******
    DATA: BEGIN OF ITAB4 OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BSIS-BUKRS,
          GJAHR LIKE BSIS-GJAHR,
          BELNR LIKE BSIS-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITAB4.
    **********TABLE RSEG - FOR MATERIAL DOCUMENT********
    DATA: BEGIN OF ITDEMO OCCURS 0,
          BELNR LIKE RSEG-BELNR,
          GJAHR LIKE RSEG-GJAHR,
          LFBNR LIKE RSEG-LFBNR,
          XBLNR LIKE RSEG-XBLNR,
          END OF ITDEMO.
    ****FINAL TABLE TO GATHER N DISPLAY OUTPUT****
    DATA: BEGIN OF ITFINAL OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BKPF-BUKRS,
          GJAHR LIKE BKPF-GJAHR,
          BELNR LIKE BKPF-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITFINAL.
    *********END OF DECLARATIONS************
    SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
    ************FETCHING OF THE DATA************
    START-OF-SELECTION.
    BKPF
        SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
        FROM BKPF
        INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
             ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
        WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
    MKPF
    ***********BEGIN OF TRY CODE FOR A MATERIAL DOCUMENT***********
        ITDEMO-BELNR = ITBKPF-AWKEY(10).
        ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
        ITDEMO-XBLNR = ITBKPF-XBLNR.
        SELECT LFBNR FROM RSEG INTO
        (ITDEMO-LFBNR) WHERE
        BELNR EQ ITBKPF-AWKEY(10) AND
        GJAHR EQ ITBKPF-AWKEY+10(4) AND
        XBLNR EQ ITBKPF-XBLNR AND LFBNR  > 0.
    CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
    ***********END OF TRY CODE FOR A MATERIAL DOCUMENT**************
        ITAB2-BUKRS = ITBKPF-BUKRS.
        ITAB2-GJAHR = ITBKPF-GJAHR.
        ITAB2-BELNR = ITBKPF-BELNR.
        ITAB3-BUKRS = ITBKPF-BUKRS.
        ITAB3-GJAHR = ITBKPF-GJAHR.
        ITAB3-BELNR = ITBKPF-BELNR.
    BSIK
        SELECT WRBTR LIFNR FROM BSIK
        INTO (ITAB2-WRBTR, ITAB2-LIFNR)
        WHERE BUKRS EQ ITBKPF-BUKRS
          AND GJAHR EQ ITBKPF-GJAHR
          AND BELNR EQ ITBKPF-BELNR.
        APPEND ITAB2.
        EXIT.
        ENDSELECT.
    BSAK
        SELECT WRBTR LIFNR AUGBL AUGDT
        FROM BSAK
        INTO (ITAB3-WRBTR,ITAB3-LIFNR,ITAB3-AUGBL,ITAB3-AUGDT)
        WHERE BUKRS EQ ITBKPF-BUKRS
          AND GJAHR EQ ITBKPF-GJAHR
          AND BELNR EQ ITBKPF-BELNR.
        APPEND ITAB3.
        EXIT.
        ENDSELECT.
    BSIS
       SELECT WRBTR XREF3 FROM BSIS
       INTO (ITAB1-WRBTR, ITAB1-XREF3)
       WHERE BUKRS EQ ITBKPF-BUKRS
         AND GJAHR EQ ITBKPF-GJAHR
         AND BELNR EQ ITBKPF-BELNR.
       APPEND ITAB1.
       EXIT.
       ENDSELECT.
      CHECK sy-subrc EQ 0?
        APPEND ITDEMO.
        EXIT.
        ENDSELECT.
        APPEND ITBKPF.
        ENDSELECT.
    Fields Found?
      READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
      IF sy-subrc NE 0.
        MESSAGE i000(zmm1) WITH 'No documents found!'.
      ENDIF.
    Prepare Output
      LOOP AT ITBKPF.
        CLEAR ITAB2.
        READ TABLE ITAB2
        WITH KEY   BUKRS = ITBKPF-BUKRS
                   BELNR = ITBKPF-BELNR
                   GJAHR = ITBKPF-GJAHR." BINARY SEARCH..
      CHECK sy-subrc EQ 0?
        CLEAR ITAB3.
        READ TABLE ITAB3
        WITH KEY   BUKRS = ITBKPF-BUKRS
                   BELNR = ITBKPF-BELNR
                   GJAHR = ITBKPF-GJAHR." BINARY SEARCH.              .
      CHECK sy-subrc EQ 0?
        READ TABLE ITDEMO
        WITH KEY BELNR = ITBKPF-AWKEY(10).
      CHECK sy-subrc EQ 0?
        APPEND LINES OF ITAB2 TO ITAB3.
      CHECK sy-subrc EQ 0?
        ITFINAL-LFBNR = ITDEMO-LFBNR.
        ITFINAL-BUKRS = ITBKPF-BUKRS.
        ITFINAL-BELNR = ITBKPF-BELNR.
        ITFINAL-GJAHR = ITBKPF-GJAHR.
        ITFINAL-AWKEY = ITBKPF-AWKEY.
        ITFINAL-WRBTR = ITAB3-WRBTR.
        ITFINAL-LIFNR = ITAB3-LIFNR.
        ITFINAL-AUGBL = ITAB3-AUGBL.
        ITFINAL-AUGDT = ITAB3-AUGDT.
        DELETE ITFINAL WHERE WRBTR = 0.
        APPEND ITFINAL.
        CLEAR  ITFINAL.
        ENDLOOP.
        SORT ITFINAL BY  AUGBL AUGDT .
    END-OF-SELECTION
    END-OF-SELECTION.
    Output
    WRITE: /'                     OPEN ITEMS ->  PAYMENTS ARE NOT DONE'.
      ULINE.
      WRITE: / 'MAT.DOC.   A/C DOC.   YEAR    REF.KEY                  AMOUNT    VENDOR     CLR.DOC.    CLR.DATE' .
      ULINE.
      LOOP AT ITFINAL.
        WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR, ITFINAL-GJAHR,ITFINAL-AWKEY, ITFINAL-WRBTR, ITFINAL-LIFNR,ITFINAL-AUGBL,ITFINAL-AUGDT.
      ENDLOOP.

  • PROBLEM WITH FETCHING THE TEXT FROM  HEADER DATA

    Hi,
    plz give me the solution.
    TYPES:BEGIN OF WA_TLINE,
            TDFORMAT TYPE TLINE-TDFORMAT,
            TDLINE(132) TYPE C, "TLINE-TDLINE,
           END OF WA_TLINE,
         BEGIN OF WA_STXH,
            TDOBJECT TYPE RSTXT-TDOBJECT,
            TDNAME TYPE STXH-TDNAME,
            TDID TYPE STXH-TDID,
            TDSPRAS TYPE STXH-TDSPRAS,
          END OF WA_STXH.
    DATA : OBJECT(10) TYPE C,
           it_inline  TYPE TABLE OF WA_TLINE with header line,
           IT_LINE TYPE TABLE OF WA_TLINE WITH HEADER LINE,
           IT_STXH TYPE STANDARD TABLE OF WA_STXH WITH HEADER LINE,
           IT_HEAD TYPE THEAD.
    *data:it_tdline like  table of tline with header line.
    PARAMETERS:PA_VBELN TYPE VBELN_VF.
    START-OF-SELECTION.
    SELECT TDOBJECT TDNAME TDID TDSPRAS FROM STXH INTO CORRESPONDING FIELDS OF TABLE IT_STXH
      WHERE  TDNAME = PA_VBELN.
    MOVE IT_STXH-TDOBJECT TO OBJECT.
    IF SY-SUBRC EQ 0.
    CALL FUNCTION 'READ_TEXT_INLINE'
      EXPORTING
        ID                    =  IT_STXH-TDID
        INLINE_COUNT          =  '1'
        LANGUAGE              =  IT_STXH-TDSPRAS
        NAME                  =  IT_STXH-TDNAME
        OBJECT                =  'VBBK'
      LOCAL_CAT             = ' '
    IMPORTING
      HEADER                =  it_head
      TABLES
        INLINES               = it_inline
        LINES                 = it_line
    EXCEPTIONS
      ID                    = 1
      LANGUAGE              = 2
      NAME                  = 3
      NOT_FOUND             = 4
      OBJECT                = 5
      REFERENCE_CHECK       = 6
      OTHERS                = 7
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    write:/ it_inline.
    iam using this program but it will shows the error  object is not found but it will comes in itab when u pass the data from itab to function module it will shows the error.
    I will give the nuts.
    Regards,
    Venkat

    Hi Venkat,
    This is working fine for me.
        CALL FUNCTION 'READ_TEXT_INLINE'
          EXPORTING
            id                   = '0001'
            inline_count    = '1'
            language        = 'D'
            name             = '0000005462'
            object            = 'VBBK'
            local_cat        = ' '
          IMPORTING
            header           = it_head
          TABLES
            inlines            = it_inline
            lines               = it_line
          EXCEPTIONS
            id                    = 1
            language         = 2
            name              = 3
            not_found        = 4
            object             = 5
            reference_check = 6
            OTHERS          = 7.
        IF sy-subrc NE 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-      msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
      WRITE:/ it_inline.
    Regards
    avi.....

  • How to parse and retrieve records from xml files into columns in Table

    Hi
    I attached the thing what i tried.
    Table to hold the XML COntent:
    create table xmlfile(xml_con sys.xmltype);
    Inserting Xml file content into the Above table:
    insert into xmlfile values(sys.xmltype.CreateXml('<Root><name>RAM</name><age>23</age></Root>'))
    SQL> select * from xmlfile;
    XML_CON
    <Root>
    <name>RAM</name>
    <age>23</age>
    </Root>
    SQL> select extractValue(xml_con, '/Root/name') content from xmlfile;
    CONTENT
    RAM
    This one works fine
    But if the file content is as below( contains MUltiple Records)
    insert into xmlfile values(sys.xmltype.CreateXml('<Root><Record><name>RAM</name><age>23</age></Record><Record><name>SAM</name><age>23</age></Record></Root>'))
    SQL> select extractValue(xml_con, '/Root/Record/name') content from xmlfile;
    ERROR at line 1:
    ORA-19025: EXTRACTVALUE returns value of only one node
    Can anyone help me 4 this issue-How to extract multiple records from the XML file inthis manner(from PL/SQL without using JAVA)
    OR
    If there is anyother way to do this please tell me?

    SQL> SELECT EXTRACTVALUE (COLUMN_VALUE, '//name') NAME,
           EXTRACTVALUE (COLUMN_VALUE, '//age') age
      FROM TABLE
              (XMLSEQUENCE
                  (EXTRACT
                      (XMLTYPE
                          ('<Root>
                              <Record>
                                <name>RAM</name>
                                <age>23</age>
                              </Record>
                              <Record>
                                <name>SAM</name>
                                <age>23</age>
                              </Record>
                            </Root>'
                       '/Root/Record'
    NAME       AGE      
    RAM        23       
    SAM        23       
    2 rows selected.

  • Problem with fetching Map object from ObjectInputStream

    Hi, please can you help me with the following...I've never seen this before (with my limited experience of JDK1.5)
    ObjectInputStream is = new ObjectInputStream(new FileInputStream(store));
    Map<Integer, Report> readObject = (Map<Integer, Report>) is.readObject();This code gives me a warning...
    Type safety: The cast from Object to Map<Integer,Report> is actually checking against the erased type Map
    How can I get rid of this warning?

         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream oos = new ObjectOutputStream( baos );
         List<String> list = new LinkedList<String>();
         list.add( "one" );
         list.add( "two" );
         oos.writeObject( list );
         oos.flush(); oos.close();
         ObjectInputStream ois = new ObjectInputStream
             ( new ByteArrayInputStream( baos.toByteArray() ) );
         List<String> list2 = (List<String>)ois.readObject();Give me 1 compile time error (Test.java:109: warning: [unchecked] unchecked cast), and no runtime errors.
    Removing the <String> from "list" add some more [uncheked], but still runs fine (no runtime warning). Adding a none-String only causes a problem when I try to "get" it. (class cast).
    When do you get this warning?

  • Fetch last record from database table

    hi,
    how to fetch last record from database table.
    plz reply earliest.
    Regards,
    Jyotsna
    Moderator message - Please search before asking - post locked
    Edited by: Rob Burbank on Dec 11, 2009 9:44 AM

    abhi,
    just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
    any ways,
    jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
    you can select max or that field or order by descending using select single.
    or get all data.. sort in descending order.(again you need some criteria like date).
    read the first entry. using read itab index 1

  • Moving the 80 Million records from Conversion database to System Test database (Just for one transaction table) taking too long.

    Hello Friends,
    The background is I am working as conversion manager and we move the data from oracle to SQL Server using SSMA and then we will apply the conversion logic and then move the data to system test ,UAT and Production.
    Scenario:
    Moving the 80 Million records from Conversion database to System Test database (Just for one transaction table) taking too long. Both the databases are in the same server.
    Questions are…
    What is best option?
    IF we use the SSIS it’s very slow and taking 17 hours (some time it use to stuck and won’t allow us to do any process).
    I am using my own script (Stored procedure) and it’s taking only 1 hour 40 Min. I would like know is there any better process to speed up and why the SSIS is taking too long.
    When we move the data using SSIS do they commit inside after particular count? (or) is the Microsoft is committing all the records together after writing into Transaction Log
    Thanks
    Karthikeyan Jothi

    http://www.dfarber.com/computer-consulting-blog.aspx?filterby=Copy%20hundreds%20of%20millions%20records%20in%20ms%20sql
    Processing
    hundreds of millions records can be done in less than an hour.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Fetch the records from cache

    say i have emp table
    eno ename sales
    1 david 1100
    2 lara 200
    3 james 1000
    1 david 1200
    2 lara 5400
    4 white 890
    3 james 7500
    1 david 1313
    eno can be duplicate
    when i give empno is 1
    i want to display his sales i.e 1100,1200,1313
    first time i will go to database and fetch the records
    but next time onwards i dont go to database; i will fetch the records from cache;
    i thought doing it using hashmap or hasptable ;both those two don't allow duplicate values(empno has duplicate values);
    How to solve this problem.

    Hi,
    Ever considered splitting that table up. You are thinking about caching thats a
    very good idea. But doesnt it make it vary evident that the table staructure that you have
    keeps a lot of redundant data. Specially it hardly makes a sense to have sales
    figures in a emp table. Instead you can have Emp table containing eno and
    ename with eno as the primary key and have another table called sales with eno
    and sales columns and in this case the eno references the Emp table.
    If you still want to continue with this structure then I think you can go ahead with
    the solution already suggested to you
    Aviroop

  • How to fetch data from bseg based  on 2 internal tables in 1 select query?

    hi,
    i have bukrs and belnr in one internal table and bukrs and vbeln in another internal table..now if i select from bseg twice using for all entries for fields bukrs vbeln and bukrs belnr twice in 2 select statements its fine..but since bseg is a huge table i want to use select only once..but the problem is that none of the belnrs in the one internal table will have vbeln in another internal table....ie if vbeln is selected from bseg based on belnr in 1 internal table non eof those vbeln will be equal to vbeln on another internal tables..in this scenario even if i take all data from two internal tables into 1 single internal table and then use for all entries on vbeln and belnr of that table ..but i think this will not work because and AND operator will not work because no record will satisfy both vbeln and belnr conditions..even if i use OR operator if the 1st condition satisfies the select clause will not enter into the second clause and all the records will not be fetched...Please help how should i tackle this..

    Hi vijaya,
    no simple select statement solution so far.
    As BSEG is a huge table you should try to get the full key values into another internal table first.
    SAP avoids direct selections from BSEG.
    Pleas consider the use of one of the secondary index tables first:
          BSAD : Accounting: Secondary Index for Customers (Cleared Items)
          BSAK : Accounting: Secondary Index for Vendors (Cleared Items)
          BSAS : Accounting: Secondary Index for G/L Accounts (Cleared Item
          BSEC : One-Time Account Data Document Segment
          BSEG : Accounting Document Segment
          BSID : Accounting: Secondary Index for Customers
          BSIK : Accounting: Secondary Index for Vendors
          BSIS : Accounting: Secondary Index for G/L Accounts
    you may include
          BKPF : Accounting Document Header
    for restrictions about time and document type.
    The last step is a FOR ALL ENTRIES selection from BSEG providing the full key values.
    Although you may have even more selects, the overall performance will be much better.
    Regards,
    Clemens

Maybe you are looking for

  • Error while activating ods

    Hi all, i have the following errors turning up while activating ods. 1. creation of export data source failed 2. rfc connection to source system b3tclnt800 is damaged - no meta data upload 3. error when activating ods object Can anyone let me know ho

  • Safari won't play audio or video without stutters.

    Console shows sandboxd - deny file-read-data errors at /Library/ScriptingAdditions as well as the same folder in my user directory. The error repeats non-stop (even when Safari is idle), approximately 50 messages per minute. PlugInProcess numbers cha

  • Change OC4J instance in Jdev 10.1.2 to one in BPEL 10.1.2 engine

    Hello Is there any provision where I can point OC4J instance in jdeveloper 10.1.2 to the one in BPEL 10.1.2 engine, if I can do this I can deploy my application to BPEL engine and can debug application.. Please point me to links...... Thanks, GBK

  • About executing a executable program in background

    Hi to all I created a report program having one variant and downloading its content in a flat file using ws_download function. When I am going to download this in background , i am not getting the result. I am fulfulling all requirement to schedule a

  • IDoc Interface Creation

    Hi,      Can somebody tell me the procedure in detail, how to create an IDOC interface for Order/Quote Confirmation including the transaction codes? I'll be very greatful. Thanks, John.