Internal table(Optimizing the codes)

Dear all,
  Please help me in optimizing the following codes..
FORM fetch_item_data1 .
  CLEAR itab_zsbhdr .
  LOOP AT itab_zsbhdr .
    IF itab_zsbhdr-bedae = 'SPI'.
      SELECT * FROM zioel2 INTO  i_zioel
                    WHERE ordr = itab_zsbhdr-vbeln
                    AND item = itab_zsbhdr-posnr
                    AND vdatu = itab_zsbhdr-vdatu .
        APPEND i_zioel.
        CLEAR i_zioel .
      ENDSELECT .
    ENDIF .
  ENDLOOP .
ENDFORM.                    " FETCH_ITEM_DATA1
MY DOUBT:
For example if you all can see the select statement,,there we can also write as,
data : itab_zsbhdr_dummy like itab_zsbhdr occurs 0 with header line.
CLEAR itab_zsbhdr .
itab_zsbhdr_dummy[] = itab_zsbhdr[].
DELETE itab_zsbhdr_DUMMY[] WHERE bedat NE 'SPI'.
SELECT * FROM zioel2 appending table i_zioel
             for all entries in itab_zsbhdr_DUMMY
                 WHERE ordr = itab_zsbhdr_dummy-vbeln
                 AND item = itab_zsbhdr_dummy-posnr
                 AND vdatu = itab_zsbhdr_dummy-vdatu .
So now we can see there is no append and modify.
So my question is ,,"Is it the right way to go?"
Again i am taking off the loop & instead deleting those date not equals to SPI.
So please help me by either confirming me with this particular optimization or give me some other optimized codes on this regard.
Thanx.

hye..
i am inserting my comments
FORM fetch_item_data1 .
CLEAR itab_zsbhdr .
You have cleared the internal table, so the content is empty.. hence it will not enter into the loop.
LOOP AT itab_zsbhdr .
IF itab_zsbhdr-bedae = 'SPI'.
SELECT * FROM zioel2 INTO i_zioel
WHERE ordr = itab_zsbhdr-vbeln
AND item = itab_zsbhdr-posnr
AND vdatu = itab_zsbhdr-vdatu .
Never use a select in a loop, this means ur hitting the database n number of times which is not at all recommondable.
APPEND i_zioel.
CLEAR i_zioel .
ENDSELECT .
instead of using select and end select it can be directly writen into
select * from [dbtab] into table [itab] for all entreis in it_comparision
where [field] = it_comparision-field.
ENDIF .
ENDLOOP .
ENDFORM. " FETCH_ITEM_DATA1
Yeah ur second code is more recommmended with these modifications.
hope this is useful.
thnks.
imran.

Similar Messages

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

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

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

  • Error on extend an internal table, but the required space was not available

    Hi All,
    I am trying to retrieve cost data from COVP tables, as well as the quantity, cost centre, and price unit fields from MSEG / BSEG tables. Thing is, if the AWTYP value in COVP table = 'MKPF', i have to get the data from MSEG, otherwise, I need to get it from BSEG table.
    I kept getting this error message:
    <i>You attempted to extend an internal table, but the required space was not available.</i>
    Anyone have any idea how to make my codes more efficient?
    Please help. Thanks!
    Regards,
    Cecilia
    REPORT  ZMISCY004.
    TABLES : COVP, BSIS, BSEG, MSEG, MAKT, CSKU.
    PARAMETERS :
    P_FILE(300) DEFAULT '\sapdcdatasaprptoh.txt' LOWER CASE.
    DATA MSG_TEXT(50).
    DATA :
    XKOKRS LIKE COVP-KOKRS,
    XBELNR LIKE COVP-BELNR,
    XBUZEI LIKE COVP-BUZEI,
    XGJAHR LIKE COVP-GJAHR,
    XPERIO LIKE COVP-PERIO,
    XWKGBTR LIKE COVP-WKGBTR,
    XWTGBTR LIKE COVP-WTGBTR,
    XREFBN LIKE COVP-REFBN,
    XREFBZ LIKE COVP-REFBZ,
    XKSTAR LIKE COVP-KSTAR,
    XBEKNZ LIKE COVP-BEKNZ,
    XMATNR LIKE COVP-MATNR,
    XBUKRS LIKE COVP-BUKRS,
    XREFGJ LIKE COVP-REFGJ,
    XREFBK LIKE COVP-REFBK,
    XLTEXT LIKE CSKU-LTEXT,
    XMAKTX LIKE MAKT-MAKTX,
    XAWTYP LIKE COVP-AWTYP,
    XTWAER LIKE COVP-TWAER,
    XSGTXT LIKE COVP-SGTXT,
    BSEG_KOSTL LIKE BSEG-KOSTL,
    BSEG_MEINS LIKE BSEG-MEINS,
    BSEG_MENGE LIKE BSEG-MENGE,
    MSEG_KOSTL LIKE MSEG-KOSTL,
    MSEG_MENGE LIKE MSEG-MENGE,
    MSEG_MEINS LIKE MSEG-MEINS.
    DATA : BEGIN OF ITAB_COVP OCCURS 10,
    KOKRS LIKE COVP-KOKRS,
    BELNR LIKE COVP-BELNR,
    BUZEI LIKE COVP-BUZEI,
    GJAHR LIKE COVP-GJAHR,
    PERIO LIKE COVP-PERIO,
    WKGBTR(15) TYPE C,
    WTGBTR(15) TYPE C,
    REFBN LIKE COVP-REFBN,
    REFBZ(3) TYPE C,
    KSTAR LIKE COVP-KSTAR,
    BEKNZ LIKE COVP-BEKNZ,
    MATNR LIKE COVP-MATNR,
    BUKRS LIKE COVP-BUKRS,
    REFGJ LIKE COVP-REFGJ,
    REFBK LIKE COVP-REFBK,
    LTEXT LIKE CSKU-LTEXT,
    MAKTX LIKE MAKT-MAKTX,
    AWTYP LIKE COVP-AWTYP,
    TWAER LIKE COVP-TWAER,
    SGTXT LIKE COVP-SGTXT,
    BSIS_WRBTR(13) TYPE C,
    BSEG_KOSTL LIKE BSEG-KOSTL,
    BSEG_MEINS LIKE BSEG-MEINS,
    BSEG_MENGE LIKE BSEG-MENGE,
    MSEG_KOSTL LIKE MSEG-KOSTL,
    MSEG_MENGE LIKE MSEG-MENGE,
    MSEG_MEINS LIKE MSEG-MEINS.
    DATA : END OF ITAB_COVP.
    SELECT M1~KOKRS
           M1~BELNR
           M1~BUZEI
           M1~GJAHR
           M1~PERIO
           M1~WKGBTR
           M1~WTGBTR
           M1~REFBN
           M1~REFBZ
           M1~KSTAR
           M1~BEKNZ
           M1~MATNR
           M1~BUKRS
           M1~REFGJ
           M1~REFBK
           M1~AWTYP
           M1~TWAER
           M1~SGTXT
           M4~KOSTL
           M4~MENGE
           M4~MEINS
    INTO (XKOKRS,
          XBELNR,
          XBUZEI,
          XGJAHR,
          XPERIO,
          XWKGBTR,
          XWTGBTR,
          XREFBN,
          XREFBZ,
          XKSTAR,
          XBEKNZ,
          XMATNR,
          XBUKRS,
          XREFGJ,
          XREFBK,
          XAWTYP,
          XTWAER,
          XSGTXT,
          MSEG_KOSTL,
          MSEG_MENGE,
          MSEG_MEINS
    FROM COVP AS M1
    LEFT OUTER JOIN MSEG AS M4
    ON M1~REFBN = M4~MBLNR AND M1~REFBZ = M4~ZEILE AND M1~REFGJ = M4~MJAHR
    WHERE M1~SCOPE = 'OCOST' AND M1~AWTYP = 'BKPF'
      OR M1~SCOPE = 'OCOST' AND M1~AWTYP = 'MKPF'
      OR M1~KSTAR = '972022'.
    IF XAWTYP = 'BKPF'.
    SELECT KOSTL MENGE MEINS INTO (BSEG_KOSTL, BSEG_MENGE, BSEG_MEINS) FROM
    BSEG WHERE BELNR = XREFBN AND BUZEI = XREFBZ AND GJAHR = XREFGJ AND
    BUKRS = XREFBK.
    ENDSELECT.
    MOVE BSEG-KOSTL TO BSEG_KOSTL.
    MOVE BSEG-MEINS TO BSEG_MEINS.
    MOVE BSEG-MENGE TO BSEG_MENGE.
    ELSE.
    MOVE ' ' TO BSEG_KOSTL.
    MOVE ' ' TO BSEG_MEINS.
    MOVE ' ' TO BSEG_MENGE.
    ENDIF.
    *GET LTEST
    SELECT LTEXT INTO XLTEXT
    FROM CSKU
    WHERE KTOPL = 'COAA' AND SPRAS = 'EN'.
    *GET MAKTX
    IF XMATNR <> ' '.
    SELECT SINGLE * FROM MAKT WHERE MATNR = XMATNR.
    MOVE MAKT-MAKTX TO XMAKTX.
    ELSE.
    MOVE ' ' TO XMAKTX.
    ENDIF.
    MOVE : XKOKRS TO ITAB_COVP-KOKRS,
           XBELNR TO ITAB_COVP-BELNR,
           XBUZEI TO ITAB_COVP-BUZEI,
           XGJAHR TO ITAB_COVP-GJAHR,
           XPERIO TO ITAB_COVP-PERIO,
           XWKGBTR TO ITAB_COVP-WKGBTR,
           XWTGBTR TO ITAB_COVP-WTGBTR,
           XREFBN TO ITAB_COVP-REFBN,
           XREFBZ TO ITAB_COVP-REFBZ,
           XKSTAR TO ITAB_COVP-KSTAR,
           XBEKNZ TO ITAB_COVP-BEKNZ,
           XMATNR TO ITAB_COVP-MATNR,
           XBUKRS TO ITAB_COVP-BUKRS,
           XREFGJ TO ITAB_COVP-REFGJ,
           XREFBK TO ITAB_COVP-REFBK,
           XLTEXT TO ITAB_COVP-LTEXT,
           XMAKTX TO ITAB_COVP-MAKTX,
           XAWTYP TO ITAB_COVP-AWTYP,
           XTWAER TO ITAB_COVP-TWAER,
           XSGTXT TO ITAB_COVP-SGTXT,
           BSEG_KOSTL TO ITAB_COVP-BSEG_KOSTL,
           BSEG_MEINS TO ITAB_COVP-BSEG_MEINS,
           BSEG_MENGE TO ITAB_COVP-BSEG_MENGE,
           MSEG_KOSTL TO ITAB_COVP-MSEG_KOSTL,
           MSEG_MENGE TO ITAB_COVP-MSEG_MENGE,
           MSEG_MEINS TO ITAB_COVP-MSEG_MEINS.
    APPEND ITAB_COVP.
    CLEAR ITAB_COVP.
    ENDSELECT.
    ENDSELECT.
    OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE.
    IF SY-SUBRC NE 0.
       WRITE: 'File cannot be opened. Reason:', MSG_TEXT.
       EXIT.
    ENDIF.
    LOOP AT ITAB_COVP.
    TRANSFER ITAB_COVP TO P_FILE.
    ENDLOOP.
    CLOSE DATASET P_FILE.

    Cecilia - I think your problemn is a nested select:
    *GET LTEST
      SELECT ltext INTO xltext
      FROM csku
      WHERE ktopl = 'COAA' AND spras = 'EN'.
    *GET MAKTX
        IF xmatnr <> ' '.
          SELECT SINGLE * FROM makt WHERE matnr = xmatnr.
          MOVE makt-maktx TO xmaktx.
        ELSE.
          MOVE ' ' TO xmaktx.
        ENDIF.
        MOVE : xkokrs TO itab_covp-kokrs,
                     etc.
              mseg_meins TO itab_covp-mseg_meins.
        APPEND itab_covp.
        CLEAR itab_covp.
      ENDSELECT.
    Do you need to do the inner select for every cost element text?
    Rob

  • Dynamic Internal Table with the same name

    Hey Guys
    I have a question.
    I know that we can create dynamic internal table taking a struct dynamically.
    But I have 2 ques on the same subject.
    1. Can we create an internal table based on a type that we have locally declared eg
    types: begin of ty_demo.
               var1(1) type c,
               var2     type p,
              end of ty_demo.
    2. If an internal table is already declared based on the above type say data: i_tab type standard table of ty_demo.
        If i need to enhance the struct of this internal table. Can i do that by dynamically redefining it based on a different structure but keepin the same name i_tab.
    In a nut shell I cannot change the name of my itab but I want to enhance the structure.
    I Hope I am clear.
    Help will be greatly apprcieated.
    Thanks
    Sameer

    hai.
    we can create an internal table based on a type that we have locally declared, but you have to use data instead of types like.
    data: begin of ty_demo.
    var1(1) type c,
    var2 type p,
    end of ty_demo.
    check the example notes for dynamic itab .
    Dynamic internal table is internal table that we create on the fly with flexible column numbers.
    For sample code, please look at this code tutorial. Hopefully it can help you
    Check this link:
    http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
    Sample code:
    DATA: l_cnt(2) TYPE n,
    l_cnt1(3) TYPE n,
    l_nam(12),
    l_con(18) TYPE c,
    l_con1(18) TYPE c,
    lf_mat TYPE matnr.
    SORT it_bom_expl BY bom_comp bom_mat level.
    CLEAR: l_cnt1, <fs_dyn_wa>.
    Looping the component internal table
    LOOP AT it_bom_expl INTO gf_it_bom_expl.
    CLEAR: l_cnt1.
    AT NEW bom_comp.
    CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
    For every new bom component the material data is moved to
    temp material table which will be used for assigning the levels
    checking the count
    it_mat_temp[] = it_mat[].
    Component data is been assigned to the field symbol which is checked
    against the field of dynamic internal table and the value of the
    component number is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
    <fs_check>.
    <fs_check> = gf_it_bom_expl-bom_comp.
    ENDAT.
    AT NEW bom_mat.
    CLEAR l_con.
    ENDAT.
    lf_mat = gf_it_bom_expl-bom_mat.
    Looping the temp internal table and looping the dynamic internal table
    *by reading line by line into workarea, the materialxxn is been assigned
    to field symbol which will be checked and used.
    LOOP AT it_mat_temp.
    l_nam = c_mat.
    l_cnt1 = l_cnt1 + 1.
    CONCATENATE l_nam l_cnt1 INTO l_nam.
    LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
    ENDLOOP.
    IF <fs_xy> = lf_mat.
    CLEAR lf_mat.
    l_con1 = l_con.
    ENDIF.
    Checking whether the material exists for a component and if so it is
    been assigned to the field symbol which is checked against the field
    of dynamic internal table and the level of the component number
    against material is been passed to the dynamic internal table field
    value.
    IF <fs_xy> = gf_it_bom_expl-bom_mat.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    CLEAR l_con.
    MOVE gf_it_bom_expl-level TO l_con.
    CONCATENATE c_val_l l_con INTO l_con.
    CONDENSE l_con NO-GAPS.
    IF l_con1 NE space.
    CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
    CLEAR l_con1.
    l_cnt = l_cnt - 1.
    ENDIF.
    <fs_check> = l_con.
    l_cnt = l_cnt + 1.
    ENDIF.
    ENDLOOP.
    AT END OF bom_comp.
    At end of every new bom component the count is moved to the field
    symbol which is checked against the field of dynamic internal table
    and the count is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    <fs_check> = l_cnt.
    INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
    ENDAT.
    ENDLOOP.
    regards.
    sowjanya.b

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • How to display data from internal table in the SELECTION-SCREEN

    Hello Experts,
    My requirement is to display the data's from an internal table in the selection screen. I tried using selection-screen comment. But it is working only for a single record. Can anyone please tell me how to do this?

    Hi Ritika,
    we cant use write statement inside selection-screen.
    see my coding.
    SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-456.
      SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
                                          NO INTERVALS.
        SELECT-OPTIONS SEL1 FOR SY-DATUM.
        PARAMETERS     PAR1(10).
    <b>** I WANT ALL RECORDS FROM AN INTERNAL TABLE HERE ONLY</b>
        SELECTION-SCREEN END OF BLOCK BL1.
      SELECTION-SCREEN PUSHBUTTON 2(10)  but1 USER-COMMAND cli1.
      SELECTION-SCREEN PUSHBUTTON 20(10)  but2 USER-COMMAND cli2.
    SELECTION-SCREEN END OF SCREEN 123.

  • How do I select a range of rows from an internal table in the debugger?

    Hi,
    I have a case where I wanted to delete a range of rows (several thousand) from an internal table using the debugger.
    It seems that rows can only be selected one at a time by selecting (clicking) on the far left side of the row.
    This is cumbersome, if not impossible when wishing to delete several thousand rows. 
    Other tools, such as Excel for example, allow for selecting a range of rows by selecting the first row and then holding the SHIFT key and selecting the last row and all rows in between will be selected.
    I can't seem to find the combination of keys that will allow this in the table (or structure) tab of the debugger.
    Is it possible to select a range of rows without having to select each row one at a time?
    Thanks for your help,
    Andy

    While it's a Table Control and should/could have a button to select all fields (or visible fields)...I don't think we can do it right now...I know it's a pain to select each row one at a time...but I don't we have any more options...
    Greetings,
    Blag.

  • How to pass the contents of an internal table to the IDoc FIDCC2?

    Hi,
    I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
    I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
    Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
    Regards,
    Balaji. R

    Hi balaji,
    use function IDOC_INBOUND_FROM_FILE. This will do half the process.
    Documentation is missing, but program RSEINB00 explains something,
    also some links
    [http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
    [RSEINB00 does not work in background]
    [RSEINB00 flat file to idoc uploading in XI]
    [Loading flat idoc via report RSEINB00 into integration server fails]
    Hope it helps.
    Regards,
    Clemens

  • To Load data to internal  Table from  the spoolrequest

    HI  All,
          I'm trying to load a data to the internal table with  the  reference of  spoolrequest generated by the programme during background process. Can anyone help me.
    Regards,
    S.JANANI

    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    * Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.

  • Create an internal table with the rows of another internal table.

    Hi I want to know if posible to create an internal table structure with the  rows of another internal table?
    ex.
    If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
    Now I want that the structure of my internal table be: first, second, third

    Hi,
    If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
    Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
    Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
    Data: begin of second_table occurs 0,
    first type <first_table type>,
    second type <first_table type>,
    third type <first_table type>,
    end of second_table.
    Regards
    Prasenjit

  • Passing the Dynamic Internal Table as the Output Parameter of the FM...

    Hi,
    How can we pass the internal table as the output from the Function Module TABLES parameter.
        SELECT * FROM TVRO BYPASSING BUFFER INTO TABLE <ltable>.
    Now I need to pass the dynamic internal table <ltable> as the output in the function module.
    Thanks!
    Puneet.

    I can't use TVRO as the table type. The Table name is as the Input. This program will download the contents of the table and create an app server file. It can be for any database table.
    so i want the output of this FM should be the data from that table. So what should be the TABLE type.
    like in  a program i will use:::
      FIELD-SYMBOLS: <ltable> TYPE ANY TABLE,
                     <l_line> TYPE ANY,
                     <l_field> TYPE ANY.
        SELECT * FROM (p_table) BYPASSING BUFFER INTO TABLE <ltable>.
    That is my requirement.

  • Passing an Internal table to the Smartform

    Hi Experts,
    I have build an internal table in the driver program with some (20 fields) now I need to pass the same internal table to Smartform as importing parameter or Tables Parameter so that I can use the table data for my further processing.
    I have searched the forums and its look like I can't pass an Internal table to the smartform unless and until it is defined in the DDIC with the table types.
    FYI...
    I can't create the DDIC table type as it needs lot of approvals to get it created.
    Please help me on how to proceed further.
    Thanks in advance.
    Regards,
    Srinivas

    I can't create the DDIC table type as it needs lot of approvals to get it created.
    It's a shame you need approval for this.
    Anyway can you overcome this with field symbols:
    - type parameter in Smartform FM with TYPE STANDARD TABLE (or INDEX/SORTED/HASHED - depending which one you use)
    - pass your locally typed table
    - in SF create the same data type
    - declare field symbol with this type
    - assign the table from the parameter to this field symbol - this way you can work with the table via field symbol as it would be of the table type
    "in SF
      TYPES: tt_my_type TYPE TABLE OF my_type..
      FIELD-SYMBOLS <tab> TYPE tt_my_type .
      "itab is parameter table
      ASSIGN itab TO <tab>.
      "now you can even address its components
       <wa_tab>-field1 = ...
    Although FM parameters in general should be typed with DDIC types only, this way you can cheat the system a little bit;)
    Regards
    Marcin

  • Moving  data in all the internal tables to the final table  t_data

    hi all,
    how to data in all the internal tables to the final table  t_data
    *selecting fields from bkpf table
      SELECT     bukrs
                 belnr
                 gjahr
                 bldat
                 xblnr
                 usnam
         FROM    bkpf
         INTO TABLE t_bkpf
        WHERE  bukrs  EQ po_bukrs AND
               belnr IN  so_belnr  AND
               budat IN  so_budat  AND
               blart IN  so_blart.
      IF t_bkpf[] IS INITIAL.
        MESSAGE a999(zfi_ap_gl) WITH text-011.
        STOP.
      ELSE.
    *selecting fields from  bseg table.
        SELECT  bukrs
                belnr
                gjahr
                koart
                shkzg
                dmbtr
                zuonr
                sgtxt
                kostl
                hkont
                lifnr
                prctr
                FROM bseg
                INTO  TABLE  t_bseg
                FOR ALL ENTRIES IN t_bkpf
              WHERE bukrs EQ  t_bkpf-bukrs AND
                    belnr EQ t_bkpf-belnr AND
                    gjahr EQ t_bkpf-gjahr AND
                    lifnr IN so_lifnr.
      ENDIF.
      IF t_bseg[] IS INITIAL.
        MESSAGE a999(zfi_ap_gl) WITH text-011.
        STOP.
      ELSE.
    *selecting the companies address from adrc table
        SELECT  SINGLE addrnumber street str_suppl2 city1
                       region post_code1
                       FROM adrc
                       INTO wa_adrc
                       WHERE addrnumber EQ w_adrnr.
    *selecting adrnr from the lfa1 table
        SELECT lifnr adrnr name1 ort01 regio pstlz
                     FROM lfa1
                     INTO TABLE t_adrnr
                     FOR ALL ENTRIES IN t_bseg
                     WHERE  lifnr EQ t_bseg-lifnr.
        IF NOT t_adrnr[] IS INITIAL.
    *populating the t_vaddress table.
          SELECT  addrnumber
                  street
                  str_suppl2
                  FROM adrc
                  INTO TABLE t_vaddress
                  FOR ALL ENTRIES IN t_adrnr
                  WHERE addrnumber  EQ t_adrnr-adrnr.
    *populating the t_vendor table with the vendor address
          SELECT lifnr
                 adrnp_2
                 namev
                 name1
                 INTO TABLE t_vendor
                 FROM knvk
                 FOR ALL ENTRIES IN t_adrnr
                 WHERE  lifnr EQ t_adrnr-lifnr AND
                        adrnp_2 EQ t_adrnr-adrnr.
        ENDIF.
      ENDIF.

    Loop the internal table which is having the maximum number of records,then use read table....for other internal tables....in that loop and then append them into final internal table.
    Ex-LOOP AT IT_VBRP INTO WA_VBRP.
        WA_FINAL-WERKS = WA_VBRP-WERKS_I.
        WA_FINAL-KUNAG = WA_VBRP-KUNAG.
        WA_FINAL-AEDAT = WA_VBRP-AEDAT.
        READ TABLE IT_KONV INTO WA_KONV WITH KEY KNUMV = WA_VBRP-KNUMV
                                                 KPOSN = WA_VBRP-POSNR_I.
        IF SY-SUBRC EQ 0.
          WA_FINAL-KSCHL = WA_KONV-KSCHL.
          CLEAR WA_KONV.
        ENDIF.
        READ TABLE IT_KNA1 INTO WA_KNA1  WITH KEY KUNNR = WA_VBRP-KUNAG.
        IF SY-SUBRC EQ 0.
          WA_FINAL-NAME1 = WA_KNA1-NAME1.
          CLEAR WA_KNA1.
        ENDIF.
        ENDIF.
        APPEND WA_FINAL TO IT_FINAL.
        CLEAR: WA_FINAL,WA_KONV,wa_kna1.
      ENDLOOP.

  • How to Read the internal table for the data download from the spool

    HI all,
    I have one issue regarding the spool ,we are getting the correct output as per requirement of  user but when we send the same to the user in pdf format they did notget the same.
    they are telling that the due date is missing from the pdf.
    Please advice me how to track the internal  table for the spool data converted intopdf in a readable format.
    the FM used for the above task is : 
    call function 'CONVERT_OTFSPOOLJOB_2_PDF'
    Please reply if any one worked on the same.
    Thanks in advance.
    Gaurav,

    Hi Wang,
    Please let me know how you solved your question.
    Points will be rewarded.
    Thanks,
    Arun.

  • Is it possible to view all open internal tables in the 4.7 debugger?

    Hello,
    Is it possible to view all open internal tables in the 4.7 debugger?
    Thx.
    Andy

    As far as i know in 4,7 there is no new debugger. But it is the new debugger which brings the functionality so i fear you go no chance.
    And for the rest who is still struggling on what OP meant: He meant the tab "globals" on the variables tab of the new debugger.

Maybe you are looking for