Include in internal tables

Hi,
i want to include 2 structures in my internal table.
i try this:
data: begin of anlab occurs 0.
       include structure anla.
       include structure anlb.
data: end   of anlab.
I get an syntax-error because some fields a declared double (what is correct).
Then i tried this:
data: begin of anlab occurs 0.
       include structure anla as anla RENAMING WITH SUFFIX _A.
       include structure anlb as anlb RENAMING WITH SUFFIX _B.
data: end   of anlab.
This works, but i have some double fields
like MANDT_A with MANDT_B and BUKRS_A with BUKRS_B.
Is there any way to include 2 structures wich include double fields?
thanks.
Regards, Dieter

1. Create a strcuture with fields you needed in ANLB as Y_ANLB
then
data: begin of anlab occurs 0.
include structure anla.
include structure Y_ABALB.
data: end of anlab.
2. otherwise
data: begin of anlab occurs 0.
include structure anla.
data : AFABE like anlb-AFABE.
data: end of anlab

Similar Messages

  • Including the internal table in Srcript Form

    Hi all
    i am collecting all the data into an internal table in the print program of the Script, now i want to pass that internal table under the text element DELPOS. so my internal table contain item data, so i want every item to be printed on the form

    It depends upon your requirement. Looks like this layout is related to Delivery.
    Currently it is printing Item data such as Item no, Material, No of Box, Quantity, unit etc.
    If you want to comment existing lines and call your internal table, you can do that or you can create a new text element and call the same in your program. Just make sure that why code mentioned is not going to work for you and if you comment that, it should not create any problem to any data printing in layout.
    ashish

  • Why using workarea for internal table is better in performance

    Please tell me
    why using workarea for internal table is better in performance

    Hi Vineet ,
      Why would we choose to use an internal table without a header line when it is easier to code one  with a header line?
    it has following reason.
    1)Separate Internal Table Work Area:
         The work area (staging area) defined for the internal table   is not limited to use with just one internal table.
    take ex-
    Suppose you want two internal tables for EMPLOYEE – one to contain all records and one to contain only those records where country = ‘USA’.  You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table.  You would conditionally append the ‘USA’ records from the same work area into the second internal table.
    2)  Performance Issues:  Using an internal table without a header line is more efficient than one  with a header line
    3) Nested Internal Tables:  If you want to include an internal table within a structure or another   internal table, you must use one without a header line.
    If this one is helpful ,then rewards me
    Regards
    Shambhu

  • Include a type in a internal table declaration.

    Hi.
    How can I do this?:
    TYPES: BEGIN OF ty_simples,
      agr_name LIKE agr_define-agr_name,
      text     LIKE agr_texts-text.  
    TYPES: END OF ty_simples.
    Transacciones de GS.
    TYPES: BEGIN OF ty_transacciones_gs,
      tcode    LIKE agr_tcodes-tcode,   
      text     LIKE bmeniface-text.   
    TYPES: END OF ty_transacciones_gs.
    And after:
    DATA: begin of t_simples occurs 0.
      include structure ty_simples.
      include structure ty_transacciones_gs.
    data: end of t_simples.
    I have got a verification error.
    Thanks!

    Hi,
    Use as follow,
    TYPES: BEGIN OF ty_simples,
           agr_name LIKE agr_define-agr_name,
           text1 LIKE agr_texts-text.
    TYPES: END OF ty_simples.
    TYPES: BEGIN OF ty_transacciones_gs,
            tcode LIKE agr_tcodes-tcode,
            text2 LIKE bmeniface-text.
    TYPES: END OF ty_transacciones_gs.
    * INTERNAL TABLES 
    data: BEGIN OF t_simples occurs 0.
            INCLUDE TYPE ty_simples.              
            INCLUDE TYPE type ty_transacciones_gs.
    data: END OF t_simples.
    Regards.
    Marcelo Ramos

  • Include structure and extra fields in the same Internal Table

    Hi developers,
    im trying to declare an internal table with include structure and extra fields,
    something like this:
    data: BEGIN OF it_loans occurs 0,
          include structure zthrca006,   
          status(10),
          pernr   like pa0001-pernr,
          sname   like pa0001-pernr,
          tipomov(20),
          monto   like zthrca006-monto,
    data: END of it_loans.
    zthrca006 is huge so i dont want to type everithing.

    What is the issue?
    data: BEGIN OF it_loans occurs 0.
                 include structure zthrca006.
    data :     status(10),
    data :     pernr like pa0001-pernr.
    data :     sname like pa0001-pernr.
    data :     tipomov(20).
    data :     monto like zthrca006-monto,.
    data:  END of it_loans.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • ABAP MM: In ME21N which internal table holds Actual Price (Including Taxes)

    Using tcode  ME21N, while creating new PO, which internal table holds Actual price (Including Taxes) of whole PO (not by item) , assuming PO is not saved.
    In the program, I want to capture the total cost of whole PO including taxes as soon as user enter the items. So that I can make some processing according to the total amount of PO.
    Thanks,

    Check the internal table lt_mepoaccounts field netpr.

  • Include space between two variables from internal table

    Hi Experts,
    I have an internal table with 4 fields with values for a b c d , i have to arrange them in the specific order so that i can download all the data in a text file.
    the first 3 variables are already arranged , the format is a bc, but the var d should be put in a specific positon after predefined spaces from var c.
    Please refer below for the sample of of the output text file. In this example:
    a = A20N
    b = 7227802
    c = 0300207
    d = 010109
    Space between c & d is determined by a POS variable in internal table
    a        b         c                                          d                       
    A20N 72278020300207                               010109     
    A20A 72278020300207        21     
    A20N 72278020300207          2511100     
    A21F 72278020300207        Van Capellen     
    A21G 72278020300207        Tim     
    A20E 72278020300207                    1     
    A20T 72278020300207        2     
    A20T 72278020300207                                                   1     
    A20E 72278020300207                    01     
    A20E 72278020300207                        Vilvoorde     
    plz help me out as i have to resolve this as soon as possible.

    Hi,
    Check this sample code using offsets, and modify as per ur requirement.
    DATA : L1 TYPE I.
    DATA : L2 TYPE I.
    DATA : L3 TYPE I.
    DATA : BEGIN OF ITAB OCCURS 0,
           A(30) TYPE C,
           B(30) TYPE C,
           C(30) TYPE C,
           D(30) TYPE C,
           POS(2) TYPE C,
           END OF ITAB.
    DATA : TEXT(120) TYPE C.
    START-OF-SELECTION.
    BREAK-POINT.
      ITAB-A = 'ABC'.
      ITAB-B = 'IND'.
      ITAB-C = 'CATOR'.
      ITAB-D = 'FINAL'.
      ITAB-POS = '3'.
      APPEND ITAB.
      CLEAR ITAB.
      LOOP AT ITAB.
        L1 = STRLEN( ITAB-A ).
        L2 = STRLEN( ITAB-B ).
        L3 = STRLEN( ITAB-C ).
        TEXT = ITAB-A.
        L1 = L1 + 1.
        TEXT+L1 = ITAB-B.
        L1 = L1 + L2.
        TEXT+L1 = ITAB-C.
        L1 = L1 + L3 + ITAB-POS.
        TEXT+L1 = ITAB-D.
        CLEAR L1.
        CLEAR L2.
        CLEAR L3.
      ENDLOOP.
      WRITE : TEXT.
    Rgds
    siva

  • How to include internal table

    hi,
    i have code where the "w_chepctycod" is a single value...but now my requirements is that it will have 2 entries...
    select single ZCHEPCTYCOD
             from Z2RLCHEPCTYCOD
             into w_chepctycod
            where land1 = s_bukrs-low(02).
      SELECT * FROM z2rlbasedat
               APPENDING TABLE ts_z2rlbasedat
               FOR ALL ENTRIES IN ts_z3rl_docket_umi
               WHERE zzumicur = ts_z3rl_docket_umi-zzumicur AND
                     ( status = c_rej OR
                       status = c_sus ) and
                   CHEPCTYCOD = w_chepctycod.   
    for the first SELECT, i will remove single and make internal table...
    select ZCHEPCTYCOD
             from Z2RLCHEPCTYCOD
             into table  ts_chepctycod
            where land1 = s_bukrs-low(02).
    but in my second SELECT, how will I inculde 'ts_chepctycod' ??????
    kindly help....
    thanks

    Hi,
    Keep you first select statement as it is
    select single ZCHEPCTYCOD
    from Z2RLCHEPCTYCOD
    into w_chepctycod
    where land1 = s_bukrs-low(02).
    SELECT * FROM z2rlbasedat
    APPENDING TABLE ts_z2rlbasedat
    FOR ALL ENTRIES IN ts_z3rl_docket_umi
    WHERE zzumicur = ts_z3rl_docket_umi-zzumicur AND
    ( status = c_rej OR
    status = c_sus ) .
    Now, you check for w_chepctycod
    the code will be something like this,
    Loop at ts_z2rlbasedat .
    read table Z2RLCHEPCTYCOD with key CHEPCTYCOD = ts_z2rlbasedat -chepctycod .
    if sy-subrc eq 0.
    Your program logic
    else.
      delete  ts_z2rlbasedat .
    endif.
    endloop.
    You can try this, may this will help
    Rani

  • To pass internal table data(including subtotal) to dynamic internal table

    here i am displaying the dynamic internal table in alv grid.
    i followed like this but i am unable to get the subtotal form the internal table.
    LOOP AT ITAB1. " assigning <fs_itab1>.
        ASSIGN COMPONENT 'RACCT' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = ITAB1-RACCT.
        ASSIGN COMPONENT 'ERGSL' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = ITAB1-ERGSL.
        ASSIGN COMPONENT 'TEXT' OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = ITAB1-TEXT.
        I = 4.
        CLEAR COMP_ITAB.
        LOOP AT COMP_ITAB.
          ASSIGN COMPONENT I OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
         LOOP AT ITAB WHERE RACCT = ITAB1-RACCT.
           IF ITAB-RBUKRS EQ COMP_ITAB-RBUKRS.
          IF ITAB1-RBUKRS EQ COMP_ITAB-RBUKRS.
            <DYN_FIELD> = ITAB1-REPVAL.
            SUB_TOT = ITAB1-REPVAL.
          ELSE.
            <DYN_FIELD> = 0.
            SUB_TOT = 0.
          ENDIF.
         ENDLOOP.
          I = I + 1.
          TOTAL = TOTAL + SUB_TOT.
        ENDLOOP.
        ASSIGN COMPONENT I OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
        <DYN_FIELD> = TOTAL.
        APPEND <DYN_WA> TO <DYN_TABLE>.
        CLEAR <DYN_WA>.
        TOTAL = 0.
      ENDLOOP.
    Thanks,
    sridhar.

    Hi Rakesh,
    We pass internal tables for the smartform are shown in bold in below code,
    CALL FUNCTION LF_FM_NAME
        EXPORTING
          ARCHIVE_INDEX      = TOA_DARA
          ARCHIVE_PARAMETERS = ARC_PARAMS
          CONTROL_PARAMETERS = LS_CONTROL_PARAM
          MAIL_RECIPIENT     = LS_RECIPIENT
          MAIL_SENDER        = LS_SENDER
          OUTPUT_OPTIONS     = LS_COMPOSER_PARAM
          USER_SETTINGS      = ' '               
          ZXEKKO             = L_DOC-XEKKO
          ZXPEKKO            = L_DOC-XPEKKO
          ZNAST              = NAST
        IMPORTING
          DOCUMENT_OUTPUT_INFO = IT_DOCUMENT
          JOB_OUTPUT_INFO      = IT_OUTPUT_INFO
          JOB_OUTPUT_OPTIONS   = IT_JOB_OUTPUT
        <b>TABLES
          L_XEKPO            = L_DOC-XEKPO[]
          L_XEKPA            = L_DOC-XEKPA[]
          L_XPEKPO           = L_DOC-XPEKPO[]
          L_XEKET            = L_DOC-XEKET[]
          L_XTKOMV           = L_DOC-XTKOMV[]
          L_XEKKN            = L_DOC-XEKKN[]
          L_XEKEK            = L_DOC-XEKEK[]
          L_XKOMK            = L_XKOMK</b>  
    EXCEPTIONS
          FORMATTING_ERROR   = 1
          INTERNAL_ERROR     = 2
          SEND_ERROR         = 3
          USER_CANCELED      = 4
          OTHERS             = 5.
    Regards,
    Azaz Ali.

  • IMPORT Statement Issue (Internal Table)

    Hi All,
    I am using an IMPORT statement to get all the data from other report's internal table. Now whenever this (the other report's internal table) is changed (for field addition, etc), my report throws a dump. Hence, everytime I have to add these fields in my program as well.
    Is there any way by which I can include the whole internal table of that report in my program just like
    'INCLUDE STRUCTURE VBRK'.
    Thanks in advance

    Hi, CHeck this code related to your problem..This will helpful to you...
    I have done this program earlier..I hope it will helpful to u..
    This programa calling the other program to import the data..
    Check it out...
    *" Tables declarations.................................................
    TABLES:
      spfli.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SPFLI     *
    TYPES:
      BEGIN OF type_s_spfli,
        carrid LIKE spfli-carrid,          " Carrier Id
        connid LIKE spfli-connid,          " Connection Number
        cityfrom LIKE spfli-cityfrom,      " City from
        cityto LIKE spfli-cityto,          " City to
        airpfrom LIKE spfli-airpfrom,      " Airport from
        airpto LIKE spfli-airpto,          " Airport to
        countryfr LIKE spfli-countryfr,    " Country from
        countryto LIKE spfli-countryto,    " Country to
      END OF type_s_spfli.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SPFLI          *
    DATA
      fs_spfli TYPE type_s_spfli.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SPFLI       *
    DATA
      t_spfli LIKE STANDARD TABLE OF fs_spfli.
    TYPES:
      BEGIN OF types_s_itab,
        carrid LIKE sflight-carrid,        " Carrier id
        connid LIKE sflight-connid,        " Connection number
        fldate LIKE sflight-fldate,        " Flight date
      END OF types_s_itab.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SFLIGHT        *
    DATA
      fs_itab TYPE types_s_itab.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SFLIGHT     *
    DATA
      t_itab LIKE STANDARD TABLE OF fs_itab.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SBOOK     *
    TYPES:
    BEGIN OF type_s_sbook,
       carrid LIKE sbook-carrid,           " Carrier Id
       connid LIKE sbook-connid,           " Connection Number
       fldate LIKE sbook-fldate,           " Flight date
       bookid LIKE sbook-bookid,           " Booking number
       loccuram LIKE sbook-loccuram,       " Local currency
       loccurkey LIKE sbook-loccurkey,
       order_date LIKE sbook-order_date,   " Booking date
    END OF type_s_sbook.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from BOOK           *
    DATA
      fs_sbook TYPE type_s_sbook.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SBOOK       *
    DATA
      t_sbook LIKE STANDARD TABLE OF fs_sbook.
    DATA
      w_checkbox.                          " Checkbox
    SELECT-OPTIONS:
      s_carr FOR spfli-carrid.             " Carrier id range
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM selectq.
                          END-OF-SELECTION EVENT                        *
    END-OF-SELECTION.
      SET PF-STATUS 'YH1314_030502'.
      PERFORM display_basic.
    AT USER-COMMAND.
      PERFORM ucomm.
    *&    Form  selectq
        This subroutine retreive data from SPFLI table
      There are no interface parameters to be passed to this subroutine.
    FORM selectq .
      SELECT carrid                        " Carrier id
             connid                        " Connection number
             cityfrom                      " City from
             cityto                        " City to
             airpfrom                      " Airport from
             airpto                        " Airport to
             countryfr                     " Country from
             countryto                     " Country to
             INTO CORRESPONDING FIELDS OF TABLE t_spfli
             FROM spfli
             WHERE carrid IN s_carr.
    ENDFORM.                               " Selectq
    *&      Form  display_basic
        This subroutine displays data from internal table
      There are no interface parameters to be passed to this subroutine.
    FORM display_basic .
      LOOP AT t_spfli INTO fs_spfli.
        WRITE:
          / w_checkbox AS CHECKBOX,
            fs_spfli-carrid,
            fs_spfli-connid,
            fs_spfli-cityfrom,
            fs_spfli-cityto,
            fs_spfli-airpfrom,
            fs_spfli-airpto,
            fs_spfli-countryfr,
            fs_spfli-countryto.
      ENDLOOP.                             " LOOP AT T-SPFLI INTO...
    ENDFORM.                               " Display_basic
    *&      Form  UCOMM
      This subroutine for at user-command event
      There are no interface parameters to be passed to this subroutine.
    FORM ucomm .
      RANGES :
        r_carr FOR spfli-carrid,
        r_conn FOR spfli-connid,
        r_carrid FOR sflight-carrid,
        r_connid FOR sflight-connid,
        r_fldate FOR sflight-fldate.
      CASE sy-ucomm.
        WHEN 'DISPLAY'.
          DATA:
            lw_lines TYPE i,
            lw_lineno TYPE i VALUE 3.
          DESCRIBE TABLE t_spfli LINES lw_lines.
          DO lw_lines TIMES.
            READ LINE lw_lineno FIELD
                 VALUE w_checkbox   INTO w_checkbox
                       fs_spfli-carrid INTO  fs_spfli-carrid
                       fs_spfli-connid INTO  fs_spfli-connid.
            IF sy-subrc = 0.
              IF w_checkbox = 'X'.
                r_carr-sign = 'I'.
                r_carr-option = 'EQ'.
                r_carr-low = fs_spfli-carrid.
                APPEND r_carr.
                r_conn-sign = 'I'.
                r_conn-option = 'EQ'.
                r_conn-low = fs_spfli-connid.
                APPEND r_conn.
              ENDIF.                       " IF W_CHECKBOX = 'X'
            ENDIF.                         " IF SY-SUBRC = 0
            ADD 1 TO lw_lineno.
          ENDDO.                           " DO LW_LINES TIMES
          SUBMIT yh1314_030502_call
            WITH s_carr IN r_carr
            WITH s_conn IN r_conn
             AND RETURN.
          IMPORT t_itab FROM MEMORY ID 'YH1314'.
          LOOP AT t_itab INTO fs_itab.
            r_carrid-sign = 'I'.
            r_carrid-option = 'EQ'.
            r_carrid-low = fs_itab-carrid.
            APPEND r_carrid.
            r_connid-sign = 'I'.
            r_connid-option = 'EQ'.
            r_connid-low = fs_itab-connid.
            APPEND r_connid.
            r_fldate-sign = 'I'.
            r_fldate-option = 'EQ'.
            r_fldate-low = fs_itab-fldate.
            APPEND r_fldate.
          ENDLOOP.                         " LOOP AT T_ITAB INTO.....
          SELECT carrid                    " Carriee Id
                 connid                    " Connection number
                 fldate                    " Flight date
                 bookid                    " Booking number
                 loccuram                  " Local Currency
                 order_date                " Booking date
             INTO CORRESPONDING FIELDS OF TABLE t_sbook
             FROM sbook
             WHERE carrid IN r_carrid AND
                   connid IN r_connid AND
                   fldate IN r_fldate.
          IF SY-SUBRC NE 0.
            MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
          ENDIF.                           " IF SY-SUBRC NE 0
          LOOP AT t_sbook INTO fs_sbook.
            AT FIRST.
              WRITE: /5 'Carrier Id'(001),
                     20 'Conn Id'(002),
                     35 'Flight date'(003),
                     50 'Book Id'(004),
                     65 'Local Currency'(005).
            ENDAT.                         " AT FIRST
            WRITE: /5 fs_sbook-carrid,
                   20 fs_sbook-connid,
                   35 fs_sbook-fldate,
                   50 fs_sbook-bookid,
                   65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
          ENDLOOP.                         " LOOP AT T_SBOOK INTO.....
      ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " UCOMM
    Regards
    Kiran

  • Internal tables

    what is the difference between sy-index and sy-tabix?can any one provide me with some points on this ?

    Hi,
    SY-INDEX
    In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.
    SY-TABIX
    Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.
    -APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
    -COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
    -LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
    -READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
    -SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string is found.
    SY-TABIX means Table Index. This signifies the number of table index. Each row of a table has certain index or counter. The value of sy-tabix for the last entry would be equivalent to number of table entries.
    SY-INDEX means the number of Iterations for a loop. bascially DO - ENDO .
    SY-INDEX is not equal to SY-TABIX.
    Check the below program
    report tabix_index.
    DO 100 times.
    wa_tab-index = sy-index.
    append wa_tab to itab.
    clear wa_tab.
    enddo.
    loop at itab into wa_tab.
    write:/1 sy-tabix.
    endloop.
    Reward if useful
    Thanks

  • 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

  • 'Search' internal table - sy-tabix question

    I realize there are many questions out there on sy-tabix but non that answer my question. 
    I have an internal table that will be filled with material numbers (among other things).  I need to loop through the internal table to see if the material number already exists in the table.  If so I need to store the index of the material number.  What is the best way to go about doing this?
    Regards,
    Davis

    Thanks Ravi, I guess instead of
    WRITE: / sy-tabix I can have something like
    LineIndex = sy-tabix.  is that correct?
    I wasn't sure if I could do something like
    READ TABLE itab WITH KEY matnr....
    I thought that I had to include a string that was searched through the whole table like the example in the online help.  Thanks again!
    Davis.
    I'm keeping this question open to see what other suggestions I receive.

  • PASSING INTERNAL TABLE IN SMARTFORM

    HI' I M NEW TO SMARTFORMS, MY PROBLEM IS =THAT
    I'VE CREATED A NEW TYPE(SAY TY_BKPF) IN THE DRIVER PROGRAM.
    THEN I'VE DECLARED AN INTERNAL TABLE OF THIS TYPE.
    TO PASS THIS INTERNAL TABLE INTO MY SMARTFORM I'VE PASSED THE INTERNAL TABLE'S NAME INTO THE FUNCTION MODULE UNDER THE TABLES PARAMETER.
    BUT I'M NOT ABLE TO UNDERSTAND AS TO WHAT TYPE SHOULD I GIVE IT IN THE FORM INTERFACE IN THE TABLES TAB.
    PLZ HELP.

    Define table in smartforms
    Global settings :
    Form interface
    Variable name    Type assignment   Reference type
    ITAB1               TYPE                  Table Structure
    Global definitions
    Variable name    Type assignment   Reference type
    ITAB2               TYPE                  Table Structure
    Also have a look at below sample code. It will give you idea abt the same.
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
            INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
       MOVE-CORRESPONDING MKPF TO INT_MKPF.
       APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
      exporting
        formname                 = 'ZSMARTFORM'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
      IMPORTING
        FM_NAME                  = FM_NAME
      EXCEPTIONS
        NO_FORM                  = 1
        NO_FUNCTION_MODULE       = 2
        OTHERS                   = 3.
    if sy-subrc <> 0.
       WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        GS_MKPF                    = INT_MKPF
      EXCEPTIONS
        FORMATTING_ERROR           = 1
        INTERNAL_ERROR             = 2
        SEND_ERROR                 = 3
        USER_CANCELED              = 4
        OTHERS                     = 5.
    if sy-subrc <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Have a look at below link for more help on smart forms.
    http://sap.ionelburlacu.ro/sap0/sapsf001.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/a9/de6838abce021ae10000009b38f842/frameset.htm
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • How to Define Internal Table in Smartform

    Hello,
    I have some problem on define Internal Table in Smartform
    I define a Temp_IT_Gen Type LBBIL_IT_GEN in Global Definiations
    but i find that it is not available for me to append data into it,
    the error message is Temp_IT_Gen is not a Internal Table - the Occurs n Specification is missing
    so how can i solve it?
    i want to use the internal table in the hold program.
    Thanks a lot in advance.

    Hi,
    First U define the Table type in 'TYPES' tab of Global Definitions and then assing that table type to Internal table in 'Global Data' tab.
    Eg:
    define the Table Type like below in TYPES tab.
    TYPES:BEGIN OF ty_TEMP.
            INCLUDE STRUCTURE XXXXXXX.
    TYPES:END OF ty_TEMP.
    TYPES: g_t_temp TYPE STANDARD TABLE OF ty_TEMP .
    Now, define the Internal table in Global Data tab like below:
    Variable Name    Type assignment    Associated Type
    G_T_ITEM_1       TYPE                    G_T_TEMP
    NOTE: whatever U define in Global Definitions can be used only in SMARTFORM, if u want to use it in Program U must define in Form Interface.
    Hope it helps!!
    Rgds,
    Pavan

Maybe you are looking for