Regarding Internal Table Manipulation

Hi All,
I have a issue when working against Internal Table inside a function module.
Issue is:
My I.Table declaration is as below:
<b>DATA: BEGIN OF i_vbfa_tab OCCURS 0.
          INCLUDE STRUCTURE vbfa.
DATA: END   OF i_vbfa_tab.</b>
Then in code i had written following logic:
  SELECT VBELV
         VBELN
         VBTYP_N
         VBTYP_V
         FROM VBFA
         INTO ( V_VBELV, V_VBELN, V_VBTYP_N, V_VBTYP_V )
         WHERE VBELN   = V_SO_ORDER2 AND
               VBTYP_N = 'G'         AND
               STUFE   = '00'.
  IF SY-SUBRC EQ 0.
    I_VBFA_TAB–VBELN   = V_VBELN.        
    I_VBFA_TAB–VBELV   = V_VBELV.        
    I_VBFA_TAB–VBTYP_N = V_VBTYP_N.      
    I_VBFA_TAB–VBTYP_V = V_VBTYP_V.      
    APPEND I_VBFA_TAB.
    CLEAR I_VBFA_TAB.
  ENDIF.
Then when i am checking for <b>F2[Syntax]</b> it is giving error as <b>'The Field I_VBFA_TAB-VBELN is unknown'</b>. This is the case with all 4 assignment statements.
Can anybody tell me what is the issue over here.
What can i do to assign those values to internal table and append. I had tried with <b>MOVE</b> that is also giving same error.
Can anybody solve my issue.
Thanks in advance.
Thanks & Regards,
Prasad.

If you are doing something like:
call function 'Z_FUNC'
  tables i_vbfa_tab = vbfa_tab.
and in the FM:
function z_func
*"  TABLES
*"      i_vbfa_tab STRUCTURE  vbfa OPTIONAL
perform get_vbfa.
and then in an include
form get_vbfa
SELECT VBELV
VBELN
VBTYP_N
VBTYP_V
FROM VBFA
INTO ( V_VBELV, V_VBELN, V_VBTYP_N, V_VBTYP_V )
WHERE VBELN = V_SO_ORDER2 AND
VBTYP_N = 'G' AND
STUFE = '00'.
I think you'll get the syntax arror you describe. Try:
call function 'Z_FUNC'
  tables i_vbfa_tab = vbfa_tab.
and in the FM:
function z_func
*"  TABLES
*"      i_vbfa_tab STRUCTURE  vbfa OPTIONAL
perform get_vbfa
<b>  tables i_vbfa_tab.</b>
and then in the include
form get_vbfa
<b>  tables i_vbfa structure vbfa.</b>
data: v_vbelv   like vbfa-vbelv,
      v_vbeln   like vbfa-vbeln,
      v_VBTYP_N like vbfa-VBTYP_N,
      v_VBTYP_v like vbfa-VBTYP_v,
SELECT VBELV
VBELN
VBTYP_N
VBTYP_V
FROM VBFA
INTO ( V_VBELV, V_VBELN, V_VBTYP_N, V_VBTYP_V )
WHERE VBELN = V_SO_ORDER2 AND
VBTYP_N = 'G' AND
STUFE = '00'.
IF SY-SUBRC EQ 0.
I_VBFA_TAB–VBELN = V_VBELN.
I_VBFA_TAB–VBELV = V_VBELV.
I_VBFA_TAB–VBTYP_N = V_VBTYP_N.
I_VBFA_TAB–VBTYP_V = V_VBTYP_V.
APPEND I_VBFA_TAB.
CLEAR I_VBFA_TAB.
ENDIF.
I didn't test this, so if you use it, test it thoroughly.
Rob

Similar Messages

  • Regarding Internal Table Field Validation [Modification]

    Hi All,
    I have a small issue with formatting of a field.
    The Field is POTX1 - it would get the value as 'New MT-EPPE0097-COMP02',
    Means i have one internal table field as i_error-POTX1 in that some times we get value as 'New MT-EPPE0097-COMP02'.
    Whenever i get 'New' literal in that internal table field i have to remove that literal from that internal table field. And Left Justify the remaining part of the field.
    Ex:  'New MT-EPPE0097-COMP02'
         should become 'MT-EPPE0097-COMP02'.
    For this first i have to find wether 'New' Literal exists in the Internal table field or not then i have to remove it.
    Can anybody tell me how can i solve this issue.
    Thanks in advance.
    Thanks & Regards,
    Rayeezuddin.

    Hi,
    Take a look :
    loop at i_error.
      if i_error-potx1(3) = 'New'
        w_potx1 = i_error-potx1.
        i_error-potx1 = w_potx1+3(37).
        MODIFY i_error.
      endif.
    ENDLOOP.
    Regards,
    Erwan.
    Message was edited by: Erwan LE BRUN

  • Regarding internal table read.

    Hi,
    i want to read internal table and compare the one variable existing with in from date and to date.
    the psudo code is like this
    READ TABLE L_TABEMPLOYEE INTO L_WAEMPLOYEE WITH KEY  EMPLOYEE = SOURCE_FIELDS_RULE-PERNR
    ULTIMO BETWEEN L_WAEMPLOYEE-DATEFROM AND L_WAEMPLOYEE-DATETO.
    but this statement gives error.
    how to code for the same requirement.
    regards,
    swami.

    Hi,
    Recode like this.It will definitely work
    LOOP AT L_TABEMPLOYEE INTO L_WAEMPLOYEE
                                 WHERE EMPLOYEE = SOURCE_FIELDS_RULE-PERNR
                                              AND ULTIMO > L_WAEMPLOYEE-DATEFROM
                                              AND ULTIMO < L_WAEMPLOYEE-DATETO.
    <Write what you want to do here >
    ENDLOOP.
    Please reward if useful
    Thanks Arjun
    Edited by: Arjun Puthuruthy on Mar 26, 2008 10:52 AM

  • Regarding Internal table and access performance

    hey guys.
    In my report , Somehow i reduced the query performance time by selecting minimum key fields and moved the selected records to internal table.
    Now from this internal table i am restricting the loop
    as per my requirements using where statements.(believing that internal table retrieval is more faster than database acces(using query)).
    But still my performance goes down.
    Could you pls suggest me how to reduce the execution time
    in abap programming.
    I used below commands.
    Read using binary search.
    loop ...where statement.
    perform statements.
    collect staements.
    delete itab.(delete duplicates staements too)
    sort itab(sorting).
    For each above statements do we have any faster way to retrieval records.
    If i see my bottle neck at se30.it shows
    ABAP programming to 70 percent
    database access to 20 percent
    R3 system as 10percent.
    now how to reduce this abap process.
    could you pls reply.
    ambichan.
    ambichan.

    Hello Ambichan,
    It is difficult to suggest the improvements without looking at the actual code that you are running. However, I can give you some general information.
    1. READ using the BINARY SEARCH addition.
    This is indeed a good way of doing a READ. But have you made sure that the internal table is <i>sorted by the required fields</i> before you use this statement ?
    2. LOOP...WHERE statement.
    This is also a good way to avoid looping through unnecessary entries. But further improvement can certainly be achieved if you use FIELD-SYMBOLS.
    LOOP AT ITAB INTO <FIELD_SYMBOL_OF_THE_SAME_LINE-TYPE_AS_ITAB>.
    ENDLOOP.
    3. PERFORM statements.
    A perform statement can not be optimized. what matters is the code that you write inside the FORM (or a subroutine).
    4. COLLECT statements.
    I trust you have used the COLLECT statement to simplify the logic. Let that be as it is. The code is more readable and elegant.
    The COLLECT statement is somewhat performance intensive. It takes more time with a normal internal table (STANDARD). See if you can use an internal table of type  SORTED. Even better, you can use a HASHED internal table.
    5. DELETE itab.(delete duplicates staements too)
    If you are making sure that you are deleting several entries based on a condition, then this should be okay. You cannot avoid using the DELETE statement if your functionality requires you to do so.
    Also, before deleting the DUPLICATES, ensure that the internal table is sorted.
    6. SORT statement.
    It depends on how many entries there are in the internal table. If you are using most of the above points on the same internal table, then it is better that you define your internal table to be of type SORTED. That way, inserting entries will take a little more time (to ensure that the table is always sorted), but alll the other operations are going to be much faster.
    Get back to me if you need further assistance.
    Regards,
    <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=zwcc%2fwm4ups%3d">anand Mandalika</a>.

  • Issue regarding internal tables

    Dear all,
    My issue is that , I need to enter data into a single internal table by fetching data from two sap tables using two different selct quries. I should not use joins or for all entries. And display the internal table data in the list.
    Problem am facing is only one select query is geeting fetched and the other table data in not in the list.
    Pleas provide the possible solutions.
    Thanks & Regards,
    Madhavi.M

    DATA: BEGIN OF itab1 OCCURS 0,
          qmnum LIKE qmel-qmnum,
          qmtxt LIKE qmel-qmtxt,
          indtx LIKE qmel-indtx,
          qmdat LIKE qmel-qmdat,
          ltrmn LIKE qmel-ltrmn,
          priok LIKE qmel-priok,
          aufnr LIKE qmel-aufnr,
          bezdt LIKE qmel-bezdt,
          qmnam LIKE qmel-qmnam,
          qmart LIKE qmel-qmart,
          END OF itab1.
    DATA: BEGIN OF itab2 OCCURS 0,
          qmnum LIKE qmih-qmnum,
          btpln LIKE qmih-btpln,
          ingrp LIKE qmih-ingrp,
          END OF itab2.
    DATA : itab3 TYPE TABLE OF z_notif WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS : notnum FOR qmel-qmnum OBLIGATORY,
                     notype FOR qmel-qmart,
                     floc FOR qmih-btpln,
                     name FOR qmel-qmnam.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
    To fetch the values in the internal table ****************
    from ztable corresponding to the entries made *************
    by the user in the selection screen ******************
    SELECT qmnum qmtxt indtx qmdat ltrmn priok aufnr bezdt qmnam qmart INTO
    TABLE itab1 FROM qmel WHERE qmnum IN notnum
    AND qmart IN notype AND qmnam IN name.
    SELECT qmnum btpln ingrp INTO TABLE itab2 FROM qmih FOR ALL ENTRIES IN
    itab1 WHERE qmnum = itab1-qmnum AND btpln IN floc.
    To move the contents of ITAB1 to ITAB3 ***************
        LOOP AT itab1.
          itab3-qmnum = itab1-qmnum.
          itab3-qmtxt = itab1-qmtxt.
          itab3-indtx = itab1-indtx.
          itab3-qmdat = itab1-qmdat.
          itab3-ltrmn = itab1-ltrmn.
          itab3-priok = itab1-priok.
          itab3-aufnr = itab1-aufnr.
          itab3-bezdt = itab1-bezdt.
          itab3-qmnam = itab1-qmnam.
          itab3-qmart = itab1-qmart.
          READ TABLE itab2 WITH KEY qmnum = itab1-qmnum.
    To move the contents of ITAB2 to ITAB3 ***************
          itab3-btpln = itab2-btpln.
          itab3-ingrp = itab2-ingrp.
          APPEND itab3.
        ENDLOOP.
    have a look at this example this may help you.....
    reward if helpful.....

  • Internal Table Manipulation

    Hi,
    I have an internal tables with 5 fields each of type Char - L1 L2 L3 L4 L5.
    I have to make the first occurance of 0 after a non zero value as 1.
    Example: if i have the values as 1 0 0 0 0, it s'd be made 1 1 0 0 0.
    If 1 1 0 0 0 it s'd be made 1 1 1 0 0.
    If 0 1 0 0 0 then it should be made 0 1 1 0 0.
    If i try this using nested IF statements the code becomes more complex.. Is there any other way out.. like using string operations??
    Regards,
    Pradhiba

    Pradhiba,
    You try the following code:
    DATA: BEGIN OF tbl_table1 OCCURS 0,
            f1 TYPE n,
            f2 TYPE n,
            f3 TYPE n,
            f4 TYPE n,
            f5 TYPE n,
          END OF tbl_table1.
    DATA: g_index LIKE sy-tabix,
          g_found TYPE c.
    FIELD-SYMBOLS: <fs> TYPE n.
    START-OF-SELECTION.
      CLEAR tbl_table1.
      tbl_table1-f2 = 1.
      APPEND tbl_table1.
      LOOP AT tbl_table1.
        CLEAR: g_index,
               g_found.
        DO.
          ADD 1 TO g_index.
          ASSIGN COMPONENT g_index OF STRUCTURE tbl_table1 TO <fs>.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
    * Was there a 1 in the previous field?
          IF g_found = 'X'.
    * Yes! Previous field was a 1, now make current field a 1 clear the
    * G_FOUND flag and CONTINUE to next field
            <fs> = 1.
            CLEAR g_found.
            CONTINUE.
          ENDIF.
    * Current field is a 1, mark the G_FOUND flag!
          IF <fs> = 1.
            g_found = 'X'.
          ENDIF.
        ENDDO.
        MODIFY tbl_table1.
      ENDLOOP.
    END-OF-SELECTION.
      LOOP AT tbl_table1.
        WRITE:/ tbl_table1-f1, tbl_table1-f2, tbl_table1-f3, tbl_table1-f4,
                tbl_table1-f5.
      ENDLOOP.
    Cheers,
    Pat

  • This is Regarding internal tables

    Hi to all,
    I have 3 internal tables like this.
    it_itab1       It_itab2        it_final
      !--f1            !-f3           !---f1
      !--f2            !-f4           !---f2
                                           !---f3
                                           !---f4
    the fields are like this.now i want to move the data from first two internal tables to final internal table.
    how to do this.
    thanks and regards,
    s

    create ur final internal table with the same data element as the fields of 1 and 2 itabs
    and say move- corresponding  to it_final..

  • This is regarding internal table

    Hi to all,
    types : begin of it_itab,
            name type ztab-name,
            tval like ztab-tval,
            fval like ztab-fval,
            end ofit_itab,
            it_jtab type standard  table of it_itab.
    What is the meaning of this it_jtab type standard table of it_itab.
    what it specifies exactly.
    Thanks and regards,
    s

    Hi,
    types : begin of it_itab,
    name type ztab-name,
    tval like ztab-tval,
    fval like ztab-fval,
    end ofit_itab,
    Types defines the standard strcuture which you can use any where in the report.
    <b>it_jtab type standard table of it_itab.</b>
    As strcuture doesnot contain morethan one data, we declaring the internal using the strcuture which defined.<b> The above statement is used to create a  internal table without header line and the internal table type is of standard.</b>
    Thanks,
    Sriram Ponna.

  • Regarding internal table

    Hi ,
         i have an internal table
    DATA: BEGIN OF tbl_infile OCCURS 0,
             Aufnr(12) type c,
             budat(8) TYPE c,
             tubes(13) type c,
             srap(13) type c,
             batches(13) type c,
             runmin(13) type c,
             stopmin(13) type c,
          END OF tbl_infile.
    here the date from file comes into internal table as 140409 i want to change this to 14.04.2009 and place back into internal table how to change the internal table ?
    Thanks in advance

    Hi,
    This is very simple:
    1.Change the lenght of the budat from 8 to 10
    2.either use the FM 'CONVERT_DATE_TO_EXTERNAL' to convert the date or
    use the below snippet
    3.Declare 3 local variable of type c each of lenght 2
    data:var1(2) tyep c,
    var2(2) tyep c,
    var3(2) tyep c,
    4.extract the dd,mm and yy using the offset from the budat
    var1 = budat+0(2).
    var2 = budat+2(2).
    var3 = budat+4(2).
    5.finally concatenate the above 3 variable into budat of internal table.
    concatenate var1 '.' var2 '.' var3 into budat.
    Hope this might solve your problem.
    Pooja
    Edited by: Pooja Gupta on Mar 13, 2009 4:46 AM

  • Regarding Internal table logic

    Hi,
    I have my internal table as follows:
    DATA: BEGIN OF I_DATA OCCURS 0,
            prgname TYPE SYST-REPID,
            matnr   TYPE mara-matnr,
            berid   TYPE mdma-berid,
          END OF I_DATA.
    Data that fills into can be as follows:
    Ex:
    PROGRAM1,1000,MRP1
    PROGRAM1,1000,MRP1
    PROGRAM1,2000,MRP1
    PROGRAM2,1000,MRP1
    PROGRAM2,1000,MRP1
    PROGRAM2,2000,MRP1
    PROGRAM3,1000,MRP1
    PROGRAM3,1000,MRP1
    PROGRAM3,2000,MRP1
    It can any order in above way.
    Then i will sort the above data as follows:
    SORT I_DATA BY prgname matnr berid.
    Now here my issue is:
    DATA: t_objtxt     LIKE solisti1   OCCURS 0  WITH HEADER LINE.
    I need to push the above internal table data into T_OBJTXT internal table as follows:
    It should first Display program Name as Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
    When 2nd program comes again i have to write Program Name: Program2, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
    When 3nd program comes again i have to write Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
    Etc. Same process we need to follow.
    The final out put should be as below:
    PROGRAM NAME : PROGRAM1
    MATNR, BERID
    1000,MRP!
    1000,MRP1
    2000,MRP1
    PROGRAM NAME : PROGRAM2
    MATNR, BERID
    1000,MRP!
    1000,MRP1
    2000,MRP1
    PROGRAM NAME : PROGRAM3
    MATNR, BERID
    1000,MRP!
    1000,MRP1
    2000,MRP1
    Like wise o/p need to be send to I_OBJTXT and to email.
    <b>The logic i have written is as follows:</b>
      LOOP AT I__DATA.
        AT NEW PRGNAME.
          MOVE '*****************************************' TO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          CONCATENATE t_objtxt-line 'PROGRAM NAME : '
                      I_DATA-PRGNAME
                      INTO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          MOVE '*****************************************' TO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          CONCATENATE TEXT-024 " Material
                      TEXT-025              " MRP
                      INTO t_objtxt-line
                      SEPARATED BY C_COMMA.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          MOVE '-----------------------------------------' TO t_objtxt-line.
          CONCATENATE t_objtxt-line '------------------' INTO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
        ENDAT.
    *    MOVE '' TO t_objtxt-line.
    *    APPEND t_objtxt.
    *    CLEAR t_objtxt.
        CONCATENATE I_DATA-MATNR
                    I_DATA-BERID
                    INTO t_objtxt-line
                    SEPARATED BY C_COMMA.
        APPEND t_objtxt.
        CLEAR t_objtxt.
        AT END OF MATNR.
          MOVE '' TO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          MOVE '*****************************************' TO t_objtxt-line.
          CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
          CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
        ENDAT.
      ENDLOOP.
    The above logic is not working correctly.
    Can anybody give me correct logic for the same.
    Thanks in advance.
    Thanks,
    Deep.

    Can you paste the total code.
    santhosh

  • Pls provide information regarding internal tables

    hi
    i would like to know can we create relationship between two internal tables.
    like foriegn key relationship . if yes pls tell me how .

    hi...
    there is  actual relationship that can b created for 2 internal tables using foreign keys,but by using " for all entries" in select statements.
    syntax: for all entries.
    TYPES: BEGIN OF ftab_type,
             carrid TYPE sflight-carrid,
             connid TYPE sflight-connid,
           END OF ftab_type.
    DATA:  ftab TYPE STANDARD TABLE OF ftab_type WITH
                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
           free TYPE I,
           wa_sflight TYPE sflight.
    Suppose FTAB is filled as follows:
    CARRID  CONNID
    LH      2415
    SQ      0026
    LH      0400
    SELECT * FROM sflight INTO wa_sflight
        FOR ALL ENTRIES IN ftab
        WHERE CARRID = ftab-carrid AND
              CONNID = ftab-connid AND
              fldate = '20010228'.
      free = wa_sflight-seatsocc - wa_sflight-seatsmax.
      WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
    ENDSELECT.
    try it out.
    reward if useful.

  • Internal table logic issue

    Hi All,
    I have one logical issue related to internal table manipulation.
    I have one internal table :
    I_DAT - This is related to Loading/Unloading of Goods.
    for example with 3 fields
    VSTEL, KUNNA, KMMANG.
    Now suppose my data looks like this after sorting:
    VSTEL   KUNNA    KMMANG
    100       -        -
    200       -        -
    300       -        -
    400       -        -
    -         500      X
    -         600      X
    -         700      X
    -         800      X
    Here 100,200,300,400 are Loading points.
    ANd 500,600,700,800 are unloading points.
    Now what i want is For loading & Unloading points i need to pick up Address and print one after other.
    But how they need to print is:
    FOR INITIAL LOADING OF
    ADDRESS- For 100
    FIRST STOP: FOR LOADING OF
    ADDRESS- For 200
    SECOND STOP: FOR LOADING OF
    ADDRESS- For 300
    Etc .....
    Then
    FOR UNLOADING OF:
    ADDRESS- For 400
    FIRST STOP: FOR UNLOADING OF
    etc.
    FINAL STOP: FOR FINAL UNLOADING OF
    We might get as many records :
    Can any body give me the logic:
    Printing Address is not a problem:
    But Above every address we need to print FIRST STOP, SECOND etc like that.
    For this i need logic.
    Can anybody give the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Try this.I think you want output like this......
    DATA: BEGIN OF LINE,
            CARRID   TYPE SBOOK-CARRID,
            CONNID   TYPE SBOOK-CONNID,
            FLDATE   TYPE SBOOK-FLDATE,
            CUSTTYPE TYPE SBOOK-CUSTTYPE,
            CLASS    TYPE SBOOK-CLASS,
            BOOKID   TYPE SBOOK-BOOKID,
          END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
    SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
           FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB INTO LINE.
      AT FIRST.
        WRITE / 'List of Bookings'.
        ULINE.
      ENDAT.
        AT NEW CARRID.
          WRITE: / 'Carrid:', LINE-CARRID.
        ENDAT.
          AT NEW CONNID.
            WRITE: / 'Connid:', LINE-CONNID.
          ENDAT.
            AT NEW FLDATE.
              WRITE: / 'Fldate:', LINE-FLDATE.
            ENDAT.
              AT NEW CUSTTYPE.
                WRITE: / 'Custtype:', LINE-CUSTTYPE.
              ENDAT.
                   WRITE: / LINE-BOOKID, LINE-CLASS.
                AT END OF CLASS.
                  ULINE.
                ENDAT.
    ENDLOOP.
    This is also helpful......
    LOOP AT <itab>.
      AT FIRST. ... ENDAT.
        AT NEW <f1>. ...... ENDAT.
          AT NEW <f2 >. ...... ENDAT.
              <single line processing>
          AT END OF <f2>. ... ENDAT.
        AT END OF <f1>. ... ENDAT.
      AT LAST. .... ENDAT.
    ENDLOOP.
    Regards
    Abhishek

  • Internal table question

    Hi Everybody-
    I am very new to SAP and i have question regarding internal tables. I have struture called "ZMI_VENDOR_TO_BW_GENERIC_V_TAB" which i get from another sap system thru SAP XI. Now i need to traverse thru this structure  and add these values into custom database table. So i have declared an internal table like below
    <b>data:itab_venkat type ZMI_VENDOR_TO_BW_GENERIC_V_TAB occurs 10.
      data vendorid type c.
      itab_venkat = Input-Generic_Vendor-Generic_Vendor_Record1.
      LOOP AT itab_venkat.
      vendorid = itab_venkat-generic_vendor_id1.
    endloop.
    </b>
    i am getting an error saying occurs cannot be used and also getting an error at the loop statement, Can somebody please correct me, i am very new to SAP.in the loop i am getting the vendor id and then i should update the database table.
    Please help me.
    Thank you
    Venkat

    hi venkat,
    check these links..
    http://cma.zdnet.com/book/abap/index.htm
    http://www.sapdevelopment.co.uk/
    http://www.sap-img.com/
    http://juliet.stfx.ca/people/fac/infosys/abap.htm
    http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_46c/helpdata/en/d6/0db357494511d182b70000e829fbfe/frameset.htm
    http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
    http://www.sapgenie.com/abap/example_code.htm
    http://www.geocities.com/SiliconValley/Campus/6345/abapindx.htm
    http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
    http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm
    http://www.sap-img.com/abap-function.htm
    http://www.sapgenie.com/abap/code/abap19.htm
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.planetsap.com/Tips_and_Tricks.htm
    http://help.sap.com/saphelp_40b/helpdata/ru/d6/0dc169494511d182b70000e829fbfe/applet.htm
    http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm
    http://www.henrikfrank.dk/abapexamples/index.html
    http://sap.ittoolbox.com/documents/document.asp?i=752
    http://members.aol.com/_ht_a/skarkada/sap/
    http://sappoint.com/abap/
    http://members.tripod.com/abap4/SAP_Functions.html
    http://members.ozemail.com.au/~anmari/sap/index.html
    http://www.planetsap.com/Userexit_List.htm
    http://www.planetsap.com/Tips_and_Tricks.htm
    http://www.kabai.com/abaps/q.htm
    http://www.planetsap.com/Userexit_List.htm
    http://help.sap.com/saphelp_bw21c/helpdata/en/c4/3a8090505211d189550000e829fbbd/frameset.htm
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/saphelp_45b/helpdata/en/65/897415dc4ad111950d0060b03c6b76/content.htm
    http://www.sap-basis-abap.com/index.htm
    http://help.sap.com/saphelp_40b/helpdata/en/fc/eb2c46358411d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_46c/helpdata/en/aa/aeb23789e95378e10000009b38f8cf/frameset.htm
    http://www.geocities.com/ResearchTriangle/1635/system.html
    http://www.sapdesignguild.org/resources/MiniSG/3_Managing/3_Functions_Table_Control.htm
    http://help.sap.com/saphelp_45b/helpdata/en/d1/801bdf454211d189710000e8322d00/content.htm
    http://www.sapfans.com/sapfans/repos/saprep.htm
    http://www.planetsap.com/howdo_a.htm
    http://help.sap.com/saphelp_util464/helpdata/en/69/c2516e4ba111d189750000e8322d00/content.htm
    http://www.sapgenie.com/abap/smartforms_detail.htm
    http://www.sap-img.com/abap.htm
    http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2d67358411d1829f0000e829fbfe/content.htm
    http://www.geocities.com/victorav15/sapr3/abap.html
    http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
    http://abap4.tripod.com/Other_Useful_Tips.html
    http://help.sap.com/saphelp_45b/helpdata/en/cf/21ee2b446011d189700000e8322d00/content.htm
    http://www.sap-basis-abap.com/sapmm.htm
    http://sap.ittoolbox.com/nav/t.asp?t=303&p=448&h1=303&h2=322&h3=448
    http://sapfans.com/
    http://cma.zdnet.com/book/abap/ch03/ch03.htm
    http://help.sap.com/saphelp_40b/helpdata/en/4f/991f82446d11d189700000e8322d00/applet.htm
    http://sappoint.com/abap/
    http://www.henrikfrank.dk/abapuk.html
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    http://www.sapgenie.com/abap/index.htm
    http://www.sap-img.com/abap.htm
    http://www.sapdevelopment.co.uk/tips/tipshome.htm
    http://help.sap.com/printdocu/core/Print46c/en/Data/Index_en.htm
    http://sap.ittoolbox.com/nav/t.asp?t=322&p=322&h1=322
    http://sap.ittoolbox.com/nav/t.asp?t=448&p=448&h1=448
    http://www.thespot4sap.com/
    http://www.kabai.com/abaps/q.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapgenie.com/abap/tips_and_tricks.htm
    http://www.sapassist.com/code/d.asp?whichpage=1&pagesize=10&i=10&a=c&o=&t=&q=&qt=
    For FAQ
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.sapgenie.com/faq/abap.htm

  • Regarding logic in manipulation of internal table

    Hi All,
    I have one internal table as below:
    <b>I_TAB</b>.
    <b>VBELN  LIKE VBAP-VBELN,
    POSNR LIKE VBAP-POSNR,
    QTY      LIKE VBAP-KWMENG,
    SUM     LIKE VBAP-KWMENG,
    </b>
    Now i have filled in this internal table from select statement
    Data is:
    100, 10, 100
    100,  10, 200
    100,  10, 300
    100, 20, 50
    100, 30, 100
    100, 30, 200
    etc.
    Now what i want is i want t calculate SUM field in above internal table based on VBELN & POSNR
    Finally data should come as
    100, 10, QTY, 600
    100, 20, QTY, 50
    100, 30, QTY, 300
    (or)
    we can update QTY with SUM of all VBELN/POSNR.
    Can anybody tell me what is the logiic!
    Thanks,
    Deep.

    Hi,
    Declare on more table as ITAB, say JTAB.
    Loop at ITAB.
    JTAB-VBELN = ITAB-VBELN.
    JTAB-POSNR = ITAB-POSNR.
    JTAB-SUM = ITAB-QTY.
    COLLECT JTAB
    endloop.
    JTAB will have ur required output, But u cant put QTY in between since, the Qunattity is Integer field u cant place 'QTY', since it is a char.
    Sreedhar
    Message was edited by:
            Sreedhar Kanchanapalli

  • Regarding Exporting and Importing internal table

    Hello Experts,
    I have two programs:
    1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
    I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
    The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
    Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
    Importing is not getting data to internal table.
    Can you please suggest something to solve this issue.
    Thank you.
    Regards,
    Anand.

    Hi,
    This is the code i am using.
    DO g_f_packets TIMES.
    * Start Immediately
           IF NOT p_imm IS INITIAL .
             g_flg_start = 'X'.
           ENDIF.
           g_f_jobname = 'KZDO_INHERIT'.
           g_f_jobno = g_f_jobno + '001'.
           CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
                                                  SEPARATED BY '_'.
           CONDENSE g_f_jobname NO-GAPS.
           p_psize1 = p_psize1 + p_psize.
           p_psize2 = p_psize1 - p_psize + 1.
           IF p_psize2 IS INITIAL.
             p_psize2  = 1.
           ENDIF.
           g_f_spname = 'MID'.
           g_f_spid = g_f_spid + '001'.
           CONDENSE g_f_spid NO-GAPS.
           CONCATENATE g_f_spname  g_f_spid INTO g_f_spname.
           CONDENSE g_f_spname NO-GAPS.
    * ... (1) Job creating...
           CALL FUNCTION 'JOB_OPEN'
             EXPORTING
               jobname          = g_f_jobname
             IMPORTING
               jobcount         = g_f_jobcount
             EXCEPTIONS
               cant_create_job  = 1
               invalid_job_data = 2
               jobname_missing  = 3
               OTHERS           = 4.
           IF sy-subrc <> 0.
             MESSAGE e469(9j) WITH g_f_jobname.
           ENDIF.
    * (2)Report start under job name
           SUBMIT (g_c_prog_kzdo)
                  WITH p_lgreg EQ p_lgreg
                  WITH s_grvsy IN s_grvsy
                  WITH s_prvsy IN s_prvsy
                  WITH s_prdat IN s_prdat
                  WITH s_datab IN s_datab
                  WITH p1      EQ p1
                  WITH p3      EQ p3
                  WITH p4      EQ p4
                  WITH p_mailid EQ g_f_mailid
                  WITH p_psize EQ p_psize
                  WITH p_psize1 EQ p_psize1
                  WITH p_psize2 EQ p_psize2
                  WITH spid     EQ g_f_spid
                  TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                  VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
    *(3)Job closed when starts Immediately
           IF NOT p_imm IS INITIAL.
             IF sy-index LE g_f_nojob.
               CALL FUNCTION 'JOB_CLOSE'
                 EXPORTING
                   jobcount             = g_f_jobcount
                   jobname              = g_f_jobname
                   strtimmed            = g_flg_start
                 EXCEPTIONS
                   cant_start_immediate = 1
                   invalid_startdate    = 2
                   jobname_missing      = 3
                   job_close_failed     = 4
                   job_nosteps          = 5
                   job_notex            = 6
                   lock_failed          = 7
                   OTHERS               = 8.
               gs_jobsts-jobcount = g_f_jobcount.
               gs_jobsts-jobname  = g_f_jobname.
               gs_jobsts-spname   = g_f_spname.
               APPEND gs_jobsts to gt_jobsts.
             ELSEIF sy-index GT g_f_nojob.
               CLEAR g_f_flg.
               DO.                         " Wiating untill any job completion
                 LOOP AT gt_jobsts into gs_jobsts.
                   CLEAR g_f_status.
                   CALL FUNCTION 'BP_JOB_STATUS_GET'
                     EXPORTING
                       JOBCOUNT                         = gs_jobsts-jobcount
                       JOBNAME                          = gs_jobsts-jobname
                    IMPORTING
                       STATUS                           = g_f_status
    *            HAS_CHILD                        =
    *          EXCEPTIONS
    *            JOB_DOESNT_EXIST                 = 1
    *            UNKNOWN_ERROR                    = 2
    *            PARENT_CHILD_INCONSISTENCY       = 3
    *            OTHERS                           = 4
                   g_f_mid = gs_jobsts-spname.
                   IF g_f_status = 'F'.
                     IMPORT gt_final FROM MEMORY ID g_f_mid .
                     FREE MEMORY ID gs_jobsts-spname.
                     APPEND LINES OF gt_final to gt_final1.
                     REFRESH gt_prlist.
                     CALL FUNCTION 'JOB_CLOSE'
                       EXPORTING
                         jobcount             = g_f_jobcount
                         jobname              = g_f_jobname
                         strtimmed            = g_flg_start
                       EXCEPTIONS
                         cant_start_immediate = 1
                         invalid_startdate    = 2
                         jobname_missing      = 3
                         job_close_failed     = 4
                         job_nosteps          = 5
                         job_notex            = 6
                         lock_failed          = 7
                         OTHERS               = 8.
                     IF sy-subrc = 0.
                       g_f_flg = 'X'.
                       gs_jobsts1-jobcount = g_f_jobcount.
                       gs_jobsts1-jobname  = g_f_jobname.
                       gs_jobsts1-spname   = g_f_spname.
                       APPEND gs_jobsts1 TO gt_jobsts.
                       DELETE TABLE gt_jobsts FROM gs_jobsts.
                       EXIT.
                     ENDIF.
                   ENDIF.
                 ENDLOOP.
                 IF g_f_flg = 'X'.
                   CLEAR g_f_flg.
                   EXIT.
                 ENDIF.
               ENDDO.
             ENDIF.
           ENDIF.
           IF sy-subrc <> 0.
             MESSAGE e539(scpr) WITH g_f_jobname.
           ENDIF.
           COMMIT WORK .
         ENDDO.

Maybe you are looking for

  • Help with using 'extend' while creating a class between two other classes

    I have an assignment, basically to take a Date class and make it so it can output the date to a String, so if it was 4/2006, it would do April 2006. Now my question is, where and when do I put super? I can post what I have and I can post the two prog

  • Will not open due to quicktime!!

    Hi, I have the following message: The iTunes application could not be opened. A required iTunes component is not installed. Please repair or reinstall Quick Time. (-42404). I have removed and reinstalled Quick Time but still no luck, can someone plea

  • What is the preferred NTFS cluster size of a disk where a mailbox database will installed on?

    I'm testing the 2013 Exchange deployment in our lab environment. We do have a 2010 Exchange server where mailbox databases are installed on disks formatted 64k (65536 bytes in each allocation unit). Is this also recommended for Exchange 2013? Remco

  • Using iDVD 6 favourite themes in idvd 4

    I have saved several themes in iDVD 6 on my Mac Mini and due to problems with compatability I have to use iDVd 4 on my Mac G4. Is it possible to use themes created with iDVD 6 within iDVD 4 and how? Thanks in advance.

  • Bought book wont open in my Nook reading tablet

    Hi, I recently bought (or so I thought) J.K Rowlings "A casual vacancy" at IBooks. Then I moved the book from my Macbook Air to my reading device Nook. It did not look ok because the cover was blank and did not show the right picture. Then when I cli