Collect in an internal table with keys plant and material

Hi ,
I have an output internal table with material , plant and var quantitites .
I would like to use Collect statement and sum the quantities but do it by plant and material .
How do I specify that i want to do it on plant or material ?
Thanks !

hi here is an example like urs..
DATA: BEGIN OF seats,
        carrid TYPE sflight-carrid,
        connid TYPE sflight-connid,
        seatsocc TYPE sflight-seatsocc,
      END OF seats.
DATA seats_tab LIKE HASHED TABLE OF seats
               WITH UNIQUE KEY carrid connid.
SELECT carrid connid seatsocc
       FROM sflight
       INTO seats.
  COLLECT seats INTO seats_tab.
ENDSELECT.
check for help..
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
regards,
venkat

Similar Messages

  • Read internal table with key not equal to

    Hi,
    How can I read internal table with key not equal to some other field.
    Basically in read statement we can read only fields equal to others fields.

    Hi,
    Test the following Code you can Use Loop at for this But not Read Table
    DATA: BEGIN OF it_test OCCURS 10,
      f1(4),
      f2 TYPE i,
      f3(2),
      END OF it_test.
    DATA: it_test2 LIKE STANDARD TABLE OF it_test WITH HEADER LINE.
    it_test-f1 = '1000'.
    it_test-f2 = 10.
    it_test-f3 = 'B'.
    APPEND it_test TO it_test.
    it_test-f1 = '2000'.
    it_test-f2 = 10.
    it_test-f3 = 'A'.
    APPEND it_test TO it_test.
    it_test-f1 = '1000'.
    it_test-f2 = 10.
    it_test-f3 = 'B'.
    APPEND it_test TO it_test.
    it_test-f1 = '1000'.
    it_test-f2 = 10.
    it_test-f3 = 'A'.
    APPEND it_test TO it_test.
    it_test-f1 = '1000'.
    it_test-f2 = 40.
    it_test-f3 = 'A'.
    APPEND it_test TO it_test.
    LOOP AT it_test INTO it_test WHERE f3 NE 'A'.
      WRITE: / it_test-f1, it_test-f2, it_test-f3.
    ENDLOOP.
    Kind Regards,
    Faisal

  • Read the internal table with key

    Hi friends,
    decleration of internal table is :
    TYPES : BEGIN OF ty_qmel,
              qmart TYPE qmel-qmart,
              qmnum TYPE qmel-qmnum,
              qmtxt TYPE qmel-qmtxt,
              strmn TYPE qmel-strmn,
              ltrmn TYPE qmel-ltrmn,
              objnr TYPE qmel-objnr,
              qmdat TYPE qmel-qmdat,
            END OF ty_qmel.
    i have written the query as follows .
    SELECT  qmart qmnum qmtxt strmn ltrmn FROM qmel
       INTO CORRESPONDING FIELDS OF TABLE i_qmel
       FOR ALL ENTRIES IN i_qmel
       WHERE qmart EQ i_qmel-qmart.
    I am getting the data into 1_qmel.
    Let me know how to read this table with key...?
    Thanks in advance...

    Hi,
    Refer this code.
    *&      Form  SUB_COLLECT_DATA
          text
    FORM sub_collect_data.
    *--Local variables
      DATA : lv_count(3) TYPE c.
      IF NOT it_fpltc[] IS INITIAL.
        LOOP AT it_fpltc INTO wa_fpltc.
          lv_count = wa_fpltc-fpltr+3(3).
          wa_final-ccnum = wa_fpltc-ccnum.
          wa_final-rfzei = lv_count.
          CLEAR : wa_vbrk.
          READ TABLE it_vbrk INTO wa_vbrk WITH KEY rplnr = wa_fpltc-fplnr
                                                   BINARY SEARCH.
          IF sy-subrc EQ 0.
            wa_final-vbeln = wa_vbrk-vbeln.
            wa_final-bukrs = wa_vbrk-bukrs.
          ENDIF.
          APPEND wa_final TO it_final.
          CLEAR : wa_vbrk,
                  wa_fpltc,
                  lv_count.
        ENDLOOP.
    Regards,
    PRashant

  • Internal table with same variable and one select query

    Hi,
    I am a new bee here with may be a silly question.
    I have a internal table as below.
    DATA: BEGIN OF IT_ORDERDETAILS OCCURS 0,
            VBELN LIKE VBAK-VBELN,        "Order number
            BSTNK LIKE VBAK-BSTNK,        "customer PO
            ERDAT LIKE VBAK-ERDAT,        " Order created date
            MATNR LIKE VBAP-MATNR,        "Sales order line item
            KWMENG LIKE VBAP-KWMENG,      "Quantity
            D_VBELN like likp-vbeln,      " delivery no
            POSNR like lips-posnr,        " delivery item
            KUNNR LIKE LIKP-KUNNR,        "ship quantity
      END OF IT_ORDERDETAILS.
    Where VBELN field is in VBAK and LIKP table.
    VBELN in VBAK table = order #
    VBELN in LIKP table is = Delivery #
    I want to use join to fetch data in single select query.
    Below is the select query
    SELECT VBAK~VBELN
            VBAK~BSTNK
            VBAK~ERDAT
            VBAP~MATNR
            VBAP~KWMENG
            likp~vbeln
            lips~posnr
            LIPS~VGBEL
          INTO (IT_ORDERDETAILSvbak, IT_ORDERDETAILSbstnk,     IT_ORDERDETAILSerdat, IT_ORDERDETAILSmatnr, IT_ORDERDETAILSkwmeng, IT_ORDERDETAILSd_vbeln,IT_ORDERDETAILSposnr, IT_ORDERDETAILSkunnr)
    FROM VBAK left outer JOIN VBAP ON ( VBAKVBELN = VBAPVBELN )
    left outer JOIN LIPS ON ( VBAKVBELN = LIPSVGBEL )
      join LIKP on ( LIPSVBELN = LIKPVBELN )
    WHERE VBAK~ERDAT IN CR_DATE.
    I am getting error in the query.
    Please suggest.
    Thanks,
    Rajesh

    Hi rajesh.nayakbola,
    although this is not quite the right place for this, let me give you some notes:
    1. Code should be
    formatted as code
    by markin it with mouse and use above <> button.
    2. Internal tables shoult not be declared using OCCURS clause - this is last century style
    3. Internal tables do not need and should not have a header line, they should use TYPES for declaration
    4. Data should not be declared using LIKE: If they refer to dictionary TYPES, use TYPE. LIKE is only mandatory for data objects declared in your program, i.e. DATA IT_some_ORDERDETAILS like IT_ORDERDETAILS.
    5. If you get an error here, never write "I am getting error" but copy and paste the error message fully.
    - The fields in brackets in  the INTO clause never have ~ character, there is no IT_ORDERDETAILS~vbak, only IT_ORDERDETAILS-vbeln
    It could be something like this:
    TYPES:
      BEGIN OF TY_ORDERDETAILS,
      VBELN TYPE VBAK-VBELN, "Order number
      BSTNK TYPE VBAK-BSTNK, "customer PO
      ERDAT TYPE VBAK-ERDAT, " Order created date
      MATNR TYPE VBAP-MATNR, "Sales order line item
      KWMENG TYPE VBAP-KWMENG, "Quantity
      D_VBELN TYPE likp-vbeln, " delivery no
      POSNR TYPE lips-posnr, " delivery item
      KUNNR TYPE LIKP-KUNNR, "ship quantity
    END OF TY_ORDERDETAILS.
    DATA:
      IT_ORDERDETAILS TYPE TABLE OF TY_ORDERDETAILS.
    SELECT VBAK~VBELN
      VBAK~BSTNK
      VBAK~ERDAT
      VBAP~MATNR
      VBAP~KWMENG 
      likp~vbeln AS D_VBELN
      lips~posnr
      LIKP~KUNNR
    INTO CORRSPONDING FIELDS OF TABLE IT_ORDERDETAILS
    FROM VBAK left outer JOIN VBAP ON ( VBAK~VBELN = VBAP~VBELN )
      left outer JOIN LIPS ON ( VBAK~VBELN = LIPS~VGBEL )
      join LIKP on ( LIPS~VBELN = LIKP~VBELN )
    WHERE VBAK~ERDAT IN CR_DATE.
    Regards,
    Clemens

  • Differences between Internal table with Occurs 0 and Field-Groups?

    Is there really any difference between just using an internal table with an OCCURS 0 statement-- which would write the entire table to paging space-- and using field-groups? How is Field-Groups is more effective than Internal tables with occurs 0 when it comes to performance?
    Could anybody please give some information regarding above question?
    Thanks,
    Surya.

    hi,
    occurs 0 means it wont create any extra memory. based on the records only the memory is allocated to internal tables at run time. but when an internal table is created it can hold data of type to which it is declared.
    i.e data: itab like mara occurs 0 with header line.
    can take data only from mara table
    we can also do in another way as using types keyword we can declare a standard structure and create a internal table of that type. its also not that useful as we have to change the structure depending on changes for storing data.
    for this purpose field symbols are used. field symbols can hold any data means that they can point to tables, fields, any standard or user-defined types. field symbols actually points to respective types by which we can directly access to that types using field symbols.
    filed symbols works more faster than internal tables.
    if helpful reward some points.
    with regards,
    Suresh.A

  • Internal table with header line and work area.

    data:itab like LIKE bapimepoheader.
    DATA : BEGIN OF it_po_items OCCURS 0.
            INCLUDE STRUCTURE bapimepoitem.
    DATA : END OF it_po_items.
    DATA:it_input         TYPE STANDARD TABLE OF typ_input,
          wa_input         TYPE typ_input,
    LOOP AT it_input INTO wa_input WHERE poind = 'H'.
    CLEAR wa_po_header.
      wa_po_header-doc_type  = wa_input-bsart.
      wa_po_header-comp_code = wa_input-bukrs.
      wa_po_header-vendor    = wa_input-lifnr.
    CLEAR it_po_items.
      it_po_items-po_item = v_itemcount * 10.
      it_po_items-acctasscat = wa_input-knttp.
      it_po_items-material   = wa_input-matnr.
      it_po_items-plant      = wa_input-werks.
      it_po_items-quantity   = wa_input-menge.
      it_po_items-net_price  = wa_input-netpr.
      it_po_items-po_unit    = wa_input-meins.
      it_po_items-free_item  = wa_input-umson.
      it_po_items-tax_code   = wa_input-mwskz.
      it_po_items-gr_ind     = wa_input-wepos.
      it_po_items-gr_non_val = wa_input-weunb.
      it_po_items-incoterms1 = wa_input-inco1.
      it_po_items-incoterms2 = wa_input-inco2.
      it_po_items-vend_mat   = wa_input-idnlf.
      it_po_items-taxjurcode = wa_input-txjcd.
      it_po_items-item_cat   = wa_input-pstyp.
      APPEND it_po_items.
    here my doubt is whether i can move data from work area to internal table in this way?
    whether this is the correct approach or not?

    hii,
    u can define structure and make workarea ,internal table using that structure.
    for example
    types:begin of struct,
             declare all fields,
             end of struct.
    data:wa type struct,
           int_tab type standard table of struct.
    hope this will help u.

  • Sorting internal table with line types

    Hi,
    I have internal table juts for an example with four entries as below:
    A[]
    Line.....Line Types
    444001.....P
    New York...C 
    Evershine..B
    Mary.......N
    I want to sort the internal table with line types in order of lin types NBCP.
    How can i do this ?
    Please help.
    Note: Above example is just with four entries, there might be internal table with ten entries and ten defined sorting order for line types.

    Hi Tushar,
    Please note that we can't changes the mandatory sequence of the address format as defined in the country specif address format. We can change the sequence of others fields by line_priority.
    Try to change the address type :
    ADDRESS_TYPE - Address type (from 3.0C)
    There are three types of address:
    Address type '1': addresses of firms or organizations; the address structure which is used in most SAP applications as 'Address'.
    Address type '2': address of a person
    Address type '3': work address, usually the address of a contact person in a company
    Please use T/code "OY01"> Select Country> Example :AU"--> Display --> Select address key and press F1. You will find SAP 's Address format configuration .
    sap help:
    Formatting Routine Key for Printing Addresses
    For printing addresses, there are country-specific routines which in each case copy the correct postal formatting of the address.
    The three-character "Address Layout Key" for the recipient country controls which of the routines available for formatting addresses in the relevant country is used.
    These routines are programmed into the ADDRESS_INTO_PRINTFORM function module.
    They are based on different national and international guidelines and norms, including:
    ISO 11180,
    contracts of the World Postal Union (Seoul 1994),
    international address samples from the World Postal Union
    as well as the available rules of the individual countries.
    Below you will find an overview of the country-specific formats currently implemented.
    Customers can program their own formatting routines using a customer exit. The SZAD0001 SAP enhancement has been defined in the package SZAD for this (-> transaction CMOD).
    General formatting rules
    The following parameters are used depending on the transaction:
    whether the company address (street/house number) or the P.O. Box address is printed if both exist,
    how many lines are available for printing,
    which is the sender country.
    If there are not enough lines, then lines are left out according to a standard sequence.
    The address format depends on whether the sender country is the same as, or different from, the recipient country. The country is always specified from abroad, either as a text name, or as an identification code of up to three characters (license plate code or country key).
    Where the country name is written out in full, it is written in the language of the sender country. If a language is not specified for the sender country, or the sender country itself is not specified, the logon language is used instead.
    Exception: the language for the country code can be explicitly overwritten by a parameter in the print program (e.g. when the country code for customs transit papers is always to be specified in a particular language, such as English). if the "Print country name in recipient language" flag is set in the print program, the recipient language is used.
    Other language-dependent components such as the title and the word 'PO Box' are printed in the recipient language or the recipient country language. If this cannot be determined, the logon language is again used.
    For all formats except Great Britain (006), Japan (013), and South Korea (017), the core of the address is formatted as follows (without empty lines, except for the compulsory empty line:)
    title line (if applicable)
    name block (differs depending on the address type, see below)
    street address or PO Box
                            (compulsory empty line, if applicable)
    city line with postal code
    country code (if applicable)
    The city line and the country name are always printed in upper case for foreign addresses (only for the complete address, not for short forms).
    The name block generally consists of the following:
    "Normal" addresses (address type SPACE and address type 1):
    NAME1
    NAME2
    NAME3
    NAME4
    Personal addresses (address type 2):
    Title of person and name of person
    Business address with department and contact person (address type 3):
    NAME1
    NAME2
    NAME3
    NAME4
    department
    title of person and name of person
    In addresses entered using Business Address Services (central address management) (see Release notes Central Address Management for Release 4.0 and Central Address Management for Release 4.5 ), the street address can comprise several lines (see Print street address), otherwise street and house number are maintained in the Street field.
    Some countries do not have a compulsory empty line (see notes below). The city and district are printed in the city line, connected by a hyphen (exceptions: 004 USA, 006 Great Britain/Ireland, 013 Japan, 015 Germany, 017 South Korea, 019 Denmark), provided that the total length does not exceed 35 characters. If a different city is specified for the PO Box (PFORT), this is used in the PO Box address.
    In all formats which use a country code (currently 001 European standard format 002 Italy, 011 Switzerland and 014 Austria ), the license plate code for that country is used. If this is not maintained, the country key in table T005 is used.
    If the "Print country name in foreign addresses" flag is set for the sender country in table 005, the country code is not used; the country name is printed in the last line of the address.
    Formats 004 (USA), 005 (Canada) and 008 (Singapore) contain a line ('F') for the function of the contact person in the company (if address type = '3'). This line comes immediately after the line 'N' (Name (and title) of the natural person).
    In formats 002 (Italy), 004 (USA), 005 (Canada), 006 (Great Britain), 007 (Brazil) and Australia (009), the REGIO field (Region, State, Province, County) is formatted. For the USA, Canada, Brazil and Australia, the key from table T005S is used; for Great Britain the text name from table T005U.
    In all countries for which no "Address structure key" is maintained, a standard format is used which corresponds to format "010".
    Hope this may help you.
    Lanka

  • BADI cant use an internal table with header line

    hi,
         In BADI, we cant use an internal table with header line, and I am calling a function module which requires internal table as import parameter, now, the table I am passing is without a header line, So how to solve this problem ?

    You can use a type and then create an internal table of that type.
    types :
    begin of t_<example>
    *field list
    end of t_<example>
    data :
    gt_<table> type standard table of t_<example>
    pass this to the FM

  • How to read an internal table with more than  one (2 or 3) key field(s).

    how to read an internal table with more than  one (2 or 3) key field(s). in ecc 6.0 version

    hi ,
    check this..
    report.
    tables: marc,mard.
    data: begin of itab occurs 0,
          matnr like marc-matnr,
          werks like marc-werks,
          pstat like marc-pstat,
          end of itab.
    data: begin of itab1 occurs 0,
          matnr like mard-matnr,
          werks like mard-werks,
          lgort like mard-lgort,
          end of itab1.
    parameters:p_matnr like marc-matnr.
    select matnr
           werks
           pstat
           from marc
           into table itab
           where matnr = p_matnr.
    sort itab by matnr werks.
    select matnr
           werks
           lgort
           from mard
           into table itab1
           for all entries in itab
           where matnr = itab-matnr
           and werks = itab-werks.
    sort itab1 by matnr werks.
    loop at itab.
    read table itab1 with key matnr = itab-matnr
                              werks = itab-werks.
    endloop.
    regards,
    venkat.

  • How to read from an internal table with multiple key fields.

    Hi All!!
    I want to read from an internal table having keys as k1,k2,k3.
    How can I use read statement to read an entry having this as the key fields.
    Thanks in adavance..
    Prabhas Jha

    hi there
    use:
    sort itab by K1 K2 K3.
    read table itab into wa with key K1 = value 1
                                                  K2 = value2
                                                  K3 = value 3
                                                   BINARY SEARCH.
    where:
    itab is ur internal table
    wa is the work area with the same line type as the itab
    cheers
    shivika

  • Internal table with variable no of columns

    Hi All,
    I have to create an internal table with some fixed columns and rest of the table should be dynamic. The total no of columns depends on a field of some other table. hence, the number of columns of the table are unknown. How to create such a table.
    Thanks,
    Neha

    Execute this program .. we will get a fair idea about how the dyanmic column are populated in the table. Based on that u can write ur sceond table with 92 columns
    *& Report  ZTEST009
    REPORT  ztest009 NO STANDARD PAGE HEADING LINE-SIZE 60 LINE-COUNT 2(1).
    TYPE-POOLS : slis.
    TYPES : BEGIN OF internal,
            matnr(18),
            werks(4),
            qtyn(20),
            desc(20) TYPE c,
            qty TYPE i,
            END OF internal.
    DATA : it TYPE TABLE OF internal,
           wa TYPE internal.
    DATA : fieldcat  TYPE lvc_t_fcat,
           lcat      TYPE lvc_s_fcat,
           final_cat TYPE slis_t_fieldcat_alv,
           fcat      TYPE slis_fieldcat_alv,
           top       TYPE slis_t_listheader,
           events    TYPE slis_t_event,
           layout    TYPE slis_layout_alv.
    DATA : newfield  TYPE REF TO data,
           newdata   TYPE REF TO data.
    FIELD-SYMBOLS : <fs1>,
                    <dynamic_value>,
                    <dynamic_cat> TYPE STANDARD TABLE.
    START-OF-SELECTION.
      PERFORM popudate.
      PERFORM buildcat.
      PERFORM loadata.
      PERFORM events USING events.
      PERFORM header USING top.
      PERFORM layout.
    END-OF-SELECTION.
      PERFORM display.
    *&      Form  popudate
          text
    -->  p1        text
    <--  p2        text
    FORM popudate .
      DEFINE popu.
        wa-matnr = &1.
        wa-werks = &2.
        wa-qtyn = &3.
        wa-desc = &4.
        wa-qty = &5.
        append wa to it.
        clear wa.
      END-OF-DEFINITION.
      popu 'material1' 'pla1' 'QTY1' 'quantity1' 100.
      popu 'material1' 'pla1' 'QTY2' 'quantity2' 200.
      popu 'material1' 'pla1' 'QTY3' 'quantity3' 300.
      popu 'material2' 'pla2' 'QTY1' 'quantity1' 400.
      popu 'material2' 'pla2' 'QTY2' 'quantity2' 500.
      popu 'material2' 'pla2' 'QTY3' 'quantity3' 600.
      popu 'material3' 'pla3' 'QTY1' 'quantity1' 700.
      popu 'material3' 'pla3' 'QTY2' 'quantity2' 400.
      SORT it BY matnr.
    ENDFORM.                    " popudate
    *&      Form  buildcat
          text
    -->  p1        text
    <--  p2        text
    FORM buildcat .
      lcat-fieldname = 'MATNR'.
      lcat-datatype = 'CHAR'.
      lcat-seltext = 'Material'.
      lcat-intlen = 18.
      APPEND lcat TO fieldcat.
      CLEAR lcat.
      lcat-fieldname = 'WERKS'.
      lcat-datatype = 'CHAR'.
      lcat-seltext = 'Plant'.
      lcat-intlen = 4.
      APPEND lcat TO fieldcat.
      CLEAR lcat.
      LOOP AT it INTO wa.
        READ TABLE fieldcat INTO lcat WITH KEY fieldname = wa-qtyn.
        IF sy-subrc <> 0.
          lcat-fieldname = wa-qtyn.
          lcat-datatype = 'CHAR'.
          lcat-seltext = wa-desc.
          lcat-intlen = 10.
          APPEND lcat TO fieldcat.
          CLEAR lcat.
        ENDIF.
      ENDLOOP.
      CLEAR lcat.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
          it_fieldcatalog           = fieldcat
       i_length_in_byte          =
        IMPORTING
          ep_table                  = newfield
       e_style_fname             =
    EXCEPTIONS
       generate_subpool_dir_full = 1
       others                    = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ASSIGN newfield->* TO <dynamic_cat>.
      CREATE DATA newdata LIKE LINE OF <dynamic_cat>.
      ASSIGN newdata->* TO <dynamic_value>.
    ENDFORM.                    " buildcat
    *&      Form   loadata
          text
    -->  p1        text
    <--  p2        text
    FORM  loadata .
      DATA flag TYPE i.
      LOOP AT it INTO wa.
        flag = 0.
        ASSIGN COMPONENT 'MATNR' OF STRUCTURE <dynamic_value> TO <fs1>.
        <fs1> = wa-matnr.
        ASSIGN COMPONENT 'WERKS' OF STRUCTURE <dynamic_value> TO <fs1>.
        <fs1> = wa-werks.
        CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
          EXPORTING
            i_input  = wa-qtyn
            i_langu  = sy-langu
          IMPORTING
            e_output = wa-qtyn.
        ASSIGN COMPONENT wa-qtyn OF STRUCTURE <dynamic_value> TO <fs1>.
        <fs1> = wa-qty.
        AT END OF matnr.
          APPEND <dynamic_value> TO <dynamic_cat>.
          CLEAR : <dynamic_value>.
        ENDAT.
        CLEAR : wa.
      ENDLOOP.
    ENDFORM.                    "  loadata
    **&      Form  display
          text
    -->  p1        text
    <--  p2        text
    FORM display .
      LOOP AT fieldcat INTO lcat.
        fcat-fieldname = lcat-fieldname.
        fcat-outputlen = lcat-intlen.
        fcat-seltext_l = lcat-seltext.
        APPEND fcat TO final_cat.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program             = sy-repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
         is_layout                      = layout
         it_fieldcat                    = final_cat
      IT_SORT                        =
      I_SAVE                         = ' '
      IS_VARIANT                     =
         it_events                      = events
        TABLES
          t_outtab                       = <dynamic_cat>
    ENDFORM.                    " display
    Regards,
    Aswin.

  • Creating dynamic internal table with deep structure

    Hi all,
    I need to create an internal table with deep structure dynamically. I've already created tables with method 'create_dynamic_table' but I'm struggling with the deep structure.
    I would need an internal table with the following structure:
    DATA: BEGIN OF lt_t1,
    s1 TYPE REF TO data,
    s2 TYPE REF TO data,
    END OF lt_t1.
    S1 and S2 have to be tables.
    It might be possible with RTTS but all the examples in the forums (that I've found so far) are related to at least one DDIC-structure. And that's my problem because both tables are created during runtime.
    Thank you in advance
    Nicola

    Hi Frédéric,
    I hope my english is good enough to explain it correctly:
    We use a function builder for SEM-BPS which copies data from one Cube to another. This Cube is transactional, so you can't easily read a structure out of DDIC.
    The export parameter of this function builder is a table with type 'any table'.
    Until today we used a fixed definition e.g.:
      TYPES:
        BEGIN OF xtyp_chas,
         /sie/sr_ocomp TYPE /b52/oisr_ocomp,
         /sie/ts_03psp TYPE /b52/oits_03psp,
         0activity     TYPE /bi0/oiactivity,
         0acty_elemt   TYPE /bi0/oiacty_elemt,
         0costelmnt    TYPE /bi0/oicostelmnt,
         0co_area      TYPE /bi0/oico_area,
         0creditor     TYPE /bi0/oicreditor,
         0currency     TYPE /bi0/oicurrency,
         0curtype      TYPE /bi0/oicurtype,
         0db_cr_ind    TYPE /bi0/oidb_cr_ind,
         0fiscper      TYPE /bi0/oifiscper,
         0fiscper3     TYPE /bi0/oifiscper3,
         0fiscyear     TYPE /bi0/oifiscyear,
         0metype       TYPE /bi0/oimetype,
         0network      TYPE /bi0/oinetwork,
         0part_actty   TYPE /bi0/oipart_actty,
         0part_cctr    TYPE /bi0/oipart_cctr,
         0piobjsv      TYPE /bi0/oipiobjsv,
         0project      TYPE /bi0/oiproject,
         0unit         TYPE /bi0/oiunit,
         0vtdetail     TYPE /bi0/oivtdetail,
         0vtstat       TYPE /bi0/oivtstat,
         0vtype        TYPE /bi0/oivtype,
         0bus_area     TYPE /bi0/oibus_area,
         0cashdetail   TYPE /bi0/oicashdetail,
         0cashtype     TYPE /bi0/oicashtype,
         0comp_code    TYPE /bi0/oicomp_code,
         0coorder      TYPE /bi0/oicoorder,
         0cs_dimen     TYPE /bi0/oics_dimen,
         0cs_unit      TYPE /bi0/oics_unit,
         0int_bus      TYPE /bi0/oiint_bus,
         0part_abcpr   TYPE /bi0/oipart_abcpr,
         0part_coord   TYPE /bi0/oipart_coord,
         0part_wbsel   TYPE /bi0/oipart_wbsel,
         0piovalue     TYPE /bi0/oipiovalue,
         0profit_ctr   TYPE /bi0/oiprofit_ctr,
         0ps_obj       TYPE /bi0/oips_obj,
         0statussys0   TYPE /bi0/oistatussys0,
         zfbwheroj     TYPE /bic/oizfbwheroj,
        END   OF xtyp_chas,
        BEGIN OF xtyp_kyfs,
          0amount      TYPE /bi0/oiamount,
          0quantity    TYPE /bi0/oiquantity,
          zf03oaws     TYPE /bic/oizf03oaws,
          zf03oqty     TYPE /bic/oizf03oqty,
          zf03ozsta    TYPE /bic/oizf03ozsta,
        END OF xtyp_kyfs,
        BEGIN OF xtyp_zf03g003,
          s_chas TYPE xtyp_chas,
          s_kyfs TYPE xtyp_kyfs,
        END   OF xtyp_zf03g003,
        xtyp_zf03g003_t TYPE HASHED TABLE OF xtyp_zf03g003
                          WITH UNIQUE KEY s_chas.
    DATA: lt_ibm_data TYPE xtyp_zf03g003_t,
          ls_ibm_data TYPE xtyp_zf03g003.
    So one table (s_chas) contains the characteristics of the Cube and the other (s_kyfs) contains the keyfigures. That's exactly the format we need for the export parameter. At the end of the program, we use the following coding to fill the export table (eto_chas):
    loop at lt_ibm_data into ls_ibm_data.
      collect ls_ibm_data-s_chas into eto_chas.
    endloop.
    So in this moment I give this table the structure that is needed to move the data into the cube. I can't change the requirement because it is a standard interface.
    I would like to change that coding to be dynamically. Because if somebody changes a charasteristic or a keyfigure in the cube, we would have to change the function builder too. I don't think that the SEM-BPS department will let us know every time they've changed something anyway.
    So I hope that my explanation wasn't too confusing
    Nicola

  • Internal table with Import and Export

    Hi All,
    Hi all
    Please let me know the use of <b>Internal table with Import and Export parameters and SET/GET parameters</b>, on what type of cases we can use these? Plese give me the syntax with some examples.
    Please give me detailed analysis on the above.
    Regards,
    Prabhu

    Hi Prabhakar,
    There are three types of memories.
    1. ABAP MEMORY
    2. SAP MEMORY
    3. EXTERNAL MEMORY.
    1.we will use EXPORT/ IMPORT TO/ FROM MEMORY-ID when we want to transfer between ABAP memory
    2. we will use GET PARAMETER ID/ SET PARAMETER ID to transfer between SAP MEMORY
    3. we will use EXPORT/IMPORT TO/FROM SHARED BUFFER to transfer between external memory.
    ABAP MEMORY : we can say that two reports in the same session will be in ABAP MEMORY
    SAP MEMORY: TWO DIFFERENT SESSIONS WILL BE IN SAP MEMORY.
    for ex: IF WE CALL TWO DIFFERENT TRANSACTIONS SE38, SE11
    then they both are in SAP MEMORY.
    EXTERNAL MEMORY: TWO different logons will be in EXTERNAL MEMORY.
    <b>Syntax</b>
    To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
    ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
    To fill one, use:
    SET PARAMETER ID <pid> FIELD <f>.
    This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
    To read an SPA/GPA parameter, use:
    GET PARAMETER ID <pid> FIELD <f>.
    This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
    To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
    The relevant fields must each be linked to an SPA/GPA parameter.
    On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
    On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.
    When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.
    When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.
    However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.
    Reading Data Objects from Memory
    To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    Saving Data Objects in Memory
    To read data objects from an ABAP program into ABAP memory, use the following statement:
    Syntax
    EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
    This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    Check this link.
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    Thanks,
    Susmitha.
    Reward points for helpful answers.

  • Collect message into internal table

    Hi,
    does any one knows how BAPIs or CALL TRANSACTIONs collect messages into internal table.
    My problem is that some BI with CALL TRANSACTION doesn't collect right message into return table and I would like to collect this last message after CALL TRANSACTION and therefore be sure that everything went OK.....
    thx
    mario

    hi
    good
    check this
    Call Transaction p_trans using ZBDC_Table
                                   Mode p_mode
                                 Update p_update
                          Messages into p_messages.
         Move sy-subrc to w__subrc.
       Scan the messages in YDCRAISES to see if we need to
       change the message class.
         Loop at p_messages.
              Select single msgtyp
                into w__msgtp
                from zdcraise
               where tcode  = p_messages-tcode  and
                     msgid  = p_messages-msgid  and
                     msgnr  = p_messages-msgnr.
              If sy-subrc = 0.
                 Move w__msgtp to p_messages-msgtyp.
                 Modify p_messages.
              EndIf.
         EndLoop.
       Dump the message table ?
         If w__ydcset-dumpmsg = True.
    thanks
    mrutyun^

  • Reg - Reading internal table with multiple record in a single field

    Dear Guru's,
                        i want to read a internal table with field having mutilple entries like
    read table READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
    But it says comma without preceding colon (after READ?).
    please guide me.....
    thanks & Regards,
    Balaji.S

    ya this is inside the loop.
    plz check....
    loop at lt_t2 into lt_t2_wa.
    READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
    endloop.
    thanks & Regards,
    Balaji.S

Maybe you are looking for