Internal Tables Looping

Hi,
loop at itab2 where lifnr = DLIFNR
                        and WRBTR = Dwrbtr.
endloop.
In above code how to find number of records selected fulfilling condition.
This I want to check within a loop and not after the endloop.
Thanks,
Pratibha.

Hi,
First
loop at itab2 where lifnr = DLIFNR
and WRBTR = Dwrbtr.
w_count = w_count + 1.
endloop.
Then  again
loop at itab2 where lifnr = DLIFNR
and WRBTR = Dwrbtr.
*HERE CHECK W_COUNT AND DO THE REQUIRED MANIPULATION.
endloop.
Thanks and Regards,
Bharat Kumar Reddy.V

Similar Messages

  • Wild car in internal table loop

    Hi,
    This is for NW 7.0 EHP1 on Oracle.
    Can I use wild card search criteria like '%ABC%' in internal table loop as shown below.
    LOOP AT where itab1-objname LIKE '%ABC%'.
    END.
    The above is just sample and it is not a correct statement as it gives me syntax error. I cannot use LIKE in loop.
    Is there is any other smart idea about it.
    I hope my question is clear.
    Your <<removed>> responce will be greatly appreciated.
    Regards,
    Sume
    Edited by: Rob Burbank on Jul 23, 2010 3:41 PM

    You can't use LIKE, but try CP(contains pattern).
    LOOP AT itab where objname CP '*ABC*'.
    ENDLOOP.
    Regards,
    Rich Heilman
    Edited by: Rich Heilman on Jul 23, 2010 4:52 PM

  • Doubts with control break statements on internal table loops (AT/ENDAT)

    Hi, i've had a couple of doubts for a long while which I hope someone can clarify today:
    1) I know how to use the AT statements, however, i'm not sure I get correctly what this part of help regarding this commands means:
    <i>"The control level structure with internal tables is static. It corresponds exactly to the sequence of columns in the internal table (from left to right). In this context, the criteria according to which you sort the internal table are unimportant."</i>
    I've always sorted the internal table before the control break and it works that way. For example:
    SORT ITAB BY EBELN EBELP.
    LOOP AT ITAB.
      AT NEW EBELN.
    *   Code for the order header
      ENDAT.
    ENDLOOP.
    If I <b>don't</b> sort the internal table, it doesn't work! (i get dupplicated processing). In the example, if i have more than one register with the same EBELN and they're not consecutive, the header gets processed twice. I really don't get that part of the help text.
    2) I know this: <i>"At the start of a new control level (i.e. immediately after AT), the following occurs in the output area of the current LOOP statement:
    All character type fields (on the right) are filled with "*" after the current control level key.
    All other fields (on the right) are set to their initial values after the current control level key."</i>
    My doubt is: WHY is that this way? Because sometimes (most times) I need those fields INSIDE the statement! So when that happened i've solved it in one of three ways:
    LOOP AT ITAB INTO WA_ITAB.
      WA_ITAB_AUX = WA_ITAB.
      AT NEW FIELD.
        WA_ITAB = WA_ITAB_AUX.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    LOOP AT ITAB INTO WA_ITAB.
      AT NEW FIELD.
        READ TABLE ITAB INDEX SY-TABIX INTO WA_ITAB.
    *   ...Rest of the code for the first register
      ENDAT.
    ENDLOOP.
    * (Without AT)
    LOOP AT ITAB INTO WA_ITAB.
      IF WA_ITAB-FIELD <> FIELD_AUX.
        FIELD_AUX = WA_ITAB_FIELD.
    *   ...Rest of the code for the first register
      ENDIF.
    ENDLOOP.
    Is there any problem with this way of coding? Can be done better?
    Thank you very much in advance.

    Hi..,
    1)
    See if u sort the table on a field on which u r using AT ENDAT .. then all the records which are having the same value for that field will form a group or those reocrds will be at one place.. so when u sort the table for all the records  AT ENDAT  will get executed onli once..
    If u dont sort this table on this field then all these records will be at different places and in between there may be records with different value for this field.. so this AT ENDAT will get executed for each record !!
    2)
    No u cannot use the Right hand fields of the field in the table .. Because these AT events work as Group based operations... So till that field on which AT ENDAT is working it breaks that record into two groups.. One is the left hand fields including that field.. and right hand fields as another group.. and makes the right hand group as stars ****.  Thats y u can observe that even any one field in the left hand group changes the AT ENDAT will get executed  !!!!
    Hope u understood !!!
    regards,
    sai ramesh

  • Inner join inside a internal table loop

    Hello to all,
    I have this internal table in which i have selected some records for particular coulms. For  the rest of the colums i need to join 3 tables for the data. I had in mind, of looping the internal table and then having a inner join query and  modifying the internal table(all inside the loop) Just wanted to know, whether its a qood practice performance wise ? IF not, what are the alternatives ..
    Thanks,
    Shehryar Dahar

    shehryar,
      say You have internal table ITAB.Already some columns are updated in internal table.say A,B,C,D.
    To fill rest of the columns(E,F,G) you need inter join.
    write the inner join of the table for all entries of itab where A eq itab-A.
    LOOP ITAB.
        READ TABLE ITAB1  WITH KEY X = ITAB-X.
       IF SY-SUBRC EQ 0.
         move  ITAB record to I_FINAL.
         move itab1 records to i_final.
        append i_final.
       clear i_final.
      ENDIF. 
    ENDLOOP.
    Don't forget to reward if useful...

  • ABAP- internal table looping

    Hi All,
    I am having a scenario where for different values of PERSON i want the inner loop to run based on the condition present in inner loop.
    If there are multiple values of PART_REF for a given PERSON, I want all of them to be displayed along with their respective job family.
    Example:
    PERSON     PART_REF
    101              ABC
    101              DEF
    102              PQR
    102              XYZ
    PART_REF   JOB_FAMILY
    ABC             201
    DEF             202
    PQR             301
    XYZ              302
    Current Output:                                Required Output:
    PERSON   JOB_FAMILY                  PERSON   JOB_FAMILY
    101            202                                  101             201
    102            302                                   101            202
                                                             102             301
                                                              102            302
    Below is code by which i am able to display only last value of part_ref along with its job_family.
    LOOP AT i_A INTO wa_A where PERSON = SOURCE_FIELDS-PERSON.
    LOOP AT i_B INTO wa_B WHERE PART_REF = wa_A-PART_REF.
      if sy-subrc = 0.
    RESULT = wa_B-Job_Family.
    else.
    RESULT = 'blank'.
    endif.
    clear wa_B.
    ENDLOOP.
    clear wa_A.
    endloop.
    Thanks,
    Tanvi

    Try this.
    LOOP AT I_A INTO WA_A WHERE PERSON = SOURCE_FIELDS-PERSON.
           READ TABLE I_B INTO WA_B WITH KEY PART_REF = WA_A-PART_REF.
           IF SY-SUBRC = 0.
             LOOP AT I_B INTO WA_B WHERE PART_REF = WA_A-PART_REF.
               RESULT = wa_B-Job_Family.
               CLEAR WA_B.
             ENDLOOP.
           ELSE.
             RESULT = 'BLANK'.
           ENDIF.
           CLEAR WA_A.
         ENDLOOP.

  • Avoiding performance issue due to loop within loop on internal tables

    Hi Experts,
                    I have a requirement where in i want to check whether each of the programs stored in one internal table are called from any of the programs stored in another internal table. In this case i am looping on two internal tables (Loop within a loop) which is causing a major performance issue. Program is running very very slow.
    Can any one advise how to resolve this performance issue so that program runs faster.
    Thanks in advance.
    Regards,
    Chetan.

    Forget the parallel cursur stuff, it is much to complicated for general usage and helps nearly nothing. I will publish a blog in the next days where this is shown in detail.
    Loop on loop is no problem if the inner table is a hashed or sorted table.
    If it must be a standard table, then you must make a bit more effort and faciliate a binary search (read binary search / loop from index exit)
    see here the exact coding Measurements on internal tables: Reads and Loops:
    /people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables
    And don't forget, the other table must not be sorted, the loop reaches anyway every line. The parallel cursor requires both tables to be sorted. The additional sort
    consumes nearly the whole advantage of the parallel cursor compared to the simple but good loop in loop solutions.
    Siegfried

  • Totals for the internal table field in alv

    Hi Gurus,
    I have an issue in displaying the totals in alv.
    I have an internal table with the three fields like below.
    scrap_code_001 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_002 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_003 like afru-xmnga, " Scrap Reason Qty.
    In the output table which i am passing to the fieldcatlog is having the three above fields with values 10,3,4 respectively.
    I am looping at the internal table
    loop at gt_grund.
    gv_tabix = sy-tabix.
    i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum = gc_x.
    perform assign_alv_qty_format.
    if gt_grund-grund is initial.
    gt_grund = 'NONE'.
    gv_text = gt_grund.
    else.
    gv_text = gt_grund-grdtx.
    endif.
    gv_tabixn = gv_tabix.
    gv_scrap_code+11(03) = gv_tabixn.
    gv_fieldname = gv_scrap_code.
    translate gv_fieldname to upper case.
    perform bild_fieldcat using
    gv_fieldname 'GT_REPORT' 'AFRU' gv_text 'QUAN' '12' ' ' .
    endif.
    endloop.
    But in the output I am getting the totals but it displays totals for all the three columns as 17,17,17 (summing 10,3,4).
    How do I display total as 10,3,4 for each column separately.
    I appreciate you help and award points for the answer

    Hi,
    Please check if value fields i_fieldcat-ref_fieldname and i_fieldcat-ref_tabname regard to numc or curr type.
    EX: i_fieldcat-ref_fieldname = 'WRBTR'
           I_fieldcat-ref_tabname = 'BSEG'.
    Regards,
    Fernando

  • Regarding reading multiple records into a single internal table..

    hi experts,
    Need your help, i have a requirement like this.
    i will have a input file like this
    D 123   Suresh    12/01/2008
    E ven   sha         5432
    E ven   sha       5432
    D 153   Sachin    11/01/2008
    E ven   sha      5432
    Now all i need to consider from D to E  (i.e., before next D) as a single record and i need to preare a separate excel,
    So that E records can be max 9. So we cant expect this will be always 2 or 3 or 4.
    So how can i do this upload and process..
    give some idea.
    Thanks,
    Suresh

    Hi,
    Once you transfer the values from input file to internal table.
    loop through all records of internal table .
    check the first letter using offset
    e.g  if Itab-field+0(1)  = 'D'
           elseif  Itab-field+0(1)  = 'E'.
           endif.
         Populate the work area of internal table until you find the next 'D' once you find 'D' again ...append the work area to internal table......clear work area.
    Regards,
    Rahul

  • Copy data from 4 internal tables

    Hi Experts,
    I need to split a database field into 2 separate fields on the frontend and display it in an alv report.
    For this i used 4 internal tables. first one for regular fields and rest 3 of them for the split fields.
    Now the problem is, if i use 1 loop and insert workarea in it, the second record overwrites the first and if i use 3 internal tables, the looping is improper and it gives me duplicate entries in the report.
    delete adjacent duplicate is also not working.
    i am pasting the code. kindly help.
    thx
    *& Report  YVENDRALVRPTFINAL
    REPORT  YVENDRALVRPTFINAL.
      TYPE-POOLS: SLIS.
        DATA: program LIKE sy-repid.
        DATA: fcat TYPE slis_fieldcat_alv.
        DATA: fieldcat TYPE TABLE OF slis_fieldcat_alv.
        DATA: layout TYPE slis_layout_alv.
        Tables: LFA1,
                LFB1,
                T002T.
    DATA: Begin of itab1 occurs 0,
               LIFNR LIKE LFA1-LIFNR,
               BUKRS LIKE LFB1-BUKRS,
               KTOKK LIKE LFA1-KTOKK,
               ANRED LIKE LFA1-ANRED,
               NAME1 LIKE LFA1-NAME1,
               SORTL LIKE LFA1-SORTL,
             STRAS LIKE LFA1-STRAS, " HOUSE and STREET NUMBER
             STRAS1 LIKE LFA1-STRAS," STREET NUMBER
               PSTLZ LIKE LFA1-PSTLZ,
               ORT01 LIKE LFA1-ORT01,
               REGIO LIKE LFA1-REGIO,
               LAND1 LIKE LFA1-LAND1,
               SPTXT LIKE T002T-SPTXT,
             TELF1 LIKE LFA1-TELF1,
             TELF2 LIKE LFA1-TELF2,
             TELFX LIKE LFA1-TELFX,
             TELTX LIKE LFA1-TELTX,
               SMTP_SRCH LIKE ADR6-SMTP_SRCH,
               STCEG LIKE LFA1-STCEG,
               BRSCH LIKE LFA1-BRSCH,
          END OF itab1.
    DATA: wrkarea1 LIKE LINE OF itab1.
          DATA: Begin of itab2 occurs 0,
               LIFNR LIKE LFA1-LIFNR,
               BUKRS LIKE LFB1-BUKRS,
               KTOKK LIKE LFA1-KTOKK,
               ANRED LIKE LFA1-ANRED,
               NAME1 LIKE LFA1-NAME1,
               SORTL LIKE LFA1-SORTL,
             STRAS LIKE LFA1-STRAS, " HOUSE and STREET NUMBER
             STRAS1 LIKE LFA1-STRAS," STREET NUMBER
               STR LIKE LFA1-STRAS,
               HOU LIKE LFA1-STRAS,
               PSTLZ LIKE LFA1-PSTLZ,
               ORT01 LIKE LFA1-ORT01,
               REGIO LIKE LFA1-REGIO,
               LAND1 LIKE LFA1-LAND1,
               SPTXT LIKE T002T-SPTXT,
              *TELF1 LIKE LFA1-TELF1,
             PHONE  LIKE LFA1-TELF1,
               PHONE_EXT  LIKE LFA1-TELF1,
              *TELFX LIKE LFA1-TELFX,
               FAX LIKE LFA1-TELFX,
               FAX_EXT LIKE LFA1-TELFX,
             * TELTX LIKE LFA1-TELTX,
               SMTP_SRCH LIKE ADR6-SMTP_SRCH,
               STCEG LIKE LFA1-STCEG,
               BRSCH LIKE LFA1-BRSCH,
          END OF itab2.
          DATA: wrkarea2 LIKE LINE OF itab2.
         DATA:    STREET1 TYPE STRING,
                  HOUSE1 TYPE STRING,
                  PHONE1 TYPE STRING,
                  PHONE_EXT1 TYPE STRING,
                  FAX1 TYPE STRING,
                  FAX_EXT1 TYPE STRING.
         DATA:  BEGIN OF ADRDTL,
                HOU TYPE LFA1-STRAS,
                STR TYPE LFA1-STRAS,
                PHONE TYPE LFA1-TELF1,
    *PHONE_EXT  TYPE LFA1-TELF1,
    *FAX TYPE LFA1-TELFX,
    *FAX_EXT  TYPE LFA1-TELFX,
    *END OF ADRDTL.
           DATA: BEGIN OF itabhs occurs 0,
                 HSESTREET LIKE LFA1-STRAS,
                 END OF itabhs.
           DATA: wahs LIKE LINE OF itabhs.
            DATA:  BEGIN OF itabph occurs 0,
                   PHONENPHEXT TYPE LFA1-TELF1,
                   END OF itabph.
            DATA: waph LIKE LINE OF itabhs.
            DATA:  BEGIN OF itabfx occurs 0,
                   FAXNFAXEXT TYPE LFA1-TELFX,
                   END OF itabfx.
            DATA: wafx LIKE LINE OF itabhs.
          DATA: THREE LIKE LINE OF itab2,
                 FOUR LIKE LINE OF itab2.
              DATA:  THREE TYPE  LFA1-STRAS,
              FOUR  TYPE  LFA1-STRAS.
    SELECT-OPTIONS vendor FOR LFA1-LIFNR.
    *parameter vendor type LFA1-LIFNR.
      DATA:  wa LIKE LFA1-STRAS,
             wa1 LIKE LFA1-STRAS,
             wa2 LIKE LFA1-STRAS.
      DATA: BEGIN OF itabhsnew occurs 0,
                 STR LIKE LFA1-STRAS,
                 HOU LIKE LFA1-STRAS,
           END OF itabhsnew.
      DATA: wahsnew LIKE LINE OF itabhsnew.
      DATA: BEGIN OF itabphnew occurs 0,
                 PHONE LIKE LFA1-TELF1,
                 PHONE_EXT LIKE LFA1-TELF1,
           END OF itabphnew.
      DATA: waphnew LIKE LINE OF itabphnew.
      DATA: BEGIN OF itabfxnew occurs 0,
                 FAX LIKE LFA1-TELFX,
                 FAX_EXT LIKE LFA1-TELFX,
           END OF itabfxnew.
      DATA: wafxnew LIKE LINE OF itabfxnew.
    START-OF-SELECTION.
    SELECT LFA1STRAS FROM LFA1 INTO TABLE itabhs where LFA1LIFNR IN vendor.
    LOOP at itabhs into wahs.
    SPLIT wahs AT SPACE INTO STREET1 HOUSE1 .
    MOVE STREET1 TO wahsnew-STR.
    MOVE HOUSE1 TO wahsnew-HOU.
    INSERT wahsnew INTO TABLE itabhsnew.
    ENDLOOP.
    SELECT LFA1TELF1 FROM LFA1 INTO TABLE itabph where LFA1LIFNR IN vendor.
    LOOP at itabph into waph.
    SPLIT waph AT '-' INTO PHONE1 PHONE_EXT1.
    MOVE PHONE1 TO waphnew-PHONE.
    MOVE PHONE_EXT1 TO waphnew-PHONE_EXT.
    INSERT waphnew INTO TABLE itabphnew.
    ENDLOOP.
    SELECT LFA1TELFX FROM LFA1 INTO TABLE itabfx where LFA1LIFNR IN vendor.
    LOOP at itabfx into wafx.
    SPLIT wafx AT '-' INTO FAX1 FAX_EXT1.
    MOVE FAX1 TO wafxnew-FAX.
    MOVE FAX_EXT1 TO wafxnew-FAX_EXT.
    INSERT wafxnew INTO TABLE itabfxnew.
    ENDLOOP.
    *MOVE STREET1 TO ADRDTL-STR.
    *MOVE HOUSE1 TO ADRDTL-HOU.
    *MOVE PHONE1 TO ADRDTL-PHONE.
    *MOVE PHONE_EXT1 TO ADRDTL-PHONE_EXT.
    *MOVE FAX1 TO ADRDTL-FAX.
    *MOVE FAX_EXT1 TO ADRDTL-FAX_EXT.
    SELECT LFA1LIFNR  LFB1BUKRS LFA1KTOKK LFA1ANRED LFA1~NAME1
    LFA1SORTL LFA1PSTLZ LFA1ORT01 LFA1REGIO
    LFA1~LAND1
    T002T~SPTXT
    LFA1TELF1 LFA1TELF2 LFA1TELFX LFA1TELTX
    ADR6~SMTP_SRCH
    LFA1STCEG LFA1BRSCH
    FROM LFA1
    INNER JOIN T002T ON LFA1SPRAS = T002TSPRSL AND T002T~SPRAS = 2
    INNER JOIN LFB1 ON LFA1LIFNR = LFB1LIFNR
    INNER JOIN ADR6 ON LFA1ADRNR = ADR6ADDRNUMBER
    INTO TABLE itab1 WHERE LFB1~LIFNR IN vendor.
    LOOP AT itab1 INTO wrkarea1.
    MOVE-CORRESPONDING wrkarea1 TO wrkarea2.
    *MOVE STREET1 TO wrkarea2-STR.
    *MOVE HOUSE1 TO wrkarea2-HOU.
    *MOVE PHONE1 TO wrkarea2-PHONE.
    *MOVE PHONE_EXT1 TO wrkarea2-PHONE_EXT.
    *MOVE FAX1 TO wrkarea2-FAX.
    *MOVE FAX_EXT1 TO wrkarea2-FAX_EXT.
    *MOVE ADRDTL-STR TO wrkarea2-STR.
    *MOVE ADRDTL-HOU TO wrkarea2-HOU.
    *MOVE ADRDTL-PHONE TO wrkarea2-PHONE.
    *MOVE ADRDTL-PHONE_EXT TO wrkarea2-PHONE_EXT.
    *MOVE ADRDTL-FAX TO wrkarea2-FAX.
    *MOVE ADRDTL-FAX_EXT TO wrkarea2-FAX_EXT.
    *MOVE-CORRESPONDING wahs TO wrkarea2.
    *MOVE-CORRESPONDING waph TO wrkarea2.
    *MOVE-CORRESPONDING wafx TO wrkarea2.
    *MOVE-CORRESPONDING wahsnew TO wrkarea2.
    *MOVE-CORRESPONDING waphnew TO wrkarea2.
    *MOVE-CORRESPONDING wafxnew TO wrkarea2.
    *MOVE itabhsnew TO itab2.
    INSERT wrkarea2 INTO TABLE itab2.
    ENDLOOP.
    LOOP AT itabhsnew INTO wahsnew.
    MOVE-CORRESPONDING wahsnew TO wrkarea2.
    INSERT wrkarea2 INTO TABLE itab2.
    ENDLOOP.
    LOOP AT itabphnew into waphnew.
    MOVE-CORRESPONDING waphnew TO wrkarea2.
    INSERT wrkarea2 INTO TABLE itab2.
    ENDLOOP.
    LOOP AT itabfxnew into wafxnew.
    MOVE-CORRESPONDING wafxnew TO wrkarea2.
    INSERT wrkarea2 INTO TABLE itab2.
    ENDLOOP.
    *loop at itabhsnew.
    *itab2-HOU = itabhsnew-HOU.
    *itab2-str = itabhsnew-str.
    *append itab2.
    *endloop.
    *LOOP AT itabhsnew.
    *itab2-HOU = itabhsnew-HOU.
    *itab2-str = itabhsnew-str.
    *append itab2.
    *ENDLOOP.
    *delete adjacent duplicates FROM itab2 COMPARING HOU STR PHONE PHONE_EXT FAX FAX_EXT.
    *LOOP AT itab2.
    *INSERT wrkarea2 INTO TABLE itab2.
    *endloop.
    *WRITE: THREE.
    *new-line.
    *WRITE: four.
    *new-line.
    *WRITE: five.
    program = SY-REPID.
    *PERFORM SELECT.
    *loop at itab2.
    *write:/    itab2-LIFNR,
              itab2-BUKRS,
              itab2-KTOKK,
              itab2-ANRED,
              itab2-NAME1,
              itab2-SORTL,
              itab2-HOU,
              itab2-STR,
              itab2-PSTLZ,
              itab2-ORT01,
              itab2-REGIO,
              itab2-LAND1,
              itab2-SPTXT,
              itab2-TELF1,
    *itab2-PHONE,
    *itab2-PHONE_EXT,
              itab2-TELF2,
              itab2-TELFX,
    *itab2-FAX,
    *itab2-FAX_EXT,
              itab2-TELTX,
              itab2-SMTP_SRCH,
              itab2-STCEG,
              itab2-BRSCH.
    *endloop.
    PERFORM CATALOG.
    PERFORM LAYOUTMAIN.
    PERFORM DISPLAY.
    LFA1STRAS LFA1STRAS
    *FORM SELECT.
    SELECT LFA1LIFNR  LFB1BUKRS LFA1KTOKK LFA1ANRED LFA1~NAME1
    *LFA1SORTL LFA1PSTLZ LFA1ORT01 LFA1REGIO
    *LFA1LAND1 T002TSPTXT LFA1TELF1 LFA1TELF2 LFA1TELFX LFA1TELTX
    *ADR6SMTP_SRCH LFA1STCEG LFA1~BRSCH
    *FROM LFA1
    *INNER JOIN T002T ON LFA1SPRAS = T002TSPRSL AND T002T~SPRAS = 2
    *INNER JOIN LFB1 ON LFA1LIFNR = LFB1LIFNR
    INNER JOIN ADR6 ON LFA1ADRNR = ADR6ADDRNUMBER
    *INTO TABLE itab1 WHERE LFA1~LIFNR IN vendor.
    *LOOP AT itab2.
    *MOVE itab1 TO itab2.
    *APPEND itab2.
    *MOVE-CORRESPONDING ADRDTL TO itab2.
    *APPEND itab2.
    *MOVE-CORRESPONDING ADRDTL TO itab2.
    *APPEND itab2.
    *ENDLOOP.
    *LOOP AT itab1 INTO wrkarea1.
    *MOVE-CORRESPONDING wrkarea1 TO wrkarea2.
    *ENDLOOP.
    *MOVE-CORRESPONDING adrdtl TO wrkarea2.
    *LOOP AT itab2.
    *INSERT wrkarea2 INTO TABLE itab2.
    *ENDLOOP.
    *ENDFORM.
    FORM CATALOG.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='LIFNR'.
    fcat-seltext_m = 'Vendor Number'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFB1'.
    fcat-fieldname ='BUKRS'.
    fcat-seltext_m = 'Company Code'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='KTOKK'.
    fcat-seltext_m = 'Account Group'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='ANRED'.
    fcat-seltext_m = 'Title'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='NAME1'.
    fcat-seltext_m = 'Name'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='SORTL'.
    fcat-seltext_m = 'Search Term'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='HOU'.
    fcat-seltext_m = 'Street'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='STR'.
    fcat-seltext_m = 'House Number'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='PSTLZ'.
    fcat-seltext_m = 'Postal Code'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='ORT01'.
    fcat-seltext_m = 'City'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='REGIO'.
    fcat-seltext_m = 'Region or State'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='LAND1'.
    fcat-seltext_m = 'Country'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='SPTXT'.
    fcat-seltext_m = 'Language'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='PHONE'.
    fcat-seltext_m = 'Telephone'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='PHONE_EXT'.
    fcat-seltext_m = 'Extension'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='FAX'.
    fcat-seltext_m = 'Fax Number'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='FAX_EXT'.
    fcat-seltext_m = 'Extension'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'ADR6'.
    fcat-fieldname ='SMTP_SRCH'.
    fcat-seltext_m = 'E-Mail'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='STCEG'.
    fcat-seltext_m = 'VAT Registration Number'.
    APPEND fcat TO fieldcat.
    fcat-tabname = 'LFA1'.
    fcat-fieldname ='BRSCH'.
    fcat-seltext_m = 'Industry Type'.
    APPEND fcat TO fieldcat.
    ENDFORM.
    FORM LAYOUTMAIN.
    layout-zebra = 'X'.
    *layout-edit= 'X'.
    *layout-zebra = 'X'.
    *layout-zebra = 'X'.
    ENDFORM.
    FORM DISPLAY.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
        I_CALLBACK_PROGRAM                = 'program'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      = 'VENDOR DETAILS'
      I_GRID_SETTINGS                   =
        IS_LAYOUT                         = layout
        IT_FIELDCAT                       = fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
       I_DEFAULT                          = 'X'
       I_SAVE                             = 'A'
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = itab2.
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.

    HI,
    " By taking two internal table
    LOOP AT ITAB.
      IT_FINAL-FIELD1 = ITAB-FIELD(10).
      IT_FINAL-FIELD2 = ITAB-FIELD+10(10).
      APPEND IT_FINAL.
      CLEAR IT_FINAL.
    ENDLOOP.
    " By taking one internal table
    LOOP AT ITAB.
      ITAB-FIELD2 = ITAB-FIELD1(10).
      ITAB-FIELD3 = ITAB-FIELD1+10(10).
      MODIFY ITAB INDEX SY_TABIX.
    ENDLOOP.

  • ECC 6.0 internal table dump

    Hi,
    I am passing a database table from selection screen(Eg T001) and build dynamic internal table and get the data from table and put into dynamic internal table.
    I am getting dump in below code.
    LOOP AT <dyn_table> INTO <dyn_wa>.
       wa_result-line = <dyn_wa>.
       APPEND wa_result TO i_result.
       CLEAR wa_result.
    ENDLOOP.
    Can anybody please execute the below progra and try to help me to put data into normal internal table i_result from dynamic internal table.
    Full points will be given to useful answer.
    Thanks in advance for your help.
    Thanks and Regards,
    Suresh.
    REPORT Z_dynamic_internal_table.
    TYPE-POOLS : abap.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                  <dyn_wa>,
                  <dyn_field>.
    DATA: dy_table TYPE REF TO data,
         dy_line  TYPE REF TO data,
         xfc TYPE lvc_s_fcat,
         ifc TYPE lvc_t_fcat.
    TYPES: BEGIN OF t_result,
           line(1024) TYPE c,
          END OF t_result.
    DATA: i_result TYPE TABLE OF t_result,
         wa_result TYPE t_result.
    DATA: tablename(16) TYPE c.
    DATA: cond(80) TYPE c.
    PARAMETERS: tabnam(8) TYPE c.
    tablename = tabnam.
    PERFORM get_structure USING tablename.
    PERFORM create_dynamic_itab USING tablename.
    PERFORM get_data USING tablename cond.
    PERFORM write_out USING tablename.
    *&      Form  get_structure
          text
    FORM get_structure USING tablename.
    DATA : idetails TYPE abap_compdescr_tab,
            xdetails TYPE abap_compdescr.
    DATA : ref_table_des TYPE REF TO cl_abap_structdescr.
    ref_table_des ?=
         cl_abap_typedescr=>describe_by_name( tablename ).
    idetails[] = ref_table_des->components[].
    LOOP AT idetails INTO xdetails.
       CLEAR xfc.
       xfc-fieldname = xdetails-name .
       xfc-datatype = xdetails-type_kind.
       xfc-inttype = xdetails-type_kind.
       xfc-intlen = xdetails-length.
       xfc-decimals = xdetails-decimals.
       APPEND xfc TO ifc.
    ENDLOOP.
    ENDFORM.                    "get_structure
    *&      Form  create_dynamic_itab
          text
    FORM create_dynamic_itab USING tablename.
    *----Create dynamic internal table and assign to fs
    CALL METHOD cl_alv_table_create=>create_dynamic_table
       EXPORTING
         it_fieldcatalog = ifc
       IMPORTING
         ep_table        = dy_table.
    CREATE DATA dy_table TYPE STANDARD TABLE OF (tablename).
    ASSIGN dy_table->* TO <dyn_table>.
    *----Create dynamic work area and assign to fs
    CREATE DATA dy_line TYPE (tablename).
    ASSIGN dy_line->* TO <dyn_wa>.
    ENDFORM.                    "create_dynamic_itab
    *&      Form  get_data
          text
    FORM get_data USING tablename cond.
    *----Select data from table.           .
    SELECT * INTO CORRESPONDING FIELDS OF TABLE <dyn_table>
                FROM (tablename) WHERE (cond).
    ENDFORM.                    "get_data
    *&      Form  WRITE_OUT
          text
    -->  p1        text
    <--  p2        text
    FORM write_out USING tablename .
    LOOP AT <dyn_table> INTO <dyn_wa>.
       wa_result-line = <dyn_wa>.
       APPEND wa_result TO i_result.
       CLEAR wa_result.
    ENDLOOP.
    ENDFORM.                    " WRITE_OUT

    Hi,
           Check the below code, it may be useful.
    data:it_grnchk  TYPE TABLE OF ty_grnchk WITH NON-UNIQUE KEY mblnr_i bwart_i.
    FIELD-SYMBOLS: <l_table> TYPE  STANDARD TABLE,
                               <l_line>  TYPE ANY,<wa_grn>  TYPE ty_grnchk, <l_field> TYPE ANY,
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
       I_STYLE_TABLE             =
        it_fieldcatalog           = it_fcat
       I_LENGTH_IN_BYTE          =
      IMPORTING
        EP_TABLE                  = new_table
       E_STYLE_FNAME             =
    EXCEPTIONS
       GENERATE_SUBPOOL_DIR_FULL = 1
       others                    = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    ASSIGN new_line->* TO <t_line>.
    ***********assigning dynamic Internal table  vlaues to normal internal table
    LOOP AT <l_table> INTO <l_line>.
             ASSIGN COMPONENT sy-index OF STRUCTURE <l_line> TO <l_field>.
             MOVE-CORRESPONDING <l_field> TO <wa_grn>.
             APPEND <wa_grn> TO it_grnchk.
        ENDLOOP.
    IF useful.......................
    Regards,
    S.Senthil kumar

  • How to read only particualr columns from excel sheet to internal table

    Hi,
    I have and excel sheet which has around 20 columns, in which i want to read only 6 columns. They are at different column positions, means the 1st column, 6thcolumn, 8th column so on..
    Can we do this in sap? do we have any FM to do this?
    Thanks.
    Praveena.

    hi,
    Use the below logic to fetch the data into internal table..You need to read the data cell by cell and update the internal table,
    DATA l_count TYPE sy-tabix.
       CONSTANTS: lc_begin_col TYPE i VALUE '1',
                  lc_begin_row TYPE i VALUE '2',
                  lc_end_col   TYPE i VALUE '2',
                  lc_end_row   TYPE i VALUE '3000'.
      CLEAR p_i_excel_data. REFRESH p_i_excel_data.
    * Function module to read excel file and convert it into internal table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_p_file
           i_begin_col             = lc_begin_col
           i_begin_row             = lc_begin_row
           i_end_col               = lc_end_col
           i_end_row               = lc_end_row
         TABLES
           intern                  = i_data
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
    * Error in file upload
       IF sy-subrc NE 0 .
         MESSAGE text-006 TYPE 'E'.
         EXIT.
       ENDIF.
       IF i_data[] IS INITIAL .
         MESSAGE text-007 TYPE 'E'.
         EXIT.
       ELSE.
         SORT i_data BY row col .
    * Loop to fill data in Internal Table
         LOOP AT i_data .
           MOVE i_data-col TO l_count .
           ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
           MOVE i_data-value TO <fs_source> .
           AT END OF row .
    * Append data into internal table
             APPEND p_i_excel_data.
             CLEAR p_i_excel_data.
           ENDAT .
         ENDLOOP .
       ENDIF .

  • Internal Table Data to XML

    Hi
    I have a requirement of writing internal table data to XML. Any idea where i should start.
    I have pretty good experience with ABAP and basic knowledge in XML.
    There are good blogs which talk about transformations and other stuff but they are not able to give me clear path to my solution.
    Could somebody give me a basic example or some reference material where i can move the data in internal table (assume Sales order details of a day) to XML.
    Thanks

    Refer the program -
    In this implementation we will only focus on the creation of the XML file and the transfer to the user. You can not create a XML document directly. You have to use a so called ixml factory first. 
    TYPE-POOLS: ixml.
    DATA: l_ixml TYPE REF TO if_ixml.
    l_ixml = cl_ixml=>create( ).
    This iXML factory can create an empty XML document object named l_document.
    DATA:  l_document TYPE REF TO if_ixml_document.
            l_document = l_ixml->create_document( ).
    At this point you can add the nodes (elements, attributes) into the document. First you have to declare the root element node.
    DATA: l_element_root TYPE REF TO if_ixml_element.
    This node we have to give a name and add it (create_simple_node) to the document object l_document, which will be the parent of this node.
    l_element_root  = l_document->create_simple_element(
                name = 'flights'
              parent = l_document ).
    Next we can add child nodes to there parent node using the same method of the document object.
    DATA: l_element_airline TYPE REF TO if_ixml_element,
    l_element_airline  = l_document->create_simple_element(
                   name = 'airline'
                 parent = l_element_root  ).
    An attribute can be add easily using the method set_attribute of the element node.
    l_rc = l_element_airline->set_attribute( name = 'code' value = 'LH401' ).
    Now we have finished the document object. Regretfully it can not be displayed in any form due to the fact that it is a binary object. 
    The next step is to convert the created document to a flat file. To achieve this we have to create a stream factory, which will help us to create an output stream.
    DATA: l_streamfactory   TYPE REF TO if_ixml_stream_factory.
    l_streamfactory = l_ixml->create_stream_factory( ).
    In this case, we will convert the document into an output stream which is based on an internal table of type x.
    TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
            END OF xml_line.
    DATA:  l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i,
            l_ostream         TYPE REF TO if_ixml_ostream.
    l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
    When we have created the output stream we can do the rendering from the document into the stream. The XML data will be stored in the internal table automatically.
    DATA: l_renderer        TYPE REF TO if_ixml_renderer.
    l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                            & nbsp;              document = l_document ).
    l_rc = l_renderer->render( ).
    In the last step we upload the file to the sapgui
    l_xml_size = l_ostream->get_num_written_raw( ).
    CALL METHOD cl_gui_frontend_services=>gui_download
       EXPORTING
         bin_filesize = l_xml_size
         filename     = 'c:\temp\flights.xml'
         filetype     = 'BIN'
       CHANGING
         data_tab     = l_xml_table
       EXCEPTIONS
         OTHERS       = 24.
    This finished the first step-of-three. As mentioned before the next log will focus on the conversion from xml files (back) to abap tables.
    REPORT  z_xit_xml_dom_create.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
             END OF xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_ostream         TYPE REF TO if_ixml_ostream,
            l_renderer        TYPE REF TO if_ixml_renderer,
            l_document        TYPE REF TO if_ixml_document.
      DATA: l_element_flights TYPE REF TO if_ixml_element,
            l_element_airline TYPE REF TO if_ixml_element,
            l_element_flight  TYPE REF TO if_ixml_element,
            l_element_from    TYPE REF TO if_ixml_element,
            l_element_to      TYPE REF TO if_ixml_element,
            l_element_dummy   TYPE REF TO if_ixml_element,
            l_value           TYPE string.
      DATA: l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i.
      DATA: lt_spfli          TYPE TABLE OF spfli.
      DATA: l_spfli           TYPE spfli.
      START-OF-SELECTION.
      Fill the internal table
        SELECT * FROM spfli INTO TABLE lt_spfli.
      Sort internal table
        SORT lt_spfli BY carrid.
      Start filling xml dom object from internal table
        LOOP AT lt_spfli INTO l_spfli.
          AT FIRST.
          Creating a ixml factory
            l_ixml = cl_ixml=>create( ).
          Creating the dom object model
            l_document = l_ixml->create_document( ).
          Fill root node with value flights
            l_element_flights  = l_document->create_simple_element(
                        name = 'flights'
                        parent = l_document ).
          ENDAT.
          AT NEW carrid.
          Create element 'airline' as child of 'flights'
            l_element_airline  = l_document->create_simple_element(
                        name = 'airline'
                        parent = l_element_flights  ).
          Create attribute 'code' of node 'airline'
            l_value = l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
          Create attribute 'name' of node 'airline'
            SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
          ENDAT.
          AT NEW connid.
          Create element 'flight' as child of 'airline'
            l_element_flight  = l_document->create_simple_element(
                        name = 'flight'
                        parent = l_element_airline  ).
          Create attribute 'number' of node 'flight'
            l_value = l_spfli-connid.
            l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
          ENDAT.
        Create element 'from' as child of 'flight'
          CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
          l_element_from  = l_document->create_simple_element(
                      name = 'from'
                      value = l_value
                      parent = l_element_flight  ).
        Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpfrom.
          l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
        Create element 'to' as child of 'flight'
          CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
          l_element_to  = l_document->create_simple_element(
                      name = 'to'
                      value = l_value
                      parent = l_element_flight  ).
        Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpto.
          l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
        Create element 'departure' as child of 'flight'
          l_value = l_spfli-deptime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'departure'
                      value = l_value
                      parent = l_element_flight ).
        Create element 'arrival' as child of 'flight'
          l_value = l_spfli-arrtime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'arrival'
                      value = l_value
                      parent = l_element_flight ).
        Create element 'type' as child of 'flight'
          CASE l_spfli-fltype.
            WHEN 'X'.
              l_value = 'Charter'.
            WHEN OTHERS.
              l_value = 'Scheduled'.
          ENDCASE.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'type'
                      value = l_value
                      parent = l_element_flight ).
        ENDLOOP.
        IF sy-subrc NE 0.
          MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
        ENDIF.
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
      Connect internal XML table to stream factory
        l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
      Rendering the document
        l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                              document = l_document ).
        l_rc = l_renderer->render( ).
      Saving the XML document
        l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xml'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    <?xml version="1.0"?>
    <flights>
         <airline code="AA" name="American Airlines">
              <flight number="0017">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>110000</departure>
                   <arrival>140100</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0064">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>090000</departure>
                   <arrival>172100</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="AZ" name="Alitalia">
              <flight number="0555">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>190000</departure>
                   <arrival>210500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0788">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="TYO">TOKYO,JP</to>
                   <departure>120000</departure>
                   <arrival>085500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0789">
                   <from airport="TYO">TOKYO,JP</from>
                   <to airport="FCO">ROME,IT</to>
                   <departure>114500</departure>
                   <arrival>192500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0790">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="KIX">OSAKA,JP</to>
                   <departure>103500</departure>
                   <arrival>081000</arrival>
                   <type>Charter</type>
              </flight>
         </airline>
         <airline code="DL" name="Delta Airlines">
              <flight number="1984">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>100000</departure>
                   <arrival>182500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="1699">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>171500</departure>
                   <arrival>203700</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0106">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>193500</departure>
                   <arrival>093000</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="JL" name="Japan Airlines">
              <flight number="0407">
                   <from airport="NRT">TOKYO,JP</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>133000</departure>
                   <arrival>173500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0408">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="NRT">TOKYO,JP</to>
                   <departure>202500</departure>
                   <arrival>154000</arrival>
                   <type>Charter</type>
              </flight>
         </airline>
         <airline code="LH" name="Lufthansa">
              <flight number="2407">
                   <from airport="TXL">BERLIN,DE</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>071000</departure>
                   <arrival>081500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="2402">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SXF">BERLIN,DE</to>
                   <departure>103000</departure>
                   <arrival>113500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0402">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>133000</departure>
                   <arrival>150500</arrival>
                   <type>Charter</type>
              </flight>
              <flight number="0401">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>183000</departure>
                   <arrival>074500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0400">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>101000</departure>
                   <arrival>113400</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="QF" name="Qantas Airways">
              <flight number="0005">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>225000</departure>
                   <arrival>053500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0006">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SIN">SINGAPORE,SG</to>
                   <departure>205500</departure>
                   <arrival>150500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="SQ" name="Singapore Airlines">
              <flight number="0988">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="TYO">TOKYO,JP</to>
                   <departure>163500</departure>
                   <arrival>001500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0158">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="JKT">JAKARTA,ID</to>
                   <departure>152500</departure>
                   <arrival>160000</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0015">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="SIN">SINGAPORE,SG</to>
                   <departure>160000</departure>
                   <arrival>024500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0002">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>170000</departure>
                   <arrival>192500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="UA" name="United Airlines">
              <flight number="0941">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>143000</departure>
                   <arrival>170600</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3504">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>150000</departure>
                   <arrival>103000</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3516">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>162000</departure>
                   <arrival>054500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3517">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>104000</departure>
                   <arrival>125500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
    </flights>
    Regards,
    Amit
    Reward all helpful replies.

  • How to save value in struture into internal table?

    good day to everyone,
    i have a prb with my coding below. i am trying to save the value tvbdpr-uecha into wa_zmas-uecha by using modify as shown below.
    however, the value uecha is not successfully being transported/saved into it_zmas.
    could anyone guide me?
    tvbdpr - is a structure table
    it_zmas - is an internal table
      LOOP AT tvbdpr WHERE posnr = wa_zmas-posnr AND matnr = wa_zmas-matnr.
              wa_zmas-uecha = tvbdpr-uecha.
              MODIFY TABLE it_zmas FROM wa_zmas TRANSPORTING uecha.
    thank you
    regards,
    sw

    Hi,
    If the internal table is already having contents and u need to modify it for the field uecha, you can try the following
    LOOP AT tvbdpr WHERE posnr = wa_zmas-posnr AND matnr = wa_zmas-matnr.
    wa_zmas-uecha = tvbdpr-uecha.
    READ TABLE it_zmas with KEY posnr = wa_zmas-posnr matnr = wa_zmas-matnr.
    if sy-subrc = 0.
    it_zmas-uecha = wa_zmas-uecha.
    MODIFY it_zmas index sy-index.
    clear it_zmas-uecha.
    endif.
    ENDLOOP.
    Else if the internal table is empty and you are populating the field uecha, use append
    LOOP AT tvbdpr WHERE posnr = wa_zmas-posnr AND matnr = wa_zmas-matnr.
    wa_zmas-uecha = tvbdpr-uecha.
    it_zmas-uecha = wa_zmas-uecha.
    append it_zmas.
    clear it_zmas.
    ENDLOOP.
    Regards,
    Vik

  • I want to create an internal table without using header line and occurs 0?

    hi experts,
    Can anybody help me to declare an internal table without using headerline and occurs 0 options but still i have to use the functionalities that occurs 0 and header line options provide.

    Hi Saisri,
    You can use the internal table without headerline and create a header for then internal table with the same structure. We need to use the header while manipulating with the data of the internal table.
    example:
    types: begin of ty_afpo,
                 kdauf type kdauf,
                 kdpos type kdpos,
                 ltrmp   type ltrmp,
               end   of ty_afpo.
    data : t_afpo type standard table of ty_afpo,  " internal table declaration
             wa_afpo type ty_afpo.                        " work area declaration
    <after populating the data into the internal table>
    loop at t_afpo into wa_afpo.
    write:/ wa_afpo-kdauf, wa_afpo-kdpos, wa_afpo-ltrmp.
    endloop.
    This I think shall give you a basic understanding of how things work.
    <b>Reward points if this helps,</b>
    Kiran

  • Select query for picking data in a dynamic internal table

    Dear All,
    Please help.
    <u>The code is :</u>
    p_table1 = itab_final-tabname1.
            p_field1 = itab_final-fieldname1.         
            SELECT (p_field1) FROM (p_table1) INTO CORRESPONDING FIELDS OF TABLE <dyntable1>.      
    It is working fine when the domain is of CHAR
    The piece of code is not working where domain is DATS, CURR, DEC, etc.
    What shall I do so that it works for other domains also. Please its urgent......
    <u>ERROR that came:</u>
    An exception occurred. This exception will be dealt with in more detail
    below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
    caught, which                                                         
    led to a runtime error. The reason for this exception is:             
    The data read during a SELECT access could not be inserted into the    
    target field.                                                          
    Either conversion is not supported for the target field's type or the  
    target field is too short to accept the value or the data are not in a 
    form that the target field can accept

    Check below code
    REPORT zpwtest .
    *** Tables
    DATA: lt_data TYPE REF TO data.
    DATA: lt_fieldcatalog TYPE lvc_t_fcat.
    data : p_field type string ,
           p_table type string .
    *** Structure
    DATA: ls_fieldcatalog TYPE lvc_s_fcat.
    *** Data References
    DATA: new_line TYPE REF TO data.
    *** Field Symbols
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
                   <fs_1> TYPE ANY TABLE,
                   <fs_2>,
                   <fs_3>.
    ls_fieldcatalog-fieldname = 'MANDT'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
    ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CONNID'.
    ls_fieldcatalog-inttype = 'N'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'FLDATE'.
    ls_fieldcatalog-inttype = 'D'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'PRICE'.
    ls_fieldcatalog-inttype = 'P'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CURRENCY'.
    ls_fieldcatalog-inttype = 'C'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ASSIGN lt_data TO <fs_data>.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
         EXPORTING
           it_fieldcatalog = lt_fieldcatalog
         IMPORTING
           ep_table = <fs_data>
         EXCEPTIONS
           generate_subpool_dir_full = 1
           OTHERS = 2
    IF sy-subrc <> 0.
    ENDIF.
    *** So <FS_1> now points to our dynamic internal table.
    ASSIGN <fs_data>->* TO <fs_1>.
    *** Next step is to create a work area for our dynamic internal table.
    CREATE DATA new_line LIKE LINE OF <fs_1>.
    *** A field-symbol to access that work area
    ASSIGN new_line->*  TO <fs_2>.
    <b>
    p_field = 'mandt carrid connid fldate price currency' .
    p_table = 'sflight' .
    *** And to put the data in the internal table
    SELECT (p_field)
      FROM (p_table)
      INTO CORRESPONDING FIELDS OF TABLE <fs_1>.
    </b>
    *** Access contents of internal table
    LOOP AT <fs_1> ASSIGNING <fs_2>.
      ASSIGN COMPONENT 5 OF STRUCTURE <fs_2> TO <fs_3>.
      WRITE: / <fs_3>.
    ENDLOOP.

Maybe you are looking for

  • Using Apple Remote Desktop

    I recently got a call from a relative in need of some tech-support (from me). Obviously, it's hard to do tech-support over the phone with someone who is not that great with computers. What exactly do I need to do in order to gain access and remote co

  • Shared components (multiple parents)

    Hi, I have posted a question in the AWT section, but it relates to Swing too, so I'm posting a link here. Please take a look: http://forum.java.sun.com/thread.jspa?threadID=786181&tstart=0 Thanks.

  • HT1338 Is it possible to upload a current 12 month calendar to my iWeb page?

    Has anyone been able to upload a usable calendar to their webpage on iWeb?

  • Hirarchial query

    Hi I use Oracle 9.2.0.1 Database I try to bulid a temporary table which will be loaded by data from a procedure. The data should be gathered from two other tables: 1 - hirarchial table of items 2 - financial data that exist in the a different table t

  • Edges not smooth after recoloring

    I am a novice in photoshop and I've been going crazy trying to accomplish what seems to be an easy process. I received an illustrator file of a logo that I'm trying to work on...it has several issues that I'm trying to fix...in photoshop because I ha