Tuesday, July 19, 2016

Thursday, July 14, 2016

Table Maintainance

Tcodes
SE11 : Viewing Table
SE16 - Viewing Table Data
SM30 - Table Maintenance


Creating Maintenance View
Go to SE11 --> Utilities --> Table Maintenance Generator
It takes you to the below screen.

Technical Dialog Details
Enter 'Authorization Group' 'Function Group' and Package(gets added directly based on function group) .

Maintenance Screens
We can type how steps we need while creating entries. You can choose either One step or Two steps. check them individually and see which satisfies your needs better.

Assign the overview screen and single screen numbers. One step needs onyl Overview screen number.  You can use 'Find Scr. Number(s) from the top of the screen to check the previously used numbers and available ones.
Each Function group has its own screen number.

Dialog Data Transport Details
***Use the default.

Click on create and the table maintenance generator is created.
Go to SM30 and add entries.


Note
When creating the table, 'Delivery and Maintenance' should be 'Display/Maintenance Allowed'



Whenever you are adding a new field / removing field, Table Maintenance needs to be regenerated.
      


Common Warnings/Errors

  • SM30 gives error after moving transport to different system
    • When table maintenance is generated, it also creates 2 FMs under a function group and if the function group entries are moved, system doesn't allow us to maintain values.
  • View/table ZTEST_TABLE can only be displayed and maintained with restriction
    • When creating the table, 'Delivery and Maintenance' should be 'Display/Maintenance Allowed'

Transporting table entries ( when transport is not asked by default )

Go to SE09
Select you task and enter as follows
Program ID : R3TR
Object Type : TABU
Object Name : <Table name>
 

Click on (Object with Keys ) icon and it takes you to the screen with table entries

You can entry under table Keys. The main screen only gives the key field value to be entered. Internally, it collects the whole entry.


If you want to check the whole entry, click on table entries you can actually select the how you want to see the entries.

Once the entries are entered, you can see them all under the task. The table entries cannot be locked by the transport unlike programs and other other objects.



Wednesday, July 13, 2016

READ_TEXT

Short texts are different from texts. These are saved mostly at transaction data. As there are different types of texts for each document ( eg : purchasing document ), SAP saves them in encrypted form.

'READ_TEXT' Function module is used to read this data. For using the FM, we need to know certain details of the texts we want to read.

The details can be found in below tables.
STXH - STXD SAPscript text file header
STXL - STXD SAPscript text file lines - This table has data encrypted. So need to use the FM to read it.


They can also be found using Tcode
SE75 - SAP Script Settings
















Below is the information needed to run the FM

OBJECT :
Go to Tcode SE75 and run it for ' Text Objects and IDs'
In Object ID , look for the base table for the text you are looking for.
For eg : Purchasing EKKO, EKPO;
             Sales Order VBBK, VBBP

NAME
This is the Document number ( with or with out item ) you are considering.
For eg : I need Shipping Instructions for Sales Document. So the Sales Order number is the NAME

ID
Once you know the OBJECT name in SE75, double click on the object name and it should give you all the available texts with its IDs. Get the ID you are looking for.
Eg : 001, 002 etc.

LANGUAGE
Language you need the text in.

You can also check entries in table 'STXL'  for a given document number. You get all the text maintained for it with it codes. you can double check it against the Tcode IDs

Once the FM is executed, LINES table should give you the text maintained. It will come in either single or multiple lines depending on how the text is maintained.

*** Reading the collection text
CALL FUNCTION 'READ_TEXT'
  EXPORTING
*   CLIENT                        = SY-MANDT
    ID                                   = 'ST'
    LANGUAGE                 = 'E'
    NAME                           = lv_name
    OBJECT                        = 'TEXT'
*   ARCHIVE_HANDLE  = 0
*   LOCAL_CAT               = ' '
* IMPORTING
*   HEADER                      =
  TABLES
    LINES                            = lt_line
 EXCEPTIONS
   ID                                    = 1
   LANGUAGE                  = 2
   NAME                            = 3
   NOT_FOUND                = 4
   OBJECT                          = 5
   REFERENCE_CHECK               = 6
   WRONG_ACCESS_TO_ARCHIVE       = 7
   OTHERS                        = 8
          .

User Roles, Security, Profiles Etc


Roles : They are used to administer security features for various users in SAP.

Composite Roles : They are roles which have individual roles with in. Parent role is a composite roles and there are individual roles inside each composite role.

Standard Programs
IAM_API_TESTFRAME’ for dealing with user and corresponding roles
RSUSR002 : Gives details of users and roles

T-Code
SU01 : User Information
SUIM - User Information System

Tables
USH02            - Change history for logon data
AGR_AGRS   - Roles in Composite Roles
AGR_USERS - Assignment of roles to users

BAPIs
BAPI_USER_CREATE1
BAPI_USER_ACTGROUPS_ASSIGN



Reference Notes
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/668e6629-0701-0010-7ca0-994cb7dec5a3?overridelayout=true



Creating Users in SAP
BAPI_USER_CREATE1
The BAPI needs the following mandatory parameters.
*& Passing the mandatory parameters
*& LogON Data
CLEAR: lw_logondata.
lw_logondata-gltgv = sy-datum.    " User Valid From
lw_logondata-gltgb = '99991231'.  " User Valid To

*& Password
CLEAR: lw_password.
lw_password-bapipwd = 'Welcome123'.

*& Address Table
CLEAR: lw_address.
lw_address-lastname = <user lastname>.

REFRESH : lt_param[], lt_return[].

 CALL FUNCTION 'BAPI_USER_CREATE1'
   EXPORTING
     USERNAME     = <userid>
     LOGONDATA    = lw_logondata
     PASSWORD     = lw_password
     ADDRESS      = lw_address
  TABLES
    PARAMETER     = lt_param
    RETURN        = lt_return

Assign Roles
BAPI_USER_ACTGROUPS_ASSIGN
  CALL FUNCTION 'BAPI_USER_ACTGROUPS_ASSIGN'
    EXPORTING
      USERNAME             = <userid>
    TABLES
      ACTIVITYGROUPS       = lt_roles
      RETURN               = lt_return
            .

Delete Users
 CALL FUNCTION 'BAPI_USER_DELETE'
  EXPORTING
    USERNAME       = <userid>
  TABLES
    RETURN         = lt_return
          .

           .

IDocs and TRfc

Idocs  and TRfc


IDoc
Intermadiate Document
An IDoc (intermediate document) is a standard data structure for electronic data interchange (EDI).
IDocs are used for the data interchange between SAP systems as well as between an SAP system
and an external system. IDocs serve as the vehicle for data transfer in SAP’s Application Link
Enabling (ALE) system. The contents, structure, sender, receiver, and current status of the IDoc are
defined in the IDoc header.

Data extraction from an SAP R/3 source system to BW begins when BW sends a request in the form of a request IDoc.
The source system then extracts the data and sends it to the BW system.

REFER LINK

Transactional RFC (tRFC)
For each transaction running in the system, there will be LUWs generated. These can be seen in SM58.


Scenarios
Data not coming to BW - Request is in Yellow status
This might happen, when the TRfc are struck in the source system .

Take the IDoc number and go to Tcode - WE02 and display the Idoc to see if there are any errors.

Also, go to SM58 and run the tcode. It will give you list of TRfc present in the system. They can either be due to some errors or just hanging there as there are no processors to process them. You can execute these from here , so that they reach the destination.

Maintaining Languages
Tcode : WE03
In the infopackage, we can see the incoming and outgoing idoc numbers and if we run WE03, we can see the logs of the request.
In language infopackages, even though we cannot see the SPRAS selection, if we check the iDoc, we can see the languages being used in the filter