Transparent Tables:
1. Contain a single table. Used to store master data
2. It has a one-to-one relationship with a table in the database
3. For each transparent table there is one associated table in the database
4. The database table has the same name, same number of fields and the fields have the same names
5. Single table can have one or more primary key
6. Secondary indexes can be created
7. They can be accessed using open and native SQL
8. USE: They are used to hold master data e.g. Table vendors or table of customers. Example of transaction
data is orders placed by customers
Pool Tables:
1. They are used to hold a large number of very small tables(stores customizing data or system data)
2. It has a many-to-one relationship with a table in the database
3. It is stored with other pooled tables in a single table called table pool in the database
4. The database table has different name, different number of fields and fields have different names
5. Table pools contain more tables than table clusters
6. Primary key of each table does not begin with same fields or fields
7. Secondary indexes cannot be created
8. They can be accessed using open SQL only
9. USE: They reduce the amount of database resources needed when many small tables have to be opened
at the same time
Cluster Tables:
1. They are used to hold data from a few number of large tables.(stores system data)
2. It has a many-to-one relationship with table in the database
3. Many cluster tables are stored in a single table in the database called a table cluster
4. The database table has different name, different number of fields and fields have different names
5. Contains less tables than table pools
6. Primary key of each table begins with same fields or fields
7. Secondary indexes cannot be created
8. They can be accessed using open SQL only
9. USE: They would be used when the tables have primary key in common and data in these tables are all
accesses simultaneously
Thursday, November 11, 2010
How to copy Idoc from one System to another system
- Below steps will be helpful to debug the production failure iodcs in your acceptance environment. Hope this may helpful for your issues with error Idocs data
Step 1: Go to transaction we19 and give the idoc number and ececute
Step 2: Click inbound file and remove the tick option from the start idoc inbound box.
provide the file name with directory ( Example, /local/data/interface/sample.txt )
IDoc number will be generate ..
Step 1: Go to transaction we19 and give the idoc number and ececute
Step 2: Click inbound file and remove the tick option from the start idoc inbound box.
provide the file name with directory ( Example, /local/data/interface/sample.txt )
Step 3: File will store in application server in AL11 transaction then download to that file using cg3y transaction code from production directory to your desktop and upload agian upload file to AL11 in acceptance environement directoty using cg3z transaction code.
Step 4: Now file placed under AL11, so just pass the file directory (/local/data/inteface/sample.txt) in WE19 towards radio button -- File as template.
SteP 5 : Choose the option, file as template and execute.
Step 6: You can see option to chose on the direction inbound or Outbound.
Step 6: You can see option to chose on the direction inbound or Outbound.
IDoc number will be generate ..
Wednesday, October 6, 2010
sample ALV Grid
TABLES : SFLIGHT.
TYPE-POOLS : SLIS.**INTERNAL TABLE DECLARTION
DATA : WA_SFLIGHT TYPE SFLIGHT,
IT_SFLIGHT TYPE TABLE OF SFLIGHT.**DATA DECLARTION
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID LIKE SY-REPID,
G_SAVE TYPE C VALUE 'X',
G_VARIANT TYPE DISVARIANT,
GX_VARIANT TYPE DISVARIANT,
G_EXIT TYPE C,
ISPFLI TYPE TABLE OF SPFLI.* To understand the importance of the following parameter, click here.
**SELECTION SCREEN DETAILS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002 .
PARAMETERS: VARIANT LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK B1.
**GETTING DEFAULT VARIANT
INITIALIZATION.
GX_VARIANT-REPORT = SY-REPID.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
VARIANT = GX_VARIANT-VARIANT.
ENDIF.**PERFORM DECLARATIONS
START-OF-SELECTION.
PERFORM DATA_RETRIVEL.
PERFORM BUILD_FIELDCATALOG.
PERFORM DISPLAY_ALV_REPORT.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM BUILD_FIELDCATALOG . FIELDCATALOG-FIELDNAME = 'CARRID'.
FIELDCATALOG-SELTEXT_M = 'Airline Code'.
FIELDCATALOG-COL_POS = 0.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'CONNID'.
FIELDCATALOG-SELTEXT_M = 'Flight Connection Number'.
FIELDCATALOG-COL_POS = 1.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG. FIELDCATALOG-FIELDNAME = 'FLDATE'.
FIELDCATALOG-SELTEXT_M = 'Flight date'.
FIELDCATALOG-COL_POS = 2.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG. FIELDCATALOG-FIELDNAME = 'PRICE'.
FIELDCATALOG-SELTEXT_M = 'Airfare'.
FIELDCATALOG-COL_POS = 3.
FIELDCATALOG-OUTPUTLEN = 20.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV_REPORT .
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = FIELDCATALOG[]
I_SAVE = 'X'
IS_VARIANT = G_VARIANT
TABLES
T_OUTTAB = IT_SFLIGHT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "DISPLAY_ALV_REPORT" DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*& Form DATA_RETRIVEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_RETRIVEL .
SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT.
ENDFORM. " DATA_RETRIVEL*-------------------------------------------------------------------*
* Form TOP-OF-PAGE *
*-------------------------------------------------------------------*
* ALV Report Header *
*-------------------------------------------------------------------*
FORM TOP-OF-PAGE.
*ALV Header declarations
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE WA_HEADER-INFO,
LD_LINES TYPE I,
LD_LINESC(10) TYPE C.* Title
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'SFLIGHT Table Report'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.* Date
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "top-of-page
TYPE-POOLS : SLIS.**INTERNAL TABLE DECLARTION
DATA : WA_SFLIGHT TYPE SFLIGHT,
IT_SFLIGHT TYPE TABLE OF SFLIGHT.**DATA DECLARTION
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID LIKE SY-REPID,
G_SAVE TYPE C VALUE 'X',
G_VARIANT TYPE DISVARIANT,
GX_VARIANT TYPE DISVARIANT,
G_EXIT TYPE C,
ISPFLI TYPE TABLE OF SPFLI.* To understand the importance of the following parameter, click here.
**SELECTION SCREEN DETAILS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002 .
PARAMETERS: VARIANT LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK B1.
**GETTING DEFAULT VARIANT
INITIALIZATION.
GX_VARIANT-REPORT = SY-REPID.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 0.
VARIANT = GX_VARIANT-VARIANT.
ENDIF.**PERFORM DECLARATIONS
START-OF-SELECTION.
PERFORM DATA_RETRIVEL.
PERFORM BUILD_FIELDCATALOG.
PERFORM DISPLAY_ALV_REPORT.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM BUILD_FIELDCATALOG . FIELDCATALOG-FIELDNAME = 'CARRID'.
FIELDCATALOG-SELTEXT_M = 'Airline Code'.
FIELDCATALOG-COL_POS = 0.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'CONNID'.
FIELDCATALOG-SELTEXT_M = 'Flight Connection Number'.
FIELDCATALOG-COL_POS = 1.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG. FIELDCATALOG-FIELDNAME = 'FLDATE'.
FIELDCATALOG-SELTEXT_M = 'Flight date'.
FIELDCATALOG-COL_POS = 2.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG. FIELDCATALOG-FIELDNAME = 'PRICE'.
FIELDCATALOG-SELTEXT_M = 'Airfare'.
FIELDCATALOG-COL_POS = 3.
FIELDCATALOG-OUTPUTLEN = 20.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV_REPORT .
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = FIELDCATALOG[]
I_SAVE = 'X'
IS_VARIANT = G_VARIANT
TABLES
T_OUTTAB = IT_SFLIGHT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "DISPLAY_ALV_REPORT" DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*& Form DATA_RETRIVEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_RETRIVEL .
SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT.
ENDFORM. " DATA_RETRIVEL*-------------------------------------------------------------------*
* Form TOP-OF-PAGE *
*-------------------------------------------------------------------*
* ALV Report Header *
*-------------------------------------------------------------------*
FORM TOP-OF-PAGE.
*ALV Header declarations
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE WA_HEADER-INFO,
LD_LINES TYPE I,
LD_LINESC(10) TYPE C.* Title
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'SFLIGHT Table Report'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.* Date
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO. "todays date
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "top-of-page
Friday, August 13, 2010
Edit table entries without coding or debugging
Below steps will explain how to change the table entries without debugging. Hope it will be useful for functionals.
Note: This tip will applies starting from release 4.7
1. Goto T-code SE16N
2. Provide the table name and press the enter
3. Now pass the &SAP_EDIT in command line and press enter - Now your debug session activated
4. Pass the value in the table selection, which you need to change the records
5. Expect primary key fields you can have the entries in change mode
6. When you change the entries, just press the save button
7. You can see updated entries in your tables. That's all
* But be aware of this SAP Note 1420281, If this note applied in your systesm then you can't perform the above activity . So we have to go with debugging option from SE11 and change entries.
Note: This tip will applies starting from release 4.7
1. Goto T-code SE16N
2. Provide the table name and press the enter
3. Now pass the &SAP_EDIT in command line and press enter - Now your debug session activated
4. Pass the value in the table selection, which you need to change the records
5. Expect primary key fields you can have the entries in change mode
6. When you change the entries, just press the save button
7. You can see updated entries in your tables. That's all
* But be aware of this SAP Note 1420281, If this note applied in your systesm then you can't perform the above activity . So we have to go with debugging option from SE11 and change entries.
Friday, June 25, 2010
Posting on Error message : Prebooking exists for personnel number
Perhaps you have faced this error when do the changes in PA records or OM integrations:
Scenario : While performing Employee cost center conversions by assiging to Postion/Org Units, I have faced the issue while doing the integrations from OM to PA
Reason:
This error is coming from the activation of switch PLOGI EVENB and PLOGI EVEGC. here is the functionality Setting the 'PLOGI EVENB' switch to 'X' enables you to move a person,position or organizational unit within an organizational structure, when these changes lead to a change in company code for the person(s) concerned.
The personnel numbers of the persons concerned are locked in PA. The only personnel action you can now carry out these personnel numbers is Organisational change. You must carryout this action before you can make further chagnes to the infotypes for the persons concerned .
Technically the lock what we are getting was caused by entry in the table T77INT.
Soluctions:
- Run the program RPLEVENT to create the actoin what it demands.
- To solve this problem, you should create a blank event reason for
personnel event '02'.
You can do in IMG -> Personnel Management -> Personnel Administration -
>Setting Up Procedures -> Actions -> Create Reasons for Personnel Actions
- Setting of PLOGI EVENB:
"Setting the 'PLOGI EVENB' switch to 'X' enables you to move a person, when position or organizational unit within an organizational structure, these changes lead to a change in company code for the person(s) concerned.
The personnel numbers of the person(s) concerned are locked in Personnel Administration. The only personnel action you can now carry out for these personnel numbers is "Organizational Change". You must carry out this action before you can make further changes to the infotypes for the person(s) concerned. Technically, the lock is caused by an entry in table T77INT.
Note that this switch only works when the 'PLOGI ORGA' switch is switched to 'X'."
Scenario : While performing Employee cost center conversions by assiging to Postion/Org Units, I have faced the issue while doing the integrations from OM to PA
Reason:
This error is coming from the activation of switch PLOGI EVENB and PLOGI EVEGC. here is the functionality Setting the 'PLOGI EVENB' switch to 'X' enables you to move a person,position or organizational unit within an organizational structure, when these changes lead to a change in company code for the person(s) concerned.
The personnel numbers of the persons concerned are locked in PA. The only personnel action you can now carry out these personnel numbers is Organisational change. You must carryout this action before you can make further chagnes to the infotypes for the persons concerned .
Technically the lock what we are getting was caused by entry in the table T77INT.
Soluctions:
- Run the program RPLEVENT to create the actoin what it demands.
- To solve this problem, you should create a blank event reason for
personnel event '02'.
You can do in IMG -> Personnel Management -> Personnel Administration -
>Setting Up Procedures -> Actions -> Create Reasons for Personnel Actions
- Setting of PLOGI EVENB:
"Setting the 'PLOGI EVENB' switch to 'X' enables you to move a person, when position or organizational unit within an organizational structure, these changes lead to a change in company code for the person(s) concerned.
The personnel numbers of the person(s) concerned are locked in Personnel Administration. The only personnel action you can now carry out for these personnel numbers is "Organizational Change". You must carry out this action before you can make further changes to the infotypes for the person(s) concerned. Technically, the lock is caused by an entry in table T77INT.
Note that this switch only works when the 'PLOGI ORGA' switch is switched to 'X'."
Saturday, June 19, 2010
Debugging a RF calls, Remotely - Article from Saptechnical
Scenario:
When I initially started working on Integration tools like Business Connector/.Net connectors/XI, I always wondered how to debug the process in the backend SAP R/3 system when I make a RFC call. Because when we call any SAP RFC function module from any integration tool, it will be processed on any available application server in the backend, where a user breakpoint can not be triggered to debug the ABAP code in the backend system. The situation becomes worst to the developers/testers when they want to test the scenarios like HTTP-XI-RFC, HTTP-XI-PROXY, and FTP-XI-RFC so on. But we have a simple solution to debug the ABAP code when we are working on Remote function calls.
PRE-REQUISITE:
The backend SAP system should be ECC 6.0 with latest patch updates.
It is assumed that user has developed a simple scenario HTTP-XI-PROXY/HTTP-XI-RFC or any similar scenario where XI makes a RFC or Proxy call to SAP R/3 system.
When developing the scenario, in the integration directory configuration, while creating the Receiver communication channel with RFC adapter or Proxy Adapter user has to use own SAP R/3 user id / password as authentication parameters with which user wants to login to the SAP system to debug the code. i.e the same user id has to use to login the sap system to set the break-point in the ABAP Code.
SOLUTION:
Log in to the sap system where RFC function module or Proxy class implemented.
Open the Function module/ Proxy class and set a break-point. It is not mandatory that break-point has to set only at the initial line of the code; user can set any where in the entire code, which will be executed on RFC call.
Execute the transaction code “SRDEBUG” (Note: this tcode is available only in latest ECC 6.0 system)
Click on the button Activate Debugging. A pop-up screen will be opened. Fill the User-ID with which break-point has been set. (The same user-id should be used as authentication data in the XI while creating RFC communication channel). Select the radio buttons “all Appl. Servers” and “External breakpoints already set”. Click on OK.
Saturday, June 12, 2010
How to D-bug a background job
It is very simple,
1. select active job in sm37.
2. type "jdbg" command in command field. .
3. Double click the job , it will go in debug mode.
OR
1. Go to sm50 .
2. place the cursor on active job.
3. goto program mode--> program--> Debugging.
1. select active job in sm37.
2. type "jdbg" command in command field. .
3. Double click the job , it will go in debug mode.
OR
1. Go to sm50 .
2. place the cursor on active job.
3. goto program mode--> program--> Debugging.
Demo Program for - Logical Database
REPORT ZChandeep_HR_prog_1
LINE-SIZE 200 .
****************************
*Database Table
****************************
TABLES: PERNR, " Pernr structure for Logical database
PA0001, " Actions
PA0002. " Personnel Info
****************************
*Infotypes
****************************
INFOTYPES: 0001, " Actions
0002. " personnel info
****************************
*Variable Declaration
****************************
DATA: FORM_NAM LIKE P0001-ENAME,
V_AGE(5) TYPE C, "variable for calculating age in days
V_CTR1 TYPE I VALUE 0, "counter
V_CTR2 TYPE I VALUE 0, "counter
VAR(5) TYPE C , " variable to store btrtl
VAR1(5) TYPE C . " variable to store werks
*****************************
*Internal Table Decalartion
*****************************
DATA: BEGIN OF I_TAB1 OCCURS 0,
WERKS LIKE PA0001-WERKS, "personnel area
BTRTL LIKE PA0001-BTRTL, "personnel sub area
PERNR LIKE PA0001-PERNR, "employee number
ENAME LIKE PA0001-ENAME, "employee name
BEGDA LIKE PA0002-BEGDA, "employee join date
PERSG LIKE PA0001-PERSG, "employee group
PERSK LIKE PA0001-PERSK, "employee sub-group
PLANS LIKE PA0001-PLANS, "position
GBDAT LIKE P0002-GBDAT, "date of birth
END OF I_TAB1.
******************************
*START-OF-SELECTION
******************************
START-OF-SELECTION .
GET PERNR .
RP-PROVIDE-FROM-LAST P0001 SPACE PN-BEGDA PN-ENDDA . " Macro for IFT-0001
RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA PN-ENDDA . " Macro for IFT-0002
**--> Populate internal table
MOVE P0001-WERKS TO I_TAB1-WERKS .
MOVE P0001-BTRTL TO I_TAB1-BTRTL .
MOVE P0001-PERNR TO I_TAB1-PERNR .
MOVE P0001-ENAME TO I_TAB1-ENAME .
MOVE P0002-BEGDA TO I_TAB1-BEGDA .
MOVE P0001-PERSG TO I_TAB1-PERSG .
MOVE P0001-PERSK TO I_TAB1-PERSK .
MOVE P0001-PLANS TO I_TAB1-PLANS .
MOVE P0002-GBDAT TO I_TAB1-GBDAT .
**--> Append data to internal table
APPEND I_TAB1 .
CLEAR I_TAB1 . " Clear header I_TAB1
******************************
*END-OF-SELECTION
******************************
END-OF-SELECTION.
*****sorting the internal table on Personnel Area & Personnel Sub-Area SORT I_TAB1 BY WERKS BTRTL. ****************************** *TOP_OF_PAGE ****************************** PERFORM TOP_OF_PAGE.
******************************
*Output Display
******************************
LOOP AT I_TAB1.
*for calculating the age in days
V_AGE = SY-DATUM - I_TAB1-GBDAT.
*control break on Personal Sub Area
AT NEW BTRTL .
IF SY-TABIX NE 1.
FORMAT COLOR COL_NORMAL ON.
WRITE:/5 'Total Number of Employees for personnel Sub-Area:',
VAR , 'is ',
V_CTR1.
CLEAR V_CTR1.
FORMAT COLOR OFF.
ENDIF.
ENDAT .
**Control Break on personnel Area
AT NEW WERKS.
IF SY-TABIX NE 1.
FORMAT COLOR COL_TOTAL ON.
WRITE:/5 'Total Number of Employees for Personal Area: ',
VAR1 ,'is ', V_CTR2. "color col_total.
CLEAR V_CTR2.
SKIP 1.
FORMAT COLOR OFF.
ENDIF.
ENDAT .
WRITE:/5 I_TAB1-PERNR, "personnel number
16 I_TAB1-ENAME, "emp name
47 I_TAB1-BEGDA, "join date
60 V_AGE, "age in days
74 I_TAB1-WERKS, "P area
84 I_TAB1-BTRTL, "P sub Area
94 I_TAB1-PERSG, "emp group
104 I_TAB1-PERSK, "emp sub group
114 I_TAB1-PLANS. "position
V_CTR1 = V_CTR1 + 1.
V_CTR2 = V_CTR2 + 1.
VAR = I_TAB1-BTRTL .
VAR1 = I_TAB1-WERKS .
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* Header Output
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE.
FORMAT COLOR COL_HEADING ON.
WRITE:/5 'Employee',
16 'Employee',
47 'Join Date',
62 'Age',
74 'Personal',
84 'Personal',
94 'Employee',
104 'Employee',
114 'Position ',
/5 'Number',
16 'Name',
60 '(In Days)',
74 'Area',
84 'Sub-Area',
94 'Group',
104 'Sub-Group'.
FORMAT COLOR OFF.
SKIP 1.
ENDFORM. " top_of_page
Following is the output:
How execute unathorised transactions?
Just user the below transaction in SE37 and pass the T-code what ever you want to execute.
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 for Amount and Currency
CURRENCY_AMOUNT_SAP_TO_IDOC | Convert currency to IDOC format |
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 |
CONVERT_AMOUNT_TO_CURRENCY | Convert an amount from a currency to another (exchange rate taken from database tables) |
CONVERT_CURRENCY_BY_RATE | Convert an amount from a currency to another, according to the passed exchange rate |
BAPI_CURRENCY_CONV_TO_EXTERNAL | Conversion of Currency Amounts into External Data Format |
BAPI_CURRENCY_CONV_TO_INTERNAL | Conversion of Currency Amounts into Internal Data Format |
CALCULATE_TAX_FROM_NET_AMOUNT | |
SPELL_AMOUNT | to get Amount in words |
HR_IN_CHG_INR_WRDS | Changes INR amount to words. |
How to send emails from SAP by using the Function Modules
Sending External email through SAP
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
Sample Program :
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING .
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-BUKRS,
END OF ITAB.
DATA: body_message LIKE soli OCCURS 5 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR BUKRS
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 5.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 10 SY-VLINE , ITAB-bukrs, 50
SY-VLINE.
ENDLOOP.
* Receivers
receiver_list-recextnam = 'Giridhar_External@gmail.com'. "-->
* EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
* General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
* Mail subject
w_object_hd_change-objdes = 'Message subject'.
* Mail body
APPEND 'Message content' TO message_content.
* Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
Sample Program :
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING .
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-BUKRS,
END OF ITAB.
DATA: body_message LIKE soli OCCURS 5 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR BUKRS
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 5.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 10 SY-VLINE , ITAB-bukrs, 50
SY-VLINE.
ENDLOOP.
* Receivers
receiver_list-recextnam = 'Giridhar_External@gmail.com'. "-->
* EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
* General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
* Mail subject
w_object_hd_change-objdes = 'Message subject'.
* Mail body
APPEND 'Message content' TO message_content.
* Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
Good article about common problem in ALV while running a program in background
Purpose: This document details about the common problem faced by many consultants: “Fatal Error - GUI cannot be reached” in ALV Grid Control.
SAP® has provided us with some demo programs on ALV. We would use one of them in our scenario. BCALV_GRID_DEMO is the demo program provided by SAP® for ALV Grid Control. When you execute the program in foreground, you get the similar following output:
When you schedule the same program in background, your job is cancelled due to an error. Screenshot of the same is shown below:
Reason:
ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error “Fatal Error - GUI cannot be reached”. This type of problem is common with all the programs that use the ALV grid control to display the output.
Solution:
Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control.
The docking container doesn’t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards.
Let us modify the standard program (by taking a copy of it) to enable it to execute it in background.
Following modifications have to be made:
· Define a docking container in the program
SAP® has provided us with some demo programs on ALV. We would use one of them in our scenario. BCALV_GRID_DEMO is the demo program provided by SAP® for ALV Grid Control. When you execute the program in foreground, you get the similar following output:
When you schedule the same program in background, your job is cancelled due to an error. Screenshot of the same is shown below:
Reason:
ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error “Fatal Error - GUI cannot be reached”. This type of problem is common with all the programs that use the ALV grid control to display the output.
Solution:
Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control.
The docking container doesn’t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards.
Let us modify the standard program (by taking a copy of it) to enable it to execute it in background.
Following modifications have to be made:
· Define a docking container in the program
- data: or_doc type ref to cl_gui_docking_container .
- if cl_gui_alv_grid=>offline( ) is initial.
create object or_custom_container
exporting container_name = c_container.
create object or_grid
exporting i_parent = or_custom_container.
else .
create object or_grid
exporting i_parent = or_doc .
- endif .
Useful Funciton modules for Amount and Currency
CURRENCY_AMOUNT_SAP_TO_IDOC | Convert currency to IDOC format |
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 |
CONVERT_AMOUNT_TO_CURRENCY | Convert an amount from a currency to another (exchange rate taken from database tables) |
CONVERT_CURRENCY_BY_RATE | Convert an amount from a currency to another, according to the passed exchange rate |
BAPI_CURRENCY_CONV_TO_EXTERNAL | Conversion of Currency Amounts into External Data Format |
BAPI_CURRENCY_CONV_TO_INTERNAL | Conversion of Currency Amounts into Internal Data Format |
CALCULATE_TAX_FROM_NET_AMOUNT | |
SPELL_AMOUNT | to get Amount in words |
HR_IN_CHG_INR_WRDS | Changes INR amount to words. |
Popup for dates, Holidays and Factory Calendar
F4_DATE | Displays a popup dialog to choose date |
POPUP_TO_SELECT_MONTH | Display a pop-up to select a month |
|
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 |
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 |
Friday, May 14, 2010
How to change the Text names in Standart screens or Standart fileds
Enhancing the text of a standard screen-field is very simple in ECC 6. This does not require any access key or exits,etc. The change can easily be achieved via t-code CMOD.
The following tutorial shows how this is done. Here let us try to change the label of field "Material" to "SAP Material".
1. This screenshot shows transaction "PO13".
2. Get the data element of the field Material using F1 -> Technical information
3. Go to transaction CMOD , Goto -> Text Enhancement -> Keywords -> Change
4. Give the language & Data Element. Press Enter
5. The following screen appears where you can change the text for the data element.
6. Let's change the medium field label. Press SAVE.
7. Give the transport request number .Press Enter.
8. The following message appears. The text is hence changed.
9. So all transactions where the medium label is displayed will now show " Evaluaction Status " instead of "Evaluation Status".
The following tutorial shows how this is done. Here let us try to change the label of field "Material" to "SAP Material".
1. This screenshot shows transaction "PO13".
2. Get the data element of the field Material using F1 -> Technical information
3. Go to transaction CMOD , Goto -> Text Enhancement -> Keywords -> Change
4. Give the language & Data Element. Press Enter
5. The following screen appears where you can change the text for the data element.
6. Let's change the medium field label. Press SAVE.
7. Give the transport request number .Press Enter.
8. The following message appears. The text is hence changed.
9. So all transactions where the medium label is displayed will now show " Evaluaction Status " instead of "Evaluation Status".
Monday, March 15, 2010
Steps for infotype creation
1) Go to Transaction PM01.
2) Enter the custom Infotype number which you want to create (Should be a 4 digit number, start with 9).
3) Select the 'Employee Infotype' radio button.
4) Select the 'PS Structure Infotype'.
5) Click on Create... A separate table maintenance window appears...
6) Create a PS structure with all the fields you want on the Infotype
7) Save and Activate the PS structure
8) Go back to the initial screen of PM01.
9) Click on 'All' push button. It takes a few moments.
10) Click on 'Technical Characteristics'. Infotype list screen appears
11) Click on 'Change'(pencil) button
12) Select your Infotype and click on 'Detail' (magnifying glass) button
13) Give 'T591A' as subtype table
14) Give 'T591S' as subtype txt tab
15) Give your subtype field as subtype field
16) Save and come back to PM01 initial screen
17) Click on 'Infotype Characteristics' ... Infotype list screen appears
18) Click on 'Change' (pencil) button
19) Click on 'New Entries'
20) Enter your Infotype number and short text
21) Here we have to set different Infotype Characteristics as per the requirement. (Better open another session with some standard Infotype's infotype characteristics screen and use as the reference to fill yours)
22) Save your entries.
23) Now the Infotype is created and ready to use.
24) If you want to change the layout of the Infotype as per your requirement...
25) In the PM01 initial screen...Select 'Screen' radio button and give 2000 as the screen name, then click on edit.
26) In the next screen.. Select 'Layout Editor' and click 'Change'.
27) Screen default layout appears...here you can design/modify the screen..change the attributes of the fields..etc.
28) Save and activate. (Don't forget to 'Activate at every level)
2) Enter the custom Infotype number which you want to create (Should be a 4 digit number, start with 9).
3) Select the 'Employee Infotype' radio button.
4) Select the 'PS Structure Infotype'.
5) Click on Create... A separate table maintenance window appears...
6) Create a PS structure with all the fields you want on the Infotype
7) Save and Activate the PS structure
8) Go back to the initial screen of PM01.
9) Click on 'All' push button. It takes a few moments.
10) Click on 'Technical Characteristics'. Infotype list screen appears
11) Click on 'Change'(pencil) button
12) Select your Infotype and click on 'Detail' (magnifying glass) button
13) Give 'T591A' as subtype table
14) Give 'T591S' as subtype txt tab
15) Give your subtype field as subtype field
16) Save and come back to PM01 initial screen
17) Click on 'Infotype Characteristics' ... Infotype list screen appears
18) Click on 'Change' (pencil) button
19) Click on 'New Entries'
20) Enter your Infotype number and short text
21) Here we have to set different Infotype Characteristics as per the requirement. (Better open another session with some standard Infotype's infotype characteristics screen and use as the reference to fill yours)
22) Save your entries.
23) Now the Infotype is created and ready to use.
24) If you want to change the layout of the Infotype as per your requirement...
25) In the PM01 initial screen...Select 'Screen' radio button and give 2000 as the screen name, then click on edit.
26) In the next screen.. Select 'Layout Editor' and click 'Change'.
27) Screen default layout appears...here you can design/modify the screen..change the attributes of the fields..etc.
28) Save and activate. (Don't forget to 'Activate at every level)
Tuesday, February 23, 2010
D-Bug a Popup by creating the SAP GUI Shortcut
This very simple and easy,
Just create the SAP GUI shortcut with below details and save it in your desk top. when ever you want to d-bug after popup then please drag this short and place on the popup. System will allow into d-bug mode.
Under Application ...
Type : System Command
Command : /H
Title : D-bugger ( your wish )
Just create the SAP GUI shortcut with below details and save it in your desk top. when ever you want to d-bug after popup then please drag this short and place on the popup. System will allow into d-bug mode.
Under Application ...
Type : System Command
Command : /H
Title : D-bugger ( your wish )
Wednesday, January 13, 2010
SPAU and SPDD
When you apply a package, a large number of objects are changed.
If you have applied any OSS notes to objects in your system, the hot package may overwrite these objects.
SPDD is used to identify dictionary objects
and
SPAU (repository objects), will identify any objects where the hot package is overwriting changes you have made through OSS notes.
You must check all objects identified in SPAU and decide whether you need to reapply the OSS note or reset the code to the original SAP Code.
If, for instance, you are applying hot package 34, SPAU identifies an object where you have applied an OSS note. You must check the OSSs note and see if SAP have fixed that note in a hot package.
If the OSS note has been fixed in hot package 34, then you should reset the object to its original source code. This means that there is no repair flag set against this object again and it is now SAP standard code.
If, however, the object is not fixed until hot package 38, or there is no fix available you have to reapply the OSS note, otherwise users will encounter the problems they had before the note was applied. You must transport all reapplied notes and Reset to SAP Standard objects after you apply your hot package to your QAS and PRD systems.
If you have applied any OSS notes to objects in your system, the hot package may overwrite these objects.
SPDD is used to identify dictionary objects
and
SPAU (repository objects), will identify any objects where the hot package is overwriting changes you have made through OSS notes.
You must check all objects identified in SPAU and decide whether you need to reapply the OSS note or reset the code to the original SAP Code.
If, for instance, you are applying hot package 34, SPAU identifies an object where you have applied an OSS note. You must check the OSSs note and see if SAP have fixed that note in a hot package.
If the OSS note has been fixed in hot package 34, then you should reset the object to its original source code. This means that there is no repair flag set against this object again and it is now SAP standard code.
If, however, the object is not fixed until hot package 38, or there is no fix available you have to reapply the OSS note, otherwise users will encounter the problems they had before the note was applied. You must transport all reapplied notes and Reset to SAP Standard objects after you apply your hot package to your QAS and PRD systems.
Subscribe to:
Posts (Atom)