Posts filed under 'TECHNICAL'

Changing the SAP Standard – Transaction Variant

In some business, sometime we need to adjust business transaction by hiding all information not relevant and displaying only the important information.As a case, asset master data maintenance only permitted to change only General data. In this case you have modify the screen of asset maintenance, for detail case see image below :

Standard : display screen of AS02.

Standart - AS02

Purpose : view only General tab.

Enhancement - AS02

To create the transaction variant, proceeds as below :

  1. login to SAP and choose this path : Tools -> AcceleratedSAP  -> Personalization -> SHD0-Transaction Variants
  2. Enter transaction code AS02, and enter the name of Variant (example ZAS02).
  3. Choose create button or F5. The system automatically call transaction code AS02.
  4. Enter the value on the General Tab.
  5. Enter name of screen variant and short text.
  6. Choose the option you want to display screen : Output only , Mandatory, Invisible, etc. In this case set tab Time Dependent, Allocation, Origin, and Depre. Area as invisible by ticking invisible box on optional dialog.
  7. Choose Continue function to proceed next screen, and repeat step 3-6 for all screen.
  8. In the last screen choose exit and save button.
  9. Enter short text for the transaction.
  10. And choose Save button to save your transaction variant.

Starting Transaction Variant, proceeds as below:

  1. Choose Tools -> AcceleratedSAP  -> Personalization -> SHD0-Transaction Variants.
  2. Enter Transaction Code AS02 and Variant Name ZAS02.
  3. Choose Test button or F8.

To make this Transaction Variant can be executed individually, you need to created Variant Transaction. The step proceeds as below:

  1. Choose Tools -> AcceleratedSAP  -> Personalization -> SHD0-Transaction Variants.
  2. Enter Transaction Code AS02 and Variant Name ZAS02.
  3. Choose Goto -> Create Variants Transaction.
  4. Enter the name of Transaction code and short text.
  5. Choose Save to save the Variant Transaction.

8 comments December 21, 2007

Finding Email address Customer and Vendor Master on SAP

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.

Rgds,

 

4 comments November 8, 2007

Get comments texts from SAP

In many transaction, SAP stores comments in different table. For example if you want to get comments texts on Item detail of Purchasing order , belive me you will not find on table EKPO (Item table of purchasing order). So you need a function and some object or id to get the comment. You can find object by entering table STXH-TDNAME with Purchasing order number plus asterisk (because STXH-TDNAME contains PO Number plus Item number of PO). STXH-TDNAME = ‘4500002131*’ will be bring back object, name, and id as parameter on function module READ_TEXT.

The following code is a function that will return PO Item text :

data: begin of tlinetab occurs 100.
             include structure tline.
data: end of tlinetab.
data: po_no    like ekpo-ebeln,
          po_item  like ekpo-ebelp,
          thead    like thead,
          line_cnt type n,
          tdname   like thead-tdname.

select single ebeln ebelp
  into (po_no, po_item)
  from ekpo
  where ebeln = ‘4500002131′
    and ebelp = ‘10′.

concatenate po_no po_item into tdname.

call function ‘READ_TEXT’
       exporting
            id = ‘F01′
            language = sy-langu
            object = ‘EKPO’
            name = tdname
       importing
            header = thead
       tables
            lines = tlinetab
       exceptions
            id = 1
            language = 2
            name = 3
            not_found = 4
            object = 5
            reference_check = 6
            wrong_access_to_archive  = 7
            others = 8.

  if sy-subrc = 0.
    loop at tlinetab.
      write / tlinetab-tdline.
      add 1 to line_cnt.
    endloop.
  endif.

Good luck …!

2 comments November 7, 2007

Release code on relation with table EBAN (Purchase Requisition)

Well, finally I found how to get release code on relation with table EBAN (purchase requisition), after 3 ours searching. I need this because my client need to build a query with out put purchase requisition release information. Basically I found the table by debugging function module “BAPI_REQUISITION_GETRELINFO”, this function module gather all information about purchase requisition release strategy. Below is detail relation between the table : 

EBAN-FRGGR = T16FS-FRGGR -> Release Group

EBAN-FRGST  = T16FS-FRGSX  -> Release strategy

2 comments August 7, 2007

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

              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

Add comment August 6, 2007

Change the development class for a customer screen

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.

1 comment August 6, 2007

SAP ABAB: Using the User Exit

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.

7 comments August 4, 2007

SAP ABAP : Using the field exit

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.

Add comment August 4, 2007


Top Posts

Categories

RECENT POSTS

Recent Comments

Archives

Blog Stats

Meta