Good practices for ECC 6.0 wr.t. internal tables..

hi,
i am told that when defining internal tables in ecc 6.0, we shud avoid using OCCURS and WITH HEADER LINE.  and always use work areas..
is this right ? is this a good practice or a must ?
i followed this and created an internal table without a header line .then i  am using a collect statement in my programn which fails and says that IT is not with header line !!
COLLECT ITT.
what to do ?
thks

Yes, that is correct.  SAP is pushing the use of ABAP Objects and you can not use OCCURS or HEADER LINEs in the ABAP OO context.  You should always defined explicitly and a work area.
Data: itab type table of mara.
Data: wa like line of itab.
So then you must keep this in mind when doing any operations on internal tables, like in the case of the COLLECT statement, the syntax would be.
wa-field1 = '1'.
wa-field2 = '2'.
Collect wa into itab.
Regards,
Rich Heilman

Similar Messages

  • Good Practice for managing player high scores & other stats

    During PC based game development, what is a good practice for saving high scores, game history etc for multiple users in terms of the following attributes :
    file types, data types to be used in the file, file protection from manual editing etc.
    pls throw some advice on the popular industry practice in use.
    regards, bittu ch

    During PC based game development, what is a good practice for saving high scores, game history etc for multiple users in terms of the following attributes :
    file types, data types to be used in the file, file protection from manual editing etc.
    pls throw some advice on the popular industry practice in use.
    regards, bittu ch

  • INSERT works for only last record of the Internal table ...??

    I am trying to insert data from an internal table JTAB to a Databse Table
    in CRM. The name of the databse table in CRM is CRMD_PARTNER
    For this i first declared an internal table JTAB with same structure as that of
    the databse table CRMD_PARTNER
    DATA: BEGIN OF JTAB OCCURS 0,
         INCLUDE STRUCTURE CRMD_PARTNER,
          END OF JTAB.
    Then I filled my JTAB with the required entries. For filling the JTAB i am
    getting data from couple of other tables and filling the internal table JTAB
         loop at ktab.
    here i am filling values in JTAB and then i say APPEND JTAB.
            endloop.
         Till here every thing works well and my internal table JTAB has all values that
    I need to insert to the CRMD_PARTNER table. Also my JTAB has vales for all primary key fields.
    Now I write a condition like below.
    if not jtab[] inital.
    MODIFY CRMD_PARTNER from TABLE JTAB.
    COMMIT WORK.
    endif.
    Here comes the problem...once this code is executed and once program totally executes...
    i always see that only last record in JTAB is being inserted to the databse table CRMD_PARTNER.
    When i check in the debugger ..i see that the loop is being executed only once
    and the SY-TABIX of JTAB is being always set to the length of JTAB and
    that is why only last  record is being inseretd to the table CRMD_PARTNER.
    Now what should i do ..to insert all records of JTAB to CRMD_PARTNER table?
    is there a way i can restet the SY-TABIX and make the modify statement work for all records of JTAB?
    Finally i hardcoded the values in JTAB then i dont have any problem and all records of JTAB are being
    inserted into the database table.
    only if i am dynamically fetching the values into JTAB(by Putting in loop..endloop statements and
    pushing values to JTAB and APPENDING JTAB ) i have a problem .
    in this case also my JTAB is being correctly filled with values ..but when i try to
    insert theses values to CRMD_PARTNER with MODIFY stmt ..only always last record is being inserted.
    i tried with INSERT instead of MODIFY and i am getting runtime error.
    kindly pease help.
    Regards,
    Jessica Sam

    yes a@s i am really struggling from last 3 days.
    I actually want to create a sales order in CRM and want to
    assign ship to party for each line item in a sales order in CRM
    for that i used the standard bapi BAPI_BUSPROCESSND_CREATEMULTI and i am able
    to create an order successfully, but i see that the ship toparty
    that i give at header is being copied to each line item.
    but this is not what is expected.
    So finally i tracked in which table the ship to party gets stored in each line item
    and then tried to insert the records directly into databse. and it worked
    but only if i am hardcoding..but not when i am dynamically fecthing the values into JTAB for insertion,
    Can yoy help ..if you have any idea why insert/modify is processing only last record?
    any help will be highly appreciated.
    Regards,
    Jessica Sam

  • SAP Best Practices - For ECC 5.0

    For ECC 5.0, can the best practices be installed on a SAP system? Would this be available via the SPRO implementation guide?

    Hi Devendra!
    For the Best Practices you can have all the useful installation and informations guides here.
    <a href="http://help.sap.com/">Best Practices for SAP</a>
    Choose here the Bast Practices tab on the line-menu.
    You have to eb careful while installing the BP -> you have to use all the time the right BP release according to your SAP release.
    I hope this helps you!
    Best regards,
    Zsolt

  • What is good practice for playing multiple video's in a single swf?

    Hello,
    I have build in the past a video wall with video's inside. After building this i came across some problems.
    If you have too many video players loading at once it takes a lot of processing and the tweens in the
    page while loading the video's where not moving fluidly, but more in a stuttering way.
    After lot's of test i found a good working solution.  I imported the flv video's into flash en exported them on the timeline
    as a embedded swf.  Then i externally loaded these swf files and that performed much better.
    Is it even good practice to load multiple video instances at once? I used this time the LoaderMax of greensock but the video's
    only play after it's completely loaded. I would like to find a way to progressive play all video's at.
    Does someone has experience with this?
    Regards,
    Chris.

    How about an XML file which supplies the title for each movie and the location or source of the video to be played?  Simple version below.
    <?xml version="1.0" ?>
    - <playlist>
    <video src="Gfx/video/Alex1.f4v" title="John Deere 330" />
    <video src="Gfx/video/Benni1.f4v" title="Hitachi Z240F" />
    <video src="Gfx/video/Scotti1.f4v" title="Hitachi Z350F" />
    <video src="Gfx/video/Scotti2.f4v" title="Hitachi Z350F" />
    </playlist>
    JR

  • WHAT IS SAP  " GOOD PRACTICE" FOR TESTING PROCEDURES ?

    Dear Gurus, could you please share with me the good practice of testing procedures? I am a 1st level fico support and being asked for this. Thanks in advance for your kindest help.

    Hi,
    Please use the below links FYR...
    http://help.sap.com/erp2005_ehp_02/helpdata/en/2f/75ba3bd14a6a6ae10000000a114084/content.htm
    http://www.ebooksquad.com/search/SAPmoduletesting+procedures
    With Regards,
    Lolla.

  • Good practice for async databinding, regarding entity-framework.

    I have some issue to find a good pattern to keep my UI responsive using asynch databinding and entity framework which is not thread-safe. It would be a shame if the UI came to totaly freeze with no feedback for a connection lost.
    So, entity framework is not thread-safe. Which mean I won't be able to rely on lazy loading here and involve than if I do async databinding to a collection of object, each object will have to load their navigations properties with their own context to display
    data. Ok, I can handle this. But what if I need more than displaying data and I want to modify a navigation property ?
    I need when I set the navigation property in my viewmodel to attach an entity from the same context than the parent entity is from. So here I have one context for multiple thread. What do I do ? =(
    Does anyone have some experience in it and can help me to clear this mess from my mind ? =D
    All the sample I can find about async databinding don't go any further than make a Thread.Sleep before returning a string, it's not realy helpfull.

    There are reasons people post simple explanations.
    One of those is because they post blog entries when they're learning something rather than when they are expert in it.  The blog post is part of their learning process.
    I sometimes share context. 
    What I do is put the context in Application.Current.Resources and then go get it from there when I need to re-use that particular one.
    xxxDomainContext DBContext = new xxxDomainContext();
    Application.Current.Resources.Add("DBContext", DBContext);
    and using that:
    context = (xxxxDomainContext)Application.Current.Resources["DBContext"];
    You can alternatively share collections in a similar way.  Depends on how many related tables you have, but reading a whole tree of static data is sometimes a good idea rather than just one table at a time.
    One technique I use is to cache slowly changing data on the client and then go get changes since the last run off the server.  For a fair few applications, yesterdays data is good enough for most data sets.  It's just the odd one or two which you really
    need up to date numbers or whatever.
    You can see a collection shared in this sample ( but the sharing is for different reasons ) :
     https://gallery.technet.microsoft.com/Dynamic-XAML-Composed-View-e087f3c1
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Best Practice for Extracting a Single Value from Oracle Table

    I'm using Oracle Database 11g Release 11.2.0.3.0.
    I'd like to know the best practice for doing something like this in a PL/SQL block:
    DECLARE
        v_student_id    student.student_id%TYPE;
    BEGIN
        SELECT  student_id
        INTO    v_student_id
        FROM    student
        WHERE   last_name = 'Smith'
        AND     ROWNUM = 1;
    END;
    Of course, the problem here is that when there is no hit, the NO_DATA_FOUND exception is raised, which halts execution.  So what if I want to continue in spite of the exception?
    Yes, I could create a nested block with EXCEPTION section, etc., but that seems clunky for what seems to be a very simple task.
    I've also seen this handled like this:
    DECLARE
        v_student_id    student.student_id%TYPE;
        CURSOR c_student_id IS
            SELECT  student_id
            FROM    student
            WHERE   last_name = 'Smith'
            AND     ROWNUM = 1;
    BEGIN
        OPEN c_student_id;
        FETCH c_student_id INTO v_student_id;
        IF c_student_id%NOTFOUND THEN
            DBMS_OUTPUT.PUT_LINE('not found');
        ELSE
            (do stuff)
        END IF;
        CLOSE c_student_id;   
    END;
    But this still seems like killing an ant with a sledge hammer.
    What's the best way?
    Thanks for any help you can give.
    Wayne

    Do not design in order to avoid exceptions. Do not code in order to avoid exceptions.
    Exceptions are good. Damn good. As it allows you to catch an unexpected process branch, where execution did not go as planned and coded.
    Trying to avoid exceptions is just plain bloody stupid.
    As for you specific problem. When the SQL fails to find a row and a value to return, what then? This is unexpected - if you did not want a value, you would not have coded the SQL to find a value. So the SQL not finding a value is an exception to what you intend with your code. And you need to decide what to do with that exception.
    How to implement it. The #1 rule in software engineering - modularisation.
    E.g.
    create or replace function FindSomething( name varchar2 ) return foo.col1%type is
      id foo.col1%type;
    begin
      select col1 into id from foo where col2 = upper(name);
      return( id );
    exception when NOT_FOUND then
      return( null );
    end;
    And that is your problem. Modularisation. You are not considering it.
    And not the only problem mind you. Seems like your keyboard has a stuck capslock key. Writing code in all uppercase is just as bloody silly as trying to avoid exceptions.

  • Best practice for external but secure access to internal data?

    We need external customers/vendors/partners to access some of our company data (view/add/edit).  It’s not so easy as to segment out those databases/tables/records from other existing (and put separate database(s) in the DMZ where our server is).  Our
    current solution is to have a 1433 hole from web server into our database server.  The user credentials are not in any sort of web.config but rather compiled in our DLLs, and that SQL login has read/write access to a very limited number of databases.
    Our security group says this is still not secure, but how else are we to do it?  Even if a web service, there still has to be a hole in somewhere.  Any standard best practice for this?
    Thanks.

    Security is mainly about mitigation rather than 100% secure, "We have unknown unknowns". The component needs to talk to SQL Server. You could continue to use http to talk to SQL Server, perhaps even get SOAP Transactions working but personally
    I'd have more worries about using such a 'less trodden' path since that is exactly the areas where more security problems are discovered. I don't know about your specific design issues so there might be even more ways to mitigate the risk but in general you're
    using a DMZ as a decent way to mitigate risk. I would recommend asking your security team what they'd deem acceptable.
    http://pauliom.wordpress.com

  • Search for a (sub)workarea in an internal table

    Hi all gurus,
    quite a simple question: I have an internal table made up of 100+ fields, and a workarea of the same type which is filled with some data.
    I'd like to know what's the best, effective way to search if there's a line in the internal table which is equal to the above cited workarea.
    I could compare specific fields:
    READ TABLE itab WITH KEY f1 = workarea-f1 f2 = workare-f2 ....
    IF sy-subrc = 0.
      OK.
    ELSE.
      KO
    ENDIF
    and so on. But it's quite terrible to write such a statement when there are a lot of fields!
    A refinement of the above request; I'd like to perform the above explained search EXCLUDING some specific fields from the comparizon, e.g. ,comparing fields from f3 to f98, ignoring f1, f2 and f99....
    Is there a simple way to obtain the desiderata? Please provide example as in documentation I've read about a COMPARING ALL FIELDS clause, but didn't understand how to use it w.r.t. the READ TABLE statement.
    Thanks!

    Hi,
    In my opinion, practically I don't see such a table that needs to combine hundreds of fields to be key fields.
    However, to meet your requirement, I guess there are several ways. But I just can think of one way that sounds a little bit workaround.
    Here is the pseudo code:
    data: itab_1 with fields from f1 to f99,
             itab_2 with fields from f3 to f98,
            wa_1 like line of itab_1,
            wa_2 like line of itab_2.   
    *there some time you fill data for your itab_1
    now assume itab_1 has been filled with data.
    now fill content for itab_2, which contain fields from f3 to f98 of itab_1
    loop at itab_1 into wa_1.
      move-corresponding fields of wa_1 to wa_2.
    append wa_2 to itab_2.
    endloop.
    clear wa_2.
    clear work area 2.
    suppose you have the work area you want to compare its content with the itab
    copy it to wa_2
    now wa_2 has value.
    *now use Read command to compare the needed data
    Read table itab_2 into wa_2 comparing all fields.
    if sy-subrc = 0.
      ok
    else.
    not ok.
    endif.
    The option Comparing all fields in Read command will compare content of all fields of the work are with all fields in itab.
    This is the output that you need.
    Regards,
    paul
    Edited by: paul the octopus on Dec 15, 2011 6:18 PM

  • Performance Problems with "For all Entries" and a big internal table

    We have big Performance Problems with following Statement:
    SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
      FOR ALL ENTRIES IN gt_zmon_help
        WHERE
        status = 'IAI200' AND
        logdat IN gs_dat AND
        ztrack = gt_zmon_help-ztrack.
    In the internal table gt_zmon_help are over 1000000 entries.
    Anyone an Idea how to improve the Performance?
    Thank you!

    >
    Matthias Weisensel wrote:
    > We have big Performance Problems with following Statement:
    >
    >  
    SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
    >   FOR ALL ENTRIES IN gt_zmon_help
    >     WHERE
    >     status = 'IAI200' AND
    >     logdat IN gs_dat AND
    >     ztrack = gt_zmon_help-ztrack.
    >
    > In the internal table gt_zmon_help are over 1000000 entries.
    > Anyone an Idea how to improve the Performance?
    >
    > Thank you!
    You can't expect miracles.  With over a million entries in your itab any select is going to take a bit of time. Do you really need all these records in the itab?  How many records is the select bringing back?  I'm assuming that you have got and are using indexes on your ZEEDMT_ZMON table. 
    In this situation, I'd first of all try to think of another way of running the query and restricting the amount of data, but if this were not possible I'd just run it in the background and accept that it is going to take a long time.

  • Select query for picking data in a dynamic internal table

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

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

  • Rough Goods Receipt for ECC 6.0

    Dear All
    Our client has a requiremnet that before final Goods Receipt is posted Rough GRC should be mandatory. Final GR will be like an approval for Rough GR.
    We are working on ECC 6.0 w/o any EHP.
    Solution to post with Mvt Type 103/105 is not feasible due to various custom developments for Mvt type 101.
    Kindly suggest a feasible solution.
    Regards
    Vikas

    Check Rough GR feature in purchase order
    Rough GR is a goods receipt prior to actual goods receipt. This step useful to compare prices, quantity delivered,
    Check this good documentation on process: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a02825f3-a956-2d10-cc80-8d98de5c74be?QuickLink=index&overridelayout=true&48232482841530

  • Good practice for charging notebook

    Gday,
    I just bought new pavilion notebook and  read this on the User Manual: "The computer does not use battery power when the computer is connected to AC external power with an approved AC adapter or an optional docking/expansion device." (chapt 6 p36)
    I'd like to have my notebook battery as healthy and longest live as possible, my quest is do I need to unplug the power adapter when the battery indicator shows 100% when charging while using the notebook? or just leave the power adapter plugged on AC as it is indicated on the Manual.
    Many thaks,
    This question was solved.
    View Solution.

    Hi,
    All smart batteries and chargers are smarter than we thought. When unplug AC power, computer will use battery and at the end of the day battery needs more charging cycles.
    My observations (I've mentioned many times on this forums): leaving batteries and machines 24/24 on AC at the end of two years, their batteries are much better than the ones pluged/unpluged everyday.
    Hope this helps.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Best practice for a same query against 2 different tables

    Hello all,
    I want to extract info about tablespaces storage, both permanent and temporary. For that I use 2 different cursors that do exactly the same query but against a different table (dba_data_files and dba_temp_files).
    CURSOR permanentTBSStorageInfo (tablespaceName VARCHAR2) IS
    SELECT file_name, bytes, autoextensible, maxbytes, increment_by
    FROM dba_data_files
    WHERE tablespace_name = tablespaceName;
    CURSOR temporaryTBSStorageInfo (tablespaceName VARCHAR2) IS
    SELECT file_name, bytes, autoextensible, maxbytes, increment_by
    FROM dba_temp_files
    WHERE tablespace_name = tablespaceName;
    First I'm bothered that I have to use 2 cursors to execute the same query against 2 different tables. Is there no another way around?
    Then I fetch the results of this cursors in 2 different loops because I didn't find a way to dynamically call the cursors. I am looking for best practice here, knowing that I will do the same parsing against the results of the 2 cursors.
    Thank you,

    Hi
    Check whether the below query is helpful or not
    select      fs.tablespace_name "Tablespace",
         fs.tempspace "Temp MB",
         df.totalspace "Total MB"
         from
         (select
         tablespace_name,
         round(sum(bytes) / 1048576) TotalSpace
         from
         dba_data_files
         group by
         tablespace_name
         ) df,
         (select
         tablespace_name,
         round(sum(bytes) / 1048576) tempSpace
         from
         dba_temp_files
         group by
         tablespace_name
         ) fs
         where
         df.tablespace_name = fs.tablespace_name;
    Thanks

Maybe you are looking for

  • Display problem in dock

    Can someone help me with this one? http://img48.imageshack.us/img48/405/bild1sm5.png I have this display on one machine only. The digits are placed incorrectly. Thanks! Amerigo

  • Problem in Discoverer installation.

    Hi, When i am trying to install Oracle BI tools for Discoverer i am getting the problem with Swap memory. Actual Swap memory :1512 MB Required Swap memory :1535 MB Please suggest me how to increase Swap memory. Regards, Surendra.V

  • Need help with andriod system -flash player.

    Am using an andriod tablet ZTE with vrsion 4.0 plus as per manufacturer info pamphlet. I have tried to install/ download flash player for this tablet and no luck at all. Can Adobe AIR  work well enough to view content on training video presentations

  • We were using SP3 for iplanet server. Now we want to use SP4.

    We were using SP3 for iplanet server. Now we want to use SP4. When we deploy the EAR on SP4(thru IASDEPLOY), its giving Null pointer error but at the end it says deployment complete. Also there are no proper entries in the registry. If we deploy the

  • Can i use my ipod to help a friend locate stolen phone?

    Can I use my Ipod to help a friend track a stolen phone?