Archive

Posts Tagged ‘ABAP’

Finding Email address Customer and Vendor Master on SAP

November 8, 2007 8 comments

It’s not quite simple to find email address of Customer and Vendor Master on SAP. You need to activated SQL trace and change email on master to find where email address is stored. Here i share the result of tracing using SQL trace of email addess Customer and Vendor master.

For Customer :

select adr6-addrnumber (email) from table adr6 join table kna1 with key adr6-addrnumber = kna1-adrnr

For Vendor :

select adr6-addrnumber (email) from table adr6 join table lfa1 with key adr6-addrnumber = lfa1-adrnr

ABAP Version :

data : lv_email like adr6-addrnumber.

select addrnumber into lv_email from adr6 as a  inner join kna1 as b on a~addrnumber = b~adrnr.

SQL error “-904” occurred when accessing table “COSS”

August 6, 2007 1 comment

              While my ABAP source code trying to select the contain data of table “COSS” using Contain Pattern in once of condition, short dump with error “SQL error “-904” occurred when accessing table “COSS “” happen in my development client with no specific error analysis given from SAP short dump system. I thought that some SQL package is not properly working, thus I decide to delete the SQL package  and restart the machine, but error still happen.           

              I try to debug my program, and I found that ABAP SQL cannot accept more than 200 records data of contain pattern as selection criteria, my head is still in question…why…? what happen…?. And finally I split the data (Contain Pattern) in a hundred records, it’s mean that when accessing table “COSS” is only limited a hundred records of contain pattern as selection parameter, and it’s working.See the ABAP source code below :

sql-error2.jpg

Categories: TECHNICAL Tags: ,

Change the development class for a customer screen

August 6, 2007 1 comment

Here some tips to change development class for a customer screen :

1. Call Transaction SE03: “Workbench Organizer: Tools.”
2. Expand node: “Object directory.”
3. Choose “Change object directory entries of objects.”
4. Enter key fields R3TR FUGX and select line.
5. Enter (for example): XM02 as contents of the key field.
6. Start the selection.
7. Position your cursor on the selected entry: FUGX XM02.
8. Choose function: “Change object catalog entry.”
9. Change and save the development class.

SAP ABAB: Using the User Exit

August 4, 2007 13 comments

Find The User Exit

The Procedure to investigate the user exit used in the transaction:

1. Running the transaction (ex: ME21), fill in the data needed, and determine in which screen the user exit will be needed.
2. While on the screen of the transaction, drill down the “System>Status” and the screen will pop up then we can get the program name used in this screen (ex: SAPMM06E).
3. Then we open the “se38” transaction and we fill in the program name we got from the procedure No.2, choose “Attributes”, choose “Display”, get the “Dev. Class” of the program (ex: ME).
4. Go to the transaction “CMOD” > “Utilities” > “SAP Enhancement” > fill in the “Dev. Class” (according the procedure 3) > then “Execute”.
5. After procedure 4, the “list of the Exits” will show up (ex: M06E0005)
Example of List of Exits:

Exit name Short text
AMPL0001  User subscreen for additional data on AMPL                 
MM06E001  User exits for EDI inbound and outbound purchasing documents
MM06E003  Number range and document number                           
MM06E004  Control import data screens in purchase order              
MM06E005  Customer fields in purchasing document

6. Give the “Check” in the checkbox (ex: MM06E005) > “Display”.
7. After the procedure 6, there will be the “lists of the components in SAP Enhancement” of MM06E005.
8. In this case there are: “Function Module Exits”, and “Screen Areas”. Beside those also there are the “Function Codes” and “Includes”.

Example:
Function module ShortTxt
EXIT_SAPMM06E_006 Export Data to Customer Subscreen for Purchasing Document
EXIT_SAPMM06E_007 Export Data to Customer Subscreen for Purchasing Document
EXIT_SAPMM06E_008 Import Data from Customer Subscreen for Purchasing Document

Program Code Short text

“Empty”

Calling screen No. Area Called screen No. ShortTxt
SAPMM06E        0101 CUSTSCR1 SAPLXM06        0101 Subscreen: PO header
SAPMM06E        0111 CUSTSCR1 SAPLXM06        0111 Subscreen: PO item 
SAPMM06E        0201 CUSTSCR1 SAPLXM06        0201 Subscreen: agreement

INCLUDEs
CI_EKKODB

9. Things needed for the investigation (in terms to find the correct includes that will be useful for the enhancement) :
– Importing value contained in “Function Module Exits”.
– In the function module, there will be one or more than one include, and we can try by giving the “break-point” to be tested in every “includes” in every ‘Function Module Exits”.

Example:
Break-point.

FUNCTION EXIT_SAPMM06E_012.
*”——————————start———————————–
*”*”Lokale Schnittstelle:
*”  IMPORTING
*”     VALUE(I_EKKO) LIKE  EKKO STRUCTURE  EKKO
*”     VALUE(I_TRTYP)
*”     VALUE(I_BSTYP) LIKE  EKKO-BSTYP
*”     VALUE(I_NO_SCREEN)
*”     VALUE(I_LFA1) LIKE  LFA1 STRUCTURE  LFA1
*”     VALUE(I_LFM1) LIKE  LFM1 STRUCTURE  LFM1
*”     VALUE(I_KEKKO) LIKE  EKKO STRUCTURE  EKKO
*”     VALUE(I_AEKKO) LIKE  EKKO STRUCTURE  EKKO
*”     VALUE(I_REKKO) LIKE  EKKO STRUCTURE  EKKO
*”     VALUE(I_CI_EKKO) LIKE  EKKO_CI STRUCTURE  EKKO_CI
*”     VALUE(I_VORGA) LIKE  T160-VORGA
*”  TABLES
*”      TEKPO STRUCTURE  BEKPO OPTIONAL
*”      TEKET STRUCTURE  BEKET OPTIONAL
*”      TEKKN STRUCTURE  EKKNU OPTIONAL
*”      TKOMV STRUCTURE  KOMV OPTIONAL
*”  CHANGING
*”     VALUE(C_CI_EKKO) LIKE  EKKO_CI STRUCTURE  EKKO_CI OPTIONAL
*”———————————————————————-
INCLUDE ZXM06U43 .
ENDFUNCTION.

———————————end————————————-

*——————————–start———————————-*
* INCLUDE ZXM06U43 *
*———————————————————————-*
BREAK-POINT.
———————————end————————————-
 

– After giving the “break-point” if this include is the one of many include that will be called in the transaction (in this case ME21), after clicking something (Save button), then will go to the debugger.
– In this case this include is the correct include.
10. If we want to maintain the global data for the function module, In “Function Module Exits”>”Go To”>”Global Data”> we can maintain the global data here.

Creating the User Exit

1. Create the new ‘Project’. Fill the “Attribute” with the Short text and Development Class
2. Fill the ‘Enhancement Assignment’ based on the procedure Find The User Exit , In this case the example would be LMR1M002.
3. Automatically, the component of the Function Exit of LMR1M002 will be assigned in the “Component” .
4. In each Function Exit consist one or many of includes. In this Includes we can make some modification, make some coding in this Includes. After coding the Includes, we activate the Includes and then activate the Function Exit (p.s. You can trace the use Function Exit by their Importing value and the Exporting Value… in terms the field you will be needed in your project).
Example:

FUNCTION EXIT_SAPLKONT_011.
*”———————————————————————-
*”*”Lokale Schnittstelle:
*” IMPORTING
*” VALUE(I_WRXMOD) LIKE WRXMOD STRUCTURE WRXMOD
*” EXPORTING
*” VALUE(E_KONTO_MODIF) LIKE T030-KOMOK
*”———————————————————————-

INCLUDE ZXM08U18 .

ENDFUNCTION.

p.s. It is necessary to determine which field’s value need to be retrieved, validated and exported to the next process… This can be done by looking the ‘Importing’, ‘Exporting’ and the ‘Changing’ value that used in the ‘Function Module Exit ‘ that we have found.

Importing Value : Just retrieved the value of the declared field.
Exporting Value : Just send the value of the declared field.
Changing Value : The value of the declared field can be changed while in the process.

———————————–oo———————————–

*———————————————————————-*
* INCLUDE ZXM08U18 *
*———————————————————————-*

IF SY-UNAME = ‘JAWGU01’.
BREAK-POINT.
ENDIF.

After activating the Includes and the Function Exit, If we go to the components, there will be the display as below:

Project ZWIDY Test for User Exit
Enhancement Impl Exp LMR1M002 Account grouping for GR/IR account maintenance
Function exit a EXIT_SAPLKONT_011

5. We have to activate the project after we already preparing all the components that we will use for the enhancement project.
Project ZWIDY Test for User Exit
Enhancement Impl Exp LMR1M002 Account grouping for GR/IR account maintenance
Function exit a EXIT_SAPLKONT_011
And all the button will become green and the project, including all the components are ready to use.
6. After this we can test it whether the requirement is already fulfilled or not.

Categories: TECHNICAL Tags: , , ,

SAP ABAP : Using the field exit

August 4, 2007 Leave a comment

If you are already in the transaction that need to be enhanced and already determined which fields that need to be enhanced (retrieved the value, validate the value, or export the value after validation or calculation to the system), check the “Data Element” (by click F1 for the ‘Help’ and then F9 for the technical info) of the field, including the “Program Name” and the “Screen Number” (On the top of the sub screen of Technical Information ‘Screen Data’).

1. Go to the transaction “CMOD” à ‘Go to’ à ‘Text Enhancement’ à ‘Field Exits’
2. If the field exits not yet assigned with the respected “Data Element”, Create the field exits , go to the ‘Field Exit’ à ‘Create’ .
3. The pop up window will generated, and required ‘ Data Element’ then click ‘Continue’.
4. The system will automatically goes to the transaction SE37 (Function Builder) in the default Field_Exit_.
5. Before creating the Field_Exit Function, we must create the Function Group first by go to ‘Go to’ à ‘Function Groups’ à ‘Create Group’ à fill in the ‘Function Groups’ name that we want to create and the short text as well. After creating the function groups we can continue the process to create the Field_Exit function. And also we define the Development class when we save it. P.s. Once we created the ‘Function groups’, the SAP will automatically generate the specific Function-Pool for the specified function groups.
6. Field_Exit_, then click ‘Create’ à assign the ‘Function Groups’ à and also the ‘Application’ . Check also the tabs for ‘Import’ , ‘Export’ , ‘Changing’ , ‘Tables’ , ‘Exceptions’ and ‘Source Code’. Got to the ‘Source Code’ for coding purposes.
Example: (For data element BISMT)

FUNCTION FIELD_EXIT_BISMT.
*”———————————————————————-
*”*”Local interface:
*” IMPORTING
*” REFERENCE(INPUT)
*” EXPORTING
*” REFERENCE(OUTPUT)
*”———————————————————————-

ENDFUNCTION.

p.s. Compared to the User Exit, the Importing and Exporting Value declared as Input and Output.

7. If we want to assign the global data (this global data can be used by all the Field_Exit Function assigned to the same ‘Function Groups’ ). This will do by go to ‘Go to’ à ‘Global Data’. Because of having the specific Function-Pool, the global data declared here, will not mesh up with the other functions assign to different Function-Groups.

8. After coding, activate the function. And back again to the transaction CMOD.
9. The Field Exit will be assigned but still in ‘Inactive’ status and ‘Global’ program
10. To make it useful for the specified transaction (program name and the screen number of the destination field), we have to assign the function by giving the ‘Check’ , and click ‘Assign prog./.screen’ , assign the ‘Program Name’ and the ‘Screen number’ and press ‘ENTER’. Then activate.
11. If we want to assign the field exit function into more than one different program name and the screen number, choose the field exits by giving the ‘Check’ to the left box , and click ‘Assign prog./.screen’ à click ‘Insert Line / F5’ à and assign the field ‘Fld. Exit’ , ‘Program Name’ and the ‘Screen Number’ . The field ‘Fld. Exit’, will be filled by the number and we must create another name of the Field_Exit Function with the default Field_Exit__, example: Field_Exit_BISMT_0, Field_Exit_BISMT_1, and so on in transaction SE37 (Function Builder).
12. If we want to edit the existing Field_Exit Function, choose the desired function and click ‘Edit FM / F7’. Don’t forget to activate after did the change the program in the function.
12. After this we can test it whether the requirement is already fulfilled or not.

Categories: TECHNICAL Tags: , , ,