OCCURS clause
WE know that the OCCURS clause in the internal table statement creates the internal <b>table object</b>
In the following statement is this possible:-
TYPES <mt> TYPE| LIKE <linetype> OCCURS<n> .
If not what else?
Hi abaper learner,
The OCCURs Clause is used for declaring the SIZE of the Internal Table..
For EG:
Data: begin of itab occurs 0, means this will create an internal table with 8KB of memory.
But if you are specifrying
data:begin of itab occurs 10, this will create an internal table with 10 rows(according to the structure of the internal table)...
<b>Kindly Reward points if you found the reply helpful.</b>
Cheers,
CHAITANYA.
<b></b>
Similar Messages
-
What will happen if we dont give occurs clause while creating an inttable?
hi
experts can u help me pzzzzzzzzzzzzzhi
work area wont be created.
table is created without header line
<b>the OCCURS clause also defines how many table entries are maintained in main storage. Extra records are written out to paging area and can effect performance.</b>
<b>EXAMPLE:</b>
TYPES : begin of line,
empno type I,
empname(20) type c ,
end of line.
By using DATA statement we need to create internal table by referring to TYPES data type.
hope it clears ur doubt
regards
ravish
<b>plz dont forget to reward points if useful</b> -
I am facing performance issue in a report due to addition of occurs clause
Hi,
I am facing performance in one program. I think while declaring internal table used OCCURS 100 but records are populating 470840 no of records.
again in 2nd internal table declared OCCURS 10 but records are entering 18 no of records.
I guess because of this program is taking nearly 30 mins time and not getting correct out put.
I am not sure weather this is the reason.
So any one can give proper suggestion to improve the performance of the program
in the internal table t_dels_tvpod showing the no of records in debugging = 470840 * 9(80)
in the internal table lt_dels_tvpod showing the no of records in debugging = 18 * 9(80)
I have shown the part of the program code.
Program code
DATA: BEGIN OF t_dels_tvpod OCCURS 100,
vbeln LIKE tvpod-vbeln,
posnr LIKE tvpod-posnr,
lfimg_diff LIKE tvpod-lfimg_diff,
calcu LIKE tvpod-calcu,
podmg LIKE tvpod-podmg,
uecha LIKE lips-uecha,
pstyv LIKE lips-pstyv,
xchar LIKE lips-xchar,
grund LIKE tvpod-grund,
END OF t_dels_tvpod,
DATA: l_tabix LIKE sy-tabix,
lt_dels_tvpod LIKE t_dels_tvpod OCCURS 10 WITH HEADER LINE,
ls_dels_tvpod LIKE t_dels_tvpod.
SELECT vbeln INTO TABLE lt_dels_tvpod FROM likp
FOR ALL ENTRIES IN t_dels_tvpod
WHERE vbeln = t_dels_tvpod-vbeln
AND erdat IN s_erdat
AND bldat IN s_bldat
AND podat IN s_podat
AND ernam IN s_ernam
AND kunnr IN s_kunnr
AND vkorg IN s_vkorg
AND vstel IN s_vstel
AND lfart NOT IN r_del_types_exclude.
Waiting for quick response.
Best regards,
BDPYou should declare your structure with TYPES statement and with this type declare internal table.
Example:
types: begin of ty_itb,
budat type budat,
matnr type matnr,
end of ty_itab.
data: itab type standard table of ty_itb,
wa_itab like line of itab. (work area of itab)
Since both occurs and header line statements are obsolete.
change the below select query as follows can improve the performence
if not IN t_dels_tvpod[] is initial. (always check this, if you are using For all entries statement)
SELECT vbeln lfart INTO TABLE lt_dels_tvpod FROM likp
FOR ALL ENTRIES IN t_dels_tvpod
WHERE vbeln = t_dels_tvpod-vbeln
AND erdat IN s_erdat
AND bldat IN s_bldat
AND podat IN s_podat
AND ernam IN s_ernam
AND kunnr IN s_kunnr
AND vkorg IN s_vkorg
AND vstel IN s_vstel.
endif.
delete lt_dels_tvpod where lfart not in r_del_types_exclude. -
hi all
wat is the use of occurs while declaring internal table.
thankn in advanceHi
The OCCURs Clause is used for declaring the SIZE of the Internal Table..
For EG:
Data: begin of itab occurs 0, means this will create an internal table with 8KB of memory.
But if you are specifrying
data:begin of itab occurs 10, this will create an internal table with 10 rows(according to the structure of the internal table)...
Reward All Helpfull Answers........ -
what does it mean occurs 0 while creating an internal table and what wil happen if we wil not give occurs clause while creating an internal table?
hai,
occurs 0 is allocating the 2kb of memory space in RAM defaultly.
thats why we are using this but now a days we wont prefer this bcose it wont supports opps concepts.
Reward points if hope ful.
regards,
jai.m -
Diff between occurs 0 and occurs 3
in internal table why should we mention occurs clause...with out header line...its giving error..
Hi,
Occurs does not limit the number of rows that can be added to the internal table. For example if you specify occurs 10, you can put upto 10 rows into internal table.The number of rows you can put into an internal table is theoritically only limited by the amount of virtual momory available on the application server.
The system uses the occurs clause only as a guidlines to determine how much memory to allocate. The first time a row is added to the internal table, enough memory is allocated to hold the number of rows specified on the occurs clause. If you use the memory up, more is allocated as needed.
Alternatively, you can specify occurs 0. If you do this, the system allocated 8KB pages of memory at a time. However there are no advantages to using occurs 0 other than the fact it is only a litter easier to code occurs 0 than it is to estimate the size of the internal table
For peak performace and minimum wasted momery, choose as occurs value equal to the average maximum number of rows in the table. For Example if most of the time the internal table is filled with a maximum of 100 rows, but every once in a while it is filled with a maximum of 1000 rows, set the occurs value 100. -
Short dump-internal table size issue
Hi,
I get the following message in the short dump analysis for a report.
No storage space available for extending table "IT_920".
You attempted to extend an internal table, but the required space was not available.
Error Analysis:
The internal table "IT_920" could not be enlarged further.
To extend the internal table, 9696 bytes of storage space was
needed, but none was available. At this point, the table "IT_920" has
1008240 entries.
Its an old report and I saw the internal table declaration using the "OCCURS" clause in the internal table declaration.
begin of itab occurs 100.
end of itab.
I tried the option of changing to "OCCURS 0", still issue persists.
Any help would be highly appretiated
CMHello CMV,
This is basic problem with SAP internal tables. For every internal table memory is alocated ( Max..256K)...once you cross the memory size/limit of the internal table it resuls in short dump.
Only way to overcome this problem is handle limited number of records at a time..
Please refer following sample code which will help you to avoid short dump while processing large number of records....
SORT TAB_RESULT.
DESCRIBE TABLE TAB_RESULT LINES W_RECORDS.
W_LOW = 1.
W_UP = 1000.
*Spliting the records from tab_result1 by pakage of 1000 at a time
*to avoid short dump in case of more records
WHILE W_LOW <= W_RECORDS.
R_PKUNWE-SIGN = 'I'.
R_PKUNWE-OPTION = 'EQ'.
R_WERKS-SIGN = 'I'.
R_WERKS-OPTION = 'EQ'.
LOOP AT TAB_RESULT FROM W_LOW TO W_UP.
MOVE TAB_RESULT-PKUNWE TO R_PKUNWE-LOW.
MOVE TAB_RESULT-WERKS TO R_WERKS-LOW.
APPEND R_PKUNWE.
APPEND R_WERKS.
ENDLOOP.
*fetch sold to party
SELECT KUNNR NAME1
FROM KNA1
APPENDING CORRESPONDING FIELDS OF TABLE TAB_KNA1
WHERE KUNNR IN R_PKUNWE.
*fetch plant
SELECT WERKS NAME1
FROM T001W
APPENDING CORRESPONDING FIELDS OF TABLE TAB_T001W
WHERE WERKS IN R_WERKS.
REFRESH: R_PKUNWE,
R_WERKS.
W_LOW = W_LOW + 1000.
W_UP = W_UP + 1000.
ENDWHILE.
Hope this will help you to solve problem.
Cheers,
Nilesh -
Some faqs can u solve dis answers asp
1) How do u handle table control in bdc?
2) What is diff b/w normal functional modules and BAPI's fm's?
3)what is fct-code of at- line- selection?
4)why do u use subroutine pool in scripts?
5)name few performance techniques?
6)in how many ways u can design interactive reprt?
7)what is the need of table maintainance option at the begin of table creation?
8)what is the system landscape?
9)what is the use of submit command in exe program?
10)how do u create secondary index?
11) what is the diff b/w sap memory and abap memory?
what is the max size of date records?
2)what is the max size of IDOC?
3)what is the relationship b/w ALE and EDI?
4)when u have data transfer, why do u chose IDOC's?
5)i have 200 records how u decide how many records should execute per IDOc?
6)ALE customizing method?
7)how do u define logical systems and assign logical systems to clients?
8)what is change pointer technique?&what is need of change pointer technique?
1) name the events in order in case of classical report?
2)if i put write statemnt in at slection-screen,does it works?
3)can u call multilple selctio screen in one report?
4)what is diff b/w integration & at slection-screen ouput?
5) i have a requirement like i have 3 radio butons in one group,
if i select one radio button then remaining radio buttons are invisible what is the code for this?
6) how do u decide which method is suite for paricular requirement if not specified in bdc?
i.e session or call transction?
7)what is BAPI?
8)how BAPI differ from ALE?
9) steps of configuring of EDI?
10) is layout set is client dependent or not?
11)how to transfer layout sets to test client side?
12)what is the protect......end protect?
13) for what purposeu create multiple wqidows in one page?
14)what are diff areas wher ucan ouput text in main window?
15)what method u use to output text in (top........endtop) or write_form?
16)what is the reason for use of write_form rather than top------endtop?
1)i need a logo on the right hand side of corner . how do u handle that?
2)what is the standard table for storing standard symbols?
3)how do u represent page no in scripts & total page nos?
4)what is the transaction code for dump analysis?
5)when top-of-page vent triggred?
6)can i plce write stament in any event?does it works?
7)what is the use of end-of-selection event?
8)what is stop& exit?
9)what happens if i plce write statement in end-of-selction?
10)what is sy-ttill?
11)does the value of sy-subrc chnge after if and write stament?
12)what is bdc & types of bdc?
13)when do u choose session , call transaction methods?
14)how may types of symbols? what are they?
15)what is the diff b/w constant & variable symbols?
16)what are the parameters in open_form & start_form?
17)does text orientation(190degrees ,145 degrees) is possible in sap scripts?
18)how do u delete text from a layoutset window?
19)what are u need to take care while transporting the request? for exeampl u developed a exit ,whta care do u take?
20) what wil u do for preparing technical specs form functional specs?
21) what is addres....endaddress in sap scripts?
22)which method do u prefer synchronous or asynchronous?
23)what is output type?
24)what does slection-screen of RBDMIDOC contains?
25)what parameters u specifyng in RFc destination?
26)what customiging y do to transfer the data from one logical systme to another logical system?
27)can u explain brifely how idoc's genrated?
28)if i just extend the idoc, what are the things u need to do?can i extend the same ouboud program?
29)can u just explain what partner profile contains?
30)what are process codes?
31)if i just develop a gui status using pf-status.is it confined to single program or can be used for any other programs?
32)what is client?
33)what is diff b/w se01,se09,se10,stms transction codes?
34)what is the diff b/w select single * from kna1 and select * from kna1 for all entries?
35)in subroutines paramaters are changing & using .what is the diff b/w them?
1) what is the diff b/w scripts & smart forms?
2)what are the function module used in smart forms?
3)what are the function module? what is the use of them?
4)what is the index? what is the secodary index ? whta is uses of them?
5)what is the table technical characteristics?
6)waht is buffering? types?
7)what is the use of interactive reprt?
8)what is the use of alv?
9)what are problems u have faced when u r doing projecs?
10)what is the diff b/w template & tables?
11)which function module used for transferring from one version to anthoer version?
12) what determines the sequence in events blocks are processed?
13)in what case are otional parameters allowed in the passig of parameters?
a) functions b) forms
14)what relationship can be esatblished in watch points?
15)what are requiremets of reading hashed internal table?
16)what does a context object provides?
17)what access methods are avaliable for accessing internal table?
18)what operations are allowed when processing data of records in internal table?
19)what tasks could be performed in SAPNET?
20)what is search help?
21)what is the lock object?
22)what is diff b/w domain and data elemnt?
23)what is diff b/w check table and value table?
24)what are the control break statements?
25)how to display SUM?
26)what is the diff b/w select single & select upto one row?
27)collect what it did?
28)how to findout data in internal table?
29)syntax for describe statement?
30)hwo to findout if internal table is empty or not?
31)hwo to transfer data from one internal table to another internal table?
32)how to modify internal table?
33)Read statement syntax?
34)what is the default event?
35)i have write only top-of-page event in that write: / 'welcome' what will happen?
36)what is message-d?
37)what is the diff b/w with events & without events?
38)what is the purpose of Direct input method?
39)what is local object?
40)is it possible to back ground process in call transaction? how?
41)what are diff types of errors?
42)what are the diff types function modules used in layout set?
43)what is the diff b/w open_form & start_form?
44) how to define logo?
45)after modification how to send modified form to modified print program?
46)what are the symbols in sap scripts? functionality of them?
47)how to write a Report in another Report?
48)syntx fr submitt &what it did?
49)what is the land scape of ABAP?
50)what is index? types?
51)hwo many secondary indexe are possible to create?
52)what is diff b/w select single * from & select upto one row?
53)in my 100 records 55th record is need some changes and that record how to send body to header line?
54) what is the use of indexs?
55)what is the diff b/w page area & roll area?
56)diff b/w interface & conversion?
57)how we configured ports andpartner-profiles?
58)what si the Enhancement and what u had did with user-exist?
59)who can extend Idoc?
60)how many types of select staments?
61)what is header line?
62)what is diff b/w internal table work area & table work area?
63)if we don't have header line what will happen?
64)when the user-exist will triggered? for which purpose u have used and where u have written?
65) how we linked the tables?
66)in at selection-screen and at user-command event which one is triggred?
67)what is the use of at pf-status? where did u use it?
68)is it possible to run Host command inSAP environment? how do u run it?
69)what are user-exists? what is involved in writting them? what precautions are needed?
70)what is the version management?
71)if u send the objects from dev server to production server,but get some bugs so those bugs how to handle?
72)if u upload the data after that. i din't put committ,then what happen?
73)how to maintain dataintegrity?
74) how to validate fields?
1)how u connect the unix platform from SAP server?
2)what is database object ? Runtime object?
3)How to populate BDC table control?
4)How to implemnt intreactive list in alv?tell me fumnction module for that?
5)How to transfer from data list to transactions?
6)How can u add anew field to Script?
7)what are problems in processing batch input session?
8)diff b/w select-options & ranges?
9)what is meant by satck list?
10)if u don't have header line for internal table what will happen?
11)what is the max no of calling modes stacked at one time is?
12)what is collect command ? how it is works?
13)if u want come back from 15th list to basic list waht will u do?
14)what is the default mode of transfers data to and from application server?
15)what is the purpose of EXTRACT parameter?
16) how will u delete duplicate records from internal table?
17)in for all entries clause of select statement ,if internal table is empty what will happen?
18) How can u find the no of records in a table?
19)Billing and invoice details are where stored?
20)what is the typical structure of ABAp program?
21)what is diff b/w ABAP program &user defiend program?
22)can a transperent table exists in a data dictionary and not in the physical database?y/n
23)diff b/w Collect & Append?
24)logical unit of work means?
25) How many types of lock objects exists? what are they?
26)what will u don inSPRO?
27)how many tyeps buffers?
28) what wil do by Maintainance generator?
29) what is o/p type? what is done by this?
30)program for BAPI?
31)what is ALE implementation progarm?
32) say the function code to catch function code F2?
33) what is IDOC& how u can extend the IDOC?
34)what is the advantage of LSMW?
35)how many types of symbols u have on scripts & in which order they can executes?
36)what is purpose of data conversion into SAP format from Legacy?
37) what si the t-code for watch the flat file in application serever?
38) what is purpose of driver program?
39)what is contents of Functional Spec?
40)what is contents of Technical Spec?
41)How do u diasble a control in a selection-screen logic?
42)what is source structure?
43)what is target structure?
44)if u don't have the access to modify the print program then how do u insert the text elemnts?
45)how can u call report in another program?
46)specify the events for classic & intractive reports in order?
47)say some usally used system fields in our programs?
48)how can u create check box in alv?
49)diff b/w select-options & parameters?
50)how can u create labels in scripts?
51)how u display the data in scripts?
52)What is the diff b/w At selection-screen output & initialization?
53)how u trap the errors in call transations?
54)diff b/w scripts & smart forms?
55)types of internal tables & explain them?
56)how many types of loops?
57)Diff b/w Synchronous & Asynchronous RFC
58)How u place data in table cotrol?
59)what are the methods execute in LSMW?
60)diff b/w sy-index & sy-tabix?
61) in call transaction bckground process which mode u prefer?
62)what is configuration of ALE?
63) what are all read operations in itab?
64)diff b/w search help & pov, which one trigger first?
65)where u can u do the validations in report?
66)what are the events in Module program?
67)diff b/w call transactions & session method and wher trap erros in both methods? how?
68)diff b/w scripts & reports?
69)how u define text elemnts inscripts?
70)what are the function modules inscripts?
71)how u diplay the data in scripts?
72)how do u do the perfomance testing?
1)when it wll triggerd initialization event? Before how many events will triggerd?what are they?
2)how many types of meaasges ?
3)what is use of Dump analysis?
4)what is the use for all entries?
5)what Is the diff b/w check & continue?
6)whenever use EXIt statement whappend in loop endloop and within subroutines, within start-of-selection ,with in end-of-selectio and in initialization?
7)what is the diff b/w value table and check table?
8)in data element level I used search help and in domain level I used value table which will be shows our criteria?
9)without doing any changes in printprogarm I want to add some fields how can?
10)how many mainwindows in one page? What is the use of remaing main windows?
11)what is sy-index & sy-tabix?
12)what are the qualities u have to maintain to ur developments?
13)Smart forms are client independent how u justify that?
14)in keyindexex what is the relationship 1:n?
15)in dynpro how can insert radio butto?
16)How can u use search help?
17)in MEDRUCk(ME21) I have changes some fields so immediate those changes send to Vendor through e-mail or fax? What is procedure?
18) I worked in foreground one session successfully so tommarow I have to work same session in back ground then what happen?
19)in bdc table control wher u have to face problem?
20)In alv grid control at the top I want header/ how can u display?
21)how can u print long text in scripts?
22)how to display Text every 4 lines after?
1)how can u create u r own types in an ABAP report?
2)which system variable is encounted in loop counter?
3) which system variable is store the record counter?
4)does a select statement carry out any authorization chek?
5)what is function of environment variable sy-lisel in interactive reports?
6)how can we identify which button is pressed?
7)diff b/w se09 ,Se10?
8)table in which entry for development class is made?
9)which client is authorized to create the workbench oragnizer configuration?
10)can we provide more than one PBO PAI for one screen?
11)which view can even possess one table?
12)What are field symbols?
13)which is ued to release to lock?
14)what are the various types of customer exists?
15)what is port?
16)what are the selection-text?
17)can we use perform in SAP scripts?
18)what is the t.code for table maintainance?
1)write validation logic for parameters option? Wher do u write ?(in at selection-screen or start-of-selection)?
2)what is the diff b/w IN jn where condition and without IN condition in where condition?
3)how can u display 21st secondary list ?explain procedure?(code?)
4)what is the diff b/w sorted and hashed tables?
5)can write statement in initialization triggers first or write statemnt in start-of-selection?
6)what can ud o if have no authorization to recording in BDC?(without F1 and Technical help)?
7)what is the diff b/w SAPLUW and DBLUW?
8)expalin VPN process?
9)what is the text in reports and scripts?
10)how can u release ur objects to end user?
11)write genereal statement to display dat-range?
12)explain pricing procedure in sap?
13)how can u display barcodes in sap scripts?
14)explain flow of S.D?
15)what are the performance techniques expect Modularization techniques I want remaning?
1)what is the purpose of initialization?
2)what are control break statements?
3)what is the diff b/w at new and on change?
4)what is the use of end-of-selection?
5)in Runtime analysis what ar the main area will be displaying for tunnning?
6)what are the ways to improve the performance the report?
7)What is the diff b/w maintainance view and databe view?
8)what are the type of search help?
9)what is the diff b/w include structure and append structure?
10)how can we generate new item in BDC program or the transaction ME21?
11) in calltransaction while transferring the data what happens idf the power goes off?
12) what are the standard programs for transfer the data for material master and vendor master?
13)whare we can assign the page size?
14)how can we call a subroutine in scripts?
15)how many max pages we have to design for script ?
16) what is use of protected and end protected?
17)what are the types of functional modules?
18)how many types of screen filed validations? What ate they?
19)how to convert the scripts to smartforms?
20)what is the history of purchase order? Wher is it store?
21)can we debug smartforms ?
22)what is the material history and where is it store?
23)what are the functional modules ued in ALV?
24)what is the fieldcatalog merge use?
25)how u print the heading in ALV ?
26)what is the t.code for BDC?
27)what is the purpose of application server?
28)what are the text elements ? what is the use of text elements ?
29)how u create vertical line and horizanatal line in reports?
30)what is the purpose header line?
31)what is the purpose of occur clause?what default area it occupies?
32)what are text elements?
33)how many secondary indexes we can create for a table?
34)What is the ue of st05?
35)what is the foriegn key table?and check table?
36)what are some essential steps for loggig changes made to SAP data?Hi Mahesh,
Very good questions. Infact it's very difficult to answer all the questions.
You can search many FAQs in net...
If you have any specific questions related to single topic, Post message for each.
I can send some of FAQ documents to u
Answers
1) Using Index like Field(1)-1st record field , Field(2) - 2nd record field etc... in Table control.. we can handle BDC
2) BAPI will be programmed using OO concepts more.. and as Interfacing is more enhanced here than normal FM.
etc...
Regards,
Manjunatha -
Report on Smartform..To make it efficient by removing SELECT ,ENDSELECT
To make a smartform report efficient by removing all occurs & modify internal table statements.
What i have been given to do is to select all data from respective tables put them into one internal table & then finally making tab2 or tab3 in the report to be the final table.I am not sure which among these two i can make final table.
THE CODE is:
REPORT zgr_note.
TABLES : mseg, "Document Segment : Material
prps, "WBS element master data
proj, "Project Definition
mkpf, "Header : Material Document
lfa1, "Vendor Master
makt, "Material Description
aufk, "Order Master Data
afvc. "Operation within an order
DATA : fname LIKE rs38l-name. "Name of Function Module
DATA: lf_fm_name TYPE rs38l_fnam.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: lf_formname TYPE tdsfname.
DATA: ls_addr_key LIKE addr_key.
DATA: ls_dlv_land LIKE vbrk-land1.
DATA: ls_job_info TYPE ssfcrescl.
DATA: ls_otpt_opt TYPE ssfcompop.
DATA: retcode TYPE sy-subrc.
DATA: cntr TYPE i VALUE 0.
DATA: cntr1 TYPE i .
DATA: number TYPE SSFCRESCL-SPOOLIDS. " OCCURS 0 WITH HEADER LINE.
DATA: TSP01 type TABLE OF TSP01_SP0R.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE mseg.
DATA : post1 LIKE proj-post1, "Project Definition
pspnr LIKE proj-pspnr, "WBS element
maktx LIKE makt-maktx, "Material Description
name1 LIKE lfa1-name1, "Name of the supplier
budat LIKE mkpf-budat, "Posting date
bldat LIKE mkpf-bldat, "Document date
cpudt LIKE mkpf-cpudt, "Date on which account document was entered
psphi LIKE prps-psphi, "Current number of project
post2 LIKE prps-post1, "WBS Definition
xblnr LIKE mkpf-xblnr, "Reference number( in this case challan number)
bktxt LIKE mkpf-bktxt, "Header text
ort01 LIKE lfa1-ort01, "vendor city
ktext LIKE aufk-ktext, "network description
ltxa1 LIKE afvc-ltxa1. "operation short text
DATA : END OF itab.
DATA : BEGIN OF jtab OCCURS 0.
INCLUDE STRUCTURE itab.
DATA : END OF jtab.
DATA : itab1 LIKE itab OCCURS 0
WITH HEADER LINE.
DATA :itab2 LIKE itab OCCURS 0
WITH HEADER LINE.
DATA: itab3 LIKE itab OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text_001.
SELECT-OPTIONS : gr_num FOR mseg-mblnr . "no INTERVALS.
PARAMETERS : gr_note LIKE itemset-xopsel RADIOBUTTON GROUP rad1.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS : mat_num FOR mseg-mblnr . "no INTERVALS.
PARAMETERS : mat_slip LIKE itemset-xopsel RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN SKIP.
CASE 'X'.
WHEN gr_note.
PERFORM gr_display.
WHEN mat_slip.
PERFORM mat_display.
ENDCASE.
FORM gr_display .
*break developer1.
SELECT mblnr mjahr matnr werks lgort lifnr menge meins
erfmg bpmng ebeln ps_psp_pnr zeile lsmng erfme
FROM mseg
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN gr_num.
LOOP AT itab.
SELECT pspnr psphi post1 INTO CORRESPONDING FIELDS OF itab1
FROM prps WHERE pspnr = itab-ps_psp_pnr.
itab-psphi = itab1-psphi.
itab-pspnr = itab1-pspnr.
itab-post2 = itab1-post1.
MODIFY itab TRANSPORTING psphi pspnr post2.
ENDSELECT.
SELECT post1 FROM proj INTO CORRESPONDING FIELDS OF itab2
WHERE pspnr = itab-psphi.
itab-post1 = itab2-post1.
MODIFY itab TRANSPORTING post1.
ENDSELECT.
REFRESH itab2.
SELECT maktx FROM makt INTO CORRESPONDING FIELDS OF itab2
WHERE matnr = itab-matnr.
itab-maktx = itab2-maktx.
MODIFY itab TRANSPORTING maktx.
ENDSELECT.
REFRESH itab2.
SELECT name1 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF itab2
WHERE lifnr = itab-lifnr.
itab-name1 = itab2-name1.
itab-ort01 = itab2-ort01.
MODIFY itab TRANSPORTING name1 ort01.
ENDSELECT.
REFRESH itab2.
SELECT budat bldat cpudt xblnr bktxt FROM mkpf
INTO CORRESPONDING FIELDS OF itab2
WHERE mblnr = itab-mblnr.
itab-budat = itab2-budat.
itab-bldat = itab2-bldat.
itab-cpudt = itab2-cpudt.
itab-xblnr = itab2-xblnr.
itab-bktxt = itab2-bktxt.
MODIFY itab TRANSPORTING budat bldat cpudt xblnr bktxt.
ENDSELECT.
ENDLOOP.
LOOP AT itab .
ON CHANGE OF itab-mblnr.
itab3-mblnr = itab-mblnr.
itab3-post1 = itab-post1.
itab3-post2 = itab-post2.
itab3-name1 = itab-name1.
itab3-ort01 = itab-ort01.
itab3-bldat = itab-bldat.
APPEND itab3.
CLEAR itab3.
ENDON.
ENDLOOP.
jtab-mblnr = itab-mblnr.
jtab-xblnr = itab-xblnr.
jtab-budat = itab-budat.
jtab-bktxt = itab-bktxt.
jtab-lsmng = itab-lsmng.
jtab-erfmg = itab-erfmg.
jtab-erfme = itab-erfme.
jtab-matnr = itab-matnr.
jtab-maktx = itab-maktx.
jtab-zeile = itab-zeile.
APPEND jtab.
LOOP AT itab3.
CLEAR: itab2,itab2[].
LOOP AT itab WHERE mblnr = itab3-mblnr.
MOVE-CORRESPONDING itab TO itab2.
APPEND itab2.
CLEAR itab2.
ENDLOOP.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMM_GOODS_RECEIPT1'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = fname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*break developer1.
PERFORM print_parameters.
CALL FUNCTION fname
EXPORTING
control_parameters = ls_control_param
output_options = ls_otpt_opt
user_settings = 'X'
gr_mseg_hdr = itab3
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
gr_mseg = itab2
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. " GR_DISPLAY
FORM mat_display .
SELECT mblnr mjahr matnr werks lgort lifnr menge meins
erfmg bpmng ebeln ps_psp_pnr zeile lsmng erfme
mat_pspnr nplnr aufpl aplzl
FROM mseg
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE mblnr IN mat_num.
LOOP AT itab.
SELECT ltxa1 FROM afvc INTO CORRESPONDING FIELDS OF itab1
WHERE aufpl = itab-aufpl AND aplzl = itab-aplzl.
itab-ltxa1 = itab1-ltxa1.
MODIFY itab TRANSPORTING ltxa1.
ENDSELECT.
REFRESH itab1.
SELECT ktext FROM aufk INTO CORRESPONDING FIELDS OF itab1
WHERE aufnr = itab-nplnr.
itab-ktext = itab1-ktext.
MODIFY itab TRANSPORTING ktext.
ENDSELECT.
REFRESH itab1.
SELECT pspnr psphi post1 INTO CORRESPONDING FIELDS OF itab1
FROM prps WHERE pspnr = itab-mat_pspnr.
itab-psphi = itab1-psphi.
itab-pspnr = itab1-pspnr.
itab-post2 = itab1-post1.
MODIFY itab TRANSPORTING psphi pspnr post2.
ENDSELECT.
SELECT post1 FROM proj INTO CORRESPONDING FIELDS OF itab2
WHERE pspnr = itab-psphi.
itab-post1 = itab2-post1.
MODIFY itab TRANSPORTING post1.
ENDSELECT.
REFRESH itab2.
SELECT maktx FROM makt INTO CORRESPONDING FIELDS OF itab2
WHERE matnr = itab-matnr.
itab-maktx = itab2-maktx.
MODIFY itab TRANSPORTING maktx.
ENDSELECT.
REFRESH itab2.
SELECT name1 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF itab2
WHERE lifnr = itab-lifnr.
itab-name1 = itab2-name1.
itab-ort01 = itab2-ort01.
MODIFY itab TRANSPORTING name1 ort01.
ENDSELECT.
REFRESH itab2.
SELECT budat bldat cpudt xblnr bktxt FROM mkpf
INTO CORRESPONDING FIELDS OF itab2
WHERE mblnr = itab-mblnr.
itab-budat = itab2-budat.
itab-bldat = itab2-bldat.
itab-cpudt = itab2-cpudt.
itab-xblnr = itab2-xblnr.
itab-bktxt = itab2-bktxt.
break developer1.
MODIFY itab TRANSPORTING budat bldat cpudt xblnr bktxt.
ENDSELECT.
ENDLOOP.
LOOP AT itab.
ON CHANGE OF itab-mblnr.
itab3-mblnr = itab-mblnr.
itab3-budat = itab-budat.
itab3-bldat = itab-bldat.
itab3-post1 = itab-post1.
itab3-ktext = itab-ktext.
APPEND itab3.
CLEAR itab3.
ENDON.
ENDLOOP.
LOOP AT itab3.
CLEAR: itab2, itab2[].
LOOP AT itab WHERE mblnr EQ itab3-mblnr.
MOVE-CORRESPONDING itab TO itab2.
APPEND itab2.
CLEAR itab2.
ENDLOOP.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMM_MAT_ISSUE_SLIP'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = fname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_control_param-no_dialog = 'X'.
*ls_control_param-preview = 'X'.
*ls_control_param-getotf = 'X'.
ls_otpt_opt-tdnoprev = 'X'.
ls_otpt_opt-tdnewid = ''.
ls_otpt_opt-tdimmed = 'X'.
ls_otpt_opt-tddest = 'LP01'.
CALL FUNCTION fname
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = ls_control_param
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = ls_otpt_opt
user_settings = 'X'
mat_slip_hdr = itab3
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = ls_job_info
JOB_OUTPUT_OPTIONS =
TABLES
mat_slip = itab2
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM.Hello Saswat,
There are a couple of criteria to make a SmartForm report efficient, i.e. to achieve a better performance:
- provide the best possible interface to the temporary FM (fname). When you do so, SmartForm itself has not to perform so much programming stuff by itself.
- The Driver program (zgr_note) has to be designed and coded well. What mean the performance of the Driver has to be optimized. In your case there should be a couple of performance improvements:
-- adjust your program declaration to the new ABAP syntax, i.e. don't use OCCURS clauses and do not use HEADER LINE. Instead, implement TYPES and use them. Here is an example:
TYPES: BEGIN OF ty_itab.
INCLUDE STRUCTURE mseg.
TYPES: post1 LIKE proj-post1, "Project Definition
pspnr LIKE proj-pspnr, "WBS element
maktx LIKE makt-maktx, "Material Description
name1 LIKE lfa1-name1, "Name of the supplier
budat LIKE mkpf-budat, "Posting date
bldat LIKE mkpf-bldat, "Document date
cpudt LIKE mkpf-cpudt, "Date on which account document was entered
psphi LIKE prps-psphi, "Current number of project
post2 LIKE prps-post1, "WBS Definition
xblnr LIKE mkpf-xblnr, "Reference number( in this case challan number)
bktxt LIKE mkpf-bktxt, "Header text
ort01 LIKE lfa1-ort01, "vendor city
ktext LIKE aufk-ktext, "network description
ltxa1 LIKE afvc-ltxa1, "operation short text
END OF ty_itab.
* Declare your internal tables and the corresponding working structures
DATA: itab1 type standard table of ty_itab,
itab2 type standard table of ty_itab,
itab3 type standard table of ty_itab,
jtab type standard table of ty_itab,
wa_itab1 type ty_itab,
wa_itab2 type ty_itab,
wa_itab3 type ty_itab,
wa_jtab type ty_itab.
-- Don't use
LOOP at itab.
SELECT ...... WHERE pspnr = itab-ps_psp_pnr.
ENDSELECT.
SELECT * ...
ENDSELECT
SELECT * .....
ENDSELECT
ENDLOOP.
Instead try to populate itab, itab1, itab2 each in ONE select statement using FOR ALL ENTRIES clause. After that you have to perform the LOOP runs using LOOP at itab INTO wa_itab. The more redundant SELECTs, the slower the program! When you perform a LOOP run, let say over itab1 and you need a corresponding record from table itab2 the use READ <itab> with key.
One additional, very important hint: Using internal tables w/o header line the CLEAR statement has another functionality than with HEADER LINE
CLEAR with HEADER LINE clears the HEADER line only
CLEAR w/o HEADER LINE clears the entire table. CLEAR does the same as REFRESH.
Another performance improvement is (when itab contains a lot of records) using FIELD-SYMBOLS.
A simple example is
FIELD-SYMBOLS: <fs> type itab.
LOOP at itab assigning <fs>.
wa_itab3-post1 = <fs>-post1.
wa_itab3-post2 = <fs>-post2.
APPEND wa_itab3 to itab.
ENDLOOP.
In this case no data values have to be transfered to a working field. The values are taken directly from the current line of the internal table.
-- For better readability disign some events like START-OF-SELECTION, END-OF-SELECTION, INITIALIZATION and others.
Try to gather all in SmartForms needed fields and pop them into table itab3.
I hope this helps improving zgr_note's efficiency.
Good luck,
Heinz -
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,
RajeshHi 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 -
How to dynamicly create a field name AND access it
All,
I am trying to build a code block that will access what amounts to a table structure inside a table. I have 38 occurances if a set of 3 fields. (Source system had an internal array/occurs clause that was converted for our ODS into individual fields) I am returning a single row as a row type and have addressability to all fields. What I am trying to avoid is coding my logic block 38 times, 1 for each occurance.
FOR X IN 1 .. 38 LOOP
V_CAT_CD_X := 'CAT_'||X||'_CD';
End Loop;
The following is the display of the correctly built field:
--> Loop Cat CD: CAT_1_CD Rec count:1 Loop counter:1
--> Loop Cat CD: CAT_2_CD Rec count:1 Loop counter:2
--> Loop Cat CD: CAT_3_CD Rec count:1 Loop counter:3
--> Loop Cat CD: CAT_4_CD Rec count:1 Loop counter:4
My problem is that my row cursor PP1 is addressable hardcoding PP1.CAT_1_CD or PP1.CAT_2_CD ect, however I am having problems using my created string to access the field.
What do I need to do to gain accessability via this method?
I do have the ability to select the column names from the system tables but even then, I am lacking addressability to my ROW type using the selected field name.
Thanks
GregNot sure if this is what you are looking for:
SQL> ed
Wrote file afiedt.buf
1 declare
2 my_cur SYS_REFCURSOR;
3 v_rec mytest%rowtype;
4 cursor c1 is select column_name from all_tab_cols where table_name = 'MYTEST';
5 v_sql_stmt VARCHAR2(1000) := NULL;
6 BEGIN
7 v_sql_stmt := 'SELECT ';
8 FOR I IN c1 LOOP
9 v_sql_stmt := v_sql_stmt||I.column_name||',';
10 end loop;
11 v_sql_stmt := RTRIM(v_sql_stmt,',');
12 v_sql_stmt := v_sql_stmt||' FROM mytest';
13 open my_cur for v_sql_stmt;
14 LOOP
15 FETCH my_cur INTO v_rec;
16 EXIT WHEN my_cur%NOTFOUND;
17 dbms_output.put_line(v_rec.a);
18 END LOOP;
19 close my_cur;
20* end;
SQL> /
1
2
PL/SQL procedure successfully completed.
SQL> Edited by: AP on Nov 17, 2010 5:29 AM -
i wan faqs on internal tables plz send me anybody,
1. wat is difference between hashed and sorted tables?
2. diff between standard and sorted internal table?
3. diff b/w internal table and dictionary table?
4 can we create an internal table dynamically ? (at run time)
5. wat is the use of at new statement?
6. wat is diff b/w at first& at new statements?
7. wat is binery serch? and how it is useful in sorted internal table?
8. wat does it mean occurs 0 while creating an internal table ?
9. wat will happen if we don't give occur clause while creating
an internal table?HI,
see this linkhttp://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
see this link for dynamic internal table
http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
rgds,
bharat. -
I AM ANALYZING THIS PROGRAM CAN U TELL ME FROM WHICH POINT I HAVE TO START
TABLES: VBAP, "Sales Document: Item Data
VBUP, "Sales Document: Item Status
VBAK, "Sales Document: Header Data
LIPS, "SD document: Delivery: Item data
MBEW, "Material Valuation
MAKT, "Material Description
MARA, "General Material Data
MARC, "Plant Data for Material
VBPA, "Sales Document: Partner
VBEP, "Sales Document: Schedule Line
VBKD, "Sales Document: Business Data
KNA1, "General Data in Customer Master
T179, "Materials: Product Hierarchies
T179T, "Product hierarchies: Texts
T001W, "Plants/Branch
RDPR.
DATA DECLARATION ********************
DATA: BEGIN OF HEADER OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales document
NAME1 LIKE KNA1-NAME1, "Customer Name
SONAME1 LIKE KNA1-NAME1, "Customer Name (sold to)
POSNR LIKE VBAP-POSNR, "Sales document item
MATNR LIKE VBAP-MATNR, "Material number
MAKTX LIKE MAKT-MAKTX, "Material Description
**included by S.Balameenakshi req by KK
VTWEG LIKE VBAK-VTWEG,
LSMENG LIKE VBAP-LSMENG, "Order Qty
KWMENG LIKE VBAP-KWMENG, "Pending order qty
KZWI2 LIKE VBAP-KZWI2, "Sale Value
KZWI1 LIKE VBAP-KZWI1, "MC value
KZWI3 LIKE VBAP-KZWI3, "MC %
AUDAT LIKE VBAK-AUDAT, "Order date
VTEXT LIKE T179T-VTEXT, "Description
AEKLK LIKE MARA-AEKLK, "Error Indicator
RDPRF LIKE MARC-RDPRF, "Rounding profile
VORMG LIKE RDPR-VORMG, "Rounding Qty
RVAL LIKE VBAP-KZWI1,
RPER LIKE VBAP-KZWI3, "MC % Rounded
PRODH LIKE VBAP-PRODH, "Product hierarchy
CUOBJ LIKE VBAP-CUOBJ, "Configuration
WERKS LIKE VBAP-WERKS, "Plant
WAERK LIKE VBAP-WAERK, "SD document currency
KURSK LIKE VBKD-KURSK, "Exch rate for pricing statistics
KUNNR LIKE VBAK-KUNNR, "Customer Code
XCAL LIKE RDPR-VORMG,
END OF HEADER.
DATA: BEGIN OF BOM OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales document
POSNR LIKE VBAP-POSNR, "Sales document item
MATNR LIKE VBAP-MATNR, "Material number
**included by S.Balameenakshi req by KK
VTWEG LIKE VBAK-VTWEG,
STUFE LIKE STPOX-STUFE, "Level
MNGLG LIKE STPOX-MNGLG, "Component quantity
LBKUM LIKE MBEW-LBKUM, "Reqd qty.
STPRS LIKE MBEW-STPRS, "Rate
SALK3 LIKE MBEW-SALK3, "total reqd value
BESKZ LIKE MARC-BESKZ, "Procurement Type
SOBSL LIKE MARC-SOBSL, "Special procurement type
WERKS LIKE VBAP-WERKS, "Plant
SLNO LIKE SY-TABIX, "current line index
RECNO TYPE I,
END OF BOM.
DATA : BOM1 LIKE BOM OCCURS 0 WITH HEADER LINE,
XSTPOX LIKE STPOX OCCURS 0 WITH HEADER LINE,
XMATCAT LIKE CSCMAT OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF MBEWTEMP OCCURS 10,
MATNR LIKE MBEW-MATNR,
VERPR LIKE MBEW-VERPR,
ZPLP1 LIKE MBEW-ZPLP1,
ZPLP2 LIKE MBEW-ZPLP2,
ZPLP3 LIKE MBEW-ZPLP3,
END OF MBEWTEMP.
DATA : BEGIN OF IT_MAT OCCURS 10,
MATNR LIKE MBEW-MATNR,
END OF IT_MAT.
DATA: BEGIN OF GRID_TAB OCCURS 10,
DESC(15) TYPE C,
TABLE(10) TYPE C,
FIELD(10) TYPE C,
KEY,
END OF GRID_TAB.
DATA: BEGIN OF FNAME OCCURS 0,
FIELD(20) TYPE C,
END OF FNAME.
DATA: BEGIN OF FNAME1 OCCURS 0,
FIELD(20) TYPE C,
END OF FNAME1.
DATA: FIRST TYPE I,
XLINENO TYPE I,
XERROR(1) TYPE C,
XPRODH(5) TYPE C,
XVBELN LIKE BOM-VBELN,
XPOSNR LIKE BOM-POSNR,
XQTY LIKE STPOX-MNGLG,
YQTY LIKE STPOX-MNGLG,
XVAL LIKE MBEW-STPRS,
XRATE LIKE MBEW-STPRS,
LEVEL LIKE BOM-STUFE,
XSALEVAL(15) TYPE P DECIMALS 2,
XMCVAL(15) TYPE P DECIMALS 2,
XMCPERC(15) TYPE P DECIMALS 2,
YSALEVAL(15) TYPE C,
YMCVAL(15) TYPE C,
YMCPERC(15) TYPE C,
XSALEDESC(25) TYPE C,
XMCDESC(25) TYPE C,
XMCPERCDESC(25) TYPE C,
A1(80) TYPE C,
A2(80) TYPE C,
A3(80) TYPE C,
A4(80) TYPE C,
X1(80) TYPE C,
X2(80) TYPE C,
XTEXT(50) TYPE C.
DATA : BOMQTY LIKE PLFH-MGVGW,
INQTY LIKE PLFH-MGVGW.
I HAVE TO ANALYZE ABOUT THE PERFORMANCE OF INTERNAL TABLESHello Ansuman,
A program analysis begins at the first statement which is right after the last DATA declaration. For maintenance purposes this statement appears after the first EVENT. Such an EVENT can be e.g. START-OF-SELECTION, INITIALIZATION, AT USER-COMMAND etc.
In your thread only data declarations are shown. These declarations can be improved (for further performance issues) as well. All the table declarations should adhere the modern ABAP syntax, what means you should omit the obsolete OCCURS clause!
E.g.
DATA : BEGIN OF MBEWTEMP OCCURS 10,
MATNR LIKE MBEW-MATNR,
VERPR LIKE MBEW-VERPR,
ZPLP1 LIKE MBEW-ZPLP1,
ZPLP2 LIKE MBEW-ZPLP2,
ZPLP3 LIKE MBEW-ZPLP3,
END OF MBEWTEMP.
should be replaced by something like
TYPES: BEGIN OF TY_MBEWTEMP,
MATNR LIKE MBEW-MATNR,
VERPR LIKE MBEW-VERPR,
ZPLP1 LIKE MBEW-ZPLP1,
ZPLP2 LIKE MBEW-ZPLP2,
ZPLP3 LIKE MBEW-ZPLP3,
END OF TY_MBEWTEMP.
DATA: MBEWTEMP TYPE TABLE OF TY_MBEWTEMP,
WA_MBEWTEMP TYPE TY_MBEWTEMP.
FIELD-SYMBOLS: <fs> TYPE TY_MBEWTEMP.
To achieve a better performance in your LOOP runs, the designed LOOP should look like:
LOOP AT MBEWTEMP into assigning <fs>. "or into wa_mbewtemp
MOVE <fs>-MATNR to <somewhere>.
ENDLOOP.
Header lines shouldn't be used anymore. Using the assign clause, there is no additional data space needed. <fs> points directly to the current index in the internal table.
The most critical areas for a proper performance are the LOOP runs, the SQL statements (prevent selects in a LOOP!!) and data uploads from either a presentation server or an application server.
Hope this helps,
Heinz -
HI floks
i did some development in new smartform its working fine but i have issue in data base performance is 76% . but i utilize similar below code with various conditions in various 12 places . is it possible to reduce performance this type of code . check it and mail me how can i do it . if possible can suggest me fast .how much % is best for this type of performance issues.
DATA : BEGIN OF ITVBRPC OCCURS 0,
LV_POSNR LIKE VBRP-POSNR,
END OF ITVBRPC.
DATA : BEGIN OF ITKONVC OCCURS 0,
LV_KNUMH LIKE KONV-KNUMH,
LV_KSCHL LIKE KONV-KSCHL,
END OF ITKONVC.
DATA: BEGIN OF ITKONHC OCCURS 0,
LV_KNUMH LIKE KONH-KNUMH,
LV_KSCHL LIKE KONH-KSCHL,
LV_KZUST LIKE KONH-KZUST,
END OF ITKONHC.
DATA: BEGIN OF ITKONVC1 OCCURS 0,
LV_KWERT LIKE KONV-KWERT,
END OF ITKONVC1.
DATA : BEGIN OF ITCALCC OCCURS 0,
LV_KWERT LIKE KONV-KWERT,
END OF ITCALCC.
DATA: COUNTC(3) TYPE n,
TOTALC LIKE KONV-KWERT.
SELECT POSNR FROM VBRP INTO ITVBRPC
WHERE VBELN = INV_HEADER-VBELN AND ARKTX = WA_INVDATA-ARKTX .
APPEND ITVBRPC.
ENDSELECT.
LOOP AT ITVBRPC.
SELECT KNUMH KSCHL FROM KONV INTO ITKONVC WHERE KNUMV =
LV_VBRK-KNUMV AND KPOSN = ITVBRPC-LV_POSNR AND KSCHL = 'ZLAC'.
APPEND ITKONVC.
ENDSELECT.
ENDLOOP.
SORT ITKONVC BY LV_KNUMH.
DELETE ADJACENT DUPLICATES FROM ITKONVC.
LOOP AT ITKONVC.
SELECT KNUMH KSCHL KZUST FROM KONH INTO ITKONHC WHERE KNUMH = ITKONVC-LV_KNUMH AND KSCHL = 'ZLAC' AND KZUST = 'Z02'.
APPEND ITKONHC.
ENDSELECT.
ENDLOOP.
LOOP AT ITKONHC.
SELECT KWERT FROM KONV INTO ITKONVC1 WHERE KNUMH = ITKONHC-LV_KNUMH AND
KSCHL = ITKONHC-LV_KSCHL AND KNUMV = LV_VBRK-KNUMV.
MOVE ITKONVC1-LV_KWERT TO ITCALCC-LV_KWERT.
APPEND ITCALCC.
ENDSELECT.
endloop.
LOOP AT ITCALCC.
COUNTC = COUNTC + 1.
TOTALC = TOTALC + ITCALCC-LV_KWERT.
ENDLOOP.
MOVE ITKONHC-LV_KSCHL TO LV_CKSCHL.
MOVE TOTALC TO LV_CKWERT.
it's urgent ..........
thanks .
bbbbye
sureshHi,
you can increase the performance by following,
1. By changing occurs clause to types declaration clause.
You need to declare like this:
DATA : BEGIN OF xVBRPC,
LV_POSNR LIKE VBRP-POSNR,
END OF xVBRPC.
DATA: ITVBRPC like table of xVBRPC,
2. do not use select statements in loop statements.
Ashven -
Dear All,
techinicallly is there any difference between.
data : it_mara type standard table of mara.
t_mara type mara occurs 0.
Which is better way to define. I know both are internal tables without header.
onemore thing, header that it is obsolete to use "occurs 0", is this right.
Please let me know.
Regards
madhuHi,
Yes...you should use only table declarations without the occurs clause. This improves performance a lot. And this kind of declarations has become mandatory with the ECC6.0 release.
Try practicing to declare without the occurs clause.
Thanks,
Subramanian
Maybe you are looking for
-
SSO Authentication Audit Information for Partner Apps ?
Hi, Is it possible to get Audit Information to show when a users has been authenticated by SSO for a Partner Application ? If I look at orasso.wwsso_audit_log_view I can see when a user has been authenticated and a row for Portal and each Partner App
-
Flex Tree Folder/File Leaf/Branch icons
Hello Everyone , I have an object which implements ITreeDataDescriptor and I stuff the objects into a Tree. The objects are being shown in the tree , however , they are all shown with the folder icon. Is there a way I can tell this tree that som
-
Re send a succesfukl idoc.
Hi Experts, I have send an IDOC and it shows success in we03. Status 03. I want to resend it. The same Idoc, with respect to it's IDOC No. Can it be done???..If positive, pls tell me the process. !! Arnab
-
I hava a question that I want to know. I use the JDK1.4.0beta 3 and J2ee1.2.1 to test the HelloWorld program. In my Program I use the POAHelper.narrow() to get a POA,because some ones tells me that I can't use the POA() to get the correct type.But th
-
Satellite A500 Issues (graphics Card freezes when Gaming)
Hi Everyone hoping you can help!! I recently purchased my Satellite A500 Laptop and I have 2 extremley bad issues!!! Firstly apparently my model number doesnt exist it is PSAM3A-04100E which is proving to be a right royal pain in the preverbial when