Google Search - Blog...........

Showing posts with label abap. Show all posts
Showing posts with label abap. Show all posts

Mass Approval For The Leave Workflow Data - PT_ARQ_REQUEST_EXECUTE

When there is a requirement for approving the mass approvals for the leave request workflow , then use the below function module PT_ARQ_REQUEST_EXECUTE to approve it.

Before running the functional module check the record status in the table PTREQ_HEADER with field status. It has the status 'SENT' .

data : EX_MESSAGES TYPE PTARQ_UIA_MESSAGES_TAB,
EX_COMMANDS TYPE PTARQ_UIA_COMMAND_TAB.

CALL FUNCTION 'PT_ARQ_REQUEST_EXECUTE'
EXPORTING
im_request_id = 'E079F211C65FEFF188150050569A609B' "PTREQ_HEADER-REQUEST_ID
IM_COMMAND = 'EXECUTE_APPROVE'
im_pernr = '00000001'
im_modus = 'R'
* IM_DEBUG =
* IMPORTING
* EX_REQUEST =
* EX_HAS_ERRORS =
* EX_SHOW_CHANGE =
tables
ex_messages = EX_MESSAGES
ex_commands = EX_COMMANDS
.

After running this function module the status become 'APPROVED' in the table PTREQ_HEADER , and if u check in the workflow the workflow would be completed. for detailed data run the report RPTARQDBVIEW.

SAP ABAP - VIEWS - Introduction, Types & Creating It.

A view is an aggregated dictionary object. Aggregate object or complex object are objects, which are created by using object. E.g., Table is created using data element and domain. A view is created using tables.

A view is an imaginary table or virtual table. Using one or more tables can create a view. Physically, view does not contain any data. The view is filled dynamically during runtime.

View is mainly used to restrict or limit, access to information or data by employees, area, plant and so on. By using view, you can display information specific to a particular user or to their work or the information for which they have the right to access.

Types of Views:

R/3 System offers following types of views:
• Database View: You can create this view on transparent table. It supports all the three operations like Selection, Projection & Join

• Projection View: This type allows you to suppress some fields from the transparent table. This view is defined only with relational operator projection.

• Help View: These views are exclusively used by the SAP help system. All relational operators are supported. These views are generated when the user presses F4 function key on the field on selection screen. You can see these views only with SAP help and not with open SQL statements.

• Maintenance View: This type of view enables the maintenance of a group of related tables using SM30 Transaction, which is for extended table maintenance.


Creating View:

• From initial screen of data dictionary, enter the name of object i.e. view.
• Select view radio button and click on the push button.
• Dialog box is displayed for types of views.
• Select the view type.
• On the next screen, you have to pass following parameters.
• Short text
• In the table box you need to enter the table names, which are to be related.
• In join table box you need to join the two tables.
• Click on the TABFIELD. System displays the dialog box for all the table fields and user can select the fields from this screen. These fields are displayed in the view fields box.
• Save and Activate: When the view is activated, view is automatically created in the underlying database system. As long as the table exists in the database, the view also exists (Unless you delete it).

SAP - Measure Performance Of ABAP Program - RunTime Analysis.

How do you measure the performance of a program in ABAP?

The runtime analysis is an additional development workbench tool that is quite useful for analyzing performance of an ABAP / 4 Program or transaction. With this tool, the system can display information about:

• Executed instruction
• Accessed execution time.
• Tables and Types of access.
• Chronological execution flow

The runtime analysis tool creates lists that reveal expensive statements, summarize table accesses. Runtime analysis is specifically designed for tuning individual programs and transactions.

The Runtime Analysis tool measures ABAP/4 statements that are potentially expensive in terms of CPU time. The most significant of these are:

  • Statement used for database access like select.
  • Statement used for modularization such as module, perform, call function.
  • Internal table statements like append, collect.


Starting Runtime Analysis:

• From ABAP/4 development workbench select Test – Runtime Analysis.
• From ABAP/4 editor, select utilities – more utilities – Runtime Analysis.
• From ABAP/ source code screen, select Execute – Runtime Analysis.
• From R3 screen, select System – Utilities – Runtime Analysis.
• Entering Transaction code SE30 in the command field.

On the initial screen, select the needed object you want to analyze i.e. program or transaction. Enter the name of the object. Click on execute. The system will execute the specified object and will generate a trace file or performance data file, which can then be analyzed when the transaction or program is finished.

Analyzing a performance data file:

These files are created at operating system level and many times occupy large memory space, so be sure to remove the files, which are no longer needed.

To analyze the files:
• Click on Analysis
• Following screen is displayed
• From GOTO option you can get overview of runtime analysis.


The options are as follows:
• Hit List – Displays a list with the most system expensive instructions.
• Tables – Displays the most important tables, the number of accesses and the time needed for the accesses.
• Group hit list – Displays a list with the performed instructions classified by instruction type.
• Call hierarchy – Presents a chronological listing with the flow of calls during the execution of a program.

During Runtime Analysis, the system measures the statements and stores these measurements in a performance data file. If you measure the same program or transaction several times, the data can vary. Many factors make it difficult to reproduce identical result. E.g., Network traffic.

When you evaluate this file, the system displays the overview - Runtime Analysis Evaluation screen including a bar chart for total execution time. From this screen, you can analyze several types of information like:

• Hit list: displays the list with the most `system-expensive’ instructions.
• Tables: displays the most important tables, the number of accesses and the time needed for the accesses.
• Group hit list: displays a list of performed instruction classified by its type.
• Call hierarchy: presents a chronological listing with the flow of calls during the execution of program.

Property Tax Data using BAPI BAPI_RE_CN_GET_LIST

t_seloption-field_name = 'CONTRACT_TYPE'.
t_seloption-sign = 'I'.
t_seloption-option = 'EQ'.
t_seloption-field_value_low = 'Z200'.

APPEND t_seloption.

t_seloption-field_name = 'CONTRACT_TYPE'.
t_seloption-field_value_low = 'Z210'.
APPEND t_seloption.

t_seloption-field_name = 'CONTRACT_TYPE'.
t_seloption-field_value_low = 'Z220'.
APPEND t_seloption.

CALL FUNCTION 'BAPI_RE_CN_GET_LIST'
TABLES
seloption = t_seloption
contract = t_contract
term_renewal = t_term_renewal
term_renewal_rule = t_term_renewal_rule
term_notice = t_term_notice
term_notice_obj = t_term_notice_obj
term_notice_rule = t_term_notice_rule
term_object_rel = t_term_object_rel
term_org_assignment = t_term_org_assignment
term_payment = t_term_payment
term_rhythm = t_term_rhythm
term_adjustment = t_term_adjustment
term_sr_reporting = t_term_sr_reporting
term_sr_sales = t_term_sr_sales
term_sr_peak_sales = t_term_sr_peak_sales
term_sr_rhythm = t_term_sr_rhythm
act_deposit = t_act_deposit
partner = t_partner
option_rate = t_option_rate
object_rel = t_object_rel
meas_cn = t_meas_cn
condition = t_condition
cond_calc = t_cond_calc
cond_dist = t_cond_dist
resubm_rule = t_resubm_rule
resubm_date = t_resubm_date
status = t_status
extension_out = t_extension_out
return = t_return
term_withholding_tax = t_term_withholding_tax
term_withholding_tax_item = t_term_withholding_tax_item
cosettle_param = t_cosettle_param
cosettle_rule = t_cosettle_rule
term_payment_split = t_term_payment_split.

ABAP - Selection Screen With Radio Buttons

report ztest .

TABLES: vbak, ltak.
DATA:
err_sw.
PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.
PARAMETERS: rb2 RADIOBUTTON GROUP rb1.

SELECTION-SCREEN: SKIP 1.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'
NO INTERVALS MODIF ID rb1.
SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.
SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.
SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.
SELECTION-SCREEN: END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.
IF rb1 = 'X'.
PERFORM hide_rb2_options.
ELSE.
PERFORM hide_rb1_options.
ENDIF.

INITIALIZATION.

START-OF-SELECTION.
CLEAR err_sw.
IF rb1 = 'X'.
IF s_auart IS INITIAL
OR s_date IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ELSE.
IF s_tanum IS INITIAL
OR s_bdatu IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ENDIF.

CHECK err_sw NE 'X'.

WRITE:/ 'Hi!'.

*&---------------------------------------------------------------------*
*& Form hide_rb2_options
*&---------------------------------------------------------------------*
FORM hide_rb2_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB1'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB2'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb2_options
*&---------------------------------------------------------------------*
*& Form hide_rb1_options
*&---------------------------------------------------------------------*
FORM hide_rb1_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB2'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB1'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.

ENDFORM. " hide_rb1_options


ALSO READ:

- Selection Screen With Push Buttons.

- Selection Screen Events.

- Selection Screen With Push Buttons With Events.

- Display LOGO On Selection Screen.

- Selection Screen Listbox From Table Entries.



ABAP - Convert Date And Month In Words - CONVERSION_EXIT_LDATE_OUTPUT

REPORT ZMONTH.

DATA X_MONTH(11).

parameters:p_date like sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
EXPORTING
INPUT = p_date
IMPORTING
OUTPUT = X_MONTH.

WRITE:/ ' Month and Date', X_MONTH+3(8).