Carsten, thanks for the response.\\n\\nCan you explain in more detail.\\n\\nRegards,\\nPeter\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712093,\"creationDate\":1284724421000,\"activeRevisionId\":8861553,\"lastActivity\":1284724421000,\"parentId\":7712048,\"originalParentId\":7711824,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false}]},\"7711866\":\"rootParentId\":7711866,\"commentsCount\":2,\"comments\":[\"body\":\"Hi try, \\n \\n\\n\\n loop at str_table into wa_table.\\n \\n"move all the material in to range or one internal table.....\\n \\nEndloop.\\n\\nselect *mara *marc data into internal table \\nfor all entries of above internal table of input file\\nwhere matnr = .\\n \\n select werks from t001w into corresponding fields of table t_t001w .\\n\\n"do it for distinct materials and Plant combination\\n LOOP AT t_final INTO wa_final.\\n\\n loop at str_table into wa_table where matnr = wa_final-matnr and plant = wa_final-werks.\\n " write conditon and append to bapi save table to respect structures\\n ENDloop.\\n \\n * at end of material\\n AT END OF matnr.\\n" Move header data\\n CALL FUNCTION 'BAPI_MATERIAL_SAVEREPLICA'\\n\\n ENDLOOP.\\n\\n \\n \\n \\nPrabhudas\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712240,\"creationDate\":1284726409000,\"activeRevisionId\":8861677,\"lastActivity\":1284726494000,\"parentId\":7711979,\"originalParentId\":7711824,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false]}"); const simplifiedQuestionView = JSON.parse("true"); (function() window.pageContext = mergeDeep(pageContext, question: id: 7711824, plug: "performance-tuning-for-a-report", votes: 0, questionTitle: "Performance Tuning for a report", isClosed: false, isLocked: false, isRedirected: false, redirectedFromTitle: "", redirectedFromId: "", closedStatusData: JSON.parse(""), userVoted: false, relations: JSON.parse("\"canClose\":false,\"canUnredirect\":false,\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"canReopen\":false,\"type\":\"question\",\"canVoteUpOrCancel\":false,\"canViewRevisions\":true,\"canUnlock\":false,\"reported\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canCancelReport\":false,\"canComment\":true,\"isCurrentUserAuthor\":false,\"canViewReports\":false"), isQuestionAccepted: false , childToViewInfo: id: "" , comments: JSON.parse("\"7712048\":\"rootParentId\":7712048,\"commentsCount\":1,\"comments\":[\"body\":\"Carsten, thanks for the response.\\n\\nCan you explain in more detail.\\n\\nRegards,\\nPeter\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712093,\"creationDate\":1284724421000,\"activeRevisionId\":8861553,\"lastActivity\":1284724421000,\"parentId\":7712048,\"originalParentId\":7711824,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"7711866\":\"rootParentId\":7711866,\"commentsCount\":2,\"comments\":[\"body\":\"Hi try, \\n \\n\\n\\n loop at str_table into wa_table.\\n \\n"move all the material in to range or one internal table.....\\n \\nEndloop.\\n\\nselect *mara *marc data into internal table \\nfor all entries of above internal table of input file\\nwhere matnr = .\\n \\n select werks from t001w into corresponding fields of table t_t001w .\\n\\n"do it for distinct materials and Plant combination\\n LOOP AT t_final INTO wa_final.\\n\\n loop at str_table into wa_table where matnr = wa_final-matnr and plant = wa_final-werks.\\n " write conditon and append to bapi save table to respect structures\\n ENDloop.\\n \\n * at end of material\\n AT END OF matnr.\\n" Move header data\\n CALL FUNCTION 'BAPI_MATERIAL_SAVEREPLICA'\\n\\n ENDLOOP.\\n\\n \\n \\n \\nPrabhudas\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712240,\"creationDate\":1284726409000,\"activeRevisionId\":8861677,\"lastActivity\":1284726494000,\"parentId\":7711979,\"originalParentId\":7711824,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false]"), answerPager: answersCount: 9, page: 1, pageSize: 10, pageCount: 1, sort: "votes" , answers: JSON.parse("[\"body\":\"Hi, \\n \\ntry this way... \\n \\n\\n loop at str_table into wa_table.\\n\\n"move all the material in to range or one internal table.....\\n\\nEndloop.\\n \\n\\n"next fetch all mara & marc data into one table using for all entries of \\n *select matnr from mara into table t_mara.\\n *select matnr werks from marc into corresponding fields of table t_marc.\\nselect *mara *marc data into internal table \\nfor all entries of above internal table of input file\\nwhere matnr = .\\n\\n select werks from t001w into corresponding fields of table t_t001w .\\n \\n\\nBAPI BAPI_MATERIAL_SAVEDATA. "call BAPI_MATERIAL_SAVEREPLiCA for every new material or at last\\n\\n \\n \\nPrabhudas\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7711866,\"posted\":1284721626000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"The "BAPI_MATERIAL_SAVEREPLICA" takes multiple materials. But for this amount of data, only multiple parallel tasks (best number depends on your system) will get you much faster. One way would be to split your input file and run a separate instance for each one of them, or use something like "SPTA_PARA_PROCESS_START_2" (see demo report SPTA_PARA_DEMO_1).\\n\\nEdit: Ohh, and you should use a "HASHED TABLE" or at least "BINARY SEARCH" for "t_mara" and "t_marc".\\n\\nEdited by: Carsten Grafflage on Sep 17, 2010 1:50 PM\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712048,\"posted\":1284723993000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"Hi Peter Grosvenor,Adding BINARY SEARCH will increase the performance for sure. Recently we had a performance issue in our system for a report which was looping on a table with 400,000 records and reading a record from a table with 100,000 records and I was not using BINARY SEARCH. After using BINARY SEARCH the execution time reduced to 40%.Note : Sort your table on the key before using BINARY SEARCH.I have seen some suggestion for "FOR ALL ENTRIES". As far as my opinion on "FOR ALL ENTRIES" is Never use it when you process large data(as you are processing huge records here). It will kill the performance.Thanks & Regards,Rock.\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712161,\"posted\":1284725364000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"@Peter: For basics about the indexed tables you should take a look at the following example chapter from Herman's book "ABAP Performance Tuning": -press.de/download/dateien/1880/sappress_abap_performance_tuning.pdf \\n \\nAs for the parallel processes, a look at the example program (which has good source comments), would be the best i think. I'll try to answer any specific question.\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7712405,\"posted\":1284728978000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"Hi Peter,\\n\\nA few more suggestions...\\n\\n1. Define T_MARA and T_MARC as HASHED internal tables, with unique keys of MATNR and MATNR+WERKS, respectively.\\n\\n2. When you read these tables, adjust your READ statements to say WITH TABLE KEY - this forces the HASHED table lookup.\\n\\n3. In your T_T001W and T_MARC logic SELECTS, ensure that the structure of these tables ONLY includes the fields you need (ie. WERKS and MATNR+WERKS, respectively) and GET RID OF the CORRESPONDING FIELDS clause in those SELECT statements.\\n\\n4. Define a field symbol and structure it like your current WA_TABLE variable. Change your LOOP AT STR_TABLE by removing the INTO WA_TABLE clause and replacing it with ASSIGNING . Change all other references (within the loop) of WA_TABLE to use instead.\\n\\nThis should shave a fair bit of time off the execution time; can't vouch for how much time is currently being taken by the BAPI(s).\\n\\nGood luck, Andy\\n\\nEdited by: abapandy on Sep 18, 2010 3:23 AM\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7713623,\"posted\":1284773007000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"Hi Peter,\\n\\nI would suggest few changes in your code. Please refer below procedure to optimize the code.\\n\\nSteps: \\n\\n Please run SE30 run time analysis and find out if ABAP code or Database fetch is taking time.\\n \\n Please run extended program check or code inspector to remove any errors and warnings.\\n \\n Few code changes that i would suggest in your code\\n\\n For select query from t001w & marc remove the corresponding clause as this also reduces the performance. ( For this you can define an Internal table with only the required fields in the order they are specified in the table and execute a select query to fetch these fields)\\n\\n Also put an initial check if str_table[] is not initial before you execute the loop.\\n\\n where ever you have used read table. Please sort these tables and use binary search.\\n\\n Please clear the work areas after every append statment.\\n\\n As i dont have a sap system handy. i would also check if my importing parameters for the bapi structure is a table. Incase its a table i would directly pass all the records to this table and then pass it to the bapi. Rather than looping every records and updating it.\\n\\n\\nHope this helps to resolve your problem.\\n\\nHave a nice day\\n\\nThanks\",\"author\":\"username\":\"sumit.naik2\",\"displayName\":\"Sumit Naik\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":7714050,\"posted\":1284843025000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"Hi Peter,\\n\\nsome hints have been given, most valuable the use of hashed table. Further improvement is possible using field-symbols, not work areas; i.e. \\n\\nfield-symols:\\n like line of t_marc.\\n...\\nread table t_marc assigning \\n\\nBut as you do not even use the data, it should be (using a hashed table t_marc)\\nloop at t_marc transporting no fields\\n where matnr = wa_table-partnumber\\n and werks = wa_table-HostLocID.\\nendloop.\\nif sy-subrc NE 0.\\n...\\n\\n\\nBut the most performing-consumtion is the BAPI_TRANSACTION_COMMIT after each call of FUNCTION 'BAPI_MATERIAL_SAVEDATA'.\\n\\nIt is OK to do this approximately every 1000 or even more calls - you will see this helps most. \\n\\nRegards,\\n\\nClemens\",\"author\":\"username\":\"clemens.li\",\"displayName\":\"Clemens Li\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":7714501,\"posted\":1284904371000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"you should be aware at least of the very basics:You READs need any kind of key support if you use very very large tables (large starts with more than 50 entries)Check this and use sorted or hashed tables Measurements on internal tables: Reads and Loops:/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tablesOf course a much better starting point for an optimization is an ABAP TraceSE30/people/siegfried.boes/blog/2007/11/13/the-abap-runtime-trace-se30--quick-and-easyIt always makes sense to look into a SQL traceSQL trace:/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easySiegfried\",\"author\":\"username\":\"siegfried.boes\",\"displayName\":\"Siegfried Boes\",\"groupIcons\":[\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":7715618,\"posted\":1284970556000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"Hello Peter,\\n\\nIn your original post code, I could see BAPI_TRANSACTION_COMMIT inside the loop, If u keep the commit statement outside of the loop u can have tremendous improvement over ur code.\\n\\nStill if u would like commit inside the loop, set up a counter say around for 500/1000 loop passes u can execute the commit work, It will give u considerable performance improvement.\\n\\nLet me know if u require further inputs for the same.\\n\\nRegards,\\nBysani.\",\"author\":\"username\":\"former.member\",\"displayName\":\"Former Member\",\"groupIcons\":[],\"suspended\":true,\"isCurrentUser\":false,\"id\":7733655,\"posted\":1285321392000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[]]"), answerForm: formAction: "/answers/7711824/post.json", textareaName: "body", textareaErrors: "", isAttachmentsEnabled: true, answerEditorialGuideline: title: "Before answering", content: "You should only submit an answer when you are proposing a solution to the poster\'s problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that your answer complies with our Rules of Engagement.", links: [ title: "Rules of Engagement", href: " -of-engagement.html", ] , answerMinBodyLength: '10', answerMaxBodyLength: '20000' , currentUser: sapInternalId: '', permissions: canVoteUpOrCancel: false, canVoteDownOrCancel: false, canModerate: false, , isVotedUp: false, isVotedDown: false , alerts: alertModeratorMinLength : "It should be given a proper explanation about why the content is inappropriate.", alertModeratorMinLengthValue : "10", alreadyReportedMessage : "You already have an active moderator alert for this content." , url: profileApiBaseUrl: ' -api.services.sap.com', followUnfollowQuestion: '/sap/nodeSubscription.json', isFollowingQuestion: '/sap/isFollowingNode.json', vote: voteUp: '/commands/0/voteup.json', voteDown: '/commands/0/votedown.json', cancelVote: '/commands/0/cancelvote.json' , rss: answers: '/feed/7711824/answers.rss', answersAndComments: '/feed/7711824/comments-and-answers.rss' , authorizeUploadContext: type: 'answer' , atMention: userSearchServiceUrl: ' ', currentUserName: '', useNewUSSCORS: true, atMentionDelayMs: 100, showMentionInRedactor: true , attachmentSettings: commentMaxAttachments: '2', answerMaxAttachments: '10', commentMaxAttachmentSizeBytes: '1048576', answerMaxAttachmentSizeBytes: '1048576', commentAttachmentsSizeBytesTotal: '2097152', answerAttachmentsSizeBytesTotal: '10485760' , editor: editorClipboardUploadEnabled: true ) )(); Home
Community
Ask a Question
Write a Blog Post
Login / Sign-up Search Questions and Answers 0 Former Member Sep 17, 2010 at 10:58 AM Performance Tuning for a report 327 Views Follow RSS Feed Hi,
sap press abap performance tuning pdf download
2ff7e9595c
Comments