Monday, July 6, 2015

Field Symbols

Moving field symbol value to variable
data f1(4) value ‘ABC’.
DATA: v_val TYPE char4 VALUE ‘XYZA’.
field-symbols <f>.
assign f1 to <f>.
write <f>.
<f> = ‘ABD’.

ABAP Dynamic Tables

  •  Reading Dynamic Table
REPORT z_dynamic_read.

DATA: gt_itab TYPE REF TO data,
      ge_key_field1 TYPE char30,
      ge_key_field2 TYPE char30,
      ge_key_field3 TYPE char30,
      go_descr_ref TYPE REF TO cl_abap_tabledescr.

FIELD-SYMBOLS: <gt_itab> TYPE STANDARD TABLE,
               <gs_key_comp> TYPE abap_keydescr,
               <gs_result> TYPE ANY.

PARAMETERS: pa_table TYPE tabname16 DEFAULT 'SPFLI',
            pa_cond1 TYPE string DEFAULT sy-mandt,
            pa_cond2 TYPE string DEFAULT 'LH',
            pa_cond3 TYPE string DEFAULT '0123'.

START-OF-SELECTION.

* Create and populate internal table
  CREATE DATA gt_itab TYPE STANDARD TABLE OF (pa_table).
  ASSIGN gt_itab->* TO <gt_itab>.
  SELECT * FROM (pa_table) INTO TABLE <gt_itab>.

* Get the key components into the fields ge_key_field1, ...
  go_descr_ref ?= cl_abap_typedescr=>describe_by_data_ref( gt_itab ).
  LOOP AT go_descr_ref->key ASSIGNING <gs_key_comp>.
    CASE sy-tabix.
      WHEN 1.
        ge_key_field1 = <gs_key_comp>-name.
      WHEN 2.
        ge_key_field2 = <gs_key_comp>-name.
      WHEN 3.
        ge_key_field3 = <gs_key_comp>-name.
    ENDCASE.
  ENDLOOP.

* Finally, perform the search
  READ TABLE <gt_itab> ASSIGNING <gs_result>
          WITH KEY (ge_key_field1) = pa_cond1
                   (ge_key_field2) = pa_cond2
                   (ge_key_field3) = pa_cond3.
  IF sy-subrc = 0.
    WRITE / 'Record found.'.
  ELSE.
    WRITE / 'No record found.'.
  ENDIF.
 
One note: When an internal table is created dynamically like in my program above, 
the table key isnot the key defined in the DDIC structure — instead, the default key 
for the standard table is used (i.e. all non-numeric fields). 

Getting Run Time

Use the GET RUN TIME FIELD statement to measure the relative runtime of program segments in microseconds. The syntax is as follows:
GET RUN TIME FIELD <f>.   <f> is a variable, which should be of type I.   
 And in order to calculate the relative runtime of  a program segment follow
GET RUN TIME FIELD F1.
Code segment for which runtime needs to be calculated.
GET RUN TIEM FIELD F2.
Difference of F2 and F1(F2-F1) gives the runtime of the code segment. This stmt is especially useful for performance tuning.

Japanese Currency

Here is my input to this issue. In SAP, amounts (data type CURR) are always stored with two decimals in the database. It does not matter how many decimals are actually allowed for that currency. Currencies like JPY, KRW, CLP, etc. do not have any decimals.
In those cases, SAP both on ECC and BW divides the amount for those currencies by the decimal factor maintained in TCURX table and multiplies by the same factor on the report.
For example, -30,000 will be stored as -30,000/100 (because the TCURX table has 0 decimal). For zero decimals, SAP divides by 100. If we are loading the flat file data from HFM, we should make sure that this division occurs. After the division, -30,000 will be stored as -300. In the BW report, -300 will be multiplied by 100 and shown as -30,000. This division and multiplication occurs for all the exception currencies maintained in TCURX.
If the above division is not happening, the report will multiply by 100 by default and that will be an overstated amount by a factor of 100.
For HFM, I am assuming it is a flat file load. There are specific settings for flat file as stated in OSS Note 1176399 for special currency loads to work correctly. May be we had correct settings and it was working correctly and those settings recently somehow got changed.

Using Hash Tables

DATA :int_target TYPE HASHED TABLE OF y_target
WITH UNIQUE KEY
COMPANYCODE
CCTXTLG
ACCOUNT
ATXTLG
ERPID
ICP
ICPTXTLG
TRANSCURR
DATASOU
LCURR,
wa_target TYPE y_target. * Moving values to Hash Table to use Collect.
LOOP AT it_target INTO ls_target CLEAR:wa_target.
MOVE-CORRESPONDING ls_target TO wa_target.
COLLECT wa_target INTO int_target.
CLEAR:ls_target,ls_source.
ENDLOOP.
Notes: When displaying data in the output of APD, for the (some)same fields the key figures need to be added and shown. So a Hash Table is used

Removing the -ve sign to the starting

var_csign TYPE /BIC/OITDATASOU .
CLEAR:var_csign.
var_csign = var_tranamt.
SEARCH var_csign FOR ‘-‘.
IF sy-subrc EQ 0 AND sy-fdpos NE 0.
SPLIT var_csign AT ‘-‘ INTO var_csign var_sign.
CONDENSE var_csign.
CONCATENATE ‘-‘ var_csign INTO var_csign.
ELSE.
CONDENSE var_csign.
ENDIF.
Notes: Change the datatype to CHAR

Removing unwanted characterstics

DATA: var_str(100) VALUE
‘QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-_’  ,
var_custpo TYPE /BIC/OIZCCUSTPO,
var_temp TYPE /BIC/OIZCCUSTPO,
var_len(3) TYPE c.
CLEAR: var_custpo,
var_len,
var_temp.
var_custpo = source_fields-/bic/zccustpo.
var_len = strlen( var_custpo ).
DO var_len TIMES.
SUBTRACT 1 FROM var_len.
IF var_str CS var_custpo+var_len(1).
CONCATENATE var_custpo+var_len(1) var_temp INTO var_temp.
ENDIF.
ENDDO.
RESULT = var_temp.
CONSTANTS: c_allowed(100) TYPE C value
‘ #{}[]!”%&”()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcd’ &
‘efghi’ &
‘jklmnopqrstuvwxyz ‘.
DATA : var_EANUPC TYPE /BI0/OIEANUPC,
var_len TYPE i,
var_error TYPE sy-subrc,
var_offset TYPE sy-index.
CLEAR: var_EANUPC.
var_EANUPC = SOURCE_FIELDS-EANUPC.
TRANSLATE var_EANUPC TO UPPER CASE.
CLEAR: var_error.
CALL FUNCTION ‘RSKC_CHAVL_CHECK’
EXPORTING
I_CHAVL                     = var_EANUPC
IMPORTING
E_ERR_SUBRC                 = var_error.
IF var_error NE 0.
CLEAR: var_len.
var_len = strlen( var_EANUPC ).
DO var_len TIMES.
CLEAR:var_offset.
var_offset = sy-index – 1.
IF var_EANUPC+var_offset(1) CO c_allowed.
ELSE.
var_EANUPC+var_offset(1) = ”.
ENDIF.
ENDDO.
ENDIF.
* result value of the routine
RESULT = var_EANUPC.

3.X Content

  • Enabling/Disabling 3.X content
we made the value of one of the filed blank in RSADMINC table Value of field RSAWBN_HIDE_FUNC = ‘X’ in the table rsadminc table we made the value blank for that field this will enable the 3.x functionality

APD


Performance
When error ‘ internal table storage’ Uncheck the “Process Data in Memory” in Performance Setting -GOTO

Zprograms

ZCOMPRESSION_PGM_TEST
This explain

ZBW_CHECK_UNMANAGED_PSA
This explain

CMOD Hash Table
This explain how to write code using HASH table , here in CMOD “

ZTRANSIT_LOAD_LOGS

ZTRANSIT_LOGS_DELETE

ZTRANSIT_LOGS_MAINTAIN

ZTRANSIT_CHECK_ELOG

ZTRANSIT_ELOG_DELETE

ZTRANSIT_ELOG_MAINTAIN

ZTRANSIT_VALUES_DELETE
The above are set of Table maintainance program

Z_NFILE_UPLOAD

ZTRANSIT_FILE_DOWNLOAD

ZTRANSIT_FILE_COPY

ZTRANSIT_FILE_DELETE

ZTRANSIT_FILE_MOVE

ZFILE_ARCHIVE_hp

ZFILE_MOVE_hp
This above are set of file manipulation program “

ZTRANSIT_HIER_IP
This program does two different functions. In the fisrt part, the program, gets data from the standard DSO, Filters the data based on the data from Metadata DSO. For the data btained, creates separate files on the application server for each hierarchy. The files are saved on the server with naming convention ---.csv. In the second part, all the files are read from the server and the infopackage runs each of the file, using the hieararchy name from the name of the file “ 

ZFILE_ARCHIVE_PC
This one does file manipulations like moving files from one folder to another, copying, renaming etc 

ZFILE_IP_SHEDULE
This program triggers the Infopackages from the program using flat files on the server “ 

DTP_Classes
This is used in the DTP routines, where a class is called multiple times using different parameters” 

Virtual_Characterstics
Usage of Virtual Characterstics 

ZBW_TVARVC_MAINTAIN 
Program to maintain TVARVC table entries “ 

ZAUM_INVALIDATE_TERMINATED_USERS
This program Invalidate users who got terminated. Based on ZAUM_DELETE_TERMINATED_USERS but invalidate users rather than deleting them. 

ZBW_OUTBOUND_DETAILS 
This report is used to provide information regarding & status of all Infospokes and OH 

ZSECUR00_CHECK USER 
This 

ZDATA_ACTIVETAB_UPLOAD 
This program reads the file from the the mentioned filepath on the selection screen and also take the table name from the selection screen. Then it uploads the data to the mentioned database table” 

Z_NFILE_DEL(Delete files from Server) 

Z_NFILE_UPLOAD 

Z_SAP_HIERARCHY_DOWNLOAD 

Z_UPLOAD_PSA

Standard Programs/Commands


RSAR_PSA_CLEANUP_DIRECTORY Clean PSA : Adjusts the PSA Tables
RSAN_PROCESS_EXECUTE APD standard Program : Variant would be APD name
 RSWATCH0 Access AL11
RSFUNCTIONBUILDER Access to SE37
RSIMPCURR Update Currency from ECC
RSIMPCUST  Currency Unit
RSDDTREX_INDEX_DELETE Delete BIA indexes
RSDDTREX_BIA_ACTIVATE_FILL Create BIA indexes
RSDG_TRFN_ACTIVATE Activate Transformations This will activate the DTPs also.
/SSA/BWT Process Chain Moniter
RmCEX_SETUP_ENTRIES Checking the dta in the set up tables

Standard Commands
 p_r_request->get_logsys( ) To get source system

FMs/BADI/User Exits

Function Modules/BAPIs

Descriptions

Reference

/SAPDMC/LSM_F4_SERVER_FILE Getting HELP for list of folders ZTRANSIT_HIER_IP..etc
ADDR_CONVERT_TIMESTAMP_TO_DATE Getting Date from Timestamp
ALINK_CALL_TRANSACTION USed to run to Tcodes when no access
ARCHIVFILE_SERVER_TO_SERVER Copy files from one Directory to another
BAPI_CURRENCY_CONV_TO_EXTERNAL Converting Currency to External format Once the FM in row 3 is used, this is used for getting the original values
BAPI_IPAK_CHANGE Infopackage change details
BAPI_IPAK_GETDETAIL Infopackage get details
BAPI_IPAK_START Trigger Infopackage
CCU_TIMESTAMP_DIFFERENCE Difference of two timestamps
CONVERSION_EXIT_ALPHA_INPUT Adding Leading zeroes depending on Dataelement F4 help ZDATA_ACTIVETAB_UPLOAD
DATE_CHECK_PLAUSIBILITY Validatting Date
DATE_TO_PERIOD_CONVERT Calender Day to Fiscal Period Pass date to i_date and fiscal variant (V3/K4.. depends on the company) to i_periv which gives fiscal period e_buper and fiscal year e_gjahr
DD_NAMETAB_TO_DDFIELDS List of fields in a database table
F4IF_INT_TABLE_VALUE_REQUEST Help for Selection Screen
GUI_UPLOAD Upload file from desktop/server to program ZDATA_ACTIVETAB_UPLOAD
KD_GET_FILENAME_ON_F4 Getting the file name in F4 help ZDATA_ACTIVETAB_UPLOAD
JOB_OPEN Opening a job ZEDW_BATCH_FF_EXTRACT_START
RSA1_SINGLE_OLTPSOURCE_GET Datasource Information
RSAOS_OLTPSOURCE_GET OLTP source details
RSAR_ODS_GET Get PSA details
RSAR_CURRENCY_CONVERT Getting currency converted to Input format Transformations : for example : JPY currency
RSAR_TRANSTRUCTURE_GET Getting the Structure of Transfer strucutres
RSATREE_PSA_DELETE_BATCH Delete PSA
RSC1_TRFC_QUEUE_WRITE Write to the BW Delta Q
RSDU_TABLE_TRUNCATE Delete data from Fact Table of Cube
RSKC_CHAVL_CHECK Valid Characters check / Maintain
RST_TOBJ_SHIFT Add/Subtract years from Fiscal Period
RSW_CURRENCY_TRANSLATION Currency translation from One Currency to anothere
SO_DOCUMENT_SEND_API1 Seding email with Documents
SCMS_DOWNLOAD Uploading the file to server ZTRANSIT_FILE_UPLOAD
SCMS_UPLOAD Download files (Used in conjunction with Call method 1) ZTRANSIT_FILE_UPLOAD
SLS_MISC_GET_LAST_DAY_OF_MONTH Last day of the month ZFX_FILE_CHANGE
SXPG_CALL_SYSTEM ZEDW_BATCH_FF_TRANSMIT
TIME_CHECK_PLAUSIBILITY Validating Time
TMP_GUI_DIRECTORY_LIST_FILES Count of files in a folder on Presentation Server
UJD_ADD_MONTH_TO_DATE Add/Subtract Months from date Dates
 

Methods

Descriptions

Reference

call method cl_gui_frontend_services=>directory_list_files Getting list of files from Desktop ZTRANSIT_FILE_UPLOAD
CALL METHOD cl_gui_frontend_services=>gui_download Downloading files to Desktop ZTRANSIT_FILE_DOWNLOAD
 

BADI

Descriptions

Reference

RSAR_CONNECTOR Badi for Custom formula
RSR_OLAP_BADI Virtual Characteristics and Key Figures in Rep
RSU5_SAPI_BADI Custom enhancements for data and hierarchy data
RSROA_VARIABLES_EXIT_BADI New BADI for Query variables
 

User Exits

Descriptions

Reference

EXIT_SAPMRSRU_001 Virtual characteristic and key figure
EXIT_SAPLRRS0_001 Global variables in reporting
EXIT_SAPLRSAP_001 Transactional Data enhancements
EXIT_SAPLRSAP_002 Master Data ATTR enhancements
EXIT_SAPLRSAP_003 Master Data TEXT enhancements
EXIT_SAPLRSAP_004 Hierarchies enhancements

T-Codes

T-Codes Description T-Codes Description
FILE Logical File Path Definition
FIBF Business Event Transactions
LBWG Deletion of setup tables
NPRT Log for setup of statistical data
RSANWB APD Tcode
RSA1 Dataware house
RSA2 Display datasources
RSA3 Extract Checker
RSA5 Installing Data Source
RSA6 Activated Datasources
RSA7 BW Delta Queue
RSBBS Jump Queries
RSBO InfoSpoke
RSDS Datasource Repository (replicate ds)
RSECAUTH Maintain Authorizations
RSKC Maintainance of Permitted characters
RSPC Process Chain
RSPC1 Single Process Chain
RSRT Running the query
RSRV Analysis and Repair of BI Objects
SCC1 transfer individual transport requests directly out for the source client into the the current client
SE01 Transportation Organizer (Display Logs)
SE03 Transport Organization Tools
SE09 List of User Transports
SE11 Tables (Create, Display,Change)
SE12 Tables (Display)
SE13 Dictionary : Technical Settings
SE14 ABAP Dictionary : Database utility
SE16 Tables Maintainance
SE18 BADI Builders (C,D,C)
SE19 BADI Implementations
SE24 Class Builders
SE37 Function Modules
SE38 Report Programs
SE80 Module pool Program
SE91 Message Classes
SE93 T-Codes Creation
SM12 Lock Objects
SM13 Queue
SM37 Backgound Jobs
SM50 Back Ground Processess
SM51 SAP Server information
SM69 External Commands Maintainance
SO01 Inbox
SU53 User Authorizations
TBE01 Library of the Publish&Subscribe Business Transaction Event
TBE24 Customer Products
TRFCQOUT tRFC Queue Description (Outbound Queue)

BW Tables

BW Tables

Tables

Description

AGR_USERS Assignment of roles to users
BTCUEV User event IDs for background processing
DD03M Table fields with data elements, text, and domains
E070 Change & Transport System: Header of Requests/Tasks
E07T Change & Transport System: Short Texts for Requests/Tasks
ROOSFIELD DataSource Fields
RSAABAP ABAP routine - source code
RSADMINC Customizing Table General BW
RSANT_PROCESSI Analysis Process TLOGO Index ( APD DSO relation )
RSBKDTP BW: Data Transfer Process Header Data
RSBKREQUEST DTP Request
RSDCHABAS InfoObject details : Basic characteristics (for chars, time-chars and units)
RSDODSO All details of the DSO
RSECVAL Authorization Value Status
RSHIEDIRT Hierarchy Catalog
RSHIEDIRT Hierarchy directory texts
RSICCONT Monitor: Saving of the updated IC and ODS per request (Search the request in RSICCONT table and delete the entry from the table. Automatically your request will be deleted from DSO)
RSISOSMAP Mapping Between InfoSources and OLTP Sources
RSLDPIO Log.data packet: No.
RSLDPSEL Selection table for fields scheduler
RSOLTPSOURCE Transfer structure table
RSOSSEGMAP Mappings between infosouece and systems
RSPCCHAIN Process chain
RSPCVARIANT Generic Variant-Storage of Process Chains
RSREQDONE Monitor: Saving of the QM entries (infopak details)
RSRPARAMETRIZA Parametrization for a query, workbook, webapplication, pla
RSTSODSREQUEST Request directory ODS; which request is in which ODS
RSTRAN Information on Transformations
RSUPDROUT Update rules - ABAP routine - check table
RSZELTDIR Directory of the reporting component elements ( Gives the relation between transport element and the query. Useful when a TR fails with multiple queries. Can look for the object failed over here to get the corresponding Query )
TADIR Directory of Repository Objects