Programming dynamic abap code
i want to build up a tree with te data of some internal tables.
i have programmed the following coding:
FORM build_node_and_item_table USING pt_node_table TYPE treev_ntab
pt_item_table TYPE item_table_type.
CLEAR l_index.
LOOP AT lt_verfasser INTO ls_verfasser.
l_key = ls_verfasser-key.
CONCATENATE 'Root' l_key
INTO ls_text SEPARATED BY '/'.
CONDENSE ls_text NO-GAPS.
l_root = ls_text.
ls_node-node_key = l_root.
CLEAR ls_node-relatkey. " Special case: A root node has no parent
CLEAR ls_node-relatship. " node.
ls_node-hidden = ' '. " The node is visible,
ls_node-disabled = ' '. " selectable,
ls_node-isfolder = 'X'. " a folder.
CLEAR ls_node-n_image. " Folder-/ Leaf-Symbol in state "closed":
" use default.
CLEAR ls_node-exp_image. " Folder-/ Leaf-Symbol in state "open":
" use default
CLEAR ls_node-expander. " see below.
" the width of the item is adjusted to its content (text)
APPEND ls_node TO pt_node_table.
CLEAR ls_item.
ls_item-node_key = ls_text.
ls_item-item_name = '1'.
ls_item-class = cl_gui_list_tree=>item_class_text. " Text Item
" the with of the item is adjusted to its content (text)
ls_item-alignment = cl_gui_list_tree=>align_auto.
" use proportional font for the item
ls_item-font = cl_gui_list_tree=>item_font_prop.
CONCATENATE sy-datum
ls_verfasser-name
ls_verfasser-rolle
INTO ls_text SEPARATED BY space.
ls_item-text = ls_text.
APPEND ls_item TO pt_item_table.
* Schmerz
READ TABLE lt_schmerz INTO ls_schmerz WITH KEY ls_verfasser-key.
IF sy-subrc = 0.
CLEAR ls_node.
l_key = l_index.
CONCATENATE 'FO_Schmerz' l_key
INTO ls_text SEPARATED BY '/'.
CONDENSE ls_text NO-GAPS.
l_node_schmerz = ls_text.
* Node with key 'Child1'
CLEAR ls_node.
* Achtung node_key darf nur 12 Zeichen lang sein!!!
ls_node-node_key = l_node_schmerz.
" Key of the node
" Node is inserted as child of the node with key 'Root'.
ls_node-relatkey = l_root.
ls_node-relatship = cl_gui_list_tree=>relat_last_child.
ls_node-isfolder = 'X'.
APPEND ls_node TO pt_node_table.
* Node with key 'Child1'
CLEAR ls_item.
ls_item-node_key = l_node_schmerz.
ls_item-item_name = '1'.
ls_item-class = cl_gui_list_tree=>item_class_text.
ls_item-alignment = cl_gui_list_tree=>align_auto.
ls_item-font = cl_gui_list_tree=>item_font_prop.
ls_item-text = 'Schmerz'(004).
APPEND ls_item TO pt_item_table.
LOOP AT lt_schmerz INTO ls_schmerz
WHERE key = ls_verfasser-key.
l_tabix = sy-tabix.
CLEAR ls_node.
l_key = l_tabix.
CONCATENATE 'IT_Schmerz' l_key
INTO ls_text SEPARATED BY '/'.
CONDENSE ls_text NO-GAPS.
ls_node-node_key = ls_text.
ls_node-relatkey = l_node_schmerz.
ls_node-relatship = cl_gui_list_tree=>relat_last_child.
APPEND ls_node TO pt_node_table.
* Items of node with key 'New1'
CLEAR ls_item.
ls_item-node_key = ls_text.
ls_item-item_name = '1'.
ls_item-class = cl_gui_list_tree=>item_class_text.
CONCATENATE ls_schmerz-ort
ls_schmerz-wo
ls_schmerz-art
ls_schmerz-kommentar
INTO ls_text SEPARATED BY space.
l_length = STRLEN( ls_text ).
ls_item-length = l_length.
ls_item-ignoreimag = 'X'. " see documentation of Structure
" TREEV_ITEM
* ls_item-usebgcolor = 'X'. " item has light grey background
* ls_item-t_image = '@01@'. " icon of the item
ls_item-text = ls_text.
APPEND ls_item TO pt_item_table.
ENDLOOP.
ENDIF.
** Ernährung
* READ TABLE lt_ernaehrung INTO ls_ernaehrung WITH KEY ls_verfasser-key.
* IF sy-subrc = 0.
* CLEAR ls_node.
* l_key = l_index.
* CONCATENATE 'FO_Ern' l_key
* INTO ls_text SEPARATED BY '/'.
* CONDENSE ls_text NO-GAPS.
* l_node_ern = ls_text.
** Node with key 'Child1'
* CLEAR ls_node.
** Achtung node_key darf nur 12 Zeichen lang sein!!!
* ls_node-node_key = l_node_ern.
* " Key of the node
* " Node is inserted as child of the node with key 'Root'.
* ls_node-relatkey = l_root.
* ls_node-relatship = cl_gui_list_tree=>relat_last_child.
* ls_node-isfolder = 'X'.
* APPEND ls_node TO pt_node_table.
** Node with key 'Child1'
* CLEAR ls_item.
* ls_item-node_key = l_node_ern.
* ls_item-item_name = '1'.
* ls_item-class = cl_gui_list_tree=>item_class_text.
* ls_item-alignment = cl_gui_list_tree=>align_auto.
* ls_item-font = cl_gui_list_tree=>item_font_prop.
* ls_item-text = 'Ernährung'(004).
* APPEND ls_item TO pt_item_table.
* LOOP AT lt_ernaehrung INTO ls_ernaehrung
* WHERE key = ls_verfasser-key.
* l_tabix = sy-tabix.
* CLEAR ls_node.
* l_key = l_tabix.
* CONCATENATE 'IT_Ern' l_key
* INTO ls_text SEPARATED BY '/'.
* CONDENSE ls_text NO-GAPS.
* ls_node-node_key = ls_text.
* ls_node-relatkey = l_node_ern.
* ls_node-relatship = cl_gui_list_tree=>relat_last_child.
* APPEND ls_node TO pt_node_table.
** Items of node with key 'New1'
* CLEAR ls_item.
* ls_item-node_key = ls_text.
* ls_item-item_name = '1'.
* ls_item-class = cl_gui_list_tree=>item_class_text.
* CONCATENATE ls_ernaehrung-art
* ls_ernaehrung-kommentar
* ls_ernaehrung-hilfsmittel
* ls_ernaehrung-bericht
* INTO ls_text SEPARATED BY space.
* l_length = STRLEN( ls_text ).
* ls_item-length = l_length.
* ls_item-ignoreimag = 'X'. " see documentation of Structure
* " TREEV_ITEM
** ls_item-usebgcolor = 'X'. " item has light grey background
** ls_item-t_image = '@01@'. " icon of the item
* ls_item-text = ls_text.
* APPEND ls_item TO pt_item_table.
* ENDLOOP.
* ENDIF.
* Index vor dem nächsten Durchlauf um 1 erhöhen
l_index = l_index + 1.
ENDLOOP.
ENDFORM.
This works fine and the data is displayed in the alv-tree. I would like to programm this a little more dynamic because of lines of code. As you see, I commented the data filling of the tree with the data of the second internal table.
I'd like to programm the coding so dynamic, that i would only use the coding i have posted, without copying the code for each internal table.
Could you please help me how to do this.
I thought about a internal table, where i collect the names of the tables which should be displayed in the alv tree.
but how do i create the internal tables dynamicly. i would also use a work area for the loop of the internal tables. how could i create the work area dynamicly?
I hope anyone could help my to spare some lines of code and make my posted coding dynamicly.
Thanks very much!
Greetings!
You could try researching the way SAPLink works to import that kind of objects, it creates those (and other) kinds of objects based on data in XML files (nuggets and slinkees). You could adapt it to create them based on your kind of input instead.
A word of caution though, I'm not sure it uses only SAP approved methods / APIs to achieve that. For instance, I know (from Thomas Jung's comments in other threads) that the APIs used in SAPLink to import Web Dynpro components are SAP internal and not intended to be used by customer developers; however to date there was no public API to do that.
SAPLink's site: http://saplink.org/
Regards
Edited by: Alejandro Bindi on Aug 11, 2009 6:54 PM
Similar Messages
-
Schedule a background job for a program using ABAP code.
Hi,
I have to write a program to schedule a background job for another program.
Need your help to understand how we can achieve this functionality.Any example of an abap code would be of great help.
Need it urgently.
Thanks in advance.
Sandeep.Hi Sandeep,
Here is the demo program regarding the BDC For the background job.
report zprprbdc1
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
*** DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
* If it is nessesary to change the data section use the rules:
* 1.) Each definition of a field exists of two lines
* 2.) The first line shows exactly the comment
* '* data element: ' followed with the data element
* which describes the field.
* If you don't have a data element use the
* comment without a data element name
* 3.) The second line shows the fieldname of the
* structure, the fieldname must consist of
* a fieldname and optional the character '_' and
* three numbers and the field length in brackets
* 4.) Each field must be type C.
*** Generated data section with specific formatting - DO NOT CHANGE ***
***data: begin of itab occurs 0 ,
*** matnr(20) type c,
*** mbrsh(30) type c,
*** mtart(30) type c,
*** kzsel(20) type c,
*** maktx(40) type c,
*** meins(5) type c,
*** end of itab.
data: begin of record occurs 0,
* data element: MATNR
matnr_001(018),
* data element: MBRSH
mbrsh_002(001),
* data element: MTART
mtart_003(004),
* data element: XFELD
kzsel_01_004(001),
* data element: MAKTX
maktx_005(040),
* data element: MEINS
meins_006(003),
* data element: MTPOS_MARA
mtpos_mara_007(004),
end of record.
*** End generated data section ***
start-of-selection.
*perform open_dataset using dataset.
perform open_group.
**do.
**read dataset dataset into record.
**if sy-subrc <> 0. exit. endif.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\jitu\bdc\10002.txt'
filetype = 'ASC'
has_field_separator = 'x'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = record
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at record .
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
record-matnr_001.
perform bdc_field using 'RMMG1-MBRSH'
record-mbrsh_002.
perform bdc_field using 'RMMG1-MTART'
record-mtart_003.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
record-kzsel_01_004.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx_005.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
record-meins_006.
perform bdc_field using 'MARA-MTPOS_MARA'
record-mtpos_mara_007.
perform bdc_transaction using 'MM01'.
**enddo.
endloop.
perform close_group.
*perform close_dataset using dataset.
&*****************Reward point if helpful************& -
Calling a mime object in the WebDynPro ABAP code dynamically
Hi ,
Can anyone let me know the API to access the mime objects dynamically in the WD ABAP code. I have a text file in the WD ABAP component as a text file.
I would like to pick the file with the help of API's and read the content of the file using Mime Object API's .
Can anyone help me out in this.
Best Regards
SidHi,
do the methods of CL_WD_WEB_ICON help?
Regards, Heidi -
How to insert abap code in LSMW generated program?
hi,
i m working on LSMW for loading data in SAP
i would like to insert abap code into the generated program....
it's because i have 1 BKPF segment (header data), 2 BSEG segments, but i cannot define rules by customizing for the second BSEG segment(LSMW doesn't permitt).
i already tried to insert code directly into the program, but obviously it disapears at each time i generate the program.
i saw that apparently a code insertion has already be made into this program and the subject of this insertion is to define rules for the second BSEG (exactly what i want to do....) and this modification doesn't disapear at new prog generation.....
Any idea ?Hi
Why dont you use the FORM provided by LSMW
To use this please do the following
1.Goto option <b>Maintain Field Mapping and Conversion Rules</b>
2.Goto menu <b>EXTRAS->LAYOUT->Form Routines</b>
Here you will now get many options like
Global Data
Begin of Transaction
Begin of Processing
Begin of Record
like wise the End of these also.
Please put a breakpoint and check where you want to insert your code.
Note:
This is only for the Conversion Program and does not affect the main program used to update the Standard Tables
Hi , I was reading your earlier post .. It seems that you have worked on EMIGALL. Consider a similar situation, it is like writing the code in the events till CALL01...
Thanks
DOminic
Message was edited by: Dominic Pappaly -
Link BOR Event with ABAP code (program or function)!
Hello experts,
I am trying to link program or function to bor event. Change of data in HR IT0002 trigger event CHANGE of PERSDATA Object. I need to execute some ABAP code (program or function) on CHANGE event, so I have to link event and ABAP code.
Question: is it possible and how?Hi,
It is very much possible....
You can use the Workflow & use BO as PERSDATA & this workflow can be triggered on event change.
& You can write your code ...
Regards,
Rahul -
To execute from ABAP code an external Unix program
HI,
I would like to know how to execute from ABAP code an external Unix program and check for a return code?HI,
There are different ways to this:
(1) OPEN DATASET <file> FOR OUTPUT 'unix command'
CLOSE DATASET <file>
This command executes the unix command and writes the output into <file>
Look into OSS Note 9391.
(2) or try the following program but unfortunately the command CALL SYSTEM is
not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
REPORT ZUNIXCOM .
DATA: U_COMMAND(200).
Table for system messages
DATA: BEGIN OF RT OCCURS 100 ,
LINE(100) ,
END OF RT .
START-OF-SELECTION .
MOVE 'unix command' to U_COMMAND .
REFRESH RT.
CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
ID 'TAB' FIELD RT-SYS .
LOOP AT RT.
WRITE : / RT-LINE .
ENDLOOP.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar. -
Can not see ABAP code of programs and FM using SE37, SE38, SE80
Hi, all!
When I try to open ABAP-code using transactions SE37, SE38, SE80, they don't display it. Instead it current mode hangs, but I can open another one.
System ECC 6.0, SAP_ABA package SAPKA70021, GUI Patch 17.
I have 2 laptops, one of them works with these transaction properly, another gives described problem. Other my colleagues don't have such problems.
Can anybody help me to solve this problem?
BR,
Borishi friend,
I had the same problem the problem than you, the problem isn´t the gui, the probelm is the msxml parser .
Follow the next sollution and you will solve your problem.
http://scn.sap.com/thread/1853701
My original problem was the "SAP signature theme" was black and with a lot of problems, changing to "Enjoy theme" everything appear works perfecly, but when I tryed to display any source code the screen was thinking without end.
The problem is solved uninstalling any SAP software from your machine also msxml program from SAP and reinstalling first msxml 4.0 and msxml 6.0 after shut down install sap logon behind, when ended everything will work again.
This my actual version and it works.
kind regards,
Miguel Angel Orihuela -
Do we have a ABAP code / program to delete all objects viz. InfoObjects etc
I am working on a SAP BI7.0 implementation project and seek help on the following points -
Do we have a ABAP code / program to delete all objects viz. InfoObjects, InfoProviders, Datasources, Infopackages, DTP, Transformations etc. in ONE shot
Secondly, does anyone have a template created for capturing information on Transports created for release?
Please do let me know.
Thanks in advance,
VenkatIt may be hard to delete objects containing data.
Try
RSDG_CUBE_DELETE Deleting InfoCubes
RSDG_IOBC_DELETE Deleting InfoCubes
RSDG_IOBJ_DELETE Deleting InfoObjects (without automatic transport connection !)
RSDG_MPRO_DELETE Deleting InfoCubes
Also check :
How to delete multiple InfoObjects in one shot? -
Starting SAP transaction in between ABAP code
Hi,
How can I start a particular transaction in between ABAP code if certain condition is true.
Regards,
Tushar.If a program has a transaction code, there are two ways of starting it from another program.
If you do not want to return to the calling program at the end of the new transaction, use the statement:
LEAVE TO TRANSACTION <tcod> [AND SKIP FIRST SCREEN].
This statement ends the calling program and starts transaction <tcod>. This deletes the call stack (internal sessions) of all previous programs. At the end of the transaction, the system returns to the area menu from which the original program in the call stack was started.
If, on the other hand, you do not want to return to the calling program at the end of the new transaction, use the statement:
CALL TRANSACTION <tcod> [AND SKIP FIRST SCREEN] [USING <itab>].
This statement saves the data of the calling program, and starts transaction <tcod>. At the end of the transaction, the system returns to the statement following the call in the calling report. If the LEAVE statement occurs within the called transaction, the transaction ends and control returns to the program in which the call occurred.
You can use a variable to specify the transaction <tcod>. This allows you to call transactions statically as well as dynamically.
The addition AND SKIP FIRST SCREEN allows you to prevent the initial screen of the new transaction from being displayed. The first screen to be displayed is then the specified Next screen in the screen attributes of the initial screen. If the first screen calls itself as the next screen, you cannot skip it.
Furthermore, the AND SKIP FIRST SCREEN option works only if all mandatory fields on the initial screen of the new transaction are filled completely and correctly with input values from SPA/GPA parameters.
The USING ITAB addition in the CALL TRANSACTION statement allows you to pass an internal table <itab> to the new transaction. <itab> has the form of a batch input table. For further information about batch input tables, refer to Importing Data With Batch Input.
Cheers
Nishanth -
ABAP Code example using "GENERATE DYNPRO"
I am looking for ABAP code example who use the "Generate dynpro" dynamic generation of dynpro at runtime under SAP 4.6C version.
Best regards,We have some programs that do:
form %view.
data: anz type i,
prog like sy-repid.
prog = sy-repid.
perform init_download(rsaqexce).
case %tab.
when 'G00'.
perform generate_view_dynpro(rsaqexce)
using prog text-grl.
describe table %g00 lines anz.
tview100-lines = anz.
perform init_view(rsaqexce) tables %g00 using tview100.
call screen 100.
perform reset_view_dynpro(rsaqexce).
when others.
message s860(aq).
endcase.
endform.
I think they were copied from existing SAP programs. In any event, look at the relevant forms in program rsaqexce.
And as Rich noted, SAP doesn't recommend this.
Rob -
What are the steps to optimise ABAP code
What are the steps to optimise ABAP code, that is how to increase the performance of a code?
Hi
Welcome to SDN forum
1) Dont use nested select statements
2) If possible use for all entries in addition
3) In the where addition make sure you give all the primary key
4) Use Index for the selection criteria.
5) You can also use inner joins
6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.
7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234
ABAP performance depends upon various factors and in devicded in three parts:
1. Database
2. ABAP
3. System
Run Any program using SE30 (performance analys) to improve performance refer to tips and trics section of SE30, Always remember that ABAP perfirmance is improved when there is least load on Database.
u can get an interactive grap in SE30 regarding this with a file.
also if u find runtime of parts of codes then use :
Switch on RTA Dynamically within ABAP Code
*To turn runtim analysis on within ABAP code insert the following code
SET RUN TIME ANALYZER ON.
*To turn runtim analysis off within ABAP code insert the following code
SET RUN TIME ANALYZER OFF.
Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
Avoid for all entries in JOINS
Try to avoid joins and use FOR ALL ENTRIES.
Try to restrict the joins to 1 level only ie only for tables
Avoid using Select *.
Avoid having multiple Selects from the same table in the same object.
Try to minimize the number of variables to save memory.
The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
Avoid creation of index as far as possible
Avoid operators like <>, > , < & like % in where clause conditions
Avoid select/select single statements in loops.
Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
Avoid using ORDER BY in selects
Avoid Nested Selects
Avoid Nested Loops of Internal Tables
Try to use FIELD SYMBOLS.
Try to avoid into Corresponding Fields of
Avoid using Select Distinct, Use DELETE ADJACENT
Check the following Links
Re: performance tuning
Re: Performance tuning of program
http://www.sapgenie.com/abap/performance.htm
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
check the below link
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
See the following link if it's any help:
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
Check also http://service.sap.com/performance
and
books like
http://www.sap-press.com/product.cfm?account=&product=H951
http://www.sap-press.com/product.cfm?account=&product=H973
http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
Performance tuning for Data Selection Statement
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
Debugger
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
Run Time Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
SQL trace
http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
CATT - Computer Aided Testing Too
http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
Test Workbench
http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
Coverage Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
Runtime Monitor
http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
Memory Inspector
http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
ECATT - Extended Computer Aided testing tool.
http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
Just refer to these links...
performance
Performance
Performance Guide
performance issues...
Performance Tuning
Performance issues
performance tuning
performance tuning
You can go to the transaction SE30 to have the runtime analysis of your program.Also try the transaction SCI , which is SAP Code Inspector.
1 Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
2 Avoid for all entries in JOINS
3 Try to avoid joins and use FOR ALL ENTRIES.
4 Try to restrict the joins to 1 level only ie only for 2 tables
5 Avoid using Select *.
6 Avoid having multiple Selects from the same table in the same object.
7 Try to minimize the number of variables to save memory.
8 The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
9 Avoid creation of index as far as possible
10 Avoid operators like <>, > , < & like % in where clause conditions
11 Avoid select/select single statements in loops.
12 Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
13 Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
14 Avoid using ORDER BY in selects
15 Avoid Nested Selects
16 Avoid Nested Loops of Internal Tables
17 Try to use FIELD SYMBOLS.
18 Try to avoid into Corresponding Fields of
19 Avoid using Select Distinct, Use DELETE ADJACENT.
<b>Reward points for useful Answers</b>
Regards
Anji -
For RFC Sender " Is it must i need to write ABAP code " ?
Hi All
I am learning XI but i have problem while creating RFC sender ?
How to configure RFC sender? I must write ABAP code in R/3 side ?
Can any one expalin me indetail on this?
I see many links in SDN but i was not able to find the exact one
Adv..thanks and points
RakeshHi ,
Go thru this data...
<b>Configuring the Sender RFC Adapter </b>
<b>Use</b>
You configure the sender RFC adapter so that you can use it to convert RFC calls from a sender to XML messages and send these messages to the Integration Server.
<b>Integration</b>
You configure the adapter on the Parameters tab page during the definition of a communication channel. In addition to the adapter configuration, on the Module tab page in the module processor, you can specify generic modules, which give the adapter additional functions.
<b>Prerequisites</b>
1. You have created a new communication channel or have opened an existing one.
2. On the Parameter tab page you have selected the adapter type RFC.
3. You have selected the Sender radio button to define the adapter as a sender adapter.
4. The communication channel in which the RFC adapter is defined must be defined for a service of type Business System in the area Service Without Party.
5. The specifications in the communication channel must match the specifications for the adapter-specific identifiers for the business system. For more information on adapter-specific identifiers, see: Service
<b>Activities</b>
<b>Transport Protocol</b>
The transport protocol is RFC.
<b>Message Protocol</b>
The message protocol is RFC (RFC XML).
<b>Adapter Engine</b>
Select the Adapter Engine on the Integration Server, or select a non-centrally installed Adapter Engine.
<b>Adapter Status</b>
Set the adapter to Active to enable messages to be exchanged.
RFC Server Parameters
The RFC server parameters identify the sender system.
<b>Specify the following parameters:</b>
Parameter Entry
Application server (Gateway) Gateway host of the sender system
Application server service (Gateway) Gateway service of the sender system
Program ID Program ID of the registered server program
Unicode Select this check box if the sender system is a Unicode system
Initial connections Number of initial connections required between sender system and adapter
Maximum connections Maximum possible number of initial connections required between sender system and adapter
Advanced mode Select this check box if you want to specify additional parameters of the class JCO.Server for the adapter configuration
Enter the name and values of the parameters in the table displayed
<b>RFC Metadata Repository Parameters</b>
The RFC metadata repository parameters identify the SAP system containing the repository for the RFC metadata. This does not necessarily have to be the sender system.
<b>Specify the following parameters:</b>
<b>Parameter Entry</b>
Load balancing Select this check box if your SAP system works with load balancing
Application server Host name of the SAP system (without load balancing)
System number System number of the SAP system (without load balancing)
Message server Host name of the message server (with load balancing)
Message server service Operating system service of the message server or message server port (with load balancing)
System ID System ID of the SAP system (with load balancing)
Logon group Logon group for the dynamic logon load (with load balancing)
Authentication Type Logon data for the SAP system
User Name SAP user name
User Password SAP user password
Logon language SAP logon language
Client SAP client
Advanced mode Select this check box if you want to specify additional parameters of the class JCO.Client for the adapter configuration
Enter the name and values of the parameters in the table displayed
Depending on the SAP system version, the following authorizations are required to read the metadata (authorization object: S_RFC, ACTVT: 16, FUGR):
Function Groups by R/3 Release
R/3 Release Function Groups (FUGRs)
As of 3.1H RFC1, SG00, SRFC, SUNI, SYST
As of 4.0A RFC1, SDIF, SG00, SRFC, SYST, SYSU, SUNI
As of 4.6A RFC1, SDIF, SG00, SRFC, SYST, SYSU
As of 4.6D RFC1, SDIFRUNTIME, SG00, SRFC, SYST, SYSU
As of SAP Web Application Server 6.20, the role SAP_BC_JSF_COMMUNICATION_RO is available, which is used for the user SAPJSF and contains all the required authorizations.
Regards,
Jayaram... -
Sample ABAP code for userexits, and calling bapi's
Hi,
Can someone please send me sample ABAP code
1) to do extractor enhancement using user exit.
2) ABAP program to call BAPI to read live cache order series data in SNP and write to Idocs through some ports.
3) ABAP routine to generate file name (based on date/country)in the infopackage to upload flatfiles.
Thank you very much in advance and appreciate any help.
Regards
Prasadhai ,
check this code...
*& Tables
tables : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
*& Selection Screen Parameters
selection-screen begin of block a01 with frame title text-001.
selection-screen skip.
parameters : p_tcode like tstc-tcode obligatory.
selection-screen skip.
selection-screen end of block a01.
*& Start of main program
start-of-selection.
Validate Transaction Code
select single * from tstc
where tcode eq p_tcode.
Find Repository Objects for transaction code
if sy-subrc eq 0.
select single * from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir
where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir
where pname = tstc-pgmna.
select single * from enlfdir
where funcname = tfdir-funcname.
select single * from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name = enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
Find SAP Modifactions
select * from tadir
into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct
where sprsl eq sy-langu
and tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
Take the user to SMOD for the Exit that was selected.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen. -
Currency translation routine - pls correct ABAP code
Hi,
I am trying to implement a scenario for currency conversion at the transformation level.(i am using BI 7.0)
My source data is flat file.
My scenario here is like
I have 2 masters - country & supplier.
I added 0loc_currcy as an attribute to the country.
The master data of country is as below:
Cid cname local currency
C1 INDIA INR
C2 SWISS CHF
C3 America USD
For supplier master data is:
supp id Sname
S1 raghu
S2 tej
S3 harish
S4 reddy
I defined 2 key figures one Zprice1 & Zprice2.
Zprice1 has currency type 0DOC_CURRCY
Zprice2 has currency type 0LOC_CURRCY
In the PSA the data is as below:
cid sid 0calday price1 doc_curr
C1 S1 01.01.2007 300,00 INR
C1 S2 01.02.2007 400,00 CHF
C1 S3 03.01.2007 350,00 USD
C1 S4 15.04.2007 450,00 EUR
C2 S1 31.05.2007 600,00 INR
C2 S2 21.06.2007 250,00 CHF
C2 S3 01.01.2007 900,00 USD
C2 S4 01.02.2007 1.300,00 EUR
C3 S1 03.01.2007 1.250,00 INR
C3 S2 15.04.2007 500,00 CHF
C3 S3 31.05.2007 50,00 USD
C3 S4 21.06.2007 300,00 EUR
I am expecting my data in the cube to be as below:
cid sid 0calday price1 doc_curr price2 loc_curr
C1 S2 01.02.2007 400,00 CHF 350,00 INR
(bcoz c1->INR)
C3 S1 03.01.2007 1.250,00 INR 25,00 USD
(bcoz c3->USD)
Based on cid the loc_curr value(amount & currency after conversion) should be displayed.
in the transformation i assigned
/BIC/zprice1 -> zprice1
DOC_CURRCY -> zprice1
/BIC/zprice1 -> zprice2
DOC_CURRCY -> zprice2
For zprice2 i selected rule details.
In IOassignment of source fields i assigned ZPRICE1
and 0DOC_CURRCY.
In currency tab of rule details now it is like :
Target Currency 0LOC_CURRCY
Currency from source
Source Currency DOC_CURRCY
Now in rule type i selected routine and inserted code shown below:
data: ZResult_Val type f,
CALMONTH type rsgeneral-chavl .
CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'
EXPORTING
I_CTTNM = 'ANYCALMON'
I_AMOUNT = SOURCE_FIELDS-/BIC/ZPRIC1
I_SCUR = SOURCE_FIELDS-DOC_CURRCY
I_TCUR = 'EUR' --- (what should i give here for target currency should be taken based on cid)
I_TIME_IOBJVL = CALMONTH
I_SCUR_IOBJVL =
I_TCUR_IOBJVL =
I_PERIV =
I_RATE = 'M'
I_VDATE =
IR_MSG =
I_MSG_TYPES =
IMPORTING
E_AMOUNT = ZResult_Val
E_RATE = 'M'
E_SCUR = SOURCE_FIELDS-DOC_CURRCY
E_TCUR = 'EUR'
EXCEPTIONS
SCUR_NOT_FOUND = 1
TCUR_NOT_FOUND = 2
DATE_NOT_FOUND = 3
CTT_NOT_FOUND = 4
SCUR_CONFLICT = 5
TCUR_CONFLICT = 6
DATE_CONFLICT = 7
INVALID_SCUR = 8
INVALID_TCUR = 9
RATE_NOT_FOUND = 10
X_MESSAGE = 11
INHERITED_ERROR = 12
OTHERS = 13
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
RESULT = ZResult_Val.
I am new to ABAP coding; infact this is my first peace of code.
Can any one tell me some tips of writing code-
->how to see all the syntax error at a time ; By clicking on check(ctrl+F2) i could see only the first syntax error.
-> how to check what each perameter mean? like what does I_CTTNM in this function call 'RSW_CURRENCY_TRANSLATION'. mean?
please help.
Thanks,
RaghuI have written a test program as below:
<code>
REPORT ZCURRENCY.
data: tgtcurr type /BI0/OILOC_CURRCY,
ZResult_Val type F.
select LOC_CURRCY into tgtcurr from /BIC/PZCONTRY1 where /BIC/ZCONTRY1 =
'C3'.
endselect.
CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'
EXPORTING
I_CTTNM = 'TEJ5' --currency trans type defined in RSCUR
I_AMOUNT = 10
I_SCUR = 'INR'
I_TCUR = tgtcurr
*I_TIME_IOBJVL = CALMONTH
IMPORTING
E_AMOUNT = ZResult_Val
E_TCUR = tgtcurr.
write: ZResult_Val
</code>
It is working fine
But the following code is not working for my scenario can some debug pls:
<code>
data: ZResult_Val type f,
ZSrc_val type f,
locvar type /BI0/OILOC_CURRCY.
Zsrc_val = SOURCE_FIELDS_RULE-/BIC/ZPRIC1.
select LOC_CURRCY into locvar from /BIC/PZCONTRY1 where /BIC/ZCONTRY1 =
SOURCE_FIELDS_RULE-/BIC/ZCONTRY1.
endselect.
CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'
EXPORTING
I_CTTNM = 'TEJ5'
I_AMOUNT = 10
I_SCUR = 'INR'
I_TCUR = locvar
IMPORTING
E_AMOUNT = ZResult_Val
E_TCUR = locvar
RESULT = ZResult_Val.
</code> -
Create Timer Jobs dynamically using code (on the fly)
What I am trying to accomplish here is different from the usual "Create and deploy a new custom timer job". So please co operate.
Scenario : I have around 200 lists in my site. Each list gets its data from a third part web service (cutom code / not BCS). The data retrieval happens via Timer Jobs. The Timer Jobs call the web service, gets the fresh data and updates the
list items. This is currently working fine with multiple lists and 1 timer job to refresh the data.
Problem : Now the issue I am facing is, each of the lists have its own Refresh Frequency. Say List 1 to 30 needs to be refreshed every 5 mins. List 31 to 60 every 10 mins, etc. I am currently handling this by having a RefreshLastRun timestamp.
This works fine in most of the scenarios - unless the Web service returns large data, in which case it takes more than 5 to 10 mins for the Update to complete on 4 to 5 lists. At the same time, the other lists - they were supposed to be updated 5 mins ago,
but are still waiting to get updated because the timer job is busy updating another list, and the refresh is in Que. This is a completely unaccepatable solution to my client because the list with lower frequency duration (5 mins) is of a higher priority than
the lists getting refreshed every 10 mins.
My Question is : How do I create a new Timer Job for each list? Whenever I add a new list (through code), I want to create a Timer Job at the same time, which will take care of refreshing the data in this and this list only. This way, I will
have a independent Timer Job for each list and dont have to depend on 1 timer job to take all the load. With this approach I will have 200 timer jobs running. Which is OK with my client. So I create one class inhereting from SPJobDefinition class, and
use it repeatedly to create unlimted timer jobs?
I hope I am able to convey the message. My Timer Jobs are working fine. I dont need suggestions on how to get the timer job working etc. My question is, how do I create a new Job Definition dynamically through code (no deployment).
HanifI'm afraid this leads to a path where you create a single timer job (or windows service) that uses parallel programming (tpl) to handle all the lists. However, that places a huge burden on you to manage schedules, monitoring etc., something the timer job
framework handles for you.
Kind regards,
Margriet Bruggeman
Lois & Clark IT Services
web site: http://www.loisandclark.eu
blog: http://www.sharepointdragons.com
Maybe you are looking for
-
HT5312 When I click send my security questions nothin we'll be in my mail I tried a lot of time
When I click on send me my security questions nothing we'll happen my mail we'll be empty is there a another way I can get my security questions?
-
Having problems downloading itunes 7.2
I'm get a 1921 error service Ipod service could not be stopped . verify that you have sufficient privileges to stop system services please help thank you
-
This one has me stumped. I'm thinking it's related to render files, but can't quite figure it out. Had a piece that contained several clips that were speed-reduced to 40%. Not strictly time-remapped with keyframes and all, just speed reduced. Piece w
-
My iPad1 died. I ordered new iPad. How do I get the apps and contacts onto the new
I was never assiduous in synching my pad. I think I did sometimes. Doesn't Apple know what I bought from them? How do I tell them I want to switch from the old dead one to the new one? Am I in the iCloud? I don't know!
-
HT201359 trying to buy app but after password says contact support, but can't find support
Keep trying tour chase in app content but after inputting my password it prompts me to contact iTunes support