tag:blogger.com,1999:blog-38621232048339665812024-02-19T14:47:21.927-08:00SAP ABAP Tips & TricksSrinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-3862123204833966581.post-55035846508597068372017-11-08T08:57:00.001-08:002017-11-08T08:57:27.019-08:00Closing Cockpit Without Transport Request<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Closing Cockpit without transport request:<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Clocking Cockpit is used for month end/quarter end/yearend
activities with some defined steps as per the client needs. There are some situations
where you may have to add additional step for that month end or quarter end, in
those situation we have to create that step in development system and transport
that entry into production system. This process is little time consuming and
client cannot wait to perform his month end/quarter end activities.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">We can bypass the transport creation with standard code
enhancement .Also we can put some additional conditions like based on users and
system wise.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 1: Go to transaction code SE24 and enter object type
CFC and display.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 2: Open the method Transport and click on Enhance
button.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 3: Now click on show implicit or explicit enhancements
options.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 4: Create enhancement on the top of the code and add
the logic to skip the code inside the method when user accessing closing
cockpit transaction.<o:p></o:p></span></div>
</div>
Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-52599763044208758522017-11-08T08:36:00.005-08:002017-11-08T08:36:58.502-08:00Test Data creation at Runtime from SRM to ECC<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Capture test data at runtime in standard function modules
from SRM to ECC.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">In day to day life, we come across situations where we have
to debug standard code or transaction codes for different issues from SRM to
ECC systems. Being standard code, sometimes it may take days to find exact root
cause of the issue. Finally after completing the analysis we may end up saying as
data issue, based on the data provided at the time of updating or posting to
standard FM’s BAPI_PO_CHANGE or BAPI_PO_CREATE etc... So, it will be useful if
we have test data created in those function modules at the time of transaction
executed.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Below are the steps to activate test data creation:<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 1: On ECC, set the parameter FBGENDAT ‘X’ in the
backend system for the RFC user of the SRM system.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 2: on ECC, execute report FBGENDAT in the mode ‘B’.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 3: on SRM, reproduce the issue from start.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 4: on ECC, check if a test data record was generated in
the function builder.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="margin: 0in 0in 8pt;">
<span style="font-family: Calibri;">Step 5: on ECC, deactivate the generation of test data
records by deleting the entries in report FBGENDAT and resetting the user
parameter.<o:p></o:p></span></div>
</div>
Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com1tag:blogger.com,1999:blog-3862123204833966581.post-81572607714186165862014-04-23T07:39:00.001-07:002014-04-23T07:39:24.172-07:00Code useful for executing ALV Grid report in Background mode causing short dump<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Calibri;"> </span><br />
<span style="font-family: Calibri;"><div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="background: white; color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Whenever an ALV grid control program is executed
in background, a short dump occurs </span></div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="background: white; color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Error:</span></u></b><b style="mso-bidi-font-weight: normal;"><span style="background: white; color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;"> </span></span></b><span style="background: white; color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">GUI cannot be reached </span></div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Reason</span></u></b></div>
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 0pt; text-align: justify;">
<span style="background: white; color: black; font-size: 12pt; line-height: 150%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">Whenever an ALV grid control program is executed in
foreground it tries to create some front-end related objects. But when the same
program is executed in background, the above error occurs as it fails to create
front-end objects (GUI objects). So in order to rectify this problem, we need
to use the docking container instead of custom container.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 0pt; text-align: justify;">
<span style="font-family: Times New Roman;">
</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.4pt; margin: 0in 0in 15pt;">
<span style="color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">The docking container doesn't need any of the custom controls on
the screen, instead it attaches an area to any or all of the four edges of the
screen (top, left, right or bottom).</span></div>
<div style="border-color: currentColor currentColor rgb(79, 129, 189); border-style: none none solid; border-width: medium medium 1pt; margin-left: 0in; margin-right: 0.65in; mso-border-bottom-alt: solid #4F81BD .5pt; mso-border-bottom-themecolor: accent1; mso-element: para-border-div; padding: 0in 0in 4pt;">
<div class="MsoIntenseQuote" style="margin: 10pt 0in 14pt;">
<strong><span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><em>The
behavior of the areas in the container is determined by the sequence in which
they are initialized. Docking Containers are attached to the screen from the
inside out. This means that when you create a second container, it is attached
to the edge of the screen, and the container that was already there </em></span><span style="background: white; color: black; font-size: 12pt; font-style: normal; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-bidi-font-weight: normal; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">is</span><span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><em> pushed
outwards.<o:p></o:p></em></span></strong></div>
<span style="font-family: Times New Roman;">
</span></div>
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 0pt; text-align: justify;">
<span style="font-family: Times New Roman;">
</span></div>
<div class="MsoNormal" style="background: white; line-height: 14.4pt; margin: 0in 0in 15pt;">
<span style="color: black; font-size: 12pt; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">We can use the below code when ALV is used in background programs</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">DATA : or_doc TYPE REF TO
cl_gui_docking_container.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">IF cl_gui_alv_grid=>offline( ) IS
INITIAL.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;"> </span>CREATE OBJECT or_custom_container</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>EXPORTING</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>container_name = c_container.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;"> </span>CREATE OBJECT or_grid</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>EXPORTING</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>i_parent = or_custom_container.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">ELSE.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>CREATE OBJECT or_grid</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>EXPORTING</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><span style="mso-spacerun: yes;">
</span>i_parent = or_doc.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: black; font-size: 12pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;">ENDIF.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 0pt; text-align: justify;">
<span style="font-family: Times New Roman;">
</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
We can also use<span style="mso-spacerun: yes;"> </span>SAP
system variable SY-BATCH<span style="mso-spacerun: yes;"> </span>is ‘X’ to check
if the program is being executed in background or foreground <o:p></o:p></div>
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 0pt; text-align: justify;">
<span style="font-family: Times New Roman;">
</span></div>
</span><br />
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 0pt; text-align: justify;">
<br /></div>
</div>
Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com4tag:blogger.com,1999:blog-3862123204833966581.post-56584378932662009802012-07-25T11:16:00.002-07:002012-07-25T11:16:45.634-07:00To find the IP address of application server in SAP<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #222222; font-family: Calibri;"> <div class="MsoNormal" style="background: white; line-height: 13pt; margin: 7.5pt 0in;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">TYPES: BEGIN OF kernel_version,<br /> key(21) TYPE c,<br /> data(69) TYPE c,<br /> END OF kernel_version.</span></div>
<div class="MsoNormal" style="background: white; line-height: 13pt; margin: 7.5pt 0in;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> DATA : gt_kernel_version TYPE STANDARD TABLE OF kernel_version,<br /> gw_kernel_version TYPE kernel_version.</span></div>
<div class="MsoNormal" style="background: white; line-height: 13pt; margin: 7.5pt 0in;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> DATA ip_address(69) TYPE c.<br /> CALL 'SAPCORE' ID 'ID' FIELD 'VERSION'<br /> ID 'TABLE' FIELD gt_kernel_version[].</span></div>
<div class="MsoNormal" style="background: white; line-height: 13pt; margin: 7.5pt 0in;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> READ TABLE gt_kernel_version INTO gw_kernel_version INDEX 11.<br /> ip_address = gw_kernel_version-data.</span></div>
<div class="MsoNormal" style="background: white; line-height: 13pt; margin: 7.5pt 0in;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">WRITE ip_address.</span></div>
</span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-82318457949340172982012-07-25T11:09:00.000-07:002012-07-25T11:09:33.397-07:00Shift negative sign from right to left in ABAP<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">DATA: gv_amount type konp-kbetr.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">DATA: gv_amount_text(15) type c. </span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">gv_amount = 100.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">gv_amount = gv_amount * -1. </span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">gv_amount_text = gv_amount. </span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">Now value will be 100 -</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;"> CHANGING</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;"> value = gv_amount_text. </span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">Now final value will be -100</span></span></div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com1tag:blogger.com,1999:blog-3862123204833966581.post-44313167141835703422012-07-25T10:52:00.003-07:002012-07-25T10:52:57.325-07:00Details of messages being displayed on WEB UI in SAP CRM<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">In order to figure out the details of the messages being displayed on WEB UI in SAP CRM for analysis purpose, the following steps can be performed:</span></span></div>
<div class="MsoListParagraph" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">1.</span><span style="font: 7pt "Times New Roman";"> </span></span></span><span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="font-family: Calibri;">Put a break-point in the method ADD_MESSAGE of the message service class CL_BSP_WD_MESSAGE_SERVICE and replicate the scenario for which the error message is appearing on the WEB UI. The import parameters IV_MSG_ID and IV_MSG_NUMBER of this method would have the message details.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="color: #222222; font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;"></span></span></div>
<div class="MsoListParagraph" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">2.</span><span style="font: 7pt "Times New Roman";"> </span></span></span><span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="font-family: Calibri;">The standard database table T100 maintains the standard error messages and their message class and message number.</span></span></div>
<div class="MsoListParagraph" style="margin: 0in 0in 0pt 0.5in;">
<br /></div>
<div class="MsoListParagraph" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">3.</span><span style="font: 7pt "Times New Roman";"> </span></span></span><span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="font-family: Calibri;">The method call stack in the debugger (‘Standard’ tab) can then be used to trace where in the logic this message is being added.</span></span></div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-65310668119095654302012-07-25T10:45:00.002-07:002012-07-25T10:45:50.072-07:00Grey out fields on ME21N/ME22N/ME23N<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #222222; font-family: Calibri;"> <div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt;"><span style="color: black;">How to grey out fields on ME21N/ME22N/ME23N</span></span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">For certain Purchase orders, based on some condition, we need to grey out the fields NETPR & KBETR.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">In order to do this, we need to find the right BADI or the right user exit to code our functionality. For this debug tool is a must to know where and how these fields are populated on the purchase order screen.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt;"><span style="color: black;">This functionality can be achieved by following the below steps.</span></span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">For the PO creation/change screen below is the solution to gray out the required fields (NETPR & KBETR)</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt;"><span style="color: black;">1. for NETPR:</span></span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">The field catalog that fills NETPR is TC_1211 Actually in standard program SAPLMEGUI, there is a call to the FM MEGUI_BUILD_PO_ITEMOV_PLUGIN.. Inside that, in line 44, TC_1211 gets populated. This contains all field catalog values. So in BADI, code to disable field NETPR by reading values using field symbols.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">In SE19:</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">Create Implementation — > Classic BADI –> ME_ACTV_CANCEL_PO –> Implementation name ZCL_IM_TEST</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">In method CHECK_ACTIVITY code the following:</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">Method IF_EX_ME_ACTV_CANCEL_PO~CHECK_ACTIVITY.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">FIELD-SYMBOLS :<fs><span style="mso-spacerun: yes;"> </span>TYPE ANY TABLE,</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;"><ls><span style="mso-spacerun: yes;"> </span>TYPE ANY,</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;"><lr_screen> TYPE screen.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">ASSIGN (‘(SAPLMEGUI)TC_1211-COLS’) TO <fs>.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">IF sy-subrc IS INITIAL.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">LOOP AT <fs> ASSIGNING <ls>.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">ASSIGN COMPONENT ’SCREEN’ OF STRUCTURE <ls> TO <lr_screen>.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">IF <lr_screen>-name = ’MEPO1211-NETPR’.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;"><lr_screen>-input = 0.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">ENDIF.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">ENDLOOP.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">ENDIF.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">endmethod.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">Activate the implementation. NETPR will be disabled in the header when u try to create or change purchase order.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt;"><span style="color: black;">2. for KBETR</span></span></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">In Screen 6201 of program SAPLV69A -> LV69AO03à Module FELDAUSWAHL, there is a User Exit: PERFORM userexit_field_modification.</span></span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-size: 12pt;"><span style="color: black;">Inside this EXIT, </span></span><span style="color: #222222; font-size: 12pt; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">change</span><span style="font-size: 12pt;"><span style="color: black;"> the contents of TCTRL_KONDITIONEN-COLS [6]-SCREEN-INPUT to 0. KBETR will get grayed out.</span></span></div>
</span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com6tag:blogger.com,1999:blog-3862123204833966581.post-72603536693001858482012-07-25T10:39:00.000-07:002012-07-25T10:39:02.178-07:00Capture error messages for function modules without exceptions<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 0pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 0pt; text-align: justify;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">At times we see function modules without any exceptions but still there is an error message being thrown inside the function module if any piece of code fails. If this situation happens then the program terminates at that point. In this case there is no SY-SUBRC other than 0. </span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 0pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 0pt; text-align: justify;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">To solve this, in the program where you have written your code for the FM, include the following lines of code.</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 0pt; text-align: justify;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><br /><span style="font-family: Calibri;"><b>EXCEPTIONS<br /> error_message = 99.</b></span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 0pt; text-align: justify;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 10pt; text-align: justify;">
<span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">By doing this you will ensure that whenever there is any error thrown by the function module, SY-SUBRC is set as 99 and you can then capture the message in system fields i.e. SY-MSGID, SY-MSGTY, SY-MSGNO, SY-MSGV1, SY-MSGV2, SY-MSGV3, SY-MSGV4, and SY-MSGV5.</span></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 10pt; text-align: justify;">
<b style="mso-bidi-font-weight: normal;"><u><span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">SAMPLE CODE:</span></span></u></b></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 10pt; text-align: justify;">
<span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">CALL</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">FUNCTION</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> </span><span style="background: white; color: #4da619; font-family: "Courier New"; font-size: 10pt;">'RV_CUSTOMER_MATERIAL_UPDATE'</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"><br /> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">TABLES</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"><br /> xknmt_tab = lt_xknmt<br /> yknmt_tab = lt_ykmt<br /> tcatalog_tab = lt_cat<br /> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">EXCEPTIONS</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"><br /> error_message = </span><span style="background: white; color: #3399ff; font-family: "Courier New"; font-size: 10pt;">99</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;">.</span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin: 0in 0in 10pt; text-align: justify;">
<span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">IF</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> sy-subrc <> </span><span style="background: white; color: #3399ff; font-family: "Courier New"; font-size: 10pt;">0</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;">.<br /> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">MESSAGE</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">ID</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> SY-MSGID </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">TYPE</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> SY-MSGTY </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">NUMBER</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> SY-MSGNO<br /> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">WITH</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;"> SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.<br /> </span><span style="background: white; color: blue; font-family: "Courier New"; font-size: 10pt;">ENDIF</span><span style="background: white; color: black; font-family: "Courier New"; font-size: 10pt;">.</span><span style="color: #222222; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"></span></div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com3tag:blogger.com,1999:blog-3862123204833966581.post-9796341805210041732012-05-30T02:18:00.002-07:002012-05-30T02:21:28.749-07:00Embedding Image in mail body instead of sending it as an attachment<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;">Get the path of image residing in MIME repository, fetch the binary content of the image, convert into BASE64 data and attach the base64 data into HTML mail body to embed image. </span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin: 0in 0in 0pt 0.5in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">· </span></span>Create a z report program.</span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin: 0in 0in 0pt 0.5in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">· </span></span>Get the image path from MIME repository (SE80): '/SAP/PUBLIC/image.jpg' (Path of image in mime repository which need to be embedded) </span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin: 0in 0in 10pt 0.5in; mso-add-space: auto; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">· </span></span>Get the binary content of the image. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> DATA: o_mr_api type ref to if_mr_api,<br /> is_folder type boole_d,<br /> l_current type xstring,<br /> l_loio type skwf_io.<br /><br /> IF o_mr_api is initial.<br /> o_mr_api = cl_mime_repository_api=>if_mr_api~get_api ( ).<br /> ENDIF. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> CALL METHOD o_mr_api->get<br /> EXPORTING<br /> i_url = '/SAP/PUBLIC/image.jpg'<br /> IMPORTING<br /> e_is_folder = is_folder<br /> e_content = l_current<br /> e_loio = l_loio<br /> EXCEPTIONS<br /> parameter_missing = 1<br /> error_occured = 2<br /> not_found = 3<br /> permission_failure = 4<br /> OTHERS = 5.<br /><br />*l_current will hold the image in a XSTRING </span></div>
<div class="MsoListParagraph" style="line-height: normal; margin: 0in 0in 10pt 0.5in; mso-add-space: auto; mso-list: l1 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">· </span></span>Convert the binary image data into Base64. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> CALL FUNCTION 'SSFC_BASE64_ENCODE'<br /> EXPORTING<br /> bindata = l_current<br /> IMPORTING<br /> b64data = b64data.<br /> IF sy-subrc <> 0. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> ENDIF. </span></div>
<div class="MsoListParagraph" style="line-height: normal; margin: 0in 0in 10pt 0.5in; mso-add-space: auto; mso-list: l1 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">· </span></span>Create mail body using HTML. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> In email body, the image will be displayed using its binary content. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> DATA lv_length TYPE I,<br /> lv_len2 TYPE i.<br /><br /> clear wa_mail_body.<br /> move '<html>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '<head>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '<title>hello</title>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '<meta http-equiv="content-type" content="text/html;charset=iso-8859- 1">' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '</head>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '<body>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> wa_mail_body = '<em><font' .<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> wa_mail_body = 'color="#0000ff" size="+7" face="arial,'.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> wa_mail_body = 'helvetica, sans-serif">test image</font></em>'.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br />*add image base64 content<br /> wa_mail_body = '<img src="data:image/gif;base64,'.<br /><br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /><br /> lv_length = strlen (b64data).<br /> lv_len2 = lv_length / 255.<br /><br /> wa_mail_body = b64data.<br /> append wa_mail_body to gt_mail_body.<br /> CLEAR wa_mail_body.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<span style="font-family: Verdana, sans-serif;"> DATA :lv_len3 TYPE I,<br /> temp1 TYPE i,<br /> temp2 TYPE i.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> do lv_len2 times.<br /> lv_len3 = 255 * sy-index.<br /><br /> if lv_len3 <= lv_length.<br /> wa_mail_body = b64data+lv_len3.<br /> if wa_mail_body is not initial.<br /> append wa_mail_body to gt_mail_body.<br /> clear wa_mail_body.<br /> else.<br /> exit.<br /> endif.<br /> elseif lv_len3 > lv_length.<br /><br /> exit.<br /> endif.<br /> enddo.<br /><br /> wa_mail_body = '"alt="happy birthday" align="middle" width="304" height="228" />'.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '</body>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.<br /><br /> clear wa_mail_body.<br /> move '</html>' to wa_mail_body.<br /> append wa_mail_body to gt_mail_body.</span></div>
<div class="MsoListParagraph" style="line-height: normal; margin: 0in 0in 10pt 0.5in; mso-add-space: auto; mso-list: l1 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">· </span></span>Send Mail. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;"> DATA : lt_mail_body TYPE soli_tab,<br /> lwa_mail_body LIKE LINE OF lt_mail_body.<br /><br /> l_subject = 'Test : Image in mail'.<br /><br /> lr_email_body = cl_document_bcs=>create_document(<br /> i_type = 'HTM'<br /> i_text = gt_mail_body<br /> i_subject = l_subject ).<br /><br /> lr_email = cl_bcs=>create_persistent( ).<br /> lr_email->set_document( lr_email_body ).<br /><br /> l_mail_address = 'test@test.com'.<br /><br /> lr_receiver = cl_cam_address_bcs=>create_internet_address( l_mail_address ).<br /> lr_email->add_recipient( i_recipient = lr_receiver ).<br /><br /> "Set Sender and send mail<br /> l_sender = cl_sapuser_bcs=>create( sy-uname ).<br /> lr_email->set_sender( l_sender ).<br /> lr_email->set_send_immediately( 'X' ). "Send email directly<br /> l_send_result = lr_email->send( i_with_error_screen = 'X' ).<br /><br /> COMMIT WORK. </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;">Output: </span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Verdana, sans-serif;">Go to SAP inbox check mail for the image embedded in the mail.</span></div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com5tag:blogger.com,1999:blog-3862123204833966581.post-26902354660442857052012-05-12T12:10:00.002-07:002012-05-12T12:10:32.618-07:00Distributing material master idoc using changepointers<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">To create material master idocs without the use change pointers execute transaction BD10<br />The step to distribute material master idocs to other systems using change pointers are:<br />• Create logical system for the receiver system: BD54<br />• Create distribution model: BD64<br />• Activate change pointers for message type MATMAS: Transaction BD50<br />• Add MATMAS message type to the Outbound parameters for the partner profile for the receiver system: WE20<br />• After the a material has been changed - Creater idocs from change pointers: BD21<br />Program RBDMIDOC which generates idocs from changepointers, can be schedules to run automatically</span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-85603303861336589772012-05-12T12:06:00.004-07:002012-05-12T12:06:48.143-07:00SAP FI - Parked Documents Transactions and Tables<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">Transaction codes</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">FBV0 : Poste parked document<br />FBV2 : Change<br />FBV3 : Display<br />FBV4 : Change Header<br />FBV5 : Display Changes<br />FBV6 : Refuse<br />FV50 : Post / Delete : Single Screen Transaction</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">Tables</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br />Parked document header data goes to bkpf table but item level data does NOT go to bseg table. Instead the tables below are used:</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">VBSEGA - Assets parked document detail<br />VBSEGD - Customers parked document detail<br />VBSEGK - Suppliers parked document detail<br />VBSEGS - General Ledger parked document detail</span></div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-40609670280842902292012-05-03T23:43:00.000-07:002012-05-03T23:43:22.697-07:00ABAP Performance Tuning Tips<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">Tools that can be used to help with performance tuning.<br />1. ST05 is the performance trace. It contains the SQL Trace plus RFC, enqueue and buffer trace. Mainly the SQL trace is is used to measure the performance of the select statements of the program.<br />2. SE30 is the Runtime Analysis transaction and can be used to measure the application performance.<br />3. SAT transaction is the replacement SE30. It provides same functionality as SE30 plus some additional features.<br />4. ST12 transaction (part of ST-A/PI software component) is a combination of ST05 and SAT. Very powerful performance analysis tool used primarily by SAP Support.</span><br />
<span style="font-family: Verdana, sans-serif;">5. One of the best tools for static performance analyzing is Code Inspector (SCI). There are many options for finding common mistakes and possible performance bottlenecks.</span><br />
<span style="font-family: Verdana, sans-serif;">Steps to optimize the ABAP Code</span><br />
<span style="font-family: Verdana, sans-serif;">1. Database<br />a. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved. <br />b. Design the Query to use as many index fields as possible from left to right in the WHERE statement<br />c. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot<br />d. Avoid using nested SELECT statement and SELECT within LOOPs, better use JOINs or FOR ALL ENTRIES. Use FOR ALL ENTRIES when the internal table is already there. Try JOINs if the SELECT statements are right behind each other.<br />e. Avoid using ORDER BY in SELECT statements if it differs from used index (instead, sort the resulting internal table), because this may add additional work to the database system which is unique, while there may be many ABAP servers<br />f. INDEX: Creation of Index for improving performance should not be taken without thought. Index speeds up the performance <br />but at the same time adds two overheads namely; memory and insert/append performance. When INDEX is created, memory is used up for storing the index and index sizes can be quite big on large transaction tables! When inserting a new entry in the table, all the indices are updated. More indices, more time. More the amount of data, bigger the indices, larger the time for updating all the indices<br />g. Avoid Executing an identical Select (same SELECT, same parameter) multiple times in the program<br />h. Avoid using join statements if adequate standard views exist.</span><br />
<span style="font-family: Verdana, sans-serif;">2. Table Buffer</span><br />
<span style="font-family: Verdana, sans-serif;">a. Defining a table as buffered (SE11) can help in improving the performance but this has to be used with caution. Buffering of tables leads to data being read from the buffer rather than from table. Buffer sync with table happens periodically, only if something changes. If this table is a transaction table chances are that the data is changing for particular selection criteria, therefore application tables are usually not suited for table buffering. Using table buffering in such cases is not recommended. Use Table Buffering for configuration data and sometimes for Master Data <br />b. Avoid using complex Selects on buffered tables, because SAP may not be able to interpret this request, and may transmit the request to the database. The code inspector tells which commands bypass the buffer.</span><br />
<br /><span style="font-family: Verdana, sans-serif;">3. Internal Table<br />a. Use sorted tables when nested loops are required.<br />b. Use assign (field symbol) instead of into in LOOPs for table types with large work areas<br />c. Use READ TABLE BINARY SEARCH with large standard tables speed up the search. Be sure to sort the internal table before binary search. <br />d. Use transaction SE30 to check the code</span><br />
<span style="font-family: Verdana, sans-serif;">4. Miscellaneous<br />a. PERFORM: When writing a subroutine, always provide type for all the parameters. This reduces the overhead which is present when the system determines on its own each type from the formal parameters that are passed.</span><br />
<span style="font-family: Verdana, sans-serif;">Which is the better - JOINS or SELECT... FOR ALL ENTRIES?<br />The effect of FOR ALL ENTRIES needs to be observed first by running a test program and analyzing SQL trace. Certain options set by BASIS can cause FOR ALL ENTRIES to execute as an 'OR' condition. This means if the table being used FOR ALL ENTRIES has 3 records, SQL Trace will show 3 SQLs getting executed. In such a case using FOR ALL ENTRIES is useless. However of the SQL Trace shows 1 SQL statement it's beneficial since in this case FOR ALL ENTRIES is actually getting executed as an IN List.<br />JOINS are recommended to be used till 5 joins. If the JOIN is being made on fields which are key fields in both the tables, it reduced program overhead and increases performance. So, if the JOIN is between two tables where the JOINING KEYS are key fields JOIN is recommended over FOR ALL ENTRIES.<br />You can use for all entries to reduce the database hits, and use non-key fields.<br />Here is a code with join :<br />SELECT A~VBELN A~KUNNR A~KUNAG B~Name1<br />into table i_likp<br />FROM LIKP AS A<br /> INNER JOIN KNA1 AS B<br /> ON A~kunnr = B~KUNNR.</span><br />
<span style="font-family: Verdana, sans-serif;">* For with limited data using for all entries:<br />* Minimize entries in I_likp by deleting duplicate kunnr.</span><br />
<span style="font-family: Verdana, sans-serif;">LOOP AT i_likp INTO w_likp.<br /> w_likp2-KUNAG = w_likp-KUNAG.<br /> APPEND w_likp2 TO i_likp2.<br />ENDLOOP.</span><br />
<span style="font-family: Verdana, sans-serif;">SORT i_likp2 BY kunnr.</span><br />
<span style="font-family: Verdana, sans-serif;">DELETE ADJACENT DUPLICATES FROM i_likp2 COMPARING kunnr.</span><br />
<span style="font-family: Verdana, sans-serif;">* GET DATA FROM kna1<br />IF NOT i_likp2[] IS INITIAL.<br /> SELECT kunnr name1<br /> INTO TABLE i_kna1<br /> FROM kna1<br /> FOR ALL ENTRIES IN i_likp2<br /> WHERE kunnr = i_likp2-KUNNR.<br />ENDIF.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">Avoid use of nested loops<br />When a nested loop has to be used, use a condition for the inner loop. Otherwise in the production environment it may be possible that the loop takes a lot of time and dumps.<br />loop at itab1.<br /> loop at itab2 where f1 = itab1-f1.<br /> ....<br /> endloop.<br />end loop.</span><br />
<span style="font-family: Verdana, sans-serif;">Another option is to use READ with BINARY SEARCH for the second table.</span><br />
<span style="font-family: Verdana, sans-serif;">SORT itab2 BY f1.loop at itab1.<br /> Read table itab2 with key f1 = itab1-f1 BINARY SEARCH. <br /> if sy-subrc = 0.<br /> idx = sy-tabix.<br /> loop at itab2 from idx.<br /> if itab2-f1 <> itab1-f1.<br /> exit.<br /> endif.<br /> ....<br /> endloop.<br /> endif.<br />endloop.</span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-2078887403291271552012-05-03T02:08:00.001-07:002012-05-03T02:08:26.246-07:00SAP ABAP Fine Tuning Developments<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: Verdana, sans-serif;">Factors influencing Performance Tuning<br />§ Database Operation<br />§ Application Code<br />§ Memory Handling<br />§ Tools for Tuning<br />- SQL Trace<br />- Runtime Analysis<br />Database Operation<br />§ Database Access<br />§ Data volume and Network Load<br />§ Bulk retrieval or update<br />§ Frequency of Communication between Application Program & Database System (Array operation over Single Row)<br />§ Usage of Index<br />§ Table buffering<br />Design Stage Considerations<br />§ Restrict Data Selection<br />§ Make more mandatory fields..<br />§ If initial data selection itself is huge.<br />- warn user about performance before proceeding further<br />- Terminate further processing with suggestion to run with more restriction<br />- Suggest Background operation<br />§ Designing the selection screen :<br />- Correctly group the fields which are used for filtering the data during selection.<br />- group the fields which would be used for only restricting the output.<br />User then would know, which can improve response and which cannot.<br />§ If the report is used for on-line purpose only, drill down report would be better alternative.<br />§ Get more information only when you need it!<br />§ Check current data size and the expected growth rate.<br />Effective Select Statement<br />§ Specify by Key fields while selection<br />§ Avoid select within loops / select.. Endselect<br />§ Inner join / views better than nested selects / multiple selects<br />§ Take care 'For All Entries in Table'<br />- Initial or Not<br />- Large number of records<br />§ Keep Select Clause simple<br />§ Into Corresponding Fields Vs Into Table<br />Data Selection from database<br />§ INTO TABLE with the SELECT statement provides faster access to the database than using an APPEND statement with SELECT<br />§ The INTO TABLES statement groups the records which accounts for reduction in network traffic whereas APPEND statements access the DATABASE for individual records<br />§ For data which is used once the SELECT ENDSELECT loop is effective since the INTO TABLE statement collects all the data of a table in the memory<br />§ Use package size option, Data is put in table in packets of size n<br />§ Use "where" clause with index rather than select all and check<br />Aggregate Clauses<br />§ Use ORDER BY Clauses only if indexes are taken<br />§ Do not use ORDER BY if data selected is more ( more than 20% of total )<br />§ Statements like COUNT, SUM, MIN, MAX, AVG are done at the database level<br />§ Usage of these statements avoid transferring large amounts of data to an application for calculating its aggregate<br />§ These aggregate functions can also be combined well with the GROUP BY statement<br />INDEXES <br />• An index can be considered a sorted copy of a database table of certain fields.<br />• Sorting provides faster access to the data records of the table, ( binary search ).<br />• Indexes are of two types:- Primary and Secondary<br />• .The primary index contains the key fields of the table and a pointer to the non-key fields<br />• The primary index is created automatically when the table is created in the database.<br />• Other indexes created are called secondary indexes.<br />• Table is accessed frequently with fields other than fields of primary index<br />Programming using Indexes<br />§ Data being selected<br />§ Volume of data<br />§ Order of fields in Index</span><br />
<br /><span style="font-family: Verdana, sans-serif;">What to Keep in Mind for Secondary Indexes <br />§ When table contents change, indexes are readjusted<br />§ Slows down database insertion<br />§ Frequently accessed tables should not have too many indexes<br />§ Create indexes only when that index is likely to be used frequently<br />§ Indexes created may not be used to one's liking.<br />§ Determined by database optimizer by an algorithm<br />§ Indexes should have few common fields. Too many common fields would<br /> create problems for the optimizer<br />§ Use SQL Trace for determining indexes<br />Type of Index Scans<br />§ Unique Index Scan :- The entry specified by that index is unique<br />§ Range Scan:- Most frequent, a range of values scanned<br />§ Full Table Scan:- No index used, full table scanned for data<br />Buffering - Important Points to consider<br />§ The database interface of SAP provides buffers on each application server which allows local storage of database tables<br />§ Access to data in tables which are buffered can take place from application server instead of accessing the database directly<br />§ Table buffers enhance the performance of a system by reducing the number of times the database is accessed through the network for data<br />§ The performance improvement due to table buffers on a systems with several application servers is considerably more compared to a central system with only one application server<br />§ But on a central system with one application server a noticeable effect on the performance comes due the reduction in the number of processes when a buffer is accessed instead the database<br />§ The buffer values remain unchanged when a read access is made. If the application changes the data the changes are made on the database and then the buffer on the corresponding application server<br />§ When data is changed on the database it is logged in the DDLOG table on the database<br />§ Buffers on other application servers are updated at intervals of one to two minutes<br />§ This is done with the help of the log maintained in the DDLOG table. When the synchronizing mechanism is run, the log invalidates the buffers on all other application servers<br />§ This causes all the other application servers to access the database directly for data and update their buffers the next time when data is needed<br />Operations on Internal Tables<br />§ Copying of Internal Tables - Copy whole table rather than line by line<br />§ Do not delete records of the same internal table within loop<br />§ Delete records using where clause<br />Memory Management<br />§ Avoid unnecessary variables<br />§ Use local variables in modularization units<br />§ Transfer key information to the Calls<br />§ Free Internal table no longer in use<br />§ Optimize usage of bulk data, memory and processing overhead<br />SQL Trace (ST05)<br />§ Overview<br />§ Understanding What is Measured<br />§ Creating an SQL Trace Data File<br />§ Calling an SQL Trace Data File <br />§ Analyzing an SQL Trace Data File<br />SQL Trace: Overview<br />§ The SQL statements that the application uses.<br />§ Shows what the ABAP processor is requesting from the database<br />§ Lists actual duration of each database request<br />§ What database accesses or changes occur in the update section of the application<br />§ How the system translates ABAP OPEN SQL commands (such as SELECT) into standard SQL commands<br />§ Gives index usage and available indexes<br />§ Presents types of table scans used on fields<br />§ Red flags questionable SQL statements<br />§ Where the application makes unnecessary database accesses or repeated accesses<br />§ Gives index usage and available indexes<br />§ Presents types of table scans used on fields<br />§ Red flags questionable SQL statements<br />§ Where the application makes unnecessary database accesses or repeated accesses<br />From the time the trace function is turned on to the time it is turned off again, all database activity occurring either for a specific user or for an entire system is recorded. The SQL Trace tool measures the following database requests:<br />Buffering of Database Requests<br />- To keep the number of runtime-consuming PREPARE calls small, each an application's work processes hold a certain number of already translated SQL statements in a special buffer. By default, a process holds up to 250 statements.<br />- If the system must execute a specific OPEN SQL, the system first checks whether this statement is stored in the "statement cache". If the statement is in the cache, the system executes it immediately using a REOPEN (SELECT) or a REEXEC (INSERT, UPDATE, DELETE).</span><br />
<span style="font-family: Verdana, sans-serif;">Buffering of Database Requests (cont'd)<br />- If the statement is not buffered, a PREPARE operation prepares it for the subsequent OPEN/EXEC. The system administers the buffer according to the LRU algorithm ("least recently used"). When space is needed for new statements, the statements that are rarely used are deleted. As a result of the LRU algorithm, the statement must prepare frequently used statements usually only once.<br />- An application server buffers the DECLARE, PREPARE, OPEN, and EXEC requests within the cursor cache of one work process. As a result, once the system opens a cursor for a DECLARE operation, it can use this cursor over and over again within the same work process.<br />Understanding What is Measured<br />§ Logical Sequence of Database Requests<br />- Database requests are interconnected and always occur in the same logical sequence. The DECLARE function defines and numbers the cursor. DECLARE precedes the PREPARE function. Use PREPARE to prepare a specific database statement, such as:<br />- select * from sflight where carrid eq 'LH'.<br />- and define the access method before the system can transfer the request to the database. During this preparation, the system is concerned only with the structure of the SQL statement and not with the values it contains.<br />- The OPEN function takes the prepared SELECT statement and completes it with the correct values. In the above example, OPEN would issue the field carrid the value LH.<br />Creating an SQL Trace Data File<br />§ Go to the program to be SQL traced<br />§ If the program has a selection screen, execute the program and bring it to the selection screen<br />§ From the menu, choose System > Create Session, and type /nst05 in the transaction entry field of the new session. Select the Trace on button.<br />§ Go back to the program session, and execute the program (F8). Once the program is through executing, return to the SQL Trace session and select Trace off. Now select List Trace. A detailed list of all database requests will appear, as shown on the next slide.<br />Retrieving Trace Data File<br />1) Call up the initial screen of the SQL Trace tool.<br />2) Choose List trace.<br /> The system asks to specify a trace file. The last trace that was run is suggested as the default value.<br />3) Ensure that the information is correct.<br /> If a trace is run using an * (asterisk) for the user name, enter * (asterisk) in the DB trace for user to retrieve the trace.<br />4) Choose OK.<br />General Tips<br />§ Visualize table growth and build suitable restrictions while on drawing board itself like limiting document selection by date / status / material etc.<br />§ SELECT less with right where clause than selecting all and then filtering.<br />§ Use effective table joins or use correct views.<br />§ Reduce database hits by selecting all info. in one shot rather than repeated access.<br />§ Use of secondary sales table may reduce time instead using main table and using custom indices.<br />§ Check whether right index is picked<br />§ Apply all performance related techniques while processing internal tables, especially when they are expected to be big.<br />§ Perform run time analysis and SQL trace to identify bottle necks<br /> </span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-22598906056099274132012-04-30T01:46:00.000-07:002012-04-30T01:46:15.865-07:00Logic to get next business day in SAP<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: Verdana, sans-serif;">PARAMETER: W_DATE like sy-datum.<br /> DATA:<br /> W_BUSDAY TYPE D.<br /> DATA: DAY_ATTRIBUTES TYPE STANDARD TABLE OF CASDAYATTR INITIAL SIZE 1<br /> WITH HEADER LINE.</span><br />
<span style="font-family: Verdana, sans-serif;"> DO.<br /> W_DATE = W_DATE + 1.<br />*Initial clean up of Day attributes<br /> CLEAR DAY_ATTRIBUTES .<br /> REFRESH DAY_ATTRIBUTES .</span><br />
<span style="font-family: Verdana, sans-serif;"> CALL FUNCTION 'DAY_ATTRIBUTES_GET'<br /> EXPORTING<br /> HOLIDAY_CALENDAR = 'US'<br /> DATE_FROM = W_DATE<br /> DATE_TO = W_DATE<br /> LANGUAGE = SY-LANGU<br /> TABLES<br /> DAY_ATTRIBUTES = DAY_ATTRIBUTES.<br /> IF SY-SUBRC <> 0.<br /> ENDIF.</span><br />
<span style="font-family: Verdana, sans-serif;"> READ TABLE DAY_ATTRIBUTES INDEX 1.<br /> IF DAY_ATTRIBUTES-HOLIDAY NE 'X' AND DAY_ATTRIBUTES-WEEKDAY NE<br /> '7' AND DAY_ATTRIBUTES-WEEKDAY NE '6'.<br /> EXIT.<br /> ENDIF.<br /> ENDDO.</span><br />
<span style="font-family: Verdana, sans-serif;"> write: W_DATE .</span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-43367057176334268602012-04-29T23:39:00.000-07:002012-04-29T23:39:06.324-07:00Program to find Userexits, BADI's and Enhancement spots in SAP standard transaction codes and programs<div dir="ltr" style="text-align: left;" trbidi="on">
<br /><span style="font-family: Verdana, sans-serif;">report zenhtest message-id z25m_x_tool.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">tables: tstc, " SAP Transaction Codes<br /> tadir, " Directory of Repository Objects<br /> modsapt, " SAP Enhancements - Short Texts<br /> sxs_attrt,"Exit: Definition side: Attributes, Text table<br /> trdir, " System table TRDIR<br /> tfdir, " Function Module<br /> enlfdir, " Additional Attributes for Function Modules<br /> tstct. " Transaction Code Texts</span><br />
<span style="font-family: Verdana, sans-serif;">data : g_oname type sobj_name, "Variable to hold Program Name Entered<br /> g_tcode type tcode. "Variable to hold Transaction Code Entered<br />data : jtab like tadir occurs 0 with header line. "Internal Tabele declaration.. Withe header line</span><br />
<span style="font-family: Verdana, sans-serif;">data : v_devclass like tadir-devclass. "Variable to hold Package of Tcode/prog entered<br />data : v_smod type i ,<br /> v_badi type i ,<br /> v_object type trobjtype.<br />data: l_es_erw type enh_hook_def, </span><br />
<span style="font-family: Verdana, sans-serif;"> l_es_erw_s type enh_hook_def_spot, </span><br />
<span style="font-family: Verdana, sans-serif;"> l_erw type enhincinx, </span><br />
<span style="font-family: Verdana, sans-serif;"> l_imp type enh_hook_source, </span><br />
<span style="font-family: Verdana, sans-serif;"> l_full_name type string, </span><br />
<span style="font-family: Verdana, sans-serif;"> l_full_name_ret type string. </span><br />
<span style="font-family: Verdana, sans-serif;">data : itab_inc type standard table of d010inc, " Internal Table to handle include programs<br /> wa_inc type d010inc. "Work area Declarations</span><br />
<span style="font-family: Verdana, sans-serif;">***************************Structure Declasrations********************************************<br />data: begin of wa_result, " Result structure<br /> obj_type type enhobj-obj_type,<br /> obj_name type enhobj-obj_name,<br /> enhspot type enhspotobj-enhspot,<br /> enhname type enhobj-enhname,<br /> switch_id type sfw_switch_id,<br /> state type sfw_switchpos,<br /> end of wa_result.</span><br />
<span style="font-family: Verdana, sans-serif;">data: begin of wa_enhnames, " Enhancement name details structure<br /> enhname type sobj_name,<br /> main_name type enhobj-main_name,<br /> end of wa_enhnames.<br />**--<br />data: begin of wa_enhnames_enho, " Enhancement deatils structure<br /> enhname type enhname,<br /> obj_name type trobj_name,<br /> main_type type trobjtype,<br /> end of wa_enhnames_enho.</span><br />
<span style="font-family: Verdana, sans-serif;">data: begin of wa_es_head_it, "Enhnacement Spot name<br /> enhspot type enhobj-main_name,<br /> end of wa_es_head_it.</span><br />
<span style="font-family: Verdana, sans-serif;">* Batch Input Table<br />data: begin of i_bdcdata occurs 0. "BDC data structure<br /> include structure bdcdata.<br />data: end of i_bdcdata.</span><br />
<span style="font-family: Verdana, sans-serif;">data: i_eso_it type standard table of enhspotobj, "enhancements details<br /> i_eso_it_1 type standard table of enhspotobj, "enhancements details<br /> i_result like wa_result occurs 0 with header line, "result table with details<br /> i_final like wa_result occurs 0 with header line, "display table<br /> i_enhnames like wa_enhnames occurs 0 with header line,<br /> i_enhnames_enho like wa_enhnames_enho occurs 0 with header line,<br /> i_es_head_it like wa_es_head_it occurs 0 with header line,<br /> i_jtab like tadir occurs 0 with header line, "table to capture enhancements<br /> i_jtab_enho like tadir occurs 0 with header line,<br /> i_messtab like bdcmsgcoll occurs 0 with header line. "#EC * "BDC message tab</span><br />
<span style="font-family: Verdana, sans-serif;">data : wa_eso_it like line of i_eso_it,<br /> lv_enhname like enhobj-enhname,<br /> lv_fld type enhname.</span><br />
<span style="font-family: Verdana, sans-serif;">*"A: show all dynpros "E: show dynpro on error only N: do not display dynpro<br />data: ctumode like ctu_params-dismode value 'E',<br />*"S: synchronously *"A: asynchronously *"L: local<br /> cupdate like ctu_params-updmode value 'L'.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Include program names<br />types: begin of t_includes,<br /> prog type trobj_name,<br /> end of t_includes.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Program content for text download<br />data: begin of content occurs 0, "#EC *<br /> line(255), "#EC *<br /> end of content.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Types for enhancement spots<br />types: begin of type_enhspotobj,<br /> enhspot type enhspotname,<br /> version type r3state,<br /> obj_type type trobjtype,<br /> obj_name type trobj_name,<br /> main_type type trobjtype,<br /> main_name type eu_aname,<br /> end of type_enhspotobj.</span><br />
<span style="font-family: Verdana, sans-serif;">**--<br />types: begin of type_enho_obj,<br /> obj_name type trobjtype,<br /> devclass type devclass,<br /> end of type_enho_obj.</span><br />
<span style="font-family: Verdana, sans-serif;">**--<br />types: begin of type_switch,<br /> switch_id type sfw_switch_id,<br /> devclass type packname,<br /> end of type_switch.<br />**--<br />types: begin of type_switch_state,<br /> switch_id type sfw_switch_id,<br /> state type sfw_switchpos,<br /> end of type_switch_state.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Names of function modules used within programmes<br />data: i_prog_includes type standard table of t_includes with header line.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Internal table for enhancement spots<br />data: i_enhspotobj type standard table of type_enhspotobj with header line,<br /> wa_enhspotobj type type_enhspotobj,<br />**-- Development classes for implimentation<br /> i_enho_obj type standard table of type_enho_obj with header line,<br />**-- Switch<br /> i_switch type standard table of type_switch with header line,<br />**-- Switch state<br /> i_switch_state type standard table of type_switch_state with header line.</span><br />
<span style="font-family: Verdana, sans-serif;">field-symbols : <l_imp> type enh_hook_source, <br /> <l_eso> type enhspotobj,<br /> <l_enhspotobj> type type_enhspotobj.</span><br />
<span style="font-family: Verdana, sans-serif;">selection-screen begin of block b1 with frame title text-001.</span><br />
<span style="font-family: Verdana, sans-serif;">parameters : r_exit radiobutton group g1 user-command ucom default 'X', "To find user exits/badis<br /> r_espot radiobutton group g1. "To find Enhancement spots</span><br />
<span style="font-family: Verdana, sans-serif;">selection-screen end of block b1.</span><br />
<span style="font-family: Verdana, sans-serif;">selection-screen begin of block b2 with frame title text-002.</span><br />
<span style="font-family: Verdana, sans-serif;">parameters : r_tcode radiobutton group g2 user-command ucom2 modif id a default 'X', "Search Based on Transaction Code<br /> p_tcode type tstc-tcode modif id b, "Transaction code name<br /> r_name radiobutton group g2 modif id c, "Search Based on Program<br /> p_name type tadir-obj_name modif id d. "Program name</span><br />
<br /><span style="font-family: Verdana, sans-serif;">selection-screen end of block b2.</span><br />
<span style="font-family: Verdana, sans-serif;">** Four MODIF ID's are used, because for 2nd block in selection screen, if transaction code has to be entered,<br />** then Program Name is suppose to be input inactive and vice-versa.</span><br />
<span style="font-family: Verdana, sans-serif;">***********************************************************************************************************<br />* TOGGLING FACILITY OF SELECTION SCREEN *<br />***********************************************************************************************************<br />at selection-screen output.</span><br />
<span style="font-family: Verdana, sans-serif;"> loop at screen.<br /> if r_exit = 'X'.<br /> if screen-group1 = 'C' or screen-group1 = 'D'.</span><br />
<span style="font-family: Verdana, sans-serif;"> screen-active = 0. "if user exit radio button is selected, grey out Prog name parameter<br /> modify screen.<br /> endif.<br /> elseif r_espot = 'X'.<br /> "if Enhancement Spots radio button is selected<br /> if screen-group1 = 'A' or screen-group1 = 'B' or screen-group1 = 'C' or screen-group1 = 'D'.<br /> screen-active = '1'.<br /> if r_tcode = 'X'.<br /> "if Tcode radio button is selected, grey out Prog name parameter<br /> if screen-group1 = 'D'.<br /> screen-input = 0.<br /> endif.<br /> elseif r_name = 'X'.<br /> "if Prog name radio button is selected, grey out Tcode parameter<br /> if screen-group1 = 'B'.<br /> screen-input = 0.<br /> endif.<br /> endif.<br /> modify screen.<br /> endif.<br /> endif.<br /> endloop.</span><br />
<span style="font-family: Verdana, sans-serif;">***********************************************************************************************************<br />* SELECTION SCREEN VALIDATIONS *<br />***********************************************************************************************************</span><br />
<span style="font-family: Verdana, sans-serif;">at selection-screen on p_tcode.<br /> case sy-ucomm.<br /> when 'ONLI'.<br /> if r_tcode = 'X'. "if user selects Transaction code and does not fill in a tcode<br /> if p_tcode is initial. " display an Error message.<br /> message e000.<br /> endif.<br /> endif.<br /> endcase.</span><br />
<span style="font-family: Verdana, sans-serif;">at selection-screen on p_name.<br /> case sy-ucomm.<br /> when 'ONLI'.<br /> if r_espot = 'X' and r_name = 'X'. "if user selects Program and does not fill in a prog name<br /> if p_name is initial. " display an Error message.<br /> message e001.<br /> endif.<br /> endif.<br /> endcase.</span><br />
<span style="font-family: Verdana, sans-serif;">***********************************************************************************************************<br />* AT SELCTION SCREEN EVENT *<br />***********************************************************************************************************<br />at selection-screen.</span><br />
<span style="font-family: Verdana, sans-serif;"> if r_exit eq 'X'.<br /> clear r_name.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> if r_espot = 'X'.<br /> if r_tcode = 'X'.<br /> clear p_name.<br /> endif.<br /> if r_name = 'X'.<br /> clear p_tcode.<br /> endif.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> if r_tcode = 'X' and p_tcode is not initial. "If user enters a transaction code<br /> select single tcode "Check if tcode exists in standard table TSTC<br /> from tstc<br /> into g_tcode<br /> where tcode = p_tcode.</span><br />
<span style="font-family: Verdana, sans-serif;"> if sy-subrc ne 0.<br /> message e003.<br /> endif.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> if r_name = 'X' and p_name is not initial. "If user enters program name<br /> select single obj_name "#EC * " Check if prog name exists in standard table TADIR.<br /> from tadir<br /> into g_oname<br /> where obj_name = p_name.</span><br />
<span style="font-family: Verdana, sans-serif;"> if sy-subrc ne 0.<br /> message e002.<br /> endif.<br /> endif.<br />***********************************************************************************************************<br />* START OF SELECTION EVENT *<br />***********************************************************************************************************</span><br />
<span style="font-family: Verdana, sans-serif;">start-of-selection.<br /> if r_exit = 'X'. "if user wants to find user exits.<br /> perform f_badis_exits. "Subroutine to find User Exits/Badis</span><br />
<span style="font-family: Verdana, sans-serif;"> elseif r_espot = 'X'. " if user want to find ENHANCEMENT SPOT.<br /> if r_tcode = 'X'.<br /> perform f_tcode_spots. "Subroutine to find Enhancment Spots For a given Tcdoe<br /> else.<br /> perform f_pname_spots. "Subroutine to find Enhancment Spots For a given Program<br /> endif.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> endif.<br />***********************************************************************************************************<br />* AT LINE SELECTION EVENT *<br />***********************************************************************************************************</span><br />
<span style="font-family: Verdana, sans-serif;">at line-selection. "Navigation on clicking on a list item<br />**--<br /> clear: lv_fld,<br /> lv_enhname.<br />**--<br /> get cursor field lv_fld value lv_enhname.</span><br />
<span style="font-family: Verdana, sans-serif;"> "If user clicks on Enhancment Name in list display, it transits to 2nd screen of SE19.<br /> if lv_fld = 'I_FINAL-ENHNAME'.<br /> if lv_enhname is not initial.<br /> perform fbdc_dynpro using 'SAPLSEXO' '0120'.<br /> perform fbdc_field using 'BDC_OKCODE' '=IMP_SHOW'.<br /> perform fbdc_field using 'BDC_CURSOR' 'G_ENHNAME'.<br /> perform fbdc_field using 'G_IS_NEW_1' 'X'.<br /> perform fbdc_field using 'G_ENHNAME' lv_enhname.<br /> perform fbdc_field using 'G_IS_NEW_2' 'X'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPLSEXO' '0120'.<br /> perform fbdc_field using 'BDC_OKCODE' '=WB_BACK'.<br /> perform fbdc_field using 'BDC_CURSOR' 'G_ENHNAME'.<br /> perform fbdc_field using 'G_IS_NEW_1' 'X'.<br /> perform fbdc_field using 'G_ENHNAME' lv_enhname.<br /> perform fbdc_field using 'G_IS_NEW_2' 'X'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_transaction using 'SE19'. " Call transaction se19<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> "If user clicks on Enhancment Spot in list display, navigate to 2nd screen of SE18.<br /> elseif lv_fld = 'I_FINAL-ENHSPOT'.<br /> perform fbdc_dynpro using 'SAPLSEXO' '0100'.<br /> perform fbdc_field using 'BDC_OKCODE' '=SHOW'.<br /> perform fbdc_field using 'BDC_CURSOR' 'G_ENHSPOTNAME'.<br /> perform fbdc_field using 'G_IS_SPOT' 'X'.<br /> perform fbdc_field using 'G_ENHSPOTNAME' sy-lisel+1(29).</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPLSEXO' '100'.<br /> perform fbdc_field using 'BDC_OKCODE' '=WB_BACK'.<br /> perform fbdc_field using 'BDC_CURSOR' 'G_BADINAME'.<br /> perform fbdc_field using 'G_IS_BADI' 'X'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_transaction using 'SE18'. " Call transaction se18</span><br />
<span style="font-family: Verdana, sans-serif;"> elseif lv_fld(4) eq 'JTAB'.</span><br />
<span style="font-family: Verdana, sans-serif;"> read table jtab with key obj_name = sy-lisel+1(20).<br /> move jtab-object to v_object.</span><br />
<span style="font-family: Verdana, sans-serif;"> case v_object.<br /> "if user clicks on a User-Exit in list display, navigate to 2nd screen of SMOD.<br /> when 'SMOD'.<br /> set parameter id 'MON' field sy-lisel+1(10).</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPMSMOD' '2010'.<br /> perform fbdc_field using 'BDC_CURSOR' 'MOD0-NAME'.<br /> perform fbdc_field using 'BDC_OKCODE' '=SHOW'.<br /> perform fbdc_field using 'MOD0-NAME' sy-lisel+1(10).<br /> perform fbdc_field using 'MODF-CHAM' 'X'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPMSMOD' '2010'.<br /> perform fbdc_field using 'BDC_CURSOR' 'MOD0-NAME'.<br /> perform fbdc_field using 'BDC_OKCODE' '=BACK'.<br /> perform fbdc_field using 'MODF-HEAS' 'X'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_transaction using 'SMOD'. "CALL TRANSACTION smod</span><br />
<span style="font-family: Verdana, sans-serif;"> "if user clicks on a BADI in list display<br /> when 'SXSD'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPLSEXO' '0100'.<br /> perform fbdc_field using 'BDC_OKCODE' '=ISSPOT'.<br /> perform fbdc_field using 'BDC_CURSOR' 'G_IS_BADI'.<br /> perform fbdc_field using 'G_IS_BADI' 'X'.</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPLSEXO' '0100'.<br /> perform fbdc_field using 'BDC_OKCODE' '=SHOW'.<br /> perform fbdc_field using 'G_BADINAME' sy-lisel+1(29).</span><br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_dynpro using 'SAPLSEXO' '100'.<br /> perform fbdc_field using 'BDC_OKCODE' '=WB_BACK'.<br /> perform fbdc_field using 'BDC_CURSOR' 'G_BADINAME'.<br /> perform fbdc_field using 'G_IS_BADI' 'X'.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;"> perform fbdc_transaction using 'SE18'. "CALL TRANSACTION se18<br /> endcase.<br /> endif.<br />***********************************************************************************************************<br />* END OF SELECTION EVENT *<br />***********************************************************************************************************<br />end-of-selection.<br /> refresh: i_result, i_final, i_enhnames,<br /> i_es_head_it, i_jtab, i_bdcdata,<br /> i_messtab.</span><br />
<span style="font-family: Verdana, sans-serif;"> free: i_result, i_final, i_enhnames,<br /> i_es_head_it, i_jtab, i_bdcdata,<br /> i_messtab.</span><br />
<span style="font-family: Verdana, sans-serif;">** All the internal table the feilds are refreshed and free, according to the requirement.</span><br />
<br /><span style="font-family: Verdana, sans-serif;">form f_badis_exits .<br /> if not p_tcode is initial.<br />*-- Validate Transaction Code using the Standard Table TSTC.<br /> select single * from tstc<br /> where tcode eq p_tcode.<br />*-- Find Repository Objects for transaction code, which has Object Type PROG.<br /> if sy-subrc eq 0.<br /> select single * from tadir<br /> where pgmid = 'R3TR'<br /> and object = 'PROG'<br /> and obj_name = tstc-pgmna.<br />**--Find Repository Objects for transaction code, which has Object Type TRAN.</span><br />
<span style="font-family: Verdana, sans-serif;"> if sy-subrc ne 0.<br /> select single * from tadir<br /> where pgmid = 'R3TR'<br /> and object = 'TRAN'<br /> and obj_name = p_tcode.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> move : tadir-devclass to v_devclass. " Capture Package<br /> if sy-subrc ne 0. "in case object type is function group<br /> select single * from trdir<br /> where name = tstc-pgmna.<br /> if trdir-subc eq 'F'.<br /> select single * from tfdir "#EC *<br /> where pname = tstc-pgmna.</span><br />
<span style="font-family: Verdana, sans-serif;"> select single * from enlfdir<br /> where funcname = tfdir-funcname.</span><br />
<span style="font-family: Verdana, sans-serif;"> select single * from tadir<br /> where pgmid = 'R3TR'<br /> and object = 'FUGR'<br /> and obj_name = enlfdir-area.</span><br />
<span style="font-family: Verdana, sans-serif;"> move : tadir-devclass to v_devclass. "Capture Package<br /> endif.<br /> endif.<br /> else.<br /> format color col_negative intensified on.<br /> message e004.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> endif.</span><br />
<span style="font-family: Verdana, sans-serif;">**--<br />* Find SAP Modifactions<br /> select * from tadir "Select user exits/BADIS<br /> into table jtab<br /> where pgmid = 'R3TR'<br /> and object in ('SMOD','SXSD')<br /> and devclass = v_devclass.<br /> "To display Tcode Short Descriptions<br /> select single * from tstct<br /> where sprsl eq sy-langu<br /> and tcode eq p_tcode.</span><br />
<span style="font-family: Verdana, sans-serif;"> format color col_positive intensified off.<br /> if not p_tcode is initial.<br /> write:/(19) text-007,<br /> 20(20) p_tcode,<br /> 45(50) tstct-ttext.<br /> endif.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> if not jtab[] is initial.<br /> write:/(105) sy-uline.<br /> format color col_heading intensified on.<br /> write:/1 sy-vline,<br /> 2 text-008,<br /> 41 sy-vline,<br /> 42 text-009,<br /> 105 sy-vline.<br /> write:/(105) sy-uline.<br /> loop at jtab.<br /> "For listing out User Exits<br /> at new object.<br /> if jtab-object = 'SMOD'.<br /> format color col_group intensified on.<br /> write:/1 sy-vline,<br /> 2 'User Exits'(300),<br /> 105 sy-vline.<br /> "For listing out BADI's<br /> elseif jtab-object = 'SXSD'.<br /> format color col_group intensified on.<br /> write:/1 sy-vline,<br /> 2 ' Business Add-in'(301),<br /> 105 sy-vline.<br /> endif.<br /> endat.</span><br />
<span style="font-family: Verdana, sans-serif;"> case jtab-object.<br /> when 'SMOD'. "for user exits<br /> v_smod = v_smod + 1. "counter for user exits, to give the total number of user exits.</span><br />
<span style="font-family: Verdana, sans-serif;"> select single * from modsapt<br /> where sprsl = sy-langu<br /> and name = jtab-obj_name.<br /> format color col_normal intensified on.</span><br />
<span style="font-family: Verdana, sans-serif;"> write:/1 sy-vline,<br /> 2 jtab-obj_name hotspot on,<br /> 41 sy-vline ,<br /> 42 modsapt-modtext,<br /> 105 sy-vline.</span><br />
<span style="font-family: Verdana, sans-serif;"> when 'SXSD'.<br />* For BADI's<br /> v_badi = v_badi + 1 . "counter for BADIS<br /> select single * from sxs_attrt<br /> where sprsl = sy-langu<br /> and exit_name = jtab-obj_name.<br /> format color col_normal intensified on.</span><br />
<span style="font-family: Verdana, sans-serif;"> write:/1 sy-vline,<br /> 2 jtab-obj_name hotspot on,<br /> 41 sy-vline ,<br /> 42 sxs_attrt-text,<br /> 105 sy-vline.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> endcase.</span><br />
<span style="font-family: Verdana, sans-serif;"> at end of object.<br /> write : /(105) sy-uline.<br /> endat.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> endloop.<br /> write:/(105) sy-uline.<br /> describe table jtab.<br /> skip.</span><br />
<span style="font-family: Verdana, sans-serif;"> format color col_total intensified on.<br /> write:/ 'No of exits:'(302), v_smod.<br /> write:/ 'No of BADI''s:'(303), v_badi.<br /> else.<br /> "Incase BADI's/ User Exits do not Exist<br /> call function 'POPUP_TO_INFORM' "EC NOTEXT<br /> exporting<br /> titel = 'Information Message'(500)<br /> txt1 = 'Sorry!!!'(501)<br /> txt2 = 'No BADI''s/User exits available for the above Transaction'(502).</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> leave program.</span><br />
<span style="font-family: Verdana, sans-serif;"> endif.</span><br />
<span style="font-family: Verdana, sans-serif;">endform. " F_BADIS_EXITS<br />*&---------------------------------------------------------------------*<br />*& Form F_TCODE_SPOTS<br />*&---------------------------------------------------------------------*<br />* Finds the enhancement spots.<br />*----------------------------------------------------------------------*<br />form f_tcode_spots .<br /> if not p_tcode is initial.<br />**--select tcode from tadir<br /> select single * from tstc<br /> where tcode eq p_tcode.<br /> if sy-subrc eq 0.<br /> "Select Prog behind the btransaction<br /> select single * from tadir<br /> where pgmid = 'R3TR'<br /> and object = 'PROG'<br /> and obj_name = tstc-pgmna.<br /> "Capture Program pav\ckage<br /> move : tadir-devclass to v_devclass.<br /> "Else look in trdir<br /> if sy-subrc ne 0.<br /> select single * from trdir<br /> where name = tstc-pgmna.</span><br />
<span style="font-family: Verdana, sans-serif;"> if trdir-subc eq 'F'.</span><br />
<span style="font-family: Verdana, sans-serif;"> select single * from tfdir "#EC *<br /> where pname = tstc-pgmna.</span><br />
<span style="font-family: Verdana, sans-serif;"> select single * from enlfdir<br /> where funcname = tfdir-funcname.</span><br />
<span style="font-family: Verdana, sans-serif;"> select single * from tadir<br /> where pgmid = 'R3TR'<br /> and object = 'FUGR'<br /> and obj_name eq enlfdir-area.</span><br />
<span style="font-family: Verdana, sans-serif;"> move : tadir-devclass to v_devclass.<br /> endif. "IF trdir-subc EQ 'F'<br /> endif. "IF sy-subrc NE 0<br /> else.<br /> format color col_negative intensified on.<br /> message e004.<br /> endif.<br />**--<br /> perform get_from_tadir.</span><br />
<br />
<br /><span style="font-family: Verdana, sans-serif;"> endif. "IF sy-subrc EQ 0</span><br />
<span style="font-family: Verdana, sans-serif;">*-Fill i_result<br /> loop at i_eso_it assigning <l_eso>.<br /> i_result-enhspot = <l_eso>-enhspot.<br /> append i_result.<br /> endloop.</span><br />
<span style="font-family: Verdana, sans-serif;"> if not i_result[] is initial.<br /> delete adjacent duplicates from i_result.</span><br />
<span style="font-family: Verdana, sans-serif;"> sort i_jtab by obj_name.<br /> loop at i_result.<br /> read table i_jtab with key obj_name = i_result-enhspot<br /> binary search.<br /> if sy-subrc = 0.<br /> i_result-obj_name = i_jtab-obj_name.<br /> read table i_eso_it into wa_eso_it with key enhspot = i_jtab-obj_name+0(30)<br /> binary search.<br /> if sy-subrc = 0.<br /> i_result-obj_type = wa_eso_it-obj_type.<br /> endif.<br /> modify i_result.<br /> clear i_result.<br /> endif.<br /> endloop.<br /> "select Name/ID's of Enhancement Spots<br /> select enhspot<br /> into table i_es_head_it<br /> from enhspotheader<br /> for all entries in i_result<br /> where enhspot = i_result-enhspot<br /> and version = 'A'.<br /> "Select Enhancement names and main prog names<br /> if sy-subrc = 0.<br /> select enhname<br /> main_name<br /> appending table i_enhnames<br /> from enhobj<br /> for all entries in i_es_head_it<br /> where main_type = 'ENHS'<br /> and main_name = i_es_head_it-enhspot.<br /> if sy-subrc = 0.<br /> sort i_enhnames by main_name.<br /> delete adjacent duplicates from i_enhnames comparing enhname main_name.<br />**-- Get the development calss for the enhacement spots & implimentation<br /> select obj_name<br /> devclass<br /> into table i_enho_obj<br /> from tadir<br /> for all entries in i_enhnames<br /> where obj_name = i_enhnames-enhname and<br /> object = 'ENHO'.<br /> if sy-subrc = 0.<br />**-- Get the switch details<br /> select switch_id<br /> devclass<br /> into table i_switch<br /> from sfw_package<br /> for all entries in i_enho_obj<br /> where devclass = i_enho_obj-devclass.<br /> if sy-subrc = 0.<br />**-- Get the switch status<br /> select switch_id<br /> state<br /> into table i_switch_state<br /> from sfw_switch_state<br /> for all entries in i_switch<br /> where switch_id = i_switch-switch_id.<br /> endif.<br /> endif.<br />**--<br /> loop at i_result.<br /> i_final-obj_type = i_result-obj_type.<br /> i_final-obj_name = i_result-obj_name.<br /> i_final-enhspot = i_result-enhspot.<br /> loop at i_enhnames where main_name = i_result-enhspot.<br />**-- Populate the switch<br /> read table i_enho_obj with key obj_name = i_enhnames-enhname. "#EC *<br /> if sy-subrc = 0.<br /> read table i_switch with key devclass = i_enho_obj-devclass.<br /> if sy-subrc = 0.<br /> read table i_switch_state with key switch_id = i_switch-switch_id.<br /> if sy-subrc = 0.<br /> i_final-switch_id = i_switch_state-switch_id.<br /> i_final-state = i_switch_state-state.<br /> endif.<br /> endif.<br /> endif.<br />**--<br /> i_final-enhname = i_enhnames-enhname.<br /> append i_final.<br /> endloop.<br /> if sy-subrc <> 0.<br /> append i_final.<br /> endif.<br /> clear i_final.<br /> endloop.<br /> endif.<br /> endif.<br />**-- Also consider the Enhancement implimentation which are not part of enhancement spot's<br /> loop at i_jtab where object = 'ENHO'.<br /> i_jtab_enho = i_jtab.<br /> append i_jtab_enho.<br /> endloop.<br />**--<br /> if not i_jtab_enho[] is initial.<br /> select enhname "EC#..,bzw.<br /> obj_name<br /> main_type<br /> into table i_enhnames_enho<br /> from enhobj<br /> for all entries in i_jtab_enho<br /> where enhname = i_jtab_enho-obj_name+0(30)<br /> and obj_type = 'ENHS'.<br /> if sy-subrc = 0.<br />**-- Select the enhancement spot object<br />**--<br /> select * "#EC<br /> from enhspotobj<br /> into corresponding fields of table i_eso_it_1<br /> for all entries in i_enhnames_enho<br /> where enhspot = i_enhnames_enho-obj_name+0(30).<br /> if sy-subrc = 0.<br /> sort i_eso_it_1 by enhspot.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Populate the final table<br /> delete adjacent duplicates from i_enhnames_enho comparing enhname.<br /> loop at i_enhnames_enho.<br /> read table i_final with key enhname = i_enhnames_enho-enhname.<br /> if sy-subrc <> 0.<br /> clear: i_final.<br />**--<br /> clear: wa_eso_it.<br /> read table i_eso_it_1 into wa_eso_it with key<br /> enhspot = i_enhnames_enho-obj_name+0(30) binary search.<br /> if sy-subrc = 0.<br /> i_final-obj_type = wa_eso_it-obj_type.<br /> endif.<br /> i_final-enhspot = i_enhnames_enho-obj_name.<br /> i_final-enhname = i_enhnames_enho-enhname.<br /> append i_final.<br /> endif.<br /> endloop.<br /> endif.<br /> endif.<br />**--<br /> loop at i_final.</span><br />
<span style="font-family: Verdana, sans-serif;"> format color col_normal intensified on.<br /> at new enhspot.<br /> write: /1 sy-vline,<br /> 2 i_final-enhspot hotspot on,<br /> 34 sy-vline.<br /> endat.</span><br />
<span style="font-family: Verdana, sans-serif;"> case i_final-obj_type.<br /> when 'REPS' or 'PROG'.<br /> write: 36 'Source Code Enhancement'(304).<br /> when 'INTF' or 'SXSD'.<br /> write: 36 'BADI Enhancement'(305).<br /> when 'FUNC' or 'FUGR'.<br /> write: 36 'Function group Enhancement'(306).<br /> when 'CLAS'.<br /> write: 36 'Class Enhancement'(307).</span><br />
<span style="font-family: Verdana, sans-serif;"> when others.<br /> write: 36 i_final-obj_type.<br /> endcase.</span><br />
<span style="font-family: Verdana, sans-serif;"> write: 64 sy-vline,<br /> 66 i_final-enhname hotspot on,<br /> 100 sy-vline,<br /> 101 i_final-switch_id,<br /> 132 sy-vline.<br />**--<br /> case i_final-state.<br /> when 'T'.<br /> write 133 'On'(308).<br /> when 'S'.<br /> write 133 'Stand-by'(309).<br /> when 'F'.<br /> write 133 'Off'(310).<br /> endcase.</span><br />
<span style="font-family: Verdana, sans-serif;"> write: 150 sy-vline.</span><br />
<span style="font-family: Verdana, sans-serif;"> endloop.<br /> write:/(150) sy-uline.</span><br />
<span style="font-family: Verdana, sans-serif;"> endif.</span><br />
<br /><span style="font-family: Verdana, sans-serif;">endform. " F_TCODE_SPOTS<br />*&---------------------------------------------------------------------*<br />*& Form GET_FROM_TADIR<br />*&---------------------------------------------------------------------*<br />*<br />*----------------------------------------------------------------------*<br />form get_from_tadir .<br /> " select records whose object types are enhancment spots/implimentations<br /> select * from tadir<br /> into table i_jtab<br /> where pgmid = 'R3TR'<br /> and object in ('ENHS','ENHO')<br /> and devclass = v_devclass.<br /> "to display short texts for tcode<br /> select single * from tstct<br /> where sprsl eq sy-langu<br /> and tcode eq p_tcode.</span><br />
<span style="font-family: Verdana, sans-serif;"> format color col_positive intensified off.<br />* Transaction Code<br /> write:/1 text-018.<br /> if not p_tcode is initial.<br /> write: 30(20) p_tcode.<br /> endif.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> write: 55(50) tstct-ttext.<br /> skip.<br /> if not i_jtab[] is initial.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Genral information.<br /> format color col_heading intensified on.<br /> write:/ 'To see Enhancement spot/Implementation in detail, please click on values under column'(311).</span><br />
<span style="font-family: Verdana, sans-serif;"> write:/(150) sy-uline.<br /> format color col_heading intensified on.<br /> write:/1 sy-vline,<br /> 2 text-015,<br /> 34 sy-vline,<br /> 36 text-016,<br /> 64 sy-vline,<br /> 66 text-014,<br /> 100 sy-vline,<br /> 101 'Switch'(520),<br /> 132 sy-vline,<br /> 133 'Switch State'(521),<br /> 150 sy-vline.</span><br />
<span style="font-family: Verdana, sans-serif;"> write:/(150) sy-uline.<br />**--Required details from enhspotobj table<br /> select * "#EC<br /> from enhspotobj<br /> into corresponding fields of table i_eso_it<br /> for all entries in i_jtab<br /> where enhspot = i_jtab-obj_name+0(30).</span><br />
<br />
<span style="font-family: Verdana, sans-serif;"> if sy-subrc eq 0.<br /> sort i_eso_it by enhspot.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> else.<br /> "Information popup</span><br />
<span style="font-family: Verdana, sans-serif;"> call function 'POPUP_TO_INFORM'<br /> exporting<br /> titel = 'Information Message'(503)<br /> txt1 = 'Sorry!!!'(504)<br /> txt2 = 'No Enhancements available for the selected Transaction'(505).</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> leave program.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> endif. "IF NOT I_JTAB[] IS INITIAL</span><br />
<br /><span style="font-family: Verdana, sans-serif;">endform. " GET_FROM_TADIR<br />*&---------------------------------------------------------------------*<br />*& Form F_PNAME_SPOTS<br />*&---------------------------------------------------------------------*<br />* text<br />*----------------------------------------------------------------------*<br />* --> p1 text<br />* <-- p2 text<br />*----------------------------------------------------------------------*<br />form f_pname_spots .</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> "select record corresponding to entered tcode<br /> select single tcode from tstc "#EC *<br /> into p_tcode<br /> where pgmna = p_name.<br /> select single * from tstc<br /> where tcode eq p_tcode.</span><br />
<span style="font-family: Verdana, sans-serif;"> if p_tcode is initial.<br /> select single * from trdir where name = p_name.<br /> if trdir-subc eq 'I'.<br /> " in case include programs, select required details from d010inc<br /> select * from d010inc<br /> into table itab_inc<br /> where include = p_name.</span><br />
<span style="font-family: Verdana, sans-serif;"> if itab_inc is not initial.<br /> loop at itab_inc into wa_inc.<br /> select single * from tstc "#EC *<br /> where pgmna = wa_inc-master.<br /> if sy-subrc = 0.<br /> exit.<br /> endif.<br /> endloop.</span><br />
<span style="font-family: Verdana, sans-serif;"> tstc-pgmna = p_name.<br /> endif.<br /> endif.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> if sy-subrc eq 0.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;"> if not tstc-pgmna is initial.<br />**-- Select the include program's which are there in the main program<br /> perform f_find_include_programs using tstc-pgmna.<br />**-- Append the main program also into internal table I_PROG_INCLUDES<br /> i_prog_includes-prog = tstc-pgmna.<br /> append i_prog_includes.<br />**--<br /> if not i_prog_includes[] is initial.<br />**-- Select the enhancement spot's data from ENHSPOTOBJ<br />**-- All the includes in itab I_PROG_INCLUDES<br /> select enhspot<br /> version<br /> obj_type<br /> obj_name<br /> main_type<br /> main_name<br /> into table i_enhspotobj<br /> from enhspotobj<br /> for all entries in i_prog_includes<br /> where obj_name = i_prog_includes-prog and<br /> version = 'A'.<br /> if not i_enhspotobj[] is initial.<br />**--Select Transaction code description in system language<br /> select single * from tstct<br /> where sprsl eq sy-langu<br /> and tcode eq p_tcode.</span><br />
<span style="font-family: Verdana, sans-serif;"> format color col_positive intensified off.<br />**-- Transaction Code<br /> write:/1 text-013,<br /> 25(20) p_tcode,<br /> 48(50) tstct-ttext.<br /> skip.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Genral information.<br /> format color col_heading intensified on.<br /> write:/ 'To see Enhancement spot/Implementation in detail, please click on the enhancements of your choice'(325).</span><br />
<span style="font-family: Verdana, sans-serif;"> write:/(150) sy-uline.<br /> format color col_heading intensified on.<br /> write:/1 sy-vline,<br /> 2 text-015,<br /> 34 sy-vline,<br /> 36 text-016,<br /> 64 sy-vline,<br /> 66 text-014,<br /> 100 sy-vline,<br /> 101 'Switch'(522),<br /> 132 sy-vline,<br /> 133 'Switch State'(523),<br /> 150 sy-vline.</span><br />
<span style="font-family: Verdana, sans-serif;"> write:/(150) sy-uline.</span><br />
<span style="font-family: Verdana, sans-serif;"> endif. "IF NOT i_enhspotobj[] IS INITIAL<br /> endif. " IF not I_PROG_INCLUDES[] is initial.<br /> else.<br /> "information popup<br /> call function 'POPUP_TO_INFORM'<br /> exporting<br /> titel = 'Information Message'(506)<br /> txt1 = 'Sorry!!!'(507)<br /> txt2 = 'No Enhancements available for the selected Transaction'(508).</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> leave program.</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> endif.<br /> else.<br /> "information popup<br /> call function 'POPUP_TO_INFORM'<br /> exporting<br /> titel = 'Information Message'(509)<br /> txt1 = 'Sorry!!!'(510)<br /> txt2 = 'No Enhancements available for the selected Transaction'(511).</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> leave program.<br /> endif. "IF sy-subrc EQ 0</span><br />
<span style="font-family: Verdana, sans-serif;">**---</span><br />
<span style="font-family: Verdana, sans-serif;">**--<br /> if not i_enhspotobj[] is initial.<br />**--<br /> loop at i_enhspotobj assigning <l_enhspotobj>.<br /> i_result-enhspot = <l_enhspotobj>-enhspot.<br /> append i_result.<br /> endloop.</span><br />
<span style="font-family: Verdana, sans-serif;"> if not i_result[] is initial.<br />**--remove redundant records<br /> delete adjacent duplicates from i_result.<br />**--sort table<br /> sort i_enhspotobj by enhspot.<br />**--Populate rest of i_result<br /> loop at i_result.<br />***--get obj_name and main_type values from ENHSPOTOBJ table<br /> read table i_enhspotobj into wa_enhspotobj with key enhspot = i_result-enhspot<br /> binary search.<br /> if sy-subrc = 0.<br /> i_result-obj_name = wa_enhspotobj-obj_name.<br /> i_result-obj_type = wa_enhspotobj-main_type. " obj_type.<br /> endif.<br /> modify i_result.<br /> clear i_result.<br /> endloop.<br />**--<br /> select enhspot<br /> into table i_es_head_it<br /> from enhspotheader<br /> for all entries in i_result<br /> where enhspot = i_result-enhspot<br /> and version = 'A'.<br /> if sy-subrc = 0.<br />**-- Get the enhancement id data from ENHOBJ<br /> select enhname<br /> main_name<br /> appending table i_enhnames<br /> from enhobj<br /> for all entries in i_es_head_it<br /> where main_type = 'ENHS'<br /> and main_name = i_es_head_it-enhspot.<br /> if sy-subrc = 0.<br />**--sort table<br /> sort i_enhnames by main_name.<br /> delete adjacent duplicates from i_enhnames comparing enhname main_name.<br />**-- Get the development calss for the enhacement spots & implimentation<br /> select obj_name<br /> devclass<br /> into table i_enho_obj<br /> from tadir<br /> for all entries in i_enhnames<br /> where obj_name = i_enhnames-enhname and<br /> object = 'ENHO'.<br /> if sy-subrc = 0.<br />**-- Get the switch details<br /> select switch_id<br /> devclass<br /> into table i_switch<br /> from sfw_package<br /> for all entries in i_enho_obj<br /> where devclass = i_enho_obj-devclass.<br /> if sy-subrc = 0.<br />**-- Get the switch status<br /> select switch_id<br /> state<br /> into table i_switch_state<br /> from sfw_switch_state<br /> for all entries in i_switch<br /> where switch_id = i_switch-switch_id.<br /> endif.<br /> endif.<br />**--<br /> loop at i_result.<br /> i_final-obj_type = i_result-obj_type.<br /> i_final-obj_name = i_result-obj_name.<br /> i_final-enhspot = i_result-enhspot.<br /> loop at i_enhnames where main_name = i_result-enhspot.<br />**-- Populate the switch<br /> read table i_enho_obj with key obj_name = i_enhnames-enhname. "#EC *<br /> if sy-subrc = 0.<br /> read table i_switch with key devclass = i_enho_obj-devclass.<br /> if sy-subrc = 0.<br /> read table i_switch_state with key switch_id = i_switch-switch_id.<br /> if sy-subrc = 0.<br /> i_final-switch_id = i_switch_state-switch_id.<br /> i_final-state = i_switch_state-state.<br /> endif.<br /> endif.<br /> endif.<br />**--Populate enhancement name<br /> i_final-enhname = i_enhnames-enhname.<br /> append i_final.<br /> endloop.<br /> clear i_final.<br /> endloop.<br /> endif.<br /> endif.<br /> endif.<br />**--<br />**--Fill up the final display table<br /> loop at i_final.<br /> format color col_normal intensified on.<br /> write: /1 sy-vline,<br /> 2 i_final-enhspot hotspot on,<br /> 34 sy-vline.<br />**--Description of object types<br /> case i_final-obj_type.<br /> when 'REPS' or 'PROG'.<br /> write: 36 'Source Code Enhancement'(315).<br /> when 'INTF' or 'SXSD'.<br /> write: 36 'BADI Enhancement'(316).<br /> when 'FUNC' or 'FUGR' .<br /> write: 36 'Function group Enhancement'(317).<br /> when 'CLAS'.<br /> write: 36 'Class Enhancement'(318).<br /> when others.<br /> write: 36 i_final-obj_type.<br /> endcase.<br />**--Enhancement names and switch id<br /> write: 64 sy-vline,<br /> 66 i_final-enhname hotspot on,<br /> 100 sy-vline,<br /> 101 i_final-switch_id,<br /> 132 sy-vline.<br />**--Switxh state<br /> case i_final-state.<br /> when 'T'.<br /> write 133 'On'(319).<br /> when 'S'.<br /> write 133 'Stand-by'(320).<br /> when 'F'.<br /> write 133 'Off'(321).<br /> endcase.</span><br />
<span style="font-family: Verdana, sans-serif;"> write: 150 sy-vline.</span><br />
<span style="font-family: Verdana, sans-serif;"> endloop.<br /> write:/(150) sy-uline.<br /> elseif i_enhspotobj[] is initial.<br /> "information popup<br /> call function 'POPUP_TO_INFORM'<br /> exporting<br /> titel = 'Information Message'(509)<br /> txt1 = 'Sorry!!!'(510)<br /> txt2 = 'No Enhancements available for the selected Transaction'(511).</span><br />
<br /><span style="font-family: Verdana, sans-serif;"> endif.</span><br />
<br /><span style="font-family: Verdana, sans-serif;">endform. " F_PNAME_SPOTS</span><br />
<span style="font-family: Verdana, sans-serif;">*&---------------------------------------------------------------------*<br />*& Form fbdc_dynpro<br />*&---------------------------------------------------------------------*<br />* text<br />*----------------------------------------------------------------------*<br />* -->PROGRAM text<br />* -->DYNPRO text<br />*----------------------------------------------------------------------*<br />form fbdc_dynpro using program type any dynpro type any.<br /> clear i_bdcdata.<br /> i_bdcdata-program = program.<br /> i_bdcdata-dynpro = dynpro.<br /> i_bdcdata-dynbegin = 'X'.<br /> append i_bdcdata.<br />endform. "FBDC_DYNPRO</span><br />
<span style="font-family: Verdana, sans-serif;">*----------------------------------------------------------------------*<br />* Insert field *<br />*----------------------------------------------------------------------*<br />form fbdc_field using fnam type any fval type any.<br /> clear i_bdcdata.<br /> i_bdcdata-fnam = fnam.<br /> i_bdcdata-fval = fval.<br /> append i_bdcdata.<br />endform. "FBDC_FIELD</span><br />
<span style="font-family: Verdana, sans-serif;">*----------------------------------------------------------------------*<br />* Start new transaction according to parameters *<br />*----------------------------------------------------------------------*<br />form fbdc_transaction using value(l_tcode) like tstc-tcode.<br /> refresh i_messtab.<br /> call transaction l_tcode using i_bdcdata<br /> mode ctumode<br /> update cupdate<br /> messages into i_messtab.</span><br />
<span style="font-family: Verdana, sans-serif;"> refresh i_bdcdata.<br /> clear i_bdcdata.</span><br />
<span style="font-family: Verdana, sans-serif;">endform. "fbdc_transaction<br />*&---------------------------------------------------------------------*<br />*& Form F_FIND_INCLUDE_PROGRAMS<br />*&---------------------------------------------------------------------*<br />* text<br />*----------------------------------------------------------------------*<br />* -->P_TSTC_PGMNA text<br />*----------------------------------------------------------------------*<br />form f_find_include_programs using p_tstc_pgmna type any.</span><br />
<span style="font-family: Verdana, sans-serif;"> data: lv_fip_prog(255),<br /> lv_tail(255). "#EC *</span><br />
<span style="font-family: Verdana, sans-serif;">*--- Lines for include<br /> data: i_inc_lines like content occurs 0 with header line.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Read ABAP<br /> read report p_tstc_pgmna into i_inc_lines.</span><br />
<span style="font-family: Verdana, sans-serif;">**-- Examine each line of ABAP<br /> loop at i_inc_lines.<br />**-- find include programs.<br /> if i_inc_lines(1) = '*' or i_inc_lines is initial.<br /> continue.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;"> translate i_inc_lines-line to upper case.<br /> shift i_inc_lines-line up to 'INCLUDE'.</span><br />
<span style="font-family: Verdana, sans-serif;"> if ( i_inc_lines-line(7) eq 'INCLUDE' ) or<br /> ( i_inc_lines-line(7) eq 'INCLUDE' )<br /> and i_inc_lines-line+8(9) ne space<br /> and sy-tabix <> 1.<br /> lv_fip_prog = i_inc_lines-line+8(64).<br /> split lv_fip_prog at '.' into lv_fip_prog lv_tail.<br />**- Append program name to list of include programs<br /> select single * from trdir where name eq lv_fip_prog.<br /> check sy-subrc eq 0.<br /> i_prog_includes-prog = lv_fip_prog.<br /> append i_prog_includes.<br />*--- Recursively look for other includes.<br /> perform f_find_include_programs using lv_fip_prog.<br /> endif.<br /> endloop.</span><br />
<span style="font-family: Verdana, sans-serif;">endform. " F_FIND_INCLUDE_PROGRAMS</span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com4tag:blogger.com,1999:blog-3862123204833966581.post-63625930452793076442012-04-29T23:12:00.002-07:002012-04-30T09:26:00.014-07:00Program to send 2 internal tables data as two attachments to mail id outside SAP System<div dir="ltr" style="text-align: left;" trbidi="on">
· <br />
This code helps in sending 2 internal tables data as two separate attachments in a single mail id outside sap system <br />
REPORT ZBC_ITAB_TO_EXCEL_NEW <br />
CLASS: cl_abap_char_utilities DEFINITION LOAD.<br />
DATA: docdata LIKE sodocchgi1,<br /> objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,<br /> objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,<br /> objbin1 LIKE solisti1 OCCURS 10 WITH HEADER LINE,<br /> objbin2 LIKE solisti1 OCCURS 10 WITH HEADER LINE,<br /> objbin_final LIKE solisti1 OCCURS 10 WITH HEADER LINE,<br /> reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE,<br /> tab_lines TYPE sy-tabix.<br />
DATA: gd_sender_type LIKE soextreci1-adr_typ.<br />
DATA: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,<br /> c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.<br />
DATA: c_dev TYPE sy-sysid.<br />
DATA: BEGIN OF i_data OCCURS 0,<br /> a(20),<br /> b(20),<br /> END OF i_data.<br />
DATA: BEGIN OF st,<br /> f1(2) TYPE c,<br /> f2(2) TYPE n,<br /> END OF st.<br />
DATA: itab1 LIKE TABLE OF st WITH HEADER LINE,<br /> itab2 LIKE TABLE OF st WITH HEADER LINE.<br />
DATA: n TYPE i.<br />
PARAMETER: p_email1 LIKE somlreci1-receiver<br /> DEFAULT <a href="mailto:'example@yahoo.com'">'example@yahoo.com'</a>,<br /> p_sender LIKE somlreci1-receiver.<br />
START-OF-SELECTION.<br />
itab1-f1 = 'AA'. itab1-f2 = '01'. APPEND itab1.<br /> itab1-f1 = 'BB'. itab1-f2 = '02'. APPEND itab1.<br /> itab1-f1 = 'CC'. itab1-f2 = '03'. APPEND itab1.<br />
itab2-f1 = 'ZZ'. itab2-f2 = '26'. APPEND itab2.<br /> itab2-f1 = 'YY'. itab2-f2 = '25'. APPEND itab2.<br />
LOOP AT itab1.<br /> CONCATENATE itab1-f1 itab1-f2 INTO objbin1 separated BY c_tab.<br /> CONCATENATE c_ret objbin1 INTO objbin1.<br /> APPEND objbin1.<br /> ENDLOOP.<br />
LOOP AT itab2.<br /> CONCATENATE itab2-f1 itab2-f2 INTO objbin2 separated BY c_tab.<br /> CONCATENATE c_ret objbin2 INTO objbin2.<br /> APPEND objbin2.<br /> ENDLOOP.<br />
LOOP AT objbin1.<br /> MOVE objbin1-line TO objbin_final-line.<br /> APPEND objbin_final.<br /> ENDLOOP.<br />
LOOP AT objbin2.<br /> MOVE objbin2-line TO objbin_final-line.<br /> APPEND objbin_final.<br /> ENDLOOP.<br />
PERFORM process_email.<br /> c_dev = sy-sysid.<br />
IF sy-sysid = c_dev.<br /> wait up to 5 seconds.<br /> SUBMIT rsconn01 WITH mode = 'INT'<br /> WITH output = 'X'<br /> AND RETURN.<br /> ENDIF.<br />
IF sy-subrc = 0.<br /> WRITE: / 'Email succesfilly delivered'.<br /> ELSE.<br /> WRITE: / 'failure'.<br /> ENDIF.<br />
*&--------------------------------------------------------------------*<br />*& Form process_email<br />*&--------------------------------------------------------------------*<br />* text<br />*---------------------------------------------------------------------*<br />FORM process_email.<br />
IF p_sender EQ space.<br /> gd_sender_type = space.<br /> ELSE.<br /> gd_sender_type = 'INT'.<br /> ENDIF.<br />
*Body<br /> docdata-obj_name = 'Mail_Excel_File'.<br /> docdata-obj_descr = 'Excel file attachment'.<br /> objtxt = 'Attached is the sample Excel file'.<br /> APPEND objtxt.<br /> DESCRIBE TABLE objtxt LINES tab_lines.<br /> READ TABLE objtxt INDEX tab_lines.<br /> docdata-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).<br />
CLEAR objpack-transf_bin.<br /> objpack-head_start = 1.<br /> objpack-head_num = 0.<br /> objpack-body_start = 1.<br /> objpack-body_num = tab_lines.<br /> objpack-doc_type = 'RAW'.<br /> APPEND objpack.<br />
*Attachment 1<br /> n = 1.<br />
DESCRIBE TABLE objbin1 LINES tab_lines.<br /> objpack-doc_size = tab_lines * 255.<br /> objpack-transf_bin = 'X'.<br /> objpack-head_start = 1.<br /> objpack-head_num = 1.<br /> objpack-body_start = n.<br /> objpack-body_num = tab_lines.<br /> objpack-doc_type = 'XLS'.<br /> docdata-obj_name = 'Excel_File_Attachment1'.<br /> objpack-obj_descr = 'Excel File Attachment1'.<br /> APPEND objpack. <br />
*Attachment 2<br />
n = n + tab_lines.<br />
DESCRIBE TABLE objbin2 LINES tab_lines.<br /> objpack-doc_size = tab_lines * 255.<br /> objpack-transf_bin = 'X'.<br /> objpack-head_start = 1.<br /> objpack-head_num = 1.<br /> objpack-body_start = n.<br /> objpack-body_num = tab_lines.<br /> objpack-doc_type = 'XLS'.<br /> docdata-obj_name = 'Excel_File_Attachment2'.<br /> objpack-obj_descr = 'Excel File Attachment2'.<br /> APPEND objpack.<br />
*Create the list of recipients<br /> reclist-receiver = p_email1.<br /> reclist-rec_type = 'U'.<br /> reclist-express = 'X'.<br /> APPEND reclist.<br />
*Send the e-mail<br /> CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'<br /> EXPORTING<br /> document_data = docdata<br /> put_in_outbox = 'X'<br /> commit_work = 'X'<br /> TABLES<br /> packing_list = objpack<br /> contents_bin = objbin_final<br /> contents_txt = objtxt<br /> receivers = reclist<br /> EXCEPTIONS<br /> too_many_receivers = 1<br /> document_not_sent = 2<br /> document_type_not_exist = 3<br /> operation_no_authorization = 4<br /> parameter_error = 5<br /> x_error = 6<br /> enqueue_error = 7<br /> OTHERS = 8.<br />
COMMIT WORK.<br />ENDFORM. "process_email <br />
<br />
<br /> </div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com5tag:blogger.com,1999:blog-3862123204833966581.post-19832715318654385682012-04-29T23:10:00.000-07:002012-04-29T23:39:59.690-07:00SAP Workflow useful transaction codes<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">Some useful workflow transaction codes</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">OOAW <br /> Evaluation paths <br /><br />PFAC_CHG <br /> Change roles <br /><br />PFAC_DEL <br /> Delete roles <br /><br />PFAC_DIS <br /> Display roles <br /><br />PFAC_INS <br /> Create roles <br /><br />PFOM <br /> Maintain assignment to SAP organizational objects <br /><br />PFOS <br /> Display assignment to SAP organizational objects <br /><br />PFSO <br /> Organizational environment of a user <br /><br />PFTC_CHG <br /> Change tasks <br /><br />PFTC_COP <br /> Copy tasks <br /><br />PFTC_DEL <br /> Delete tasks <br /><br />PFTC_DIS <br /> Display tasks <br /><br />PFTC_INS <br /> Create tasks <br /><br />PPOCW <br /> Create organizational plan <br /><br />PPOMW <br /> Maintain organizational plan <br /><br />PPOSW <br /> Display organizational plan <br /><br />SWDA <br /> Workflow Builder (Calls the Workflow Builder in alphanumeric mode) <br /><br />SWDD <br /> Workflow Builder <br /><br />SWDS <br /> Workflow Builder (Selection) <br /><br />SWDD_CONFIG <br /> Workflow configuration <br /><br />SBWP <br /> The Business Workplace <br /><br />SWDC_DEFINITION <br /> Workflow Builder administration data <br /><br />SWDC_RUNTIME <br /> Workflow runtime administration data <br /><br />SWNCONFIG <br /> Extended notifications for business workflow <br /><br />SWDM <br /> Business Workflow Explorer <br /><br />SWEINST <br /> Evaluation and maintenance of instance linkages <br /> </span><br />
<span style="font-family: Verdana, sans-serif;">SWUD <br /> Diagnostic tools <br /><br />SWUE <br /> Trigger event <br /><br />SWUI <br /> Start workflows/tasks <br /><br />SWEINSTVC <br /> Evaluation and maintenance of instance linkages <br /><br />SWE2 <br /> Evaluation and maintenance of type linkages <br /><br />SWE3 <br /> Evaluation and maintenance of instance linkages <br /><br />SWE4 <br /> Switch event trace on/off <br /><br />SWEL <br /> Display event trace <br /><br />RSWELOGD <br /> Delete event trace <br /><br />SWEC <br /> Link change documents to events <br /><br />SWED <br /> Assign change document objects to object types <br /><br />SWEQADM_1 <br /> Event queue administration <br /><br />SWEQBROWSER <br /> Administration of event queue browser <br /><br />SWETYPV <br /> Evaluation and maintenance of type linkages <br /><br />SWI1 <br /> Selection report for work items <br /><br />SWI2_FREQ <br /> Work items per task <br /><br />SWI2_DEAD <br /> Work items with monitored deadlines <br /><br />SWI2_DURA <br /> Work items by processing duration <br /><br />SWI11 <br /> Tasks in workflows <br /><br />SWI13 <br /> Task profile <br /><br />SWI5 <br /> Workload analysis <br /><br />SWL1 <br /> Settings for dynamic columns <br /><br />SWLV <br /> Maintain work item views <br /><br />SWFVISU <br /> Parameters for Work Item Visualization in the UWL <br /><br />SWO1 <br /> Business Object Builder <br /><br />SWO6 <br /> Customizing object types <br /><br />SWR_WEBSERVER <br /> Customizing Web server <br /><br />SWU_CONT_PERSISTENCE <br /> Administration of container persistence <br /><br />SWU_EWCD <br /> Wizard for event creation using change documents <br /><br />SWU_EWLIS <br /> Wizard for event creation using the Logistics Information System <br /><br />SWU_BTE <br /> Wizard for event creation using Business Transaction Events <br /><br />SWU0 <br /> Event simulation <br /><br />SWU2 <br /> RFC monitor <br /><br />SWU3 <br /> Automatic Workflow Customizing <br /><br />SWU4 <br /> Consistency check for standard tasks <br /><br />SWU5 <br /> Consistency check for customer tasks <br /><br />SWU6 <br /> Consistency check for workflow tasks <br /><br />SWU7 <br /> Consistency check for workflow templates <br /><br />SWU8 <br /> Switch workflow trace on/off <br /><br />SWU9 <br /> Display workflow trace <br /><br />SWU10 <br /> Delete workflow trace <br /> </span><br />
<span style="font-family: Verdana, sans-serif;">SWUS <br /> Testing workflows/tasks <br /><br />SWXML <br /> Display XML documents <br /><br />SWUY <br /> Wizard for linking messages to workflows <br /><br />SWWCOND_INSERT <br /> Schedule background job for work item deadline monitoring <br /><br />SWWCLEAR_INSERT <br /> Schedule background job for clearing tasks <br /><br />RSWWCOND <br /> Execute single background job for work item deadline monitoring <br /><br />RSWWCLEAR <br /> Execute work item clearing work once <br /><br />WF_HANDCUST <br /> WebFlow service handler maintenance <br /><br />WF_EXTSRV <br /> Maintain Web Service Repository <br /><br />WFWS <br /> Import WSDL files <br /> </span></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-19051363301940611842012-04-29T23:05:00.002-07:002012-04-29T23:05:27.972-07:00Testing tool designed to ensure minimu transport requests for any object changed in development<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;"> <br />* This program is for testing purposes only.<br />* Make sure the correct version of this program is available in QA or PA</span><br />
<span style="font-family: Verdana, sans-serif;">* This program will copy the code and text elements of the program in<br />* in DEV that got changed and which requires testing in QA before the<br />* CTS is released to QA and PA. ESSENTIALLY THIS WILL RUN THE CODE IN<br />* DEVELOPMENT IN QUALITY CLIENT WITHOUT TRANSPORTING THE CHNAGE TO QA.</span><br />
<span style="font-family: Verdana, sans-serif;">* Using this tool will minimize the number of times the chnaged object<br />* has to be moved from DEV to QA for testing to be completed.</span><br />
<span style="font-family: Verdana, sans-serif;">* EXECUTE THIS PROGRAM FROM QA FOR TESTING ANY PROGRAM</span><br />
<span style="font-family: Verdana, sans-serif;">report zz_test_program_rfc_read message-id fb.</span><br />
<span style="font-family: Verdana, sans-serif;">tables: trdir.</span><br />
<span style="font-family: Verdana, sans-serif;">* By default the changed program will be in DEV - choose correct name<br />* of the DEv clnt in the system<br />parameters: rfcdest like rsedr-sysid obligatory default 'DA1CLNT100'.</span><br />
<span style="font-family: Verdana, sans-serif;">* The name of the report you changed in DEV that needs to be tested<br />* in QA<br />parameters: p_rep like rsedr-repid obligatory.</span><br />
<span style="font-family: Verdana, sans-serif;">* By default the program code and txt elements will be uploaded to<br />* this name so that the original version in QA is not overwritten.<br />parameters: p_rep1 like rsedr-repid obligatory default 'Z_NEW_REPORT'.</span><br />
<span style="font-family: Verdana, sans-serif;">data: begin of itab occurs 0.<br /> include structure d022s.<br />data: end of itab.</span><br />
<span style="font-family: Verdana, sans-serif;">data: progname like sy-cprog.</span><br />
<span style="font-family: Verdana, sans-serif;">data: source_table(72) occurs 0 with header line.</span><br />
<span style="font-family: Verdana, sans-serif;">data: entry like textpool-entry.</span><br />
<span style="font-family: Verdana, sans-serif;">data: itab1 like textpool occurs 50 with header line.<br />data: itab2 like textpool occurs 50 with header line.</span><br />
<span style="font-family: Verdana, sans-serif;">*------------------------------------------------</span><br />
<span style="font-family: Verdana, sans-serif;">perform call_program.</span><br />
<span style="font-family: Verdana, sans-serif;">if sy-subrc ne 0.<br /> message e000 with 'Program not generated.'.<br />endif.</span><br />
<span style="font-family: Verdana, sans-serif;">submit (p_rep1) via selection-screen and return.</span><br />
<span style="font-family: Verdana, sans-serif;">*&---------------------------------------------------------------------*<br />*& Form call_program<br />*&---------------------------------------------------------------------*<br />* text<br />*----------------------------------------------------------------------*<br />* --> p1 text<br />* <-- p2 text<br />*----------------------------------------------------------------------*<br />form call_program .</span><br />
<span style="font-family: Verdana, sans-serif;"> perform read_report.</span><br />
<span style="font-family: Verdana, sans-serif;"> loop at itab.<br /> move itab to source_table.<br /> append source_table. clear source_table.<br /> endloop.<br />*<br /> insert report p_rep1 from source_table state 'A' ." keeping directory<br />* entry<br /> .<br /> if sy-subrc ne 0.<br /> message e000 with 'Program not generated.'.<br /> endif.<br />*<br /> perform upload_texts.</span><br />
<span style="font-family: Verdana, sans-serif;">endform. " call_program<br />*&---------------------------------------------------------------------*<br />*& Form read_report<br />*&---------------------------------------------------------------------*<br />* text<br />*----------------------------------------------------------------------*<br />* --> p1 text<br />* <-- p2 text<br />*----------------------------------------------------------------------*<br />form read_report .</span><br />
<span style="font-family: Verdana, sans-serif;"> call function 'RFC_READ_DEVELOPMENT_OBJECT'<br /> destination rfcdest<br /> exporting<br /> program = p_rep<br /> tables<br /> qtab = itab<br /> texttab = itab2.</span><br />
<span style="font-family: Verdana, sans-serif;"> if sy-subrc ne 0.<br /> message e000 with 'Program not read from development.'.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;">endform. " read_report</span><br />
<span style="font-family: Verdana, sans-serif;">*&---------------------------------------------------------------------*<br />*& Form upload_texts<br />*&---------------------------------------------------------------------*<br />* text<br />*----------------------------------------------------------------------*<br />* --> p1 text<br />* <-- p2 text<br />*----------------------------------------------------------------------*<br />form upload_texts .</span><br />
<span style="font-family: Verdana, sans-serif;"> insert textpool p_rep1 from itab2 language sy-langu.<br /> if sy-subrc ne 0.<br /> message e000 with 'Texts not generated.'.<br /> endif.</span><br />
<span style="font-family: Verdana, sans-serif;">endform. " upload_texts</span><br />
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-22982607083718071602012-04-29T22:47:00.004-07:002012-04-30T09:20:25.626-07:00How to Scan ABAP Sources for Specific Strings<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="line-height: 16.5pt; margin: 0in 0in 0pt 22.5pt; vertical-align: baseline;">
It is simple to locate a string within a program but how to find all programs where a specific ”string”, or line of text, or object name, is used.<br />
There is a wonderful report which can be used to find ABAP programs related to specific search terms.<br />
The Report name is – RPR_ABAP_SOURCE_SCAN <br />
You can execute it from transaction SA38 or SE38.<br />
<br />Some useful benefits of this report are:<br />
You can limit the search range of the programs for example to your custom built developments only for example all programs starting with Y* or Z*.<br />
Tip - Another similar program is RKCTSEAR.</div>
<div class="MsoNormal" style="line-height: 16.5pt; margin: 0in 0in 0pt 22.5pt; text-align: left; vertical-align: baseline;">
</div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-4863314121873335372012-04-29T22:42:00.000-07:002012-04-30T09:27:42.307-07:00Generate a WSDL from a RFC Function Module<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="line-height: 16.5pt; margin: 0in 0in 0pt 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in; vertical-align: baseline;">
<br /></div>
<div class="MsoNormal" style="line-height: 16.5pt; margin: 0in 0in 0pt 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in; vertical-align: baseline;">
Step by Step process to generate WSDL from RFC Function module<br />
<br />
1. Select the Function module for which you wish to create the WSDL, either from transaction SE80or SE37.<br />
2. Check in the Attributes of the FM that the FM has a processing type of “Remote-Enabled Module”.<br />
3. From within the FM use the following menu path: Utilities–>More Utilities–>Create Web Service –>From the Function Module.<br />
4. Then follow the Create Web service Wizard.<br />
5. You will need to create a workbench transport request.<br />
6. Then go to transaction WSCONFIG to see the web service for SOAP runtime. Double click on the web service.<br />
7. Go to transaction WSADMIN and select the web service.<br />
8. Then use the menu path: Web Service–>WSDL to generate the WSDL.<br />
9. You are now able to use the WSDL and URL. Use a user interface like SOAPUI to send values and check the response.</div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-43196608871631792042012-04-29T22:38:00.003-07:002012-04-30T09:29:13.910-07:00Send smartform as PDF attachment through email<div dir="ltr" style="text-align: left;" trbidi="on">
REPORT ztest_smartform.<br />
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,<br /> i_tline TYPE TABLE OF tline WITH HEADER LINE,<br /> i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,<br /> i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,* Objects to send mail.<br /> i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,<br /> i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,<br /> i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,<br /> i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,* Work Area declarations<br /> wa_objhead TYPE soli_tab,<br /> w_ctrlop TYPE ssfctrlop,<br /> w_compop TYPE ssfcompop,<br /> w_return TYPE ssfcrescl,<br /> wa_doc_chng TYPE sodocchgi1,<br /> w_data TYPE sodocchgi1,<br /> wa_buffer TYPE string, "To convert from 132 to 255<br />* Variables declarations<br /> v_form_name TYPE rs38l_fnam,<br /> v_len_in LIKE sood-objlen,<br /> v_len_out LIKE sood-objlen,<br /> v_len_outn TYPE i,<br /> v_lines_txt TYPE i,<br /> v_lines_bin TYPE i.*Get function module form smart form<br />CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'<br /> EXPORTING<br /> formname = 'ZSMARTFORMS_TEST1'<br /> IMPORTING<br /> fm_name = v_form_name<br /> EXCEPTIONS<br /> no_form = 1<br /> no_function_module = 2<br /> OTHERS = 3.<br />IF sy-subrc <> 0.<br /> MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno<br /> WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.<br />ENDIF.*Set control parameters and output options<br />w_ctrlop-getotf = 'X'.<br />w_ctrlop-no_dialog = 'X'.<br />w_compop-tdnoprev = 'X'.CALL FUNCTION v_form_name<br /> EXPORTING<br /> control_parameters = w_ctrlop<br /> output_options = w_compop<br /> user_settings = 'X'<br /> IMPORTING<br /> job_output_info = w_return<br /> EXCEPTIONS<br /> formatting_error = 1<br /> internal_error = 2<br /> send_error = 3<br /> user_canceled = 4<br /> OTHERS = 5.<br />IF sy-subrc <> 0.<br /> MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno<br /> WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.<br />ENDIF.*Covert the OTF data returned to PDF format<br />i_otf[] = w_return-otfdata[].CALL FUNCTION 'CONVERT_OTF'<br /> EXPORTING<br /> format = 'PDF'<br /> max_linewidth = 132<br /> IMPORTING<br /> bin_filesize = v_len_in<br /> TABLES<br /> otf = i_otf<br /> lines = i_tline<br /> EXCEPTIONS<br /> err_max_linewidth = 1<br /> err_format = 2<br /> err_conv_not_possible = 3<br /> OTHERS = 4.<br />IF sy-subrc <> 0.<br />ENDIF.LOOP AT i_tline.<br /> TRANSLATE i_tline USING '~'.<br /> CONCATENATE wa_buffer i_tline INTO wa_buffer.<br />ENDLOOP.TRANSLATE wa_buffer USING '~'.<br />DO.<br /> i_record = wa_buffer.<br /> APPEND i_record.<br /> SHIFT wa_buffer LEFT BY 255 PLACES.<br /> IF wa_buffer IS INITIAL.<br /> EXIT.<br /> ENDIF.<br />ENDDO.* Attachment<br />REFRESH: i_reclist,<br /> i_objtxt,<br /> i_objbin,<br /> i_objpack.CLEAR wa_objhead.<br />
i_objbin[] = i_record[].* Create Message Body Title and Description<br />i_objtxt = 'test with pdf-Attachment!'.APPEND i_objtxt.DESCRIBE TABLE i_objtxt LINES v_lines_txt.READ TABLE i_objtxt INDEX v_lines_txt.<br />wa_doc_chng-obj_name = 'smartform'.<br />wa_doc_chng-expiry_dat = sy-datum + 10.<br />wa_doc_chng-obj_descr = 'smartform'.<br />wa_doc_chng-sensitivty = 'F'.<br />wa_doc_chng-doc_size = v_lines_txt * 255.<br />* Main Text<br />CLEAR i_objpack-transf_bin.<br />i_objpack-head_start = 1.<br />i_objpack-head_num = 0.<br />i_objpack-body_start = 1.<br />i_objpack-body_num = v_lines_txt.<br />i_objpack-doc_type = 'RAW'.APPEND i_objpack.* Attachment (pdf-Attachment)<br />i_objpack-transf_bin = 'X'.<br />i_objpack-head_start = 1.<br />i_objpack-head_num = 0.<br />i_objpack-body_start = 1.<br />DESCRIBE TABLE i_objbin LINES v_lines_bin.READ TABLE i_objbin INDEX v_lines_bin.<br />i_objpack-doc_size = v_lines_bin * 255 .<br />i_objpack-body_num = v_lines_bin.<br />i_objpack-doc_type = 'PDF'.<br />i_objpack-obj_name = 'smart'.<br />i_objpack-obj_descr = 'test'.APPEND i_objpack.CLEAR i_reclist.<br />i_reclist-receiver = <a href="mailto:'mkumardas@deloitte.com'">'mkumardas@deloitte.com'</a>.<br />i_reclist-rec_type = 'U'.APPEND i_reclist.CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'<br /> EXPORTING<br /> document_data = wa_doc_chng<br /> put_in_outbox = 'X'<br /> commit_work = 'X'<br /> TABLES<br /> packing_list = i_objpack<br /> object_header = wa_objhead<br /> contents_bin = i_objbin<br /> contents_txt = i_objtxt<br /> receivers = i_reclist<br /> EXCEPTIONS<br /> too_many_receivers = 1<br /> document_not_sent = 2<br /> document_type_not_exist = 3<br /> operation_no_authorization = 4<br /> parameter_error = 5<br /> x_error = 6<br /> enqueue_error = 7<br /> OTHERS = 8.<br />IF sy-subrc <> 0.<br /> WRITE:/ 'Error When Sending the File', sy-subrc.<br />ELSE.<br /> WRITE:/ 'Mail sent'.<br />ENDIF.<br />
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-83853616947215240052012-04-25T01:25:00.000-07:002012-04-25T01:26:26.630-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: Calibri;">TO – Transfer order business process</span></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9S-HRcMW7rQ0U8B44vbNofRHMNRnOFLz4AJK6X0qDZvPdsT_sei5D79dLG4rdKUxo9NPSkcAYKVFYFK7D5HwiGu5qYwrmO-V8EzOMliwlvG2tmyXhFkBFg3nJdYUAn0t2hTa-tvFH53ui/s1600/TO+process.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="275" oda="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9S-HRcMW7rQ0U8B44vbNofRHMNRnOFLz4AJK6X0qDZvPdsT_sei5D79dLG4rdKUxo9NPSkcAYKVFYFK7D5HwiGu5qYwrmO-V8EzOMliwlvG2tmyXhFkBFg3nJdYUAn0t2hTa-tvFH53ui/s400/TO+process.jpg" width="400" /></a></div>
<br />
<br /></div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-58352748100709455702012-04-25T01:17:00.003-07:002012-04-29T22:59:10.102-07:00ABAP Utility to execute any program<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;"></span><br />
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b><u><span style="font-family: Verdana, sans-serif;">ABAP Utility to execute any program.</span></u></b></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-family: Verdana, sans-serif;">This is simple program and can be used to generate any program at runtime.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<span style="font-family: Verdana, sans-serif;">The code has to be put in notepad and execute it through this utility.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<br /></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b><u><span style="font-family: Verdana, sans-serif;">Advantages:</span></u></b></div>
<div class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">1)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>All one time programs can be generated at runtime through this utility; this avoids actual development of one time programs in SAP.</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;">
<span style="font-family: Verdana, sans-serif;">One time programs are those which are run on demand and they have no use once they are run.</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">2)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>Requirement to pull data for quick audit on demand can be done without actual development of programs. </span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">3)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>No actual transports need to be done, as we are just putting our code in note pad file.</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">4)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>Check for different sensitive statements can be put in the program so has to restrict the usage.</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">5)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>User Authorization can be put, hence allowing only the authorized users to run this utility.</span></div>
<div class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in;">
<span style="font-family: Verdana, sans-serif;">Since the utility can execute any code passed to it.</span></div>
<div class="MsoNormal" style="margin: 0in 0in 0pt;">
<b><u><span style="font-family: Verdana, sans-serif;">Disclaimer: </span></u></b></div>
<div class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">1)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>Only authorized must execute this program, as this utility can execute the program passed to it as text file.</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">2)<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>Validations has to be done for sensitive commands like mentioned below</span></div>
<span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;"></span></span><span style="font-family: "Calibri", "sans-serif"; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;"><span style="font-family: Verdana, sans-serif;"> </span></span> <br />
<div class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>DELETE</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>UPDATE</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>INSERT</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>DROP</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>CREATE</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>ALTER</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>GRANT</span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>REVOKE</span></div>
<div class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -0.25in;">
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span>MODIFY </span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -0.25in;">
</div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0tag:blogger.com,1999:blog-3862123204833966581.post-45551164381565578092012-04-25T01:08:00.001-07:002012-04-30T09:30:36.413-07:00Convert Internal Table Rows to Columns and Columns to Rows<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />TYPES: BEGIN OF ty_col_row,<br /> col01 TYPE string,<br /> col02 TYPE string,<br /> col03 TYPE string,<br /> END OF ty_col_row.<br />
FIELD-SYMBOLS: <fs1> TYPE any,<br /> <fs2> TYPE any.<br />
DATA: it1_col_row TYPE STANDARD TABLE OF ty_col_row,<br /> wa1_col_row TYPE ty_col_row,<br /> it2_col_row TYPE STANDARD TABLE OF ty_col_row,<br /> wa2_col_row TYPE ty_col_row,<br /> cline TYPE sy-tabix.<br />
wa1_col_row-col01 = 'C-1_R-1'. wa1_col_row-col02 = 'C-2_R-1'. wa1_col_row-col03 = 'C-1_R-1'.<br /> APPEND wa1_col_row TO it1_col_row. <br /> wa1_col_row-col01 = 'C-1_R-2'. wa1_col_row-col02 = 'C-2_R-2'. wa1_col_row-col03 = 'C-1_R-2'.<br /> APPEND wa1_col_row TO it1_col_row. <br /> wa1_col_row-col01 = 'C-1_R-3'. wa1_col_row-col02 = 'C-2_R-3'. wa1_col_row-col03 = 'C-1_R-3'.<br /> APPEND wa1_col_row TO it1_col_row.<br />
LOOP AT it1_col_row INTO wa1_col_row.<br /> WRITE: / wa1_col_row-col01, wa1_col_row-col02, wa1_col_row-col03 .<br /> ENDLOOP.<br />
WRITE: /.<br />
LOOP AT it1_col_row INTO wa1_col_row.<br /> CLEAR wa2_col_row.<br /> ASSIGN COMPONENT sy-tabix OF STRUCTURE wa2_col_row TO <fs1>.<br /> cline = sy-tabix.<br /> DO.<br /> ASSIGN COMPONENT sy-index OF STRUCTURE wa1_col_row TO <fs2>.<br /> IF sy-subrc NE 0.<br /> EXIT.<br /> ENDIF.<br /> IF cline = 1.<br /> <fs1> = <fs2>.<br /> APPEND wa2_col_row TO it2_col_row.<br /> ELSE.<br /> READ TABLE it2_col_row INTO wa2_col_row INDEX sy-index.<br /> <fs1> = <fs2>.<br /> MODIFY it2_col_row FROM wa2_col_row INDEX sy-index.<br /> ENDIF.<br /> ENDDO.<br /> ENDLOOP.<br />
LOOP AT it2_col_row INTO wa2_col_row.<br /> WRITE: / wa2_col_row-col01, wa2_col_row-col02, wa2_col_row-col03 .<br /> ENDLOOP.</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com2tag:blogger.com,1999:blog-3862123204833966581.post-6287497535174147992012-04-25T01:02:00.000-07:002012-04-29T22:59:54.347-07:00Background Job Variants<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 3.75pt 45pt; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;">If the variant was created ad-hoc and has not been saved it’ll be a temporary variant with a name similar to SAP&0001.</span></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 3.75pt 45pt; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;">You can see the values used in temporary variants by doing the following:</span></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 0in 0in 7.5pt 15pt; vertical-align: baseline;">
<i><span style="color: #666666; font-family: Verdana, sans-serif;"> From the job overview within SM37:</span></i></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 3.75pt 45pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;"><i><span style="color: #666666; mso-fareast-font-family: Helvetica;"><span style="mso-list: Ignore;">1. </span></span></i><i><span style="color: #666666;">Select the Job that was run/is running.</span></i></span></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 3.75pt 45pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;"><i><span style="color: #666666; mso-fareast-font-family: Helvetica;"><span style="mso-list: Ignore;">2. </span></span></i><i><span style="color: #666666;">Select the “Step” button (Ctrl+Shift+F9)</span></i></span></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 3.75pt 45pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;"><i><span style="color: #666666; mso-fareast-font-family: Helvetica;"><span style="mso-list: Ignore;">3. </span></span></i><i><span style="color: #666666;">Select the program name.</span></i></span></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 0pt 45pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;"><i><span style="color: #666666; mso-fareast-font-family: Helvetica;"><span style="mso-list: Ignore;">4. </span></span></i><i><span style="color: #666666;">Then select the menu path Goto–>Variant</span></i></span></div>
<div class="MsoNormal" style="line-height: 18pt; margin: 3.75pt 0in 3.75pt 45pt; vertical-align: baseline;">
<span style="font-family: Verdana, sans-serif;">Also – A tip is changing the defaulted Job Overview screen Layout to add the “Executing server” to the display. Do this from within the Job Overview of SM37 by selecting (Ctrl+F7).</span></div>
</div>Srinivas Dummuhttp://www.blogger.com/profile/16176093880641285915noreply@blogger.com0