SAP: HOW TO CHECK THE USER STATUS IN THE TABLE

Defined User Status details are stored in the Table: ENT5854. You can
see the number of status details for one status profile. These details
may differ from client to client. Also differs from one status profile
to another. Against each status(ENT5854-TXT04) you can see the
technical status(ENT5854-ESTAT) details. Here the technical status
(ENT5854-ESTAT) is the main reference to check details further.

In the Table: VICN01, for every RE-Contract (VICN01- RECNNR) you can
see the Object number (VICN01- RECNOBJNR).


Now, use the same object number in the Table: JEST in the Object
number (JEST- OBJNR) field and execute for the entries. Now you can
see multiple entries in the output. For one object number you can see
multiple entries.


To get the latest status relating to the object (JEST-OBJNR), check
the particular entry, which is with 'active' status (JEST-INACT) and
with the latest 'change number' (JEST-CHGNR).


This status check procedure is same even in case of Rental Object,
Internal Order, WBS Element, etc.,


Always user status starts with 'E0001'and system status starts with
'I0001'. Logic to check the status is also same i.e., active status
having the latest change number.

ABAP Development Standards concerning Security

You know the Secure Programming Guidelines but you want to do more?

Well, here are my top priority security recommendations for developing secure ABAP applications:

New database tables
 
1. Assign table authorization group
    Usually you create 3 table authorization groups per application:
    a) for customizing tables (<appl>C)
    b) for master data and transaction data or other application data (<appl>A)
    c) for system data (<appl>S)

You can use the report RDDPRCHK (or RDDTDDAT_BCE) to analyze the settings.
Use transaction SM30 for view V_BRG_54 to maintain authorization groups respective view V_DDAT_54 to maintain authorization group assignments.

Maintain authorization groups
http://help.sap.com/saphelp_nw70/helpdata/en/a7/5134d2407a11d1893b0000e8323c4f/frameset.htm
Maintain authorization group assignments
http://help.sap.com/saphelp_nw70/helpdata/en/a7/5134df407a11d1893b0000e8323c4f/frameset.htm

2. Set the maintenance flag, which controls SE16 am SM30, correctly

    Data Browser/Table View Maintenance
    http://help.sap.com/saphelp_nw70/helpdata/en/a6/03883acb00d768e10000000a114084/content.htm
3. Activate table logging for customizing table or create a change document object for master data.

    You can use the report RDDPRCHK (or RDDTDDAT_BCE) to analyze the settings.

    Check the settings of profile parameter rec/client and the tp parameter RECCLIENT, too.

Activate/Deactivate Table Change Logging 
http://help.sap.com/saphelp_nw70/helpdata/en/7e/c81ebb52c511d182c50000e829fbfe/frameset.htm 
Note 1916 Logging table changes in R/3 
https://service.sap.com/sap/support/notes/1916 
Note 84052 R3trans: Table logging
https://service.sap.com/sap/support/notes/84052  
4. Create specialized SM30 maintenance views instead of offering maintenance using SE16 and add additional authorization checks if required.

Create a Maintenance Dialog
http://help.sap.com/saphelp_nw70/helpdata/en/a1/e4521aa2f511d1a5630000e82deaaa/frameset.htm
Event 25: At the Start of the Maintenance Dialog
http://help.sap.com/saphelp_nw70/helpdata/en/c2/703037301f327ae10000009b38f839/frameset.htm 
 
New transactions
 
1. Assign authorization object with appropriate field values in the definition of the transaction using transaction SE93

Authorization Checks
http://help.sap.com/saphelp_nw70/Helpdata/en/52/67129f439b11d1896f0000e8322d00/frameset.htm
2. Enter authorization proposals using transaction SU24

Check Indicators
http://help.sap.com/saphelp_nw70/helpdata/en/52/671470439b11d1896f0000e8322d00/frameset.htm
3. If the transaction is a report transaction and you have decided that the authorization check for the transaction is important: Check the authorization again using function AUTHORITY_CHECK_TCODE within the code of the report.

New BAPI / RFC Function

  1. Ensure that application specific authorization checks are executed
  2. Put critical and non-critical RFC functions into separate function groups.

New Web UI

See Secure Programming Guide chapter "Secure User Interface"
http://help.sap.com/saphelp_nw70/helpdata/en/58/4d767ed850443c891ad27208789f56/frameset.htm

Critical ABAP statements

Have a close look at critical ABAP statements
 
 -  INSERT REPORT / GENERATE SUBROUTINE POOL
These statements allow to create arbitrary code. Avoid anything which would enable users to inject ABAP code.

INSERT REPORT
http://help.sap.com/abapdocu_70/en/ABAPINSERT_REPORT.htm
GENERATE SUBROUTINE POOL http://help.sap.com/abapdocu_70/en/ABAPGENERATE_SUBROUTINE_POOL.htm
-  CALL TRANSACTION
The statement CALL TRANSACTION does not check the authorization of the current user to execute the called transaction automatically. To do this, either the calling (preferred) or the called program must call function module AUTHORITY_CHECK_TCODE.

CALL TRANSACTION
http://help.sap.com/abapdocu_70/en/ABAPCALL_TRANSACTION.htm

Generic functionality

Avoid developing generic functionality which enables the user to choose any target table, file, report or transaction. Have a close look to these statements:

 - Generic access to tables to SELECT … FROM (variable)
    http://help.sap.com/abapdocu_70/en/ABAPFROM_CLAUSE.htm
 - Generic access to files using OPEN DATASET variable
    http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET.htm
 - Generic access to reports using SUBMIT (variable)
    http://help.sap.com/abapdocu_70/en/ABAPSUBMIT.htm
 - Generic access to transactions using CALL TRANSACTION variable
    http://help.sap.com/abapdocu_70/en/ABAPCALL_TRANSACTION.htm
 
source: sdn. sap. com
author: Frank Buchholz is security evangelist for securing SAP systems.

How to Log Changes in Plan Data Using DataStore Object

Overview

In many planning project it is not only necessary to create new plan data but also to keep track how this new data originated. Thus a mechanism is necessary that logs all changes done in the plan data – either when new data is created or existing data is changed. Usually the logging information contains information about the user who has done the changes and the date and time when these changes where performed. This paper gives an example how the new logging BAdI delivered with SAPNetWeaver 7.0 EHP1 (SP6) can be used to log information about these changes in a DataStore Object. As the example is very generic the contained coding can be easily adapted to a given customer scenario.
 
Full Story --> Click Here
 
source: sdn. sap. com
author: sap

ABAP Transaction Codes Related to Java Administration

Overview

In a productive landscape, an SAP J2EE server/ SAP Enterprise portal or any other application based on the JAVA engine is in constant interaction with a variety of backend R/3 servers, be it UME related, internet application components (IAC's) like ESS or MSS, TREX etc. This guide describes the main TCodes from the ABAP end that can be useful to assist troubleshooting in such cases where connection is made from the j2ee server to the R/3 server or vice versa.
 
Full Story --> Click Here
 
source: sdn. sap. com
author: hemanth kumar

Step by Step Procedure to Create Logical File Name and Logical File Path

Overview

Document decribes the step by step procedure to create Logical File Path and Logical File Name.
 
for full story click here
 
source: sdn. sap. com
Author: Jaimin Soni

How to Work with F4 Input Help Effectively in BEX

Overview

This document helps to overcome the challenges while using F4 help in variable inputs and choosing filter selections. It talks about the introduction to F4 help settings and how they affect input help in Bex analyzer, Web and portal.
 
for full story Click Here
 
Source: sdn. sap. com
Author: Sreekanth S

SAP : Using USER EXIT For FI SUBSTITUTION

Substitutions can be used for validating data at the time of entry in SAP system. This wiki can be used for creating custom user exits so that one can set his validations & conditions. User exits are user defined FORM routines that are used to calculate/replace values with in a substitution .I have shown demo for FI but same steps with some minor modifications can be used for other areas too.
What are substitutions?
Whenever a data is entered in a system, validations are invoked to check  its integrity .Once validations are done, one can substitute the entered value with some other value. This gives you the opportunity of having the system validate values that are to be substituted. A substitution value can be numeric or a string. The system first performs some validations and then substitutions.
Transactions used for substitutions are :                   
GGB1 :  Substitutions  maintenance.                                                                                                                                
OBBH :  Activation of FI substitutions.
Substitutions can be performed using three ways:
1.Constant values.
2.Field -Field assignment.
3.User exits.

Steps for creating user exits for substitutions....click here for fully story

Author: Rajneesh
Source: sdn. sap. com

Analyzing Problems Using ABAP Short Dumps: Part I

ABAP 'short dump' (German Kurzdump) is a misnomer. There is nothing 'short' about an ABAP dump. Should the ABAP AS no longer be able to execute a program - because of an unhandled or unhandleable exception, a resource or system problem, or an error in coding - it may document the problem with 20 or more pages of diagnostic information.
Very often, a short dump contains not only the exact diagnosis of the problem that occurred but also the solution, or at least important pointers toward the solution of the problem. But experience has shown that developers often don't even read dumps - not even the highly useful Error analysis - much less make use of the diagnostic resources that short dumps offer.
The lack of attention to short dumps is understandable but regrettable.
Understandable  because the report that your program is dumping in a customer system is about the worst news you can get. It's time to drop everything and switch to emergency mode. 
Regrettable, because often developers who don't take a good look at the short dump waste a lot of time thrashing around in the debugger, trying to understand what went wrong. Taking a good look at the short dump is usually a better use of your time. And then there are the situations in which the dump is the only diagnostic resource that you have - when the dump occurred in a production system and is too sensitive to repeat, when the dump occurred several hours after the background job started, and so on.
In this pair of weblogs, we will take a quick tour through the ABAP short dump as of NetWeaver Release 7.0 EHP1, pointing out important analytic aids that it offers and how to make the best use of them.
In the first weblog, we will just get ready to analyze a dump. The weblog looks at the ABAP dump lists and how to get the most out of them, as well as at a couple of related sources of information.
Click here for Full Story 
Author: Stephen Pfeiffer
Source: sdn. sap. com

Analyzing Problems Using ABAP Short Dumps: Part II

The first part of this weblog did not quite manage to open a short dump as of Release NW04s 7.0 EHP1 for display. Instead it reviewed ways to extract contextual information from the short dump lists and elsewhere.
In this second part of the web log we, in the words of W. C. Fields, grab the bull by the tail and face the issue.  In a short dump, you want to answer these primary questions:
  • What exactly happened?
  • Where did it happen?
  • How can the problem be corrected? 
We will look at the diagnostic information and aids that the short dump offers for answering these questions.
Read full story Click here
Author: Stephen Pfeiffer
Source: sdn. sap. com

SAP ABAP : Making CIN tab fields Obligatory

Making country version fields mandatory while creating the customer master data.
The aim was to make the country version fields like Pan Number, service tax registration number mandatory while creating the customer master data.
The challenge is, the user may not click the relevant tab (CIN tab) and hence the fields will not flow during run time or even they are not flown in any of the user exits. Assigning the CIN master data program SAPLJ1I_MASTER and CIN table J_1IMOCUST(memory area) to Field symbols ensuring the data pick during runtime. Also, assigning customer master data to field-symbols variable, ensuring the transaction is related to customer master data.
Read full story Click here
Author: Rama krishna S
Source: sdn. sap. com

Automatic Notification mail to basis for user locking - SAP

Introduction:
Users log in SAP R/3 system by providing userid and password. If they enter wrong userid or password an error message ''Name or password is incorrect(repeat logon)''appears in the taskbar prompting user to provide correct userid and password. The number of incorrect logon attempts is determined by value of profile parameters which are used to define password and logon rules.
The profile parameter  login/fails_to_user_lock defines the number of unsuccessful logon attempts before the system locks the user. By default, the lock applies until midnight. Default value: 12; permissible values: 1 -99. The basis team will set the value for this parameter.
The userid will be locked once the maximum number of incorrect logon attempts is exceeded. Normally user has to manually inform the basis user to unlock his userid. Here we will see how an automatic notification mail is sent to basis user once the userid gets locked.
Read full story Click here
Author: bharath padmanabhan
Source: sdn. sap. com

Finding and Implementing BADIs - SAP

This will touch very basics of BAdis and remove a few doubts, may be. If you are reading this document then I believe you already know that BAdi stands for Business Ad-ins and they are used for enhancement purpose. You might also know that their use is 'almost' same as User Exits.

First off a couple of major differences between BAdis and User Exits:

1. Object Oriented.
BAdis are implemented through ABAP Objects, classes, interfaces and all that Object Oriented stuff. User exits are plain simple normal traditional include programs.

2. Single Use Vs. Multiple Use
User Exits are called as single use in the sense that there is only one implementation of a certain user exit. Of course many users can use that User Exit, but activating or deactivating the user exit will affect all the code (which may be written by different programmers in same include program)
BAdis can be multiple use (implementations). Each Implementation having different logic, you can easily activate or deactivate your own Z implementation without affecting other implementations.

Now, how to Implement BAdi:

There are two tcodes involved, SE18 and SE19. 

Please note that we can do all activities in SE18, we do not need to go to SE19 if we are only implementing a new BAdi or changing some old implemented Z BAdi.

In SE18, we have all the BAdis and we can also define new BAdis. 
- This screen will show you two options, Enhancement Spots and BAdi name.
- Input the BAdi definition name in the box next to BAdi name, how to find this name is a different science altogether … we'll discuss that later in the discussion.
- Click on display. Do not click on create or change button on this screen, we will do it later.
- Here you can see the structure of BAdi, click on interface tab and make sure that this is the BAdi that you want to implement.
- Now, Important step, click on menu item "Implementation", you will see options for create, change, display etc. choose the one that you need, lets go with create.
- Enter the BAdi name starting with Z.
- Give short text description.
- Double click the method that you want to use, and place your code there.
- Save the implementation, activate it.
- Go back and activate again on that screen, this is the BAdi definition that you are activating. And you are done, you can put all of your code here, you will not see anybody else's code here as it happens in User Exits.
- Important observation is that there are two steps of activation, at definition level, which will activate or deactivate all implementations and one is at implementation level which will only activate/deactivate your BAdi definition only.

Find a BAdi.

For a programmer, simplest way to find a BADI is through using Function Module and Debugger: 
- Go to SE37 and display Function Module SXV_GET_CLIF_BY_NAME.
- Put a break point on any line. 
- Then open a new session and go to the tcode you are digging for BAdis and execute that.
- You will notice a lot of stops on that function module, each stop is for a BAdi call. 
- The parameter "name" of FM 'SXV_ADD_PREFIX' holds the BAdi name.

Data Load from SAP R/3 to BI - Automation

This post is meant about pulling data from R/3 System to BI System automatically from R/3 system without logging into the BI System with all the User Selections. 
The SAP ECC User can easily load this data and getthe status of the data load without logging into BI System. 
Scenario:::
Caution: This is just an example not real scenario. 
There is a company where the User wants to forecast the sales by viewing Actual sales. Then he post the data from ECC and load the data to BI where he can also send data to Application server through the open hub destination and then can check his data in SAP BPC (Business Planning and Consolidation) and after viewing this report if he wants to change the Forecast values he can do and load again as he wish.
I'll clearly explain this with an beautiful example provided with the ABAP program code.
Coming into the work, First, we have to create a Process chain on the BI side.
For example: Here i want to load data for a Cube from COPA datasource. So, i've created a Process chain from the Datasource toDSO and DSO to Cube. From here the Data is sent to BPC (to Application server) where the data is used for BPC through the Open Hub Destination. 
Hope this process chain creation is not a tough job for you guys, anyways for simple cut-off discussion to small, we can create the process chain the RSPC (T-code).
After the creation of the Process chain, you can create a T-code with ABAP Program where the program code is given below for your reference.
You can make your own changes as per your requirement.
ABAP PROGRAM::
Here our program is the ZTEST_BI, this program has to create on R/3 side.
I'll clearly explain how this program works.
1. We need to make a selection screen for the Process chain, User parameters(here i took, Controlling area, Costcenter, Cost element, Fiscal Year/Period, Version. You can give your own parameters)
2. In order to get the Process chain list we need to use this Function Module: 'RFC_GET_TABLE_ENTRIES' from the table 'RSPCCHAIN' from BI System,here we need to provide the BI system client.
3. In order to embed these Process chain list with 'F4' functionality we need to create a FORM with the function module ''F4IF_INT_TABLE_VALUE_REQUEST'.
4. The User values (Parameters) from the selection screen can be uploaded through a remote function module to BI system.The function module here is 'ZIP_SEL_FM'. This function module send the user selection values to BI generic table. The function module code is given below.
5. To create a generic table we need to use SM30(t-code).
The above are the functions done by Program. 
Here the Program name is "ZTEST_BI"
REPORT ZTEST_BI.
*Declaration of tables.
TABLES: bseg, mvop, coplnctrl, rspcchain, WRMA_EVALPER.

*declarations to get the list of process chain
DATA: BEGIN OF l_itab OCCURS 0,
         chain_id LIKE rspcchain-chain_id,
      END OF l_itab.

*declarations for the table to post to BI generic table.
DATA: BEGIN OF gt_itab OCCURS 0,
        client     LIKE sy-mandt,
        pchain   TYPE c length 25,
        fnam     TYPE c length 30,
        seq       TYPE n length 3,
        sign      TYPE c length 1,
        opt        TYPE c length 2,
        low        TYPE c length 45,
        high      TYPE c length 45,
      END OF gt_itab.

DATA:  pc_itab    LIKE rspcchain occurs 0,
       wa_pc_itab TYPE rspcchain.

DATA: e_logid   TYPE rspc_logid,
      e_t_log   TYPE rspc_s_msg occurs 0 with header line.

DATA: t_results   TYPE TABLE OF ddshretval,
      wa_results  TYPE ddshretval.


INITIALIZATION.
*To get the Process chain's.
  CALL FUNCTION 'RFC_GET_TABLE_ENTRIES' DESTINATION 'DBDCLNT100'
    EXPORTING
      table_name = 'RSPCCHAIN'
    TABLES
      entries    = pc_itab.
*selection screen when program executed.
  SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
  SELECT-OPTIONS   : chain_id FOR rspcchain-chain_id no-EXTENSION NO INTERVALS OBLIGATORY.
  SELECTION-SCREEN : END OF BLOCK b1.

  SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-002.
  SELECT-OPTIONS   :   kokrs     FOR   bseg-kokrs,
                       kostl     FOR   bseg-kostl,
                       kstar     FOR   bseg-kstar,
                       fiscper   FOR   WRMA_EVALPER-PERIOD,
                       versn     FOR   coplnctrl-versn.
  SELECTION-SCREEN : END OF BLOCK b2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR chain_id-low.
  PERFORM value_request.

*to get the list of Process chains
  LOOP AT pc_itab INTO wa_pc_itab
    WHERE chain_id+0(1) = 'F' AND objvers = 'A' AND type = 'TRIGGER'.
    APPEND wa_pc_itab TO l_itab.
  ENDLOOP.


*to get the user parameters to BI
START-OF-SELECTION.

*For the Controlling Area.
  gt_itab-client = sy-mandt.
  gt_itab-pchain = chain_id-low.
  gt_itab-fnam   = 'KOKRS'.
  gt_itab-seq    = '1'.
  gt_itab-sign   = kokrs-sign.
  gt_itab-opt    = kokrs-option.
  gt_itab-low    = kokrs-low.
  gt_itab-high   = kokrs-high.
  APPEND gt_itab.
  CLEAR  gt_itab.

*For the Cost Center.
  gt_itab-client = sy-mandt.
  gt_itab-pchain = chain_id-low.
  gt_itab-fnam   = 'KOSTL'.
  gt_itab-seq    = '2'.
  gt_itab-sign   = kostl-sign.
  gt_itab-opt    = kostl-option.
  gt_itab-low    = kostl-low.
  gt_itab-high   = kostl-high.
  APPEND gt_itab.
  CLEAR  gt_itab.
*For the Fiscal Year/Period
  gt_itab-client = sy-mandt.
  gt_itab-pchain = chain_id-low.
  gt_itab-fnam   = 'FISCPER'.
  gt_itab-seq    = '4'.
  gt_itab-sign   = fiscper-sign.
  gt_itab-opt    = fiscper-option.
  gt_itab-low    = fiscper-low.
  gt_itab-high   = fiscper-high.
  APPEND gt_itab.
  CLEAR  gt_itab.

*For the Version
  gt_itab-client = sy-mandt.
  gt_itab-pchain = chain_id-low.
  gt_itab-fnam   = 'VERSN'.
  gt_itab-seq    = '5'.
  gt_itab-sign   = versn-sign.
  gt_itab-opt    = versn-option.
  gt_itab-low    = versn-low.
  gt_itab-high   = versn-high.
  APPEND gt_itab.
  CLEAR  gt_itab.


  IF gt_itab[] IS NOT INITIAL.
    CALL FUNCTION 'ZIP_SEL_FM' DESTINATION 'DBDCLNT100'
      TABLES
        gt_itab = gt_itab.
  ENDIF.
*Start Process Chain if Updation is Okay.
  CALL FUNCTION 'RSPC_CHAIN_START' DESTINATION 'DBDCLNT100'
    EXPORTING
      i_chain = chain_id-low
    IMPORTING
      e_logid = e_logid.
  WRITE:/ e_logid, sy-subrc.




*To get the Process chain log.
  CALL FUNCTION 'RSPC_API_CHAIN_GET_LOG' DESTINATION 'DBDCLNT100'
    EXPORTING
      I_CHAIN = chain_id-low
      I_LOGID = e_logid
    TABLES
      E_T_LOG = E_T_LOG.
  SKIP.
  LOOP AT e_t_log.
    WRITE:/ sy-uline+1(107).
    WRITE:/ '|', E_T_LOG-MSGV1, '|',
                 E_T_LOG-MSGV4, '|'.
  ENDLOOP.
  WRITE:/ sy-uline+1(107).

*&---------------------------------------------------------------------*
*&      Form  VALUE_REQUEST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
*to get the Process chains with F4 functionality in the selection screen
FORM value_request .
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'RSPCCHAIN-CHAIN_ID'
      value_org       = 'S'
    TABLES
      value_tab       = l_itab
      return_tab      = t_results
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF t_results[] IS NOT INITIAL.
    READ TABLE t_results INTO wa_results INDEX 1.
    chain_id-low = wa_results-fieldval.
  ENDIF.
ENDFORM.                    " VALUE_REQUEST
 
We should Create a Remote Function module in order to save the user parameters in the BI System from R/3.
FM: ZIP_SEL_FM
FUNCTION ZIP_SEL_FM.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      GT_ITAB STRUCTURE  ZIP_SEL_TAB3
*"----------------------------------------------------------------------

  TABLES: zip_sel_tab3.            

  SELECT * FROM zip_sel_tab3.      

  ENDSELECT.                     

  MODIFY zip_sel_tab3 FROM TABLE gt_itab.

ENDFUNCTION. 
Here ZIP_SEL_TAB3 is the Generic Table which is created from SM30(T-code). The user selections from R/3 are updated to this table.
This table is also used for the DTP restrictions within the ProcessChains.
The example code for the DTP restrictions::
TABLES: ZIP_SEL_TAB3. (This is in the Global declarations)
The code mentioned below is for picking up the User selections from the Generic table to the DTP selections
 data: l_idx like sy-tabix.
  read table l_t_range with key
       fieldname = 'COSTCENTER'.
  l_idx = sy-tabix.
  data: l_DTP type RSBKDTPNM.
  data: l_CHAIN type RSPC_CHAIN.
  data: l_seltab type ZIP_SEL_TAB3.

  l_DTP = I_R_REQUEST->GET_DTP( ).
  SELECT single ACTUALCHAIN from RSBKDTPSTAT into l_chain
    where DTP = l_DTP.

  Select * from ZIP_SEL_TAB3 into l_seltab
          where RSPC_CHAIN = l_chain
          and   FNAM     = 'KOSTL'.

    l_t_range-fieldname = 'COSTCENTER'.
    l_t_range-SIGN = l_seltab-sign.
    l_t_range-OPTION = l_seltab-opt.
    l_t_range-LOW = l_seltab-LOW.
    l_t_range-HIGH = l_seltab-HIGH.
    if l_idx <> 0.
      modify l_t_range index l_idx.
    else.
      append l_t_range.
    endif.
  ENDSELECT.
  p_subrc = 0.  
Withall above steps and Programs we can achieve the Automation of the Data load from R/3 to BI.
Author: Ravi kanth
Source: sdn. sap. com

SAP ABAP: Date Calculations

As you might see in different ABAP forums people ask repeatedly for a function module doing some simple date calculation, e.g. end of month or weekday calculation. The first question, the rhetorical one - "why on earth they cannot search the SAP repository themselves" - definitely has no answer. We must assume that there is a kind of people whose mentality prevents them from trying to solve problems themselves; they always seek help from others in their everyday duties.
The other question is why at all one needs an FM for these particular calculations. Just think: ABAP has a special data type for dates, and it has built-in efficient date arithmetic, so why not to use it.  
For example, if you need to add a number of days to a date, you can use a simple ADD statement or arithmetic '+' operation, where one operand is of type d and the other is of type integer.
Another example is weekday calculation. Knowing that 01/01/1900 was Monday, you can always calculate a weekday by the simple statement:
CONSTANTS: c_known_monday TYPE d VALUE '19000101'. "It's Monday  weekday = ( given_Date - c_known_monday ) mod 7 + 1. 
The result will be the number of range from 1 to 7, where 1 is Monday and 7 is Sunday. This calculation will work also correctly for dates before 01/01/1900. You can use the result as a key for T246 SAP table, which stores weekday names in different languages.
A little harder is end-of-month calculation. By the way, you can find in SAP system repository several FMs calculating an end-of-month day, with more or less correct leap year calculation. However, the thing is that having built-in ABAP date arithmetic you hardly need an FM, and you don't need to calculate a leap year.
Suppose, you have a variable SOMEDATE with arbitrary date. First, we calculate the first day of a month (remember, internally date is represented in ABAP as YYYYMMDD):
SOMEDATE+6(2) = '01'.
Next, we have to find some date in the next month. Knowing the first day of the month, we can add, for example, 31 days to that day, and the result will obviously be in the next month boundaries:
ADD 31 TO SOMEDATE.
Next, let's again calculate the first day of the month (in this step this will be the next month):
SOMEDATE+6(2) = '01'.
Now as we have the first day of the next month we can just subtract 1 day, and the result will be our end-of-month day:
SUBTRACT 1 FROM SOMEDATE.
So, the calculation consists of just four statements:
SOMEDATE+6(2) = '01'. ADD 31 TO SOMEDATE. SOMEDATE+6(2) = '01'. SUBTRACT 1 FROM SOMEDATE. 
No IF's, no CASE's. The good idea is to encapsulate this code snippet into a parametric macro definition; no need for another function module as the cost of its call will be far beyond the payload.
Author: Sergey Korolev
Source: sdn. sap. com

SAP: You can hide the Check Box in selection screen of the ABAP Report

I usually wondered (and probably you too would) why would someone need to hide checkboxes on the selection-screen. If you don't need it, then just delete it. What's the big deal in it!.
But, after I got to do this recent assignment of handling certain changes to a report where I did not have the option of deleting the checkboxes from the selection-screen, the method of hiding them came in handy.
 The way to achieve this is really very simple (though it took hours out of my life to figure it out).
Usually we declare our checkboxes as shown below:
PARAMETERS: p_chkbx AS CHECKBOX.
Note that it is not allowed to include the formatting option NO-DISPLAY here. It throws an error message asking you to delete this formatting option.
So we definitely have to come up with a workaround.
Another very interesting way of declaring a checkbox is:
PARAMETERS: p_chkbx TYPE xfeld.
This too creates a checkbox on the selection screen; and it is very much possible to add our formatting option NO-DISPLAY here.
Just declare the checkbox as below to hide it.
PARAMETERS: p_chkbx TYPE xfeld NO-DISPLAY.
Simple. Isn't it?
Author: Dawood.S.Ghasletwala
Source: sdn. sap. com

Starting workflow from outlook mail

 The inspiration for this blog is a post which made me to think that is it possible to do some thing like, if a mail is sent to outlook along with a hyperlink, and as soon as the end user clicks on the hyperlink a workflow has to be started in the SAP system, irrespective what the workflow handles.
To make things clear, the scenario what I considered is, a mail will be sent to a set of employees in an organization, to know the opinion of the employee, based on this a workflow will be triggered, which will update a Z table by using Program Exit class.
The SAP itself has given us a way to handle this kind of cases by using START FORM, in the basic data of the workflow. The way in which, we define a start event, and when ever the event is raised and the workflow acts as the receiver, in the same way even the start form concept works. In order to use start form,
Read Full story here
Author: Pavan Bhamidipati
Source: sdn.sap.com

SAP ABAP : IDoc - How to Deal with Reprocessing?

What is the potential Error?
The potential error that might lead to reprocessing is data mapping / issues during transformation. Ex. In a package of say 1000 IDocs, if the field of an IDoc has wrong value which leads to  mapping error in PI.
Note: Issues with queues, target adapter etc are not considered here
How to reprocess an IDoc?
Continue here for full story
Author: Shabarish Vijayakumar
Source: sdn.sap.com

SAP ABAP: IDoc Status Codes

The following table describes outbound IDOC status codes
Outbound IDOCs
Code
Error
Event Severity
SAP Meaning
2YesErrorError passing data to port
3NoError if transaction SM58 indicates an RFC transmission errorData pass to port OK
4YesErrorControl information of EDI subsystem
5YesErrorTranslation
6NoHarmlessTranslation
7YesErrorSyntax check
8NoHarmlessSyntax check
9YesErrorInterchange handling
10NoHarmlessInterchange handling
11YesErrorDispatch
12, 13, 14NoHarmlessOK
15YesWarningInterchange acknowledgement negative
16NoHarmlessFunctional acknowledgement
17YesWarningFunctional acknowledgement negative
18NoHarmlessTriggering EDI subsystem
20YesErrorTriggering EDI subsystem
22NoHarmlessDispatch OK, acknowledgement still due
23YesErrorRetransmission
24NoHarmlessControl information of EDI subsystem
25YesWarningProcessing despite syntax error
26YesErrorSyntax check
27YesErrorALE error
29YesErrorError in ALE services
30NoHarmlessReady for dispatch (ALE)
31NoHarmlessIDOC is marked for deletion
33NoHarmlessOriginal of an IDOC which was edited
34YesErrorError in control record of IDOC
36YesErrorTimeout error; electronic signature not performed
37YesErrorIDOC added incorrectly
38NoHarmlessIDOC archived
39NoHarmlessReceive confirmed
40YesErrorApplication document not created in target system
41NoHarmlessApplication document created in target document
The following table describes the inbound IDOC status codes :
<><><>  <><><>  <><><> 
Inbound IDOCs
CodeErrorEvent SeveritySAP Meaning
51, 52YesErrorPosting error
53NoHarmlessPosting successful
54YesErrorError during formal application check
55NoHarmlessFormal application check
56YesErrorIDOC with error added
60YesErrorSyntax error
61YesWarningProcessing despite syntax error
62NoHarmlessIDOC passed to application
63YesErrorError passing IDOC to application
64NoHarmlessIDOC ready to be passed to application
65YesErrorALE error
68NoHarmlessIDOC is marked for deletion
70NoHarmlessOriginal of an IDOC which was edited
73NoHarmlessIDOC archived
source: www. publib .boulder .ibm .com