Preserve Downloaded data formatting in Excel

Posted by Krishh Webworld | 8:48 AM | | 0 comments »

When we download the data from the SAP using FMs like GUI_DOWNLOAD or WA_DOWNLOAD (absolute); or the method of class CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD and open that file in the Microsoft Excel, we loose some important information like leading zero, long numbers will come as exponents. Most of the times we don't want this because we will use this File as input of some program or we will use it for future analsys.

When we use the .xls extension to save the file and open it directly in the Excel, the file will look like this:


We will see how to stop Excel removing our precise information which we have downloaded from SAP. We need to follow this Steps:
1. We will save our file with .txt extension instead of the .xls extension.

2. Start Excel. Start > Run > Enter Excel.

3. Open the downloaded file by Selecting it from the Open File dialog box.

4. Once we open the file, excel will bring "Text to column" wizard.

5. Select the "Delimilated" option in the first screen. Move to the 3rd Step of the wizard by pressing the Next button two times.


6. In the 3rd step, select all the columns. To select all the columns do like: Click on first column, Hold the shift key, scroll to last column, click on last column. This way all the columns gets selected. The colums which got selected will have black background. Now, select the Option "Text" in the format.


7. Finish the Wizard.

Our file after opening in Excel will look like this:



This is the code snippet I have used to generate the test file.

Code Snippet
  
*&---------------------------------------------------------------------*
*& Report will show how to use the GUI_DOWNLOAD to preserve the
*& formatting of the data
*&---------------------------------------------------------------------*
REPORT ztest_download.
*
TYPES: BEGIN OF ty_data,
vbeln TYPE vbeln,
amt TYPE dmbtr,
long TYPE char30,
text TYPE char20,
END OF ty_data.
*
DATA: it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data.
*
START-OF-SELECTION.
* Fill the test table
DO 5 TIMES.
wa_data-vbeln = sy-index.
UNPACK wa_data-vbeln TO wa_data-vbeln.
wa_data-amt = '12345.67' * sy-index.
wa_data-long = '12345678901234567890'.
wa_data-text = sy-abcde.
APPEND wa_data TO it_data.
CLEAR wa_data.
ENDDO.
*
* Download file
DATA: l_file TYPE string.
*
* here we will pass the .txt instead of the .xls
l_file = 'C:\temp\test_data.txt'.
*
* In the Filetype, we still pass the DAT because we want
* our output in the tabular format.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file
filetype = 'DAT'
TABLES
data_tab = it_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21.

ABAP and Excel - Formatted Files with XML

Posted by Krishh Webworld | 8:46 AM | | 0 comments »

This is one of my published blogs on the SAP Community Network --> https://www.sdn.sap.com/irj/scn.

This blog show a way to generate the formatted excel files using the XML. From release 620, ABAP has provided us a way to transform our data using the XML transformation. We can very use the XML to generate the formatted Excel File.

Follow:
ABAP and Excel - Create Formatted Excel using XML --> https://weblogs.sdn.sap.com/pub/wlg/13092

What Is Knowledge Management in SAP

Posted by Krishh Webworld | 8:43 AM | | 0 comments »

Knowledge Management or Enterprise Knowledge Management provides central and role-based access to the information in your company and creates a connection between structured business data and unstructured documents.

Enterprise Knowledge Management contains the tools to integrate different data sources and to create, administer, and distribute information. It allows consolidation and integration of intranet platforms and makes available integrated search technology that takes into account all data stores in your company.

In Knowledge management there is some thing called Knowledge warehousing...

Under which you have

a) Document management service &

b) Content Mnagement service

Its part of Netweaver 2004s release..

The technological components required or which are integral part of KM are:-

i. Application Server Java (AS-Java)

ii. Application Server ABAP (AS ABAP) – only required for the Documentation, Manuals, and Training Material Management

iii. Enterprise Portal (EP)

iv. Stand-alone engines:

v. Search and Classification (TREX) and of course BIContenet also.

The intended purpose of Knowledge Management:

- Receipt of relevant, role-based, and personalized information

- Automatic notification about new or changed information

- Quick finding of information using advanced search functions

- Direct options for reacting to information

- Display of information from different data sources on a common user interface

- Simplified exchange of information between users

- Clear structuring due to automatic classification

- Means of storing and efficiently using unstructured information

- Integration of your existing information landscape

- Or a complete switch to the KM capabilities of SAP NetWeaver

- Implementation of a consistent Content Management system

- Administration of business applications and Content Management in a single platform

- Use of integrated search technology for company-wide stores

Implement SAP - Scope of Work

Posted by Krishh Webworld | 8:43 AM | | 0 comments »

What are the scope of work when SAP is implement?

You should have a Project manager from your company, who will work or should work closely with the implementing Company Project Manager.

The Implementing company will supply the Technical/Functional Consultants. Your company should provide so-called "Super Users / Key Users. These are persons within the company who know the business and its processes inside out.

The Key Users will work closely with the Technical Consultants in designing the companies Business Process to fit with SAP.

The Technical consultants should pass on their knowledge to the Key Users. The Key User will train the End Users, so they must be also trained in SAP Business Process, this is either done by the Implementing company or your company can
send them to SAP training.

The driving person here is your Company Project Manager, in any case all company persons involved in the Implementation project should be on the project 100 percent.

You should setup five phases :
1. Preparation
2. Blueprinting,
3. Realization
4. Preparation Go Live
5. Go Live/Support

From the Project Management side, there are many thing that must be set up prior to Blueprinting, such as Project Charter, Project Plan, Risk Management Plan, Change Management plan etc.

As far as a SOW, this is part of your Charter and there are many Templates of such documents, you need more than just the template, you must know how to analysis your overall environment (Company goals, landscape, Business objectives etc)
in coming up with the Scope. More than one person is involved in the SOW defination.

Difference Between SAP Basis and ABAP

Posted by Krishh Webworld | 8:42 AM | | 0 comments »

BASIS is like an Operating System for R/3.

We can say that BASIS is a middleware between ABAP/4 (Advanced Business Application Programming) and the computer Operating system.

R/2 system was mainframe based. SAP ported it to client/server environment. To do this SAP created BASIS. Creating BASIS enabled ABAP/4 code to run on other platforms as well.

ABAP/4 programs cannot run directly on an Operating system (like Windows). It requires set of programs (collectively known as BASIS) to load and intreprete its input and output.

Without BASIS programs ABAP/4 programs cannot run.

You can relate BASIS to ABAP/4 programs, like Windows is to Windows programs.

To install BASIS, the installer runs the program "r3inst" at the command prompt level of O/s. Like most installs, this also creates a directory structure and copies set of executables into it (like for e.g. when we install the Windows operating system in our computer, it creates a directory structure like program files, windows etc..and copies set of executables into it). These executables taken together form BASIS.

Thus, ABAP/4 programs run within the protective BASIS environment. They are not executables that run on an Operating system. Instead BASIS reads ABAP/4 code and intrepretes it into Operating system instructions. ABAP/4 programs do not access O/S functions directly. Instead they use the BASIS function to perform the file input/output operation and display data in windows.

Tips by: Vishwanath.B

What is SAP Production Support - Ticket Resolving

Posted by Krishh Webworld | 8:42 AM | | 0 comments »

1. How the tickets in production support are resolved?
2. Give some examples with solutions?

What are the types of ticket and its importance?

This depends on the SLA. It can be like:

1. Critical.
2. Urgent.
3. High.
4. Medium
5. Low.

The response times and resolution times again are defined in the SLA based on the clients requirement and the charges.

This is probably from the viewpoint of Criticality of the problem faced by the client as defined by SAP.

1) First Level Ticketing:

Not severe problem. Routine errors. Mostly handled by Service desk arrangement of the company (if have one).

Eg: a) Say Credit limit block in working on certain documents?
b) Pricing Condition Record not found even though conditions are maintained?
c) Unable to print a delivery document or Packing list?

PS: In the 4th phase of ASAP Implementation Methodology( i.e Final Preparations for GO-LIVE) SAP has clearly specified that a Service desk needs to be arranged for any sort of Implementation for better handling of Production errors.

Service desk lies with in the client.

2) Second Level Ticketing:

Some sort of serious problems. Those Could not be solved by Service Desk. Should be referred to the Service Company (or may be company as prescribed in SLA).

Eg: a) Credit Exposure (especially open values) doesn't update perfectly to KNKK Table.
b) Inter company Billing is taking a wrong value of the Bill.
c) Need a new order type to handle reservation process
d) New product has been added to our selling range. Need to include this into SAP. (Material Masters, Division attachements, Stock Handling etc.)

3) Third Level Ticketing:

Problems could not be solved by both of the above, are referred to Online Service Support (OSS) of SAP Itself. SAP tries to solve the Problem, sometimes by providing the perfect OSS Notes, fits to the error and rarely SAP logs into our Servers (via remote log-on)for post mortem the problem. (The Medical check-up client, connections, Login id and Passwords stuff are to be provided to SAP whenever they need or at the time of opening OSS Message.)

There are lots of OSS Notes on each issue, SAP Top Notes and Notes explaining about the process of raising a OSS Message.

Sometimes SAP Charges to the client / Service company depending on the Agreement made at the time of buying License from SAP.

Eg: 1) Business Transation for the Currency 'EUR' is not possible. Check OSS Note - This comes at the time of making Billing.
2) Transaction MMPI- Periods cannot be opened – See OSS Note.

There are many other examples on the issue.

4) Fourth Level Ticketing:

Where rarely, problems reach this level.

Those problem needs may be re-engineering of the business process due to change in the Business strategy. Upgradation to new Version. More or less this leads to extinction of the SAP Implementation.

Tips by: Arun NG

SAP Cost/Benefit Analysis

Posted by Krishh Webworld | 8:41 AM | | 0 comments »

Actully we are planning to implement sap in our fertilizer company. The thing which I need to know from you people is why we should implement sap in our company and what kind of steps should we take to implement sap in fertilizer company. Before we are running manualy so what kind of benefits sap will bring us for prolong period of time.

Yasir Bhatti

SAP COST/BENEFIT ANALYSIS

Reduce Receivables (0%- 75%)
1. Identify current working capital investment in receivables
2. Determine average days outstanding
3. Estimate reduction in days outstanding
4. Determine associated reduction in working capital
5. Benefit in the cost of capital for the reduction in working capital

SAP Enablers

1. On-line and integrated system provides faster invoicing cycling time
2. Better analysis tools for receivables analysis

Increase Sales (0% - 10%)

Calculation
1. Identify sales volume by product line
2. Estimate total sales capacity/production capacity (This should include allowances for preventive and unplanned
downtime for maintenance reasons)
3. Estimate sales value of lost available production
4. Estimate portion of capacity that an be converted to sales

SAP Enablers
1. On line real-time capabilities increase responsiveness and customer service
2. Improved customer forecasting

Increase Production/Sales (0%-5%)

Calculation
1. Determine total sales
2. Determine margin on sales
3. Determine capacity utilization
4. Estimate increase in capacity utilization
5. Benefit in the margin on additional products

SAP Enablers
1. Integration with MM provides earlier visibility of material/asset availability issues
2. Production planning helps identify unused capacity
3. Better forecasting and planning tools helps identify correct product mix to produce
4. Better planning tools help manage product conversion (tear down, setup, off-spec) costs

Reduce Inventory (0%-50%)

Calculation
1. Identify inventory value by category (if LIFO valuation, value is actually higher than reported)
2. Multiply inventory reductions by incremental carrying costs (carrying costs includes cost of capital, taxes,
insurance, and damage allowance)

SAP Enablers
1. Improved visibility of inventory
2. Improved forecasting
3. Improved data accuracy
4. Reduced process cycle times

Hope this will give you a small picture.

Faraz

SAP Session take over Disabled

Posted by Krishh Webworld | 8:41 AM | | 0 comments »

SAP have disabled the session takeover once you upgrade to 4.6x.

Definitively SAP have blocked the functionality from the kernel.

The original program RSM04000 still exists but it doesn't work anymore.

Alternatively, you can used software like Microsoft NetMeetings.

However, in some of the SAP Version 4.x, you can still echo the user session.

This is how it goes :-

How to Create the Echoed Session :-

a) Make sure the User you want to Echo to is logged onto the same system you are logged onto.
b) Rel prior to 4.6B, Execute the SM04 transaction from your logon.
Rel 4.6B and later, Execute program RSM04000 from your logon.
c) Single Mouse-click to the command input area and key in 'slon' (without the quotes).
d) Single Mouse-click to the Userid you want to 'Echo-on' to.
e) Hit enter.
f) You will now be echoing your screens to the other User.
Note: You have not taken over their original session, you have created a new session for the echo.

How to Terminate the Echoed Session :-

a) Return to your SM04 screen display.
Single Mouse-click to the command input area and key in 'slof' (without the quotes).
b) Single Mouse-click to the Userid you want to 'Echo-off'.
c) Hit enter.

Note: This will remove your Echoed session screen from the Users screen, but leave the User logged on with their original session.

url to download SAPGUI from SAP

Posted by Krishh Webworld | 8:39 AM | | 0 comments »

To download any software from SAP Market place, first of all, you will need to be an existing SAP customer. If you are one of those that are authorized to access the SAP site, you'll be assigned an OSS ID which allowed you to report problems, search for SAP notes as well as request SAP related software on behalf of your company.

Please note that the following url and path might change after the time of writing this:

Download the latest SAPGUI

http://service.sap.com/SWCENTER-MAIN
- Ordering SAP Software
-- SAP Frontend
--- SAP Frontend GUI/ITS
---- SAP Frontend (GUI/ITS) 620 Comp.5

Download SAPGUI 610 Patches

http://service.sap.com/SWCENTER-MAIN
SAP R/3
..SAP R/3 4.6C
...Binary Patches
....SAP GUI FOR WINDOWS 6.10
.....Win32
-----GUI610.EXE

SAP Profile from 3.x to 4.x

Posted by Krishh Webworld | 8:39 AM | | 0 comments »

  • SAP_NEW - When you are upgrading from 3.x to 4.x, all the new transaction code are store in this profile. You have to do a mass insert of all the users with the new profile and slowly remove those unathorized transaction once the system start running.
  • PFCG - The new Authorization transaction.
Note : Research based on version 3.0f under Unix, Oracle data base and Windows.

Locking the whole SAP system

Posted by Krishh Webworld | 8:38 AM | | 1 comments »

Using the command tp locksys «SysID» only the user SAP* will be allowed to login. The command tp unlocksys «SysID» cancels the lock.

Connection between SAP R/3 and operating system
The command sapevt can be used to trigger an event from the operation system. Thus, a job previously defined within R/3 will be released.

SQL code help
Run the command oerr ora «error number» under user ora«SysID».

Oracle import and export explanations
Run the command imp help=yes under user ora«SysID». This format can also be used with exp, impst, and expst.

Before going live for your SAP Implementation

Posted by Krishh Webworld | 8:38 AM | | 1 comments »

It is highly advisable to increase the next extend´s size of some tables and their indexes even before initial loadings

FI BKPF, BSEG, BSIS, BSAD, BSAK, BSID and BSIK

CO COEJ, COEP, COKS, COSS and T811*

AM ANL*

MM MKPF, MSEG and BSIM

SD VBAP, VBAK, VBEP, VBPA, LIKP, LIPS, VBRK, VBRP, VBKD, VBUK, VBUP and VBSS

PP RESB and MDTB

Accross module
ATAB, TST03, TSP01, MCSI, KNVP, ACCTIT, COEP, APQD, RFBLG, CDCLS, SDBAD and from S000 to S999

Scheduling of system maintenance jobs

Posted by Krishh Webworld | 8:37 AM | | 0 comments »

RSBTCDEL Clean the old background job records

RSDBCREO Clean batch input session log

RSPO0041 Removing old spooling objects

RSSNAPDL Clean the old ABAP error dumps

SAPConnect: Email with Formatting

Posted by Krishh Webworld | 11:21 AM | , , , | 0 comments »

Sometimes, it is necessary to send emails with the Formatting when we are sending the email using SAPConnect.

Formatting is necessary to display proper information. For example, Information is formatted repesentation of the Data. If no formatting, no information. Same way, if we send the unformatted contents, than it will make wrong impression.

In ABAP also, using the SAPConnect function modules we can send the highly formatted contents in the Message body. For this purpose, we need to use HTML. HTML will represent our data in the formatted way on receipient side.

While filling up the Body of the message (CONTENTS_TXT), we fill it up with the HTML code. After filling up the content, we need to tell the system that we are sending the HTML data instead of the pure text. Generally, we specify the DOC_TYPE in PACKING_LIST as the TEXT. But for this purpose, we will pass HTML since our data is in HTML. Than we will pass all the information to the Function Module SO_NEW_DOCUMENT_ATT_SEND_API1.

Code Snippet to send the Email with Formatting:Email with Formatting code snippet
( I am not able to post the code in this blog because it contains the HTML tags and Blogger engine doesnot allow me to add it here).

This code snippet will generate the output:

Dynamic Internal Table

Posted by Krishh Webworld | 11:14 AM | | 1 comments »

Describes a way to create a dynamic internal table from coding. This is also can be used when RTTS is not supported or class CL_ALV_TABLE_CREATE is not available.


Previously, we have seen:
  • Dynamic Internal Table Creation using RTTS
  • Dynamic Internal Table with Deep structure using RTTS
  • Dynamic Internal Table creation using class CL_ALV_TABLE_CREATE


  • Recently, one of my friends asked me for the solution to create Internal Table. The problem was his system was not able to support the RTTS nor it has the class CL_ALV_TABLE_CREATE. Actually, I had developed this solution in early days when I was working on system 4.6B where I haven't RTTS nor the ALV class.

    Here is the solution:
    Code Snippet to Generate Dynamic ITAB
     
    *&---------------------------------------------------------------------*
    *& Report ZDYN_ITAB_OLD
    *&---------------------------------------------------------------------*
    *& Fill the Subroutine Pool source
    *& Generate Subroutine Pool
    *& Call the Sobroutine to create ITAB
    *&---------------------------------------------------------------------*
    *
    REPORT zdyn_itab_old.
    *
    DATA: dy_table TYPE REF TO data,
    dy_line TYPE REF TO data.
    *
    FIELD-SYMBOLS: TYPE STANDARD TABLE,
    .
    *
    FIELD-SYMBOLS: TYPE ANY.
    *
    * To generate the Dyanmic table with the COLOR
    DATA: ls_source TYPE string.
    DATA: lt_source LIKE STANDARD TABLE OF ls_source WITH HEADER LINE.
    *
    DATA: l_name LIKE sy-repid.
    DATA: l_message(240) TYPE c,
    l_line TYPE i,
    l_word(72) TYPE c.
    *
    DATA: l_form(30) TYPE c VALUE 'TABLE_CREATE'.
    *
    *.....................................................................
    START-OF-SELECTION.
    * Subroutine definition
    lt_source = 'REPORT ZTEST_SUBROUTINE_POOL.'.
    APPEND lt_source.
    * From Begin
    lt_source = 'FORM TABLE_CREATE USING I_FS TYPE ANY.'.
    APPEND lt_source.
    * Table definition begin
    lt_source = 'DATA: BEGIN OF LT_GENTAB OCCURS 0.'.
    APPEND lt_source.
    lt_source = 'DATA: BUKRS TYPE BUKRS. '.
    APPEND lt_source.
    lt_source = 'DATA: BKTXT TYPE BKTXT. '.
    APPEND lt_source.
    lt_source = 'DATA: END OF LT_GENTAB.'.
    APPEND lt_source.
    lt_source = 'DATA: POINTER TYPE REF TO DATA.'.
    APPEND lt_source.
    lt_source = 'CREATE DATA POINTER LIKE STANDARD TABLE OF LT_GENTAB.'.
    APPEND lt_source.
    lt_source = 'I_FS = POINTER.'.
    APPEND lt_source.
    * Form End
    lt_source = 'ENDFORM. '.
    APPEND lt_source.
    *
    * Subroutine Pool name
    l_name = 'ZTEST_SUBROUTINE_POOL'.
    *
    * Generate Subroutine
    CATCH SYSTEM-EXCEPTIONS generate_subpool_dir_full = 9.
    GENERATE SUBROUTINE POOL lt_source NAME l_name
    MESSAGE l_message LINE l_line WORD l_word."#EC CI_GENERATE
    ENDCATCH.
    * Error handling
    IF NOT l_message IS INITIAL.
    MESSAGE e000(0k) WITH l_message l_line l_word.
    ENDIF.
    *
    * data reference
    ASSIGN dy_table TO .
    * Call the subroutine
    PERFORM (l_form) IN PROGRAM (l_name) USING .
    * Get the reference of the data and assign to field symbol
    ASSIGN dy_table->* TO .
    *
    * Create dynamic work area and assign to FS
    CREATE DATA dy_line LIKE LINE OF .
    ASSIGN dy_line->* TO .
    *
    *

    Dynamic Background Colors in Smartforms

    Posted by Krishh Webworld | 11:10 AM | , , , | 0 comments »

    We were having some specific background colors in our output generated by the SMartforms. This background colors are coming properly in the print-out. But, when we try to send them as FAX, we are getting the BLACK background whereever we have that background color.

    I used Field-symbols to have an access of the table which stores the Smartforms definition. I replaced the background color with the White background.

    Code Snippet for Dynamic Background Color
    *&---------------------------------------------------------------------*
    * This code will clear the specific background for specific conditions
    *&---------------------------------------------------------------------*
    * In line type TYPE1 under the MAIN_TABLE, we have two columns.
    * Column 1 with RED background and border
    * Column 2 with no background color and BLUE border
    *
    *
    FIELD-SYMBOLS: TYPE tsftabdef. " Table - Actual SF definitions
    *
    DATA: l_tabdef TYPE ssftabdef, " Work Area for the Table
    t_ltypes TYPE tsfltype, " Table - Line types
    l_ltypes TYPE ssfltype, " Work Area for the table
    t_colinfo TYPE tsfcolinfo, " Table - Columns
    l_colinfo TYPE ssfcolinfo, " Work area for the table
    t_border TYPE tsfctaba, " Tables - Borders
    l_border TYPE ssfctaba. " Work Area for the border
    *
    *
    * Assign the table definition to the table field symbol
    * Assiging by '(Program)Tablename' will give as the actual table
    * which contains the defination of the Smartform. We will change
    * respective table background color.
    *
    ASSIGN ('(SAPLSTXBC)TABDEFS') TO .
    *
    * Table definition table
    LOOP AT INTO l_tabdef.
    *
    * Table line Types
    * Line type TYPE1 from the table MAIN_TABLE
    LOOP AT l_tabdef-tltype INTO l_ltypes.
    *
    * Coloum information
    * Column1 (cell) of the TYPE1
    LOOP AT l_ltypes-tcolinfo INTO l_colinfo.
    *
    * Borders
    * Background color and borders for that cell
    LOOP AT l_colinfo-borders INTO l_border.
    *
    * Clearing the color parameters for the cell
    CLEAR: l_border-intensity, " Intensity
    l_border-fillcolor-red, " Red
    l_border-fillcolor-used, " Color Used
    l_border-cfillcolor-color, " Red color in Hexa
    l_border-cfillcolor-xred. " Color used in Hexa
    *
    MODIFY l_colinfo-borders FROM l_border.
    ENDLOOP.
    *
    MODIFY l_ltypes-tcolinfo FROM l_colinfo.
    ENDLOOP.
    *
    MODIFY l_tabdef-tltype FROM l_ltypes.
    ENDLOOP.
    *
    MODIFY FROM l_tabdef.
    ENDLOOP.

    You can follow this link to have step-by-step explianation alongwith the Screenshots and SMartform XML file:
    Dynamic Background Colors in Smartforms

    This is one of my published WIKIes on SDN.

    Unconditional mode when importing or exporting a request/transport

    Posted by Krishh Webworld | 11:04 AM | | 0 comments »

    Run the command R3trans -u under user «SysID»adm.

    Reapplying hot packages

    If you accidently applied hot packages out of sequence for instance. Use the transaction SM31 to modify table PAT03. You have to choose the desired patch and click on delete entry.

    Main return codes of tp program

    0 Successfully done

    4 Warnings occurred

    8 Errors occurred

    12 Fatal errors occurred

    16 Internal errors occurred

    Meaning of info structures' first letter

    Posted by Krishh Webworld | 11:03 AM | | 0 comments »

    A Pricing

    B Output determination

    C Account determination

    D Material determination

    E Rebates

    F Index

    G Listing and Exclusion

    H Batch determination

    I Profile determination

    S Statistics

    X Statistics extra

    Shortcut keystroke to enter TODAYS DATE

    Posted by Krishh Webworld | 11:02 AM | | 0 comments »

    In the date fields press F4 then press F2

    It works in MOST date fields.

    ABAP Objects Design Patterns - Model View Controller MVC I

    Posted by Krishh Webworld | 3:16 PM | | 0 comments »

    Today we will discuss about the Design Pattern: Model-View-Controller, which is also very famous by its abbriviation MVC. By definition, MVC is to isolate the business logic from the User Interface which gives great degree of flexibility to change business logic independently to the user interface and vice versa.

    In MVC, User Interface acts as the View; Business logic acts as the Model and the link which provides the link between the View and Model is known as the Controller. In real time business, MVC is used anywhere, where users have a choice to select his or her view. For example, Windows Media Player, Gmail or Yahoo mail and so on. All these type of applicaiton provides us the option to select the skin as per our choice.

    Let's take an example: We have to develop one Sales report for our corporate intranet. This report must have the option to display the sales data in the classical report format; different charts - pie, bar, line or both - report & chart and it must be based on the User's choice. This type of requirements where we can easily separate the Business logic and the views are the best candidates for MVC.

    Generally, Model sends the data to controller and controller will pass that data to Views and views will display the data as per their nature. In SAP, our business logic(model) will not send data unless and untill View request for an data becase ABAP is event driven language. Like user has to run some transaction to get the data, means application view has to initiate the process and ask for the data from the Model. In this requesting process, Controller will help the view to be apart from the model.

    UML diagram of the typical MVC application would be:


    As we can see here, Model will send the data to the Controller and controller will pass that information to the View. Now, its a view's responsibility to create a user specific view - Report, or Chart.


    Advantages:
    Since both our business logic and view logic are different, we can easily change any of the logic without interepting the other part.

    ABAP Objects Design Patterns - Model View Controller MVC - II

    Posted by Krishh Webworld | 3:15 PM | | 0 comments »

    In this post, we will see how we can implement the MVC (Model-View-Controller) design pattern in ABAP using the Objects. If you have not read the previous discussion about MVC: ABAP Objects Design Patterns - Model View Controller (MVC) Part 1, than I strongly recommond to read that before moving forward.

    To implement the MVC, we will create two applications - One will generate an output in ALV and other will generate an output Smartforms. We will put our business logic in the MODEL class. We will create one CONTROL class to establish control between Model and Views.

    The UML diagram for any of the application would be like:


    Our business logic for this example is fairly simple - select the Sales Orders from the VBAK which were created in last ten days. The public method GET_DATA in the class ZCL_MODEL will act as the business logic. Additionally, this class has the public attribute T_VBAK which will be set by the GET_DATA and hold our data from the table.
    Model Method Definition


    Model Attribute definition


    Code Snippet of method GET_DATA
      
    * Parameters
    * Importing IR_ERDAT TYPE TPMY_R_DATE Ranges for date
    *
    METHOD get_data.
    *
    * Get data and save into attribute T_VBAK
    SELECT * FROM vbak
    INTO TABLE t_vbak
    WHERE erdat IN ir_erdat.
    *
    *
    ENDMETHOD.



    Our controller class ZCL_CONTROL will have a method GET_OBJECT which will give us an object of the model class. We require a public attribute which can refer to the object created in the method GET_OBJECT.
    Controller Method definition:


    Controller Attributes definition:


    Code Snippet for method GET_OBJECT
     
    * Parameters
    * Importing IF_NAME TYPE CHAR30 Model class name
    *
    METHOD get_object .
    *
    DATA: lo_object TYPE REF TO object.
    *
    * Generic object reference to importing class
    CREATE OBJECT lo_object TYPE (if_name).
    IF sy-subrc = 0.
    * Downcasting to assign generic object to O_MODEL
    o_model ?= lo_object.
    ENDIF.
    *
    ENDMETHOD.


    In the next post we will see, how we will use the controller class in our view and access the business logic encapsulated in Model class.

    ABAP Objects Design Patterns - Model View Controller MVC - III

    Posted by Krishh Webworld | 3:13 PM | | 0 comments »

    In this post, we will see how we can implement the Views which will access the Controller and model which is encapsulated in the controller. This post is in continuation of previous post: ABAP Objects Design Patterns - Model View Controller (MVC) Part 2.

    For our first Application view will be ALV output. To get the data for the ALV into the application, we will use the reference of the MODEL class created in the Controller. This way our model class is entrily separated by the view.

    Code Snippet for View 1 (ALV) of MVC design
     
    *&---------------------------------------------------------------------*
    *
    REPORT ztest_mvc_alv.
    *
    START-OF-SELECTION.
    *---------
    * Controller
    *---------
    DATA: lo_control TYPE REF TO zcl_control.
    *
    * Iniiate controller
    CREATE OBJECT lo_control.
    *
    * Get the object from Control
    CALL METHOD lo_control->get_object
    EXPORTING
    if_name = 'ZCL_MODEL'.
    *
    *---------
    * Model - Business Logic
    *---------
    * Date Range
    DATA: r_erdat TYPE RANGE OF vbak-erdat,
    la_erdat LIKE LINE OF r_erdat.
    *
    la_erdat-sign = 'I'.
    la_erdat-option = 'BT'.
    la_erdat-low = sy-datum - 10.
    la_erdat-high = sy-datum.
    APPEND la_erdat TO r_erdat.
    *
    * Get data method
    CALL METHOD lo_control->o_model->get_data
    EXPORTING
    ir_erdat = r_erdat.
    *
    *---------
    * View - ALV output
    *---------
    DATA: lo_alv TYPE REF TO cl_salv_table.
    *
    DATA: lx_msg TYPE REF TO cx_salv_msg.
    TRY.
    cl_salv_table=>factory(
    IMPORTING
    r_salv_table = lo_alv
    CHANGING
    t_table = lo_control->o_model->t_vbak ).
    CATCH cx_salv_msg INTO lx_msg.
    ENDTRY.
    *
    *
    * Displaying the ALV
    lo_alv->display( ).



    Our Second application is fairly simple once we have implemented the first application. In this application only part which differs is calling the Smartform.

    Code Snippet for View 1 (Smartforms) of MVC design
      
    *&---------------------------------------------------------------------*
    *
    REPORT ztest_mvc_view_2_ssf.
    *
    START-OF-SELECTION.
    *---------
    * Controller
    *---------
    DATA: lo_control TYPE REF TO zcl_control.
    *
    * Iniiate controller
    CREATE OBJECT lo_control.
    *
    * Get the object from Control
    CALL METHOD lo_control->get_object
    EXPORTING
    if_name = 'ZCL_MODEL'.
    *
    *---------
    * Model - Business Logic
    *---------
    * Date Range
    DATA: r_erdat TYPE RANGE OF vbak-erdat,
    la_erdat LIKE LINE OF r_erdat.
    *
    la_erdat-sign = 'I'.
    la_erdat-option = 'BT'.
    la_erdat-low = sy-datum - 10.
    la_erdat-high = sy-datum.
    APPEND la_erdat TO r_erdat.
    *
    * Get data method
    CALL METHOD lo_control->o_model->get_data
    EXPORTING
    ir_erdat = r_erdat.
    *
    *---------
    * View - Smartform Output
    *---------
    * Smartform FM
    DATA: l_form TYPE tdsfname VALUE 'ZTEST_MVC_VIEW_2',
    l_fm TYPE rs38l_fnam.
    *
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = l_form
    IMPORTING
    fm_name = l_fm
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3.
    *
    * calling Smartform FM
    DATA: ls_control TYPE ssfctrlop. " Controlling info
    DATA: ls_composer TYPE ssfcompop. " Output info
    *
    CALL FUNCTION l_fm
    EXPORTING
    control_parameters = ls_control
    output_options = ls_composer
    user_settings = ' '
    t_vbak = lo_control->o_model->t_vbak
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.




    Let's say, in future we enhanced the business logic model class and now we want to implement for the business. In this case, we just have to change the object reference created in the Controller and we are good to go. Obviously, we have to take care of the newly created methods or methods which parameters are enhanced.

    Helpful ABAP reports

    Posted by Krishh Webworld | 3:07 PM | | 0 comments »

    RSCLTCOP Copy tables across clients

    RSAVGL00 Table adjustment across clients

    RSINCL00 Extended program list

    RSBDCSUB Release batch-input sessions automaticly

    RSTXSCRP Transport SAPscript files across systems

    RSORAREL Get the Oracle Release

    RGUGBR00 Substitution/Validation utility

    RSPARAM Display all instance parameters

    RSUSR003 Check the passwords of users SAP* and DDIC in all clients

    RSUSR006 List users last login

    Report command field formats

    Posted by Krishh Webworld | 3:07 PM | | 0 comments »

    %pri Print the current report

    %pc Download the current report

    %sc Call the find function

    p+ Go to the next page

    p- Go to the previous page

    p++ Go to the last page

    p-- Go to the first page

    Archives

    Subscribe Now: Feed Icon