Monday, 29 July 2013

Important Links

Cancel variant protection or Uncheck protection checkbox for variant.




Problem:
How do you take the Protect Variant off.
We have created transportable variants using variant prefix CUS& and it automatically selects the protect variant checkbox.  You cannot deselect it and so only the user can change this variant.
I have tried Program RSVARENT which is supposed to cancel variant protection but this did not work.


Protect variant:
If you select this option, the variant can only be changed by the
person who created it or the last person to change it. If you start
a program using a protected variant, none of the fields on the
selection screen accept user input.








 Solution:
*&---------------------------------------------------------------------*
*& Report  ZCV_RSVARENT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zrsvarent_partha.


TABLES: varid,rsvar.

DATA: i_varid TYPE STANDARD TABLE OF varid WITH HEADER LINE.

SELECT-OPTIONS: s_report FOR rsvar-report,
                s_vari   FOR rsvar-variant.
PARAMETERS: p_mandt  LIKE sy-mandt OBLIGATORY DEFAULT '000'.

START-OF-SELECTION.

  SELECT * INTO TABLE i_varid
  FROM varid CLIENT SPECIFIED
  WHERE mandt     =  p_mandt
    AND report    IN s_report
    AND variant   IN s_vari
    AND protected NE space .

  IF sy-subrc = 0.
    LOOP AT i_varid.
      CLEAR i_varid-protected.
      IF NOT  i_varid-variant(4) EQ 'SAP&'
         AND NOT i_varid-variant(4) EQ 'CUS&'.
        MOVE 'F' TO i_varid-transport.
      ENDIF.
      MODIFY i_varid.
    ENDLOOP.
    MODIFY varid CLIENT SPECIFIED FROM TABLE i_varid .
    WRITE:/ 'SY-SUBRC = ' , sy-subrc.
    WRITE:/ 'No. of records updated = ' , sy-dbcnt.
    COMMIT WORK.
  ELSE.
    WRITE:/ 'No records found for the selection criteria.'.
  ENDIF.









Inputs:
S_REPORT – Report/Program name.
S_VARI – Variant name.
P_MANDT – NO CHANGE (Let it be as ‘000’).

Run the program.
Hurray .. !! The variant is now with protected check box unchecked.  :-)

Saturday, 27 July 2013

User Exit and Customer Exit - Interview Questions



what is diff b/w user exits and customer exits
 
User Exits: 
1.These are forms, so they are called by sap 
standard programs using perform.
2. Inside the form you can read and change almost any 
global data from host program.
3. User exits doesn't have any classification.
4. These are basically destined for SD module only

Customer Exits: 
1. These are functions, so they are called 
using call functions.
2. Inside the function you can only access your 
import/export/changing/table/parameters
3. These exits have function, module, screen exits.
4. These are available for MM, SD, FI, hr almost for all 
Modules.
 
User Exit Characteristics:

1.A user exit is a three character code that instructs the system to access a program during system processing.SXX: S is for standard exits that are delivered by SAP.
XX represents the 2-digit exit number.UXX: U is for user exits that are defined by the user. XX represents the 2-digit exit number

2.USER EXITS are FORMS and are called by SAP standard programs
using PERFORM.
3.Inside the form (user exit) you can read and change almost
any global data from host program.

4. User exits are more flexible because you have more information to use in your code but on the other hand , it is very easy to manipulate erroneously global data and lead the standard program to a dump or even to make database inconsistent.

5.While changing User-exit,Access Key is required,




In user exits Usually global variables are used.

So this has disadvantage that if two or more user exits access the same global variables then the data or result may be erroneously interpreted.


So to overcome this in Customer exits the exits were defined in the form of function modules,therefore the exit can access only the variables that have been declared in their import,export or tables parameters thereby limiting the access to global variables.


Customer Exit Characteristics:

Due to the disadvantages they faced in the user exits (data can be interpreted erroneously) ,then SAP introduced the concept of Customer Exits.

1.   The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.

2.   CUSTOMER EXITS are FUNCTIONS so they are called using CALL
FUNCTION (or more exactly CALL CUSTOMER FUNCTION).

3.   Inside a function (customer exit) you can only access your import/export/changing/tables parameters.

4.   Customer exits are more restrictive but you are sure any change you can make to any parameters will never lead to inconsistency

5.   in Customer-exit no access key is needed.

Also since the custom coding done as part of these customer-exits is located away from the original SAP code, the maintenance is easier than user-exits.


 
 

Monday, 22 July 2013

Change Pointer Basic Concept and Configurations



Purpose

If you want to distribute master data changes with the SMD tool (Shared Master Data), changes to the master data objects are flagged for distribution by change pointers ( Master Data Distribution).

The SMD tool is connected to the change document interface. If the master data changes are to be distributed, the application writes a change document. The contents of this are passed to the SMD tool. The tool writes change pointers, reads the application data and creates the master IDoc.

The master IDoc is then passed to the ALE layer, which sends it to all interested systems.

The change pointer tables (BDCP und BDCPS) should be as small as possible. Use as few change pointers as possible and delete change pointers which you no longer need.

You can increase the rate of processing by using the Analyze Change Pointer and Reorganize Change Pointer functions.





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









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.


















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 RBDMIDOC  (TCODE – BD21)by passing Message type "MATMAS"

10. WE02 IDOC List

Sunday, 21 July 2013

How to find BADI - method 1

How to find out a BADI  for a  transaction:
1.     Go to the TCode SE24 and enter CL_EXITHANDLER as object type.
2.     In 'Display' mode, go to 'Methods' tab.
3.     Double click the method 'Get Instance' to display it source code.
4.     Set a breakpoint on 'CALL METHOD cl_exithandler=>get_class_name_by_interface'.
5.     Then run your transaction.
6.     The screen will stop at this method.
7.     Check the value of parameter 'EXIT_NAME'. It will show you the BADI for that transaction.
Choose correct BADI for requirement.  

Thursday, 18 July 2013

INDX Table (Cluster Table): Characteristics, Usages and Advantages


INDX Table (Cluster Table):

























Detail Link:




Characteristics:


  1. It’s a cluster table.

     Some other example of cluster tables:

     Like – RFBLG (BSEG, BSEC, BSED, BSES ans BSET.)

     Go to the table DD02L and enter the field Tabclass as TRANSP to get all transparent      tables, CLUSTER to get all cluster tables and POOL to get the pooled tables.



  1. The data stored (fields, structures, internal tables) are store in the CLUSTD in hexadecimal format (a compressed format).



  1. The length of a CLUSTD record is 2886. After reaching the length, there will be another line with increasing the SRTF2 value.SRTF2 value is start from 0.

Usage and Advantages:



  1. As it holds data in hexadecimal format, it compress the data. So there will be less consumption of memory.
  2. INDX table can hold data of any structure; structure independent. So using this feature we can store dynamic structured records in it. 
  3. It is useful when we need to keep a huge amount of data in ABAP memory, to improve the performance.

EXPORT the internal table or variable values into INDX and then  IMPORT from INDX will accelerate the performance, because it doesn’t consume ABAP session memory.



The INDX table is useful for huge amount of data to accelerate the performance.

Saturday, 13 July 2013

Customer Exit find - process 2


Tricks to find Customer Exits: Process 2
  • Find the package name inside which the t-code or the program created. 
( Go to the T-Code for which you want to find the customer exit. 
  Go to the program name.    
  From menu, Goto - Object Directory Entry - copy the Package name).

  • Go to T-Code SMOD and go for F4 Help in the field Enhancement and put the Package name and enter.
You will find the Exit Names / Enhancement Nos. under the package.











Implement the Customer Exit:
  • Go to T-Code CMOD
  • Create a Z<ANY PROJECT-NAME>.
  • Enter the enhancement assignment (Enhancement No.) and press enter.
  • Go into Component - Function Exit - Z<include> - Write your custom code. 

Customer Exit find and implement - process 1


Tricks to find Customer Exits: Process 1
  • Go into the program against the transaction code, you want to find any customer exit.
  • Find the string – call customer-function. You will find the CALL CUSTOMER-FUNCTION '***' .


 
  • Double click on the three digit number '***'. You will be redirected inside the function module.












  • Now find the Enhancement No./ SAP extension name from the table MODSAP with entering the function module name.

Implement the Customer Exit:

  • Go to T-Code CMOD
  • Create a Z<ANY PROJECT-NAME>.
  • Enter the enhancement assignment (Enhancement No.) and press enter.
  • Go into Component - Function Exit - Z<include> - Write your custom code. 

Characteristics of Customer Exit and advance than User Exit


Due to the disadvantages that SAP faced in the user exits (data can be interpreted erroneously), SAP introduced the concept of Customer Exits.


  • The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.
  • CUSTOMER EXITS are FUNCTIONS basically function modules, so they are called using CALL FUNCTION (or more exactly CALL CUSTOMER FUNCTION).
  • Inside the function module (customer exit) you can only access your import/export/changing/tables parameters.
  • Customer exits are more restrictive ensuring you in changing/using of any parameter of the FM, will never lead to inconsistency.
  • In Customer-exit no access key is needed.
Also since the custom coding done as part of these customer-exits is located away from the original SAP code, the maintenance is easier than user-exits.

Tuesday, 9 July 2013

Important Tables in SAP

Customer related tables with Important fields

KNA1: Customer Master-General(KUNNR,NAME1,LAND1)

KNB1: Customer Master(Company Code)(KUNNR,BUKRS,PERNR)

KNC1: Customer Master Data (Transaction Figures)(KUNNR,BUKRS,GJAHR)

KNVK: Customer Master Contact Partner(PARNR,KUNNR,NAME1)

KNVV: Customer Master sales data(KUNNR,VKORG,VTWEG,KDGRP)

KNBK: Customer Bank Details(KUNNR,BANKS,BANKL,BANKN)

KNVH: Customer Hierarchy (HITYP,KUNNR,VKORG,VTWEG,SPART)

KNVP: Customer Master Partner Functions(KUNNR,PARVW,KUNN2)

KNVS: Customer Shipment data(KUNNR,VSTEL,TRANS)

KNVI: Customer Tax data(KUNNR,ALAND,TATYP)



Vendor related

LFA1--Vendor Master-General (LIFNR,NAME1,ORT01)

LFB1--Vendor Master(Company Code)(LIFNR,BUKRS,PERNR)

LFC1--Vendor Master (Transaction Figures)(LIFNR,BUKRS,GJAHR)

LFM1—-Pur.Orgn. Related Vendor Data (LIFNR,EKORG)



Material Related

MARA--Material Master-General (MATNR,MTART,MATKL)

MARC--Material Master-Plant data(MATNR,WERKS,EKGRP)

MARD--Material Master- St.Location Data(MATNR,WERKS,LGORT,LABST)

MAKT--Material Descriptions(MATNR,MATKL,MAKTX)

MBEW--Material Valuation Data(MATNR,BWTAR)

MVKE—-Material Master: Sales related Data(MATNR,VKORG,VTWEG)



Plant related

T001W-- Plants (WERKS)

T001L-- Storage Locations (LGORT)



Sales related

VBAK: Sales Document(Header Data) (VBELN)

VBAP: Sales Document(Item Data) (VBELN,POSNR,MATNR,ARKTX,CHARG)

Enquiry, Quotation, Sales Order are differentiated based on Doc.

Type(VBTYP field) in VBAK,VBAP Tables( for Enquiry VBTYP = A,

for Quotation 'B' & for Order it is 'C'.)

LIKP: Delivery Table (Header Data)(VBELN,LFART,KUNNR,WADAT,INCO1)

LIPS: Delivery Table (Item Data)(VBELN,POSNR,WERKS,LGORT,MATNR,VGBEL)

(LIPS-VGBEL = VBAK-VBELN, LIPS-VGPOS = VBAP-POSNR)

VTTK: Shipment Table (Header Data)(TKNUM)

VTTP: Shipment Table (Item Data)( TKNUM,TPNUM,VBELN)

(VTTP-VBELN = LIKP-VBELN)

VTFA: Shipping Document Flow(TKNUM,VBELV,VBELN)

VTPA: Shipping Partners data(VBELN,PARVW,KUNNR,PERNR)

VTTS: Stages in Shipment(TKNUM,TSNUM,TSTYP)

VTSP: Transport Stage/Shipment Item Allocation(TKNUM,TSNUM,TPNUM)

VEKP: Handling Unit: Header(Packing)(VENUM,VSTEL)

VEPO: Handling Unit: Item (Packing)(VENUM,VEPOS,VBELN)

VBRK: Billing Table(Header Data)(VBELN,FKART,BELNR)

VBRP: Billing Table(Item Data)(VBELN,POSNR,FKIMG,NETWR,VGBEL,VGPOS)

(VBRP-AUBEL = VBAK-VBELN, VBRP-VGBEL = LIKP-VBELN)

Apart from these tables there are lot of other tables which starts with

‘V’, but we use the following tables frequently.

VBUK: All Sales Documents status & Admn. Data(Header)(VBELN,VBTYP)

VBTYP= ‘C’(Sales Order) VBTYP=’J’(Delivery) VBTYP=’M’(Invoice)

VBUP: Sales Documents status & Admn. Data(Item)(VBELN,POSNR)

VBEP: Sales Doc. Schedule Lines Data(VBELN,POSNR,EDATU,WMENG)

VBKD: To get sales related Business data like Payment terms etc.(VBELN,ZTERM)

VBFA: sales document flow data(VBELV,VBELN,POSNV,VBTYP)

VBPA: Partner functions Data(VBELN,PARVW,KUNNR,LIFNR)

VEDA: Contract Data(VBELN,VPOSN)

VEDAPO: Contract Data(VBELN,VPOSN)

Useful Transactions in SAP Workflow



Useful Transactions in SAP Workflow 

Transaction Code
Description
OOAW
Evaluation paths
PFAC_CHG
Change roles
PFAC_DEL
Delete roles
PFAC_DIS
Display roles
PFAC_INS
Create roles
PFOM      
Maintain assignment to SAP organizational objects
PFOS
Display assignment to SAP organizational objects
PFSO
Organizational environment of a user
PFTC_CHG
Change tasks
PFTC_COP
Copy tasks
PFTC_DEL
Delete tasks
PFTC_DIS
Display tasks
PFTC_INS
Create tasks
PPOCW
Create organizational plan
PPOMW
Maintain organizational plan
PPOSW
Display organizational plan
SWDA
Workflow Builder (Calls the Workflow Builder in alphanumeric mode)
SWDD
Workflow Builder
SWDS
Workflow Builder (Selection)
SWDD_CONFIG
Workflow configuration
SBWP
The Business Workplace
SWDC_DEFINITION
Workflow Builder administration data
SWDC_RUNTIME
Workflow runtime administration data
SWNCONFIG
Extended notifications for business workflow
SWDM
Business Workflow Explorer
SWEINST
Evaluation and maintenance of instance linkages
Transaction Code
Description
SWEINSTVC
Evaluation and maintenance of instance linkages
SWE2
Evaluation and maintenance of type linkages
SWE3
Evaluation and maintenance of instance linkages
SWE4
Switch event trace on/off
SWEL
Display event trace
RSWELOGD
Delete event trace
SWEC
Link change documents to events
SWED
Assign change document objects to object types
SWEQADM_1
Event queue administration
SWEQBROWSER
Administration of event queue browser
SWETYPV
Evaluation and maintenance of type linkages
SWI1
Selection report for work items
SWI2_FREQ
Work items per task
SWI2_DEAD
Work items with monitored deadlines
SWI2_DURA
Work items by processing duration
SWI11
Tasks in workflows
SWI13
Task profile
SWI5
Workload analysis
SWL1
Settings for dynamic columns
SWLV
Maintain work item views
SWFVISU
Parameters for Work Item Visualization in the UWL
SWO1
Business Object Builder
SWO6
Customizing object types
SWR_WEBSERVER
Customizing Web server
SWU_CONT_PERSISTENCE
Administration of container persistence
SWU_EWCD
Wizard for event creation using change documents
SWU_EWLIS
Wizard for event creation using the Logistics Information System
SWU_BTE
Wizard for event creation using Business Transaction Events
SWU0
Event simulation
SWU2
RFC monitor
SWU3
Automatic Workflow Customizing
SWU4
Consistency check for standard tasks
SWU5
Consistency check for customer tasks
SWU6
Consistency check for workflow tasks
SWU7
Consistency check for workflow templates
SWU8
Switch workflow trace on/off
SWU9
Display workflow trace
SWU10
Delete workflow trace
Transaction Code
Description
SWUD
Diagnostic tools
SWUE
Trigger event
SWUI
Start workflows/tasks
SWUS
Testing workflows/tasks
SWXML
Display XML documents
SWUY
Wizard for linking messages to workflows
SWWCOND_INSERT
Schedule background job for work item deadline monitoring
SWWCLEAR_INSERT
Schedule background job for clearing tasks
RSWWCOND
Execute single background job for work item deadline monitoring
RSWWCLEAR
Execute work item clearing work once
WF_HANDCUST
WebFlow service handler maintenance
WF_EXTSRV
Maintain Web Service Repository
WFWS
Import WSDL files