Thursday, January 22, 2009

Transporting Table Data

Method 1:
Display the entries that you need to transport in se11.YOu will find an option Table Entry-> Transport Entries in the menu.The changes to the structure are anyway captured in a transport request as and when you activate the change to the structure.
Method 2:
Delivery class
The delivery class controls the transport of table data when installingor upgrading, in a client copy and when transporting between customersystems. The delivery class is also used in the extended tablemaintenance.
There are the following delivery classes:
o A: Application table (master and transaction data).
o C: Customer table, data is maintained by the customer only.
o L: Table for storing temporary data.
o G: Customer table, SAP may insert new data records, but may notoverwrite or delete existing data records. The customer namespacemust be defined in table TRESC. (Use Report RDDKOR54 here).
o E: System table with its own namespaces for customer entries. Thecustomer namespace must be defined in table TRESC. (Use ReportRDDKOR54 here.)
S: System table, data changes have the same status as programchanges.
W: System table (e.g. table of the development environment) whosedata is transported with its own transport objects (e.g. R3TR PROG,R3TR TABL, etc.).
or during client copy
the data of client-specific tables is copied.
Classes C, G, E, S: The data records of the table are copied to thetarget client.
Classes W, L: The data records of the table are not copied to thetarget client.
Class A: Data records are only copied to the target client ifexplicitly requested (parameter option). Normally it does not makesense to transport such data, but is supported to permit you to copyan entire client environment.
or during installation, upgrade and language import
behavior differs here for client-specific and cross-client tables.
nt-specific tables
Classes A and C: Data is only imported into client 000. Existingdata records are overwritten.
Classes E, S and W: Data is imported into all clients. Existing datarecords are overwritten.
Class G: Existing data records are overwritten in client 000. In allother clients, new data records are inserted, but existing datarecords are not overwritten.
Class L: No data is imported.Cross-client tables
o Classes A, L and C: No data is imported.
o Classes E, S, and W: Data is imported. Exisitng data records withthe same key are overwritten.
o Classe G: Data records that do not exist are inserted, but existingdata records are not overwritten.
ehavior during transport between customer systems
Data records of tables of delivery class L are not imported into thetarget system. Data records of tables of delivery classes A, C, E, G, Sand W are imported into the target system (this is done for the targetclient specified in the transport for client-specific tables).
se of the delivery class in the extended table maintenance
The delivery class is also analyzed in the extended table maintenance(SM30). The maintenance interface generated for a table makes thefollowing checks:
o You cannot transport the entered data with the transport link of thegenerated maintenance interface for tables of delivery classes W andL.
o When you enter data, there is a check if this data violates thenamespace defined for the table in table TRESC. If the data violatesthe namespace, the input is rejected.
Method 3:
In se11->table maintainence ->check radio button standard recording routine .
Above procedure will ask for request and data can be transported to QA.
Method 4:
Go to SE10. Press F5. Enter your transport number. Put cursor on the Task(second number not the higher one). Click on the icon 'Display Object List'. Switch from display mode to change mode. Click on 'New Entries'. Enter R3TR, TABU, ZTABLENAME in the three columns.
In the menu, go to 'Extras-->Change Object Function'. Select the radiobutton for 'Entire table'. Save and exit.

Wednesday, January 21, 2009

Important Links

ABAP
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
MODULE POOL:
http://sample-code-abap.blogspot.com/2008/06/select-option-in-module-pool-creen.html
http://help-sap.blogspot.com/2008/11/select-options-in-module-pool-screen.html
Certification
http://www.soinfotech.com/sap_edu.html

Formatting SAPSCRIPT


Offset &symbol+offset&
Output Length &symbol(length)&
Omitting the Leading Sign &symbol(S)&
Leading Sign to the Left and Right &symbol(<)& , &symbol(>)&
Omitting Leading Zeros &symbol(Z)&
Space Compression &symbol(C)&
Number of Decimal Places &symbol(.N)&
Omitting the Separator for ‘Thousands’ &symbol(T)&
Specifying an Exponent for Floating Point Numbers &symbol(EN)&
Right-Justified Output &symbol(R)&
Fill Characters &symbol(F f )&
Suppressing Output of Initial Values &symbol(I)&
Ignoring Conversion Routines &symbol(K)&
Local Dates (Currently Only for Japan) &symbol(L)&
Changing the Value of a Counter
&SAPSCRIPT-COUNTER_x(+)& - Increase counter by 1

&SAPSCRIPT-COUNTER_x(-)& - Decrease counter by 1
Preceding and Subsequent Texts (Pre-Text / Post-Text) &'pre-text'symbol'post-text'&
Country-Dependent Formatting /: SET COUNTRY country_key
Date Mask /: SET DATE MASK = 'date_mask'
Time Mask /: SET TIME MASK = 'time_mask'

MM Document Flow


MM Process Flow

1. Purchase Requisition (ME51N)

Material requirement are identified either by the user, department or via material planning and control. For example a MRP Run in production planning or material falling short of reorder-point can automatically generate Purchase Requisition. At the same time PR can be created manually in the system.

2. Source Determination - RFQ (ME41)

Identify the possible source of supply based on the past order and existing long term purchase contract. Then create Request for Quotation, which can be then sent electronically to vendors.

3. Vendor Selection and Comparision of Quotation (ME49)

After receiving quotation system is capable to simulate pricing scenarios, allowing user to compare number of quotations and sent rejection letter automarically.

4. Purchase Order (ME21N)

Data from Quotation or Purchase Requisition can be adopted to create Purchase Orders. Purchase Order is then sent to Vendor to supply the goods.

5. Purchase Order Follow ups ME91, ME91F, ME92F

Reminder can be sent to vendors at predefined intervals.

6. Goods Receipts (MB01)

Goods were received.

7. Invoice Verification (MIRO)

Along with the goods vendor also submits Invoice, system verifies then invoice against the quantity received and PO data. The account payable clerk is notified.

Important Transactions in MM

MM01 Material Creation

Me51N Purchase Requisition

Me41 Request for Quotation

Me49 Comparision of Quotation

Me21N Purchase Order Creation

MIGO, MB01 Goods Receipt

MIRO Invoice Verification

MB1A Good IssueTables in MM

MARA Material General

MARC Material Plant Data

MAKT Material Description

MARD Material Storage Location Data

MAST Material BOM Link

MBEW Material Valuation

MKPF Material Document Header

MSEG Mateial Document Line Item

MVKE Mateial Sales Data

T023 Material Group

T024 Pruchase Organisation

EBAN Purchase Requisition

EBKN Account Assignment Purchase Requisition

EINA Purchasing Info Record - General Data

EINE Purchase Info Record - Purchase Organisation Data

EKKO Purchase Order Header Data

EKPO Purchase Order Line Item Data

EKKN Account Assignment Purchase Order

EKBE History Purchase Order

EKET Scheduling Agreement Purchase Order

EKAB Release Documentation

Friday, January 9, 2009

Printing Vertical Texts in Smartforms

If u want to print data in vertical format, just create one style , in that create paragraph format as left justfied 0 and right justified as windowlength-1.use this paragraph format for u r text.
OR
Have to create command within a window (window would be containingtexts which you want to print vertically).Within Command on General Attributes you will have to specify appropriateprint control one which is useful for your requirement.

Tuesday, January 6, 2009

Function Modules in ABAP

Function Module to execute unauthorized transactions
TRANSACTION_CALL_VIA_RFC
To execute some unauthorized transactions.
Function Modules for creating programs (Useful when you are generating programs)
RS_PROGRAM_CHECK_NAME - To check program names if you are generating them.
RS_CORR_INSERT - To insert the correction request in the repository.
REPS_OBJECT_ACTIVATE - To activate repository objects, for example - to activate a newly generated program.
RS_DELETE_PROGRAM - To delete the program.
RS_ACCESS_PERMISSION - To lock or unlock a program.
Function Modules related to Date and Time Calculations
CALCULATE_DATE - Calculates the future date based on the input .
DATE_TO_DAY - Returns the Day for the entered date.
DATE_COMPUTE_DAY - Returns weekday for a date
DATE_GET_WEEK - Returns week for a date
RP_CALC_DATE_IN_INTERVAL - Add days / months to a date
Function Modules related to (ALV) ADVANCED LIST VIEWER
REUSE_ALV_LIST_DISPLAY - ABAP List viewer (LIST DISPLAY)
REUSE_ALV_GRID_DISPLAY - ALV GridControl full screen
REUSE_ALV_FIELDCATALOG_MERGE - Create field catalog from dictionary structure or internal table
Function Module related to Change Tracking
CHANGEDOCUMENT_READ_HEADERS - Read and format change documents
DAY_ATTRIBUTES_GET - Returns attributes for a range of dates specified
MONTHS_BETWEEN_TWO_DATES - To get the number of months between the two dates.
END_OF_MONTH_DETERMINE_2 - Determines the End of a Month.
HR_HK_DIFF_BT_2_DATES - Find the difference between two dates in years, months and days. FIMA_DAYS_AND_MONTHS_AND_YEARS - Find the difference between two dates in years, months and days.
MONTH_NAMES_GET - Get the names of the month
WEEK_GET_FIRST_DAY - Get the first day of the week
HRGPBS_HESA_DATE_FORMAT - Format the date in dd/mm/yyyy format
SD_CALC_DURATION_FROM_DATETIME - Find the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE - Find the time difference between two date/time
HR_99S_INTERVAL_BETWEEN_DATES - Difference between two dates in days, weeks, months
LAST_DAY_OF_MONTHS - Returns the last day of the month
DATE_CHECK_PLAUSIBILITY - Check for the invalid date.
DATE_2D_TO_4D_CONVERSION - Year entry: 2-character to 4-character.
DAY_IN_WEEK - Input date and will give the name of the day 1-monday,2-Tuesday....
SD_DATETIME_DIFFERENCE - Give the difference in Days and Time for 2 dates
Function Modules Related To Formatting
CLOI_PUT_SIGN_IN_FRONT - Displays the negative sign in front of the numeral
RKD_WORD_WRAP - Wrap text into several lines
CONVERSION_EXIT_ALPHA_INPUT - Pad zeros to the number at the left
CONVERSION_EXIT_ALPHA_OUTPUT - Eliminate zeros to the number at the left
READ_EXCHANGE_RATE - Exchange Convertion
SPELL_AMOUNT - Transforms numeric values into text
Function Modules Related To Dialog Prompts
POPUP_TO_CONFIRM - Displays a popup dialog with a user defined message for confirmation POPUP_TO_GET_VALUE - Displays a popup dialog requesting a value for a particular table-fieldname SAPGUI_PROGRESS_INDICATOR - Displays a progress bar with text to denote the percentage of completion and status
FILENAME_GET - Displays a popup dialog to get the presentation server filename
F4_DATE - Displays a popup dialog to choose date
GUI_UPLOAD - Upload a file from the presentation server
GUI_DOWNLOAD - Download an Internal Table to the PC
POPUP_TO_SELECT_MONTH - Display a pop-up to select a month
GET_PRINT_PARAMETERS - Printer parameters
Function modules related to RFC communication
RFC_CONNECTION_CLOSE - Close a RFC connection
RFC_GET_SYSTEM_INFO - Give system's information of a remote system
Function modules related to reading/writing files
FILE_READ_AND_CONVERT_SAP_DATA - Uploads the file from either presentation or application server into an internal table
SUBST_GET_FILE_LIST - To get the list of files from Application Server.
ALSM_EXCEL_TO_INTERNAL_TABLE - Legacy Data Transfer w/ Excel
WS_FILE_DELETE - Delete files on UNIX server
PFL_COPY_OS_FILE - Copy UNIX files
EPS_GET_DIRECTORY_LISTING - Returns all files from a Server directory
Function Modules related to sending emails
SO_NEW_DOCUMENT_ATT_SEND_API1 - Sends emails with texts and attachments
SO_NEW_DOCUMENT_SEND_API1 - Sends emails with texts.
Function Modules related to F4 Help
F4IF_INT_TABLE_VALUE_REQUEST - F4 help also returning the value to be displayed in interal table

F4IF_FIELD_VALUE_REQUEST - F4 help for fields that are only known at runtime
Function Modules related to data maintenance
VIEW_MAINTENANCE_CALL - To maintain data from a table
Function Modules related to FI, CO and SD Modules
FOR_ALL_SKC1A - Account subtotal
VC_I_GET_CONFIGURATION - Sales Purchase details configuration
SD_PRINT_TERMS_OF_PAYMENT - Print terms for unique payment
SD_PRINT_TERMS_OF_PAYMENT_SPLI - Print terms for some parcels payment
J_1B_NF_DOCUMENT_READ - Read NF details
J_1B_NF_VALUE_DETERMINATION - Read values from NF returned combined with J_1B_NF_DOCUMENT_READ using.
Amount and Currency
CURRENCY_AMOUNT_SAP_TO_IDOC - Convert currency to IDOC format
CONVERT_TO_LOCAL_CURRENCY - Conversion of currency
CLOI_PUT_SIGN_IN_FRONT - Move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all character fields), not right justifed as numbers normally are.
CONVERT_TO_FOREIGN_CURRENCY - Convert local currency to foreign currency.
CONVERT_TO_LOCAL_CURRENCY - Convert from foreign currency to local currency
SPELL_AMOUNT - to get Amount in words
Holidays and Factory Calendar
Holiday_Get - Gives holidays for a country.

It has two flags Freeday(for weekends)and Holiday(for public holidays).
Function Module related to HR-ABAP
HR_MAINTAIN_MASTERDATA - This function module is used to maintain master data for employees and applicants.
HR_READ_INFOTYPE - This function module reads the data records of an HR infotype that exist for employees and applicants.
HR_INFOTYPE_OPERATION - This function module is used to maintain employees and applicants data.
CU_READ_RGDIR - This function module is used to read RGDIR of cluster CU.
PYXX_READ_PAYROLL_RESULT - This function module reads complete payroll result for all country versions, from file PCL2 cluster.
HR_GET_PAYROLL_RESULTS - This function module is used to fetch the payroll results for employees . HR_RELATION_MAINTAIN - This function module is to maintain the relation between employee and position.
BAPI_HRMASTER_SAVE_REPL_MULT - This function module is to create position or organizaion unit ect.
Function Module for Converting Amount into Words
HR_IN_CHG_INR_WRDS - Changes INR amount to words.
SPELL_AMOUNT - Spell Out Numbers/Amount into Words.

Monday, January 5, 2009

SPDD SPAU


In upgradiation project SPDD and SPAU Aare the main transactions.

Upgradiation project are like

1.Technical Upgrade

2.Functional Upgrade
In technical project process steps like

1.System preparation and stack level patch upgrade – Basis Team

2.SPDD Phase – ABAP and Functionals

3.Up gradation of the system – Basis Team

4.SPAU Phase – ABAP and Functionals

5.DBACOCKPIT for indexing – ABAP TEAM

6.Issue resolution and error tracking – ABAP and Functionals

7.Zprograms corrections – obsolete function modules and objects
In SPDD Phase

This transaction code SPDD is the core step in an upgrade project. The system compares all the dictionary objects – data elements, database tables and structures of the latest system (say ECC) with the previous or the old system (Say 4.6c). These all elements are present under two nodes – with modification assistant and without modification assistant. Objects present under with modification assistant have the modification assistant ‘ON’ and we can see the modification logs.The objects in green color as shown below are the objects processed already and the ones in blue are the ones which still need to be processed. Apart from the nodes – ‘With modification assistant ‘and ‘Without modification assistant ‘, there is one more node sometimes – ‘Deleted objects’. This node contains objects which are deleted in the newer version of SAP and this node is to be left as it is. The objects under ‘With modification assistant’ and ‘Without modification assistant’ are to be processed by the ABAP team. The ABAP team clicks on the objects one by one – it takes us to the corresponding object – data element, structure or database table in the SE11 transaction code where we need to do the version comparison of the object. Click on Utilities 􀃆 Versions 􀃆 Version Management. There it shows all the versions of the object. The topmost or the latest version is of the Latest SAP Version and the versions below are the previous or modified versions.Now, we need to compare the Latest SAP version with the previous versions. Click on the check boxes of the two versions to compare and then click on the ‘compare’ button. We have to choose two and only two versions in order to compare them. In the comparison, it shows the differences in the two versions. We can click the Delta Comparison to see the delta differences between the two versions of the object. Now, after seeing the comparison, the ABAPER has to decide whether he/she wants to keep the Latest SAP version (ECC) of the object. (Reset to Original) or he/she wants to keep the changes made or modifications made (Adapt Modification) in the previous system (4.6c). For Example say a table MARA is there in SPDD. When we click on it and go to the version comparison, suppose it shows that 2 new fields are added in the Latest SAP version (ECC), when compared to the older version (4.6c).The ABAPER has to analyze the pros and corns of this objects – If he/she resets the table to original in SPDD, the 2 new fields would be added in the table MARA. If he Adapts modification, whenever any transaction or any program tries to store or read any value from the two new fields, it might give a short dump. So in this case, it is better to go for ‘Reset to original’. Considering another example, if say a data element say PRODH1 was of length say char7 in the previous versions where it had been modified by the user from char5 to char7 by the user for their business requirement, and again in the Latest SAP version, its char5, then it is better to adopt modification since in some transactions the user might be storing char7 values instead of char5. So if we reset the object to original, it might give dumps whenever char7 length value gets stored in any field using PRODH1 data element.
In SPAU Phase

The SPAU transaction contains the objects – Programs, Reports, Screens, Messages, Notes, Function Modules etc. which have difference in the Latest SAP request and the previous ones. This SPAU phase can be done either just after SPDD or after the Up gradation of the system by the Basis team.The same way we need to compare the objects in ‘Version Management’ and decide weather to ‘Reset to Original’ or ‘Adapt Modification’. The ‘Adapt Modification is however slightly different for codes – Function modules, reports etc. In adapt modification, the SPAU gives us the empty space to write our code – by having a reference to the code in previous request, we can decide and write the code with some corrections when required. This is in the case of objects present in ‘Without Modification Assistant’. In case of ‘With modification Assistant’, it opens a the program code in grey mode and we can insert or delete or modify code by pressing corresponding buttons in a similar way we do to modify any SAP standard code by using the access key. The objects present in SPAU do not require any access key for a period of around 15-20 days after which SAP automatically locks those codes and after this locking, if we want to change or delete any code in SPAU objects, we would require an access key. So it is a good practice to finish the SPAU phase in 10-15 days time. In SPAU also, only one request is to be made for all objects as a best practice.

Thursday, January 1, 2009

Tables Related to BADI

SXS_ATTRT - BADI Definition list
V_EXT_ACT - Active implementations of an exit
V_EXT_ IMP - Implementation class for an interface+filter
V_EXT_M - BAdi’s with filters

How to use msword as text editor in sap scripts and smartforms

I18N –Internationalization --> MSWORD as Editor

Check the CheckBoxes

Developing a smartform... and I want to display the preview of the smartform automatically before i print without displaying the "print dialog box


For ONLY PREVIEW
ST_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

ST_CONTROL_PARAMETERS-PREVIEW = 'X'.
For PRINTING DIRECTLY
ST_CONTROL_PARAMETERS-PREVIEW = ' '.

ST_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

ST_OUTPUT_OPTIONS-TDIMMED = 'X'.

CALL FUNCTION v_fm_name

EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = st_control_parameters
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = st_output_options
USER_SETTINGS = 'X'
IMPORTING

DOCUMENT_OUTPUT_INFO = st_document_output_info

JOB_OUTPUT_INFO = st_job_output_info

JOB_OUTPUT_OPTIONS = st_job_output_options

TABLES

IS_LABELS = IS_LABELS

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

BADI that is linked to an SAP transaction code.

1. Execute transaction SE37 or SE80 and find function module 'SXV_GET_CLIF_BY_NAME'.
2. Insert a breakpoint in it.
3. Now go to the SAP transaction you want to find a BADI in.
4. When you execute it, it will stop at the above function module.
5. Look at the value of field EXIT_NAME.
6. This will provide you with the name of the BADI that is available in your SAP transaction code.

BADI that is linked to an SAP transaction code.

1. Execute transaction SE37 or SE80 and find function module 'SXV_GET_CLIF_BY_NAME'.
2. Insert a breakpoint in it.
3. Now go to the SAP transaction you want to find a BADI in.
4. When you execute it, it will stop at the above function module.
5. Look at the value of field EXIT_NAME.
6. This will provide you with the name of the BADI that is available in your SAP transaction code.

ALE Segment Reduction

* IDOC Reduction Maintenance (BD53)
---------------------------------
It is used to supress the unwanted segments while sending the Idoc.
1. BD53 IDOC reduction maintenance
- Enter reduction message type "ZMATMAS" and click on Create icon.
- Enter Message type reference "MATMAS".
- Enter the Description .
'*' represents Mandatory segments
'-' to supress these segments
- If we select the segments with (-) sign and click on "Select" icon it will convert into mandatory (with '+' sign).
- If we double click on the segment and then it will display the fields in the segment. Here also we can choose the fields and click on "Select" icon for converting them into Mandatory fields (with '+' sign).
2. WE82 Assign Message type to Idoc types
Message Type Basic type
----------------------------------
ZMATMAS MATMAS05
3. WE20 Partner Profile (OUtbound - Sender side)
- Message type : ZMATMAS
Port : ZRECVPORT
* Transfer IDOC immediately
Basic type : MATMAS05
- Save it WE20 Partner profile (Inbound - Receiver side)
- Message type : ZMATMAS
Process Code : MATM
- Save it
4. BD64 Distribution Model
- Model Sender Receiver
Message type : ZMATMAS
5. BD10 Send Material
- Material Message type : ZMATMAS
Logical System : RECVCLN810
6. WE02 IDOC List

ALE for MESSAGE CONTROL

II. Message Control (Output TYpes):

-----------------------------------
* ME10 - Process Code for Purchase Orders (ORDERS) ORDERS

- Message type for Purchase Order ORDERS05

- Basic Type
* SD10 - Process Code for Sales order confirmation (ORDRSP)

ORDRSP - Message type for Sales Order

ORDERS05 - Basic Type
* SD09 - Process Code for Invoice(INVOIC)

INVOIC - Message type for Invoice

INVOIC02 - Basic Type
* SD05 - Process Code for Shipping Notification (DESADV)

DESADV - Message type for Delivery

DELVRY03 - Basic TYpe
In SAPLID Server :

------------------
1. WE 81 Message type config (ORDRSP - Message type for Sales Order)

2. WE 30 Idoc type (ORDERS05 - Sales/Purchase Orders)

3. WE 82 - Adding Message type to Idoc type.

ORDRSP ---> ORDERS05

4. NACE Transaction.

- Select Application : V1 (Sales) and Click on 'Output types' icon

- Select Output type : BA00 and Click on 'Processing routines'.

- Processing routines :

- Medium : A

- Printprogram : RSNASTED

- FORM routine : ALE_PROCESSING

5. WE41 Outbound Process code

- Process Code : SD10

- Description : ORDRSP: Sales order confirmation

- Function Module : IDOC_OUTPUT_ORDRSP

* Select radio button 'Processing with ALE service'

* Select radio button 'Processing with function module version 3.0'
6. WE20 Partner Profile

Partner No : SAPLER

Par.Type : LS

Type : US

Agent : USER6

OUtbound Parameters :

Message type : ORDRSP

Receiver Port : Zbkpfport

* Transfer Idoc Immediately

Basic type : ORDERS05

7. BD64 MOdel View

- Select 'model view' and click on Create Model View.

- Technical Name : SALMODEL - Place the cursor on 'SALMODEL' and click on 'Add message type'.

- Model View : SALMODEL

- Sender : SAPLID

- Receiver : SAPLER

- Message type : ORDRSP

- Save it

- Environment --> Generate Partner Profile

- Edit --> Modelview --> Distribute

6. VA01 Create Sales Order

- Extras --> Output --> Header --> Edit

- Output type : BA00

Medium : Distribution (ALE)

- click on 'Futher data'.

Dispatch time : Send immediately (when saving the applicaiton)

- Save it

8. WE02 Idoc List

- Direction : 1

- Logical Message : DEBMAS

- Execute it

ALE for Change Pointers

Change Pointers:
-----------------
Change documents are working based on change document technique which tracks changes made to the key documents (Material Master, Customer Master, Vendor Master ..etc) in SAP.-Changes made to the keydocuments are recorded in the change document Header table i.e. CDHDR and Item table CDPOS, Additional change pointers are written in the BDCP and BDCPS tables. -Change pointers technique is used to initiate the outbound process automatically when master data is created or changed.-A standard program RBDMIDOC is sechuled to run on periodic basis to evaluate the change pointers for a message type and starts the ALE process for distributing the Masterdata to the appropriate destination. -'Object' is collection of fields of different database tables. T.code for creating an object is SCDO.
* Configuration for Change Pointers:
----------------------------------
1. BD61 Active change pointers generally
- Check the checkbox "Change pointers activated -generally"
- Save it
2. BD50 Active change pointers for Message Type
- Message Type Active
----------------------------
MATMAS check the check box
3. SCDO Change Document Objects
- Check whether the "MATERIAL" is available in the object list.
4. BD52 Maintain Table Views
- Enter the Message type "MATMAS" and press enter.
- OBJECT TABLE NAME FIELD NAME
----------------------------------------
Ex: MATERIAL MARA BISMT
5. BD60 Additional data for message types
- Message Type Function Module Table
---------------------------------------------------
Ex: MATMAS MASTERIDOC_CREATE_SMD_MATMAS MARA
6. WE20 Partner Profile
7. BD64 Distribution Model
8. Create a Material by using T.Code MM01
9. SE38 Run the program by passing Message type "MATMAS"
10. WE02 IDOC List

ALE for MASTER DATA

II. Master Data Transactions:
----------------------------
In SAPLID Server :
------------------
1. In the SALE transaction, - Application Link Enabling (ALE) --> Sending and Receiving Systems --> Logical Sysems --> Define Logical Systems - Click on 'New Entries' - Enter 'Logical System' & 'Name'.
-------------------------------------------------------
SAPLID Logical System for the server SAPLID
SAPLER Logical System for the server SAPLER
- Save it.
- Application Link Enabling (ALE) --> Sending and Receiving Systems --> Logical Sysems --> Assign Client to Logical
System.
- Client : 800 Sending system
City : Hyderabad
Logical System : SAPLID
Std Currency : INR
client role : Demo

- Application Link Enabling (ALE) --> Sending and Receiving Systems --> Systems in Network --> Define Target Systems for RFC calls.

- Select 'R/3 Connections' and click on 'Create' icon.
- RFC Destination : SAPLER
Connection type : 3
Descripiton : RFC for Destination Server SAPLER
Target host : SAPLER
System Number : 00
- Logon/Security
Language : EN
Client : 800
User : USER6
Password : ******
- Click on 'Test Connection'.
- Click on 'Remorte Logon'.
2. WE 81 Message type config (DEBMAS - Customer Master)
3. WE 30 Idoc type (DEBMAS06 - Customer Master data distribution)
4. WE 82 - Adding Message type to Idoc type. DEBMAS ---> DEBMAS06

==> Create Port in WE21 Transaction.
5. WE20 Partner Profile
Partner No : SAPLER
Par.Type : LS
Type : US
Agent : USER6
OUtbound Parameters :
Message type : DEBMAS
Receiver Port : Zbkpfport
* Transfer Idoc Immediately
Basic type : DEBMAS066.

BD64 MOdel View - Select 'model view' and click on Create Model View.
- Technical Name : CUSTMODEL
- Place the cursor on 'CUSTMODEL' and click on 'Add message type'.
- Model View : CUSTMODEL
- Sender : SAPLID
- Receiver : SAPLER
- Message type : DEBMAS
- Save it
- Environment --> Generate Partner Profile - Edit --> Modelview --> Distribute

7. XD01 Create Customer Master - Create Customer Number : 0000000001
8. BD12 Sending Customer Data
- Customer : 0000000001
- OUtput type : DEBMAS
- Logical System : SAPLER
- Execute it

9. WE02 Idoc List
- Direction : 1
- Logical Message : DEBMAS
- Execute it
In SAPLER Server:-----------------
1. In the SALE transaction,
- Application Link Enabling (ALE) --> Sending and Receiving Systems --> Logical Sysems --> Define Logical Systems - Click on 'New Entries'
- Enter 'Logical System' & 'Name'.
-------------------------------------------------------
SAPLER Logical System for the server SAPLER
SAPLID Logical System for the server SAPLID
- Save it.

- Application Link Enabling (ALE) --> Sending and Receiving Systems --> Logical Sysems --> Assign Client to Logical System.
- Client : 800 Sending system
City : DELHI
Logical System : SAPLER
Std Currency : DEM
client role : Demo

- Application Link Enabling (ALE) --> Sending and Receiving Systems --> Systems in Network --> Define Target Systems for RFC calls.
- Select 'R/3 Connections' and click on 'Create' icon.
- RFC Destination : SAPLID
Connection type : 3
Descripiton : RFC for Destination Server SAPLID
Target host : SAPLID
System Number : 00
- Logon/Security
Language : EN
Client : 800
User : USER6
Password : ******
- Click on 'Test Connection'.
- Click on 'Remorte Logon'.
2. WE42 Inbound Process Code
- DEBM : Process Code for DEBMAS
********************************
- Change Mode - Click on New Entries
- Process code : ZDEBM
- Description : Process code for DEBMAS
- Choose "Processing by function module"
- Save it
- Function Module : IDOC_INPUT_DEBITOR
- Maximum number of repeat : 0
- IDOC Packet :
- Object type : IDPKDEBMAS
- End event : MASSINPUTFINISHED
- IDoc : - Object type : IDOCDEBMAS
- Start event : INPUTERROROCCURRED
- End event : INPUTFINISHED
- Application object :
- Object type : kna1
- Save it
********************************
- CRE1 : Process Code for CREMAS
- MATM : Proces COde for Material
********************************
3. BD51 Characteristics of Inbound FUnction Module
- Function Module : IDOC_INPUT_DEBITOR
- Input : 1 (Individual Input)
- Save it
4. WE57 Assignment of Function Module to Log.
Message and IDOC Type
- FM name : IDOC_INPUT_DEBITOR
- Type : F - Basic
Type : DEBMAS06
- Message tyep : DEBMAS
- Direction : 2
5. WE20 Partner Profile
- Partner No : SAPLID
- Partner :
Type - LS
- Type : US
- Agent : User6
- Inbound Parameters
- Message type : DEBMAS
- Process Code : DEBM
- * Trigger Immediately
- Save it.
6. BD13
Get Customers
- Customer : 0000000001
- Message type : DEBMAS
7. WE02 Display Idoc
- Direction : 2
- Logical Message : DEBMAS
- Execute it

Downloading the Report With Includes in It

************************************************************************
*PROGRAM INFORMATION *
************************************************************************
*PROGRAM : ZPROGRAM_DOWNLOAD *
*TITLE : Download Program with includes to a folder in PC *
*PROGRAM FUNCTION: *
*This program is used to download any program with all its includes to *
* any location on PC selected by the use *
************************************************************************
REPORT zprogram_download.
DATA : itab TYPE TABLE OF string,
itab4 TYPE TABLE OF string,
g_string TYPE string,
g_c(7) TYPE c,
g_stokes TYPE stokes,
itab1 LIKE TABLE OF g_c,
itab2 TYPE TABLE OF stokes,
wa_itab2 LIKE LINE OF itab2,
g_tabix TYPE sy-tabix,
g_text TYPE repti,
itab3 TYPE TABLE OF sstmnt.
DATA: frontendslashseparator TYPE string.
DATA: slashseparatortouse TYPE string.
DATA: frontendopsystem TYPE string.
CONSTANTS: unix TYPE string VALUE 'UNIX'.
CONSTANTS: non_unix TYPE string VALUE 'not UNIX'.
TYPES : g_file TYPE rlgrap-filename.
*Program name to be dowloaded.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_prgnam TYPE progname DEFAULT 'ZUSEREXIT'.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
PARAMETERS: pfolder TYPE rlgrap-filename DEFAULT 'E:\ANIL'.
SELECTION-SCREEN: END OF BLOCK b2.
*INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_prgnam.
IF p_prgnam IS NOT INITIAL.
ENDIF.
*-----------------------------------------------------------------------
* Display a directory picker window
*-----------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfolder.
DATA: objfile TYPE REF TO cl_gui_frontend_services.
DATA: pickedfolder TYPE string.
DATA: initialfolder TYPE string.
DATA : i_dynpread TYPE TABLE OF dynpread,
wa_dynpread TYPE dynpread.
wa_dynpread-fieldname = 'PFOLDER'.
APPEND wa_dynpread TO i_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = i_dynpread
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc = 0.
READ TABLE i_dynpread INTO wa_dynpread WITH KEY fieldname = 'PFOLDER'.
IF sy-subrc EQ 0.
MOVE : wa_dynpread-fieldvalue TO initialfolder.
ENDIF.
ENDIF.
IF sy-batch IS INITIAL.
CREATE OBJECT objfile.
IF NOT pfolder IS INITIAL.
initialfolder = pfolder.
ELSE.
objfile->get_temp_directory( CHANGING temp_dir = initialfolder
EXCEPTIONS cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3 ).
ENDIF.
objfile->directory_browse( EXPORTING initial_folder = initialfolder
CHANGING selected_folder = pickedfolder
EXCEPTIONS cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3 ).
IF sy-subrc = 0.
pfolder = pickedfolder.
ELSE.
WRITE: / 'An error has occured picking a folder'.
ENDIF.
ENDIF.
INITIALIZATION.
* Determine the frontend operating system type.
IF sy-batch IS INITIAL.
PERFORM determinefrontendopsystem USING frontendslashseparator
frontendopsystem.
ENDIF.
g_c = 'INCLUDE'.
APPEND g_c TO itab1.
START-OF-SELECTION.
*Populate an internal table with the report name specified in the
*selection screen
READ REPORT p_prgnam INTO itab.
*If report exists.
IF itab IS NOT INITIAL.
*Use the system code for obtaining any include in the report.
SCAN ABAP-SOURCE itab TOKENS INTO itab2 STATEMENTS INTO itab3
KEYWORDS FROM itab1.
*Get the tokens if any.
IF itab2 IS NOT INITIAL.
APPEND LINES OF itab TO itab4.
REFRESH : itab.
LOOP AT itab2 INTO g_stokes.
*For downloading includes if any in the program.
IF g_stokes-str = 'INCLUDE'.
g_tabix = sy-tabix + 1.
CONTINUE.
ENDIF.
*Get the include names if any using read to itab2.
READ TABLE itab2 INTO wa_itab2 INDEX g_tabix.
IF sy-subrc EQ 0.
WRITE : wa_itab2-str TO g_text.
*Getting the include code into an internal table.
READ REPORT g_text INTO itab.
APPEND LINES OF itab TO itab4.
REFRESH : itab.
ENDIF.
ENDLOOP.
*download the file into a file on the pc.
PERFORM dowload_file USING itab4[]
pfolder.
*Printing the whole program on the screen.
LOOP AT itab4 INTO g_string.
WRITE : / g_string.
ENDLOOP.
ELSE.
*download the program to pc path.
PERFORM dowload_file USING itab[]
pfolder.
*Display the code on the screen.
LOOP AT itab INTO g_string.
WRITE : / g_string.
ENDLOOP.
ENDIF.
ELSE.
WRITE : / 'Program with that name doesnt exist'.
ENDIF.
*&---------------------------------------------------------------------*
*& Form dowload_file
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ITAB4[] text
* -->P_PFOLDER text
*----------------------------------------------------------------------*
FORM dowload_file USING p_itab4
p_pfolder.
DATA: objfile TYPE REF TO cl_gui_frontend_services.
DATA : filenamewithpath TYPE string.
CONCATENATE pfolder '\' p_prgnam INTO filenamewithpath.
CONDENSE filenamewithpath.
CREATE OBJECT objfile.
CALL METHOD objfile->gui_download
EXPORTING
filename = filenamewithpath
filetype = 'ASC'
* write_field_separator = writefieldseparator
* trunc_trailing_blanks = truncatetrailingblanks
CHANGING
data_tab = p_itab4
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
not_supported_by_gui = 22
error_no_gui = 23.
IF sy-subrc <> 0.
* PERFORM displaystatus USING statusmessage 3.
ENDIF.
ENDFORM. " dowload_file
*&---------------------------------------------------------------------*
*& Form determinefrontendopsystem
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FRONTENDSLASHSEPARATOR text
* -->P_FRONTENDOPSYSTEM text
*----------------------------------------------------------------------*
FORM determinefrontendopsystem USING separator
operatingsystem.
DATA: platformid TYPE i VALUE 0.
DATA: objfile TYPE REF TO cl_gui_frontend_services.
CREATE OBJECT objfile.
CALL METHOD objfile->get_platform
RECEIVING
platform = platformid
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3.
CASE platformid.
WHEN objfile->platform_windows95
OR objfile->platform_windows98
OR objfile->platform_nt351
OR objfile->platform_nt40
OR objfile->platform_nt50
OR objfile->platform_mac
OR objfile->platform_os2
OR 14. "XP
separator = '\'.
operatingsystem = non_unix.
WHEN OTHERS.
separator = '/'.
operatingsystem = unix.
ENDCASE.
ENDFORM. " determinefrontendopsystem

Generate a Passwoard for Report

*&---------------------------------------------------------------------*
*& Report ZGENERATEPASSWORD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZGENERATEPASSWORD.
* Data declaration
DATA : w_password TYPE char10, " Generated Password is stored here
w_pass_chars(80). " We provide the characters we desire
" in the password
CONCATENATE
'ABCDEFGHJKLMNPQRSTUVWXYZ'
'abcdefghijklmnopqrstuvwxyz'
'123456789@$%&/\()=+-#~ []{}'
INTO w_pass_chars.
* Function module which generates the password
CALL FUNCTION 'RSEC_GENERATE_PASSWORD'
EXPORTING
alphabet = w_pass_chars
alphabet_length = 0
force_init = ' '
output_length = 10
downwards_compatible = ' '
IMPORTING
output = w_password
EXCEPTIONS
some_error = 1.IF sy-subrc NE 0.
* Trigger some message, as required.
ENDIF.WRITE:/ 'The generated password is: ', w_password.

DONLOAD Programs in a Package


*&---------------------------------------------------------------------*
*& Report ZDOWNLOADPACKAGE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZDOWNLOADPACKAGE.
*&--------------------------------------------------------------------*
*& Program To Download All The Programs Present In A Package (Dev. Class) To Desktop
*&--------------------------------------------------------------------*
*REPORT z_downloadall_to_desktop.
***********************************************************************
* Table declaration *
***********************************************************************
TABLES: tadir.
***********************************************************************
* Data declaration *
***********************************************************************
TYPES: abapline(255) TYPE c.
TYPES: BEGIN OF ty_reposit,
pgmid TYPE tadir-pgmid,
object TYPE tadir-object,
obj_name TYPE tadir-obj_name,
devclass TYPE tadir-devclass,
END OF ty_reposit.
DATA: it_reposit TYPE STANDARD TABLE OF ty_reposit,
wa_reposit TYPE ty_reposit.
DATA: it_repsrc TYPE STANDARD TABLE OF abapline,
wa_repsrc TYPE abapline.
DATA: prog(60) TYPE c,
mc_filename TYPE rlgrap-filename,
filename TYPE string.
***********************************************************************
* Selection Screen *
***********************************************************************
PARAMETERS: p_dev TYPE tadir-devclass. "Package Name
*****Program Logic
SELECT pgmid
object
obj_name
devclass
FROM tadir
INTO TABLE it_reposit
WHERE pgmid = 'R3TR' AND
object = 'PROG' AND
devclass = p_dev.
IF sy-subrc NE 0.
MESSAGE s001(00) WITH 'No programs available in the given package'.
EXIT.
ENDIF.
LOOP AT it_reposit INTO wa_reposit.
prog = wa_reposit-obj_name.
READ REPORT prog INTO it_repsrc.
CONCATENATE 'C:\Documents and Settings\lgs100743\Desktop\My ABAP Programs\Report'
prog
'.txt'
INTO mc_filename.
filename = mc_filename.
*****Function module for download files into local system
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
TABLES
data_tab = it_repsrc
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
OTHERS = 22.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR prog.
CLEAR wa_repsrc.
ENDLOOP.
*****After download all the programs to intimate user.
MESSAGE s001(00) WITH 'Check your folder for the Programs downloaded'.

Supress Decimal Zeros

REPORT Z_SUPRESS_DECIMALZEROS.
PARAMETERS: XMENGE type p default '2.12000'.
data : LV_KPEIN(13) type C.
lv_kpein = XMENGE.
*--- Call function Module to reamove the Decimal

CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'

CHANGING

C_VALUE = LV_KPEIN.
write : lv_kpein.

Difference Between Functions and Procedures

Functions
1. Functions must return a value
2. Functions have the advantage of being able
to be imbedded in a larger statement.
3. If you wanted to get the value, you would typically use a Function.
4. Function wont support deffered name resolution.
5. function return type could be scalar or table or table values(SQL Server).
6. funtion returns only one value at a time.
7. We can call the functions in sql statements.
8. Function do not return the images,text
9. Functions are not.
10. we can select the fields from function. 11. functions are used for computations
Procedures
1. Procedures need not.
3. If you wanted to set a value you would likely use a procedure.
4. Supports deffered name resolution Example while writing a stored procedure that uses table named tabl1 and tabl2 etc..but actually not exists in database is allowed only in during creation but runtime throws error.
5.Stored procedure returns always integer value by default zero
6. Strore Procedure retuns more than one value at a time.
7. Cannot call.
8. Returns.
9. Stored Procedure is pre compiled execution plan.
10.We cannot select the fields from Procedure.
11. Procedures can be used for performing business logic.

Get the Month Name

REPORT ZMONTH.
DATA X_MONTH(11).
CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'

EXPORTING
INPUT = SY-DATUM
IMPORTING
OUTPUT = X_MONTH.
WRITE:/ 'Month in words', X_MONTH+3(8).
*-- End of Program

Spell Amount in Words

TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '1234510'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AM