Thursday, October 29, 2009

How to modify any code in Quality or Production without the need for a access key.

How to modify any code in Quality or Production without the need for a access key.
Imagine, you are doing a unit test for a object in QA, suddenly a test case fails and oh! come one you have to change this one line again in development and move it to Quality to test. That will take definetly at least 5 minutes to 30 minutes, depending on how your system is configured. How about changing the code directly in quality and continuing the testing. One little suggestion before we proceed with the tutorial, always use this trick only in quality and not in production or it may create chaos. I work on 4.6c and have not used this trick in all the other sap versions. Please try it and let me know your comments.
When you click on the change button in quality, you will get a screen like this saying 'Error in Object Editing'.
Now, we will work out a way to skip this message and make the change to the code. You will need this handy debugger to start the debugger from a popup.
Drag the debug tool and place it on the above popup. then, Click Continue or Press Enter. This will take you into ABAP Debugger. Click on Call stack button –> double click on Function TRINT_CORR_CHECK.
Now click on Fields button and then set a break point on the line LV_SUBRC = SY-SUBRC ( see image below) after the call to the function module 'TRINT_CORR_CHECK'.
Press F8 and the code will stop on the line 'LV_SUBRC = SY-SUBRC'. Double click on SY-SUBRC and the value must be '12′ now change the value to '0′. Now, press F8 again, this should bring you back to the editor with change mode.
Wait, there is an another step to it. Once you edit the code and make the changes and press activate. The program will again bring you to the same window saying 'Error in Editing Object'.
Now, again drag and drop our little Debug Tool. Then click continue or press enter. This will take you to the ABAP Debugger, well this is a similar code, but it's a different include so you have to carry the steps again. Click on Call stack button –> double click on Function TRINT_CORR_CHECK. Now, you will get a screen like below.
Now, set the break-point at line 'When 0′. Press F8 and now change the value of SY-SUBRC from '12′ to '0′.
Press F8(execute) and now the program will going through a set of break-points set by you. Change the value everytime from '12′ to '0′ and press F8. Finally after three or four execute sy-subrc changes, the program will finally get activate and you will have the new modified code available to execute.
Do you know about the syntax 'INSERT REPORT'. We can also modify the code using it.
 
 
Regards,
Ankur Bhandari
Capgemini Development Lead
Envision Project
+1 847 345 8004
 
 
 

Assign a role to a USER

Using the following function module you can assign a role to a user in DEV and Quality environment since you would have access to SE37.
ISAI_USER_ROLES_MAINTAIN Assign Role to User
 
 
 
Regards,
Ankur Bhandari
Capgemini Development Lead
Envision Project
+1 847 345 8004
 
 
 

Program to change SAP source code without Key

Program to change SAP source code without Key
 
  • RS_REPAIR_SOURCE
 
 
 

Report Program to find which transaction was used by which User in the past month.

REPORT YBAS_CHECK_TRANS_USE NO STANDARD PAGE HEADING LINE-SIZE 255.
*----------------------------------------------------------------------
*
* THIS CODE IS TO BE CHANGED ONLY ON DEV ECC !!
*----------------------------------------------------------------------
*
* PROGRAM INFORMATION
*----------------------------------------------------------------------
*
* DESCRIPTION   : Collect transaction usage info.
*
* NOTES         : Collects the usage of a transaction code for a period.
*
* APPLICATION   : BC
*
* RESTART       : Anytime
*
*----------------------------------------------------------------------
*
* MODIFICATION LOG
*----------------------------------------------------------------------
\
tables: usr21, adrp.

DATABEGIN OF SERVLIST OCCURS 25.
        
INCLUDE STRUCTURE MSXXLIST.
DATAEND OF SERVLIST.
DATABEGIN OF i_APPLICATION_STATISTIC OCCURS 5000.
        
INCLUDE STRUCTURE SAPWLUSTCX.
DATAEND OF i_APPLICATION_STATISTIC.

DATABEGIN OF I_trans_user OCCURS 100,
        entry_id  
like I_APPLICATION_STATISTIC-entry_id,
        account    
like usr21-bname.
DATAEND OF I_trans_user.

DATA: COLLECT_TIME LIKE SY-UZEIT.
DATA: COLLECT_DATE LIKE SY-DATUM.
DATA: CLEANUP_DATE LIKE SY-DATUM.

DATA: INSTANCE LIKE SAPWLSERV-NAME.
DATA: i_RECORD_COUNT(9).
DATA: i_RECORD_PROCESSED(9).
DATA: i_temp(80).
data: P_period(1).

PARAMETER: P_trans LIKE I_APPLICATION_STATISTIC-entry_id,
           P_sdate 
like sy-datum default SY-DATUM,
           P_day 
radiobutton group per,
           P_mon 
radiobutton group per default 'X',
           P_wk 
radiobutton group per.

START-
OF-SELECTION.

  
TRANSLATE P_trans TO UPPER CASE.
  COLLECT_DATE = SY-DATUM.
  COLLECT_TIME = SY-UZEIT.

if P_day = 'X'.
   P_period = 
'D'.
else.
   
if P_mon = 'X'.
      P_period = 
'M'.
   
else.
      P_period = 
'W'.
   
endif.
endif.

  
PERFORM GET_SERVER_LIST.
  
LOOP AT SERVLIST.
    
CLEAR INSTANCE.
    INSTANCE = SERVLIST-NAME.
    
PERFORM GET_TRANS_STATS.
    i_RECORD_COUNT = 
0.
    i_RECORD_PROCESSED = 
0.
    
LOOP AT i_APPLICATION_STATISTIC.
      
clear I_trans_user.
*      i_RECORD_COUNT = i_RECORD_COUNT + 1.
      if i_APPLICATION_STATISTIC-entry_id(20eq P_trans(20).
        I_trans_user-entry_id = i_APPLICATION_STATISTIC-entry_id(
20).
        I_trans_user-account = i_APPLICATION_STATISTIC-account.
        
append I_trans_user.
        i_RECORD_PROCESSED = i_RECORD_PROCESSED + 
1.
      
ENDIF.
    
ENDLOOP.
  
ENDLOOP.

  
write:/ 'Report YBAS_CHECK_TRANS_USE Rundate:', COLLECT_DATE, 'Runtime:',COLLECT_TIME.
  
write:/ 'Transaction: '14 P_trans, 24 'was executed by user(s):'.
  
uline.
  
loop at I_trans_user.
    
select * from usr21 where bname = I_trans_user-account.
      
if sy-subrc = 0.
        
select * from adrp where persnumber = usr21-persnumber.
          
if sy-subrc = 0.
          
clear i_temp.
          
concatenate adrp-name_first adrp-name_last into i_temp separated by ' '.
          
write:/ I_trans_user-account, ' - ', i_temp.
          
else.
            
write:/ I_trans_user-account, ' name not found.'.
          
endif.
          
endselect.
        
else.
          
write:/ I_trans_user-account, ' name not found.'.
        
endif.
        
endselect.
      
endloop.
      
uline.
      
write:/ 'Total users that executed this transaction:', i_RECORD_PROCESSED.

END-OF-SELECTION.
*
FORM GET_TRANS_STATS.

  
CALL FUNCTION 'SAPWL_WORKLOAD_GET_STATISTIC'
    EXPORTING
      PERIODTYPE                 = P_period
      HOSTID                     = 
' '
      STARTDATE                  = P_sDATE
      ONLY_APPLICATION_STATISTIC = 
'X'
      INSTANCE                   = INSTANCE
    
TABLES
      APPLICATION_STATISTIC      = i_APPLICATION_STATISTIC
    
EXCEPTIONS
      UNKNOWN_PERIODTYPE         = 1
      NO_DATA_FOUND              = 2
      NO_SERVER_GIVEN            = 3
      OTHERS                     = 4.

ENDFORM.                    "GET_TRANS_STATS

*&---------------------------------------------------------------------*
*&      Form  GET_SERVER_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM GET_SERVER_LIST.

  
CALL FUNCTION 'TH_SERVER_LIST'
    TABLES
      LIST = SERVLIST.

ENDFORM.        .                    "GET_SERVER_LIST
 
 
 
Ankur
 
 

Run T-Code in SAP without authority

Using Function Modules
  • ALINK_CALL_TRANSACTION
 
  • C160_TRANSACTION_CALL
 
AND ALSO USING PROGRAM
 
  • RSDEMO04
 
 
 

Thursday, October 22, 2009

Find the BADI in a different way.

Find the BADI in a different way.
  1. Enter SE37, display Function Module - SXV_GET_CLIF_BY_NAME.
  2. Set a BREAKPOINT in call function SXV_ADD_PREFIX .
  3. In another SESSION run the transaction, parameter 'name' gives the BADI; parameter 'clif ' gives implementation, e.g. for TCode MIGO name = MB_MIGO_BADI, clif = CL_EX_MB_MIGO_BADI .


Code
FUNCTION sxv_get_clif_by_name .
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(NAME)
*"     VALUE(PREFIX) TYPE  SEEX_CLIF_PREFIX
*"  EXPORTING
*"     VALUE(CLIF) TYPE  SEOCLSNAME
*"----------------------------------------------------------------------
  CALL FUNCTION 'SXV_ADD_PREFIX'
       EXPORTING
            name     = name
            prefix   = prefix
       IMPORTING
            new_name = clif.
ENDFUNCTION.
 
 

Thursday, October 01, 2009

Workflow Container.

RSWF_CNT_EDIT: Can be used to edit container values of the workflow.
 
Regards,
Ankur Bhandari
Capgemini Development Lead
Envision Project
+1 847 345 8004
 
 
 

Wednesday, July 01, 2009

Customizing Directly in Production

  1. Find the IMG activity which needs to be directly maintained in Production environment.- T549A
  2. Find the table view – By going to SE11 and we find V_T549a
  3. Go to SOBJ and find the view – enter V_T549a
  4. Click Current settings, Save now this Customizing activity will be maintainable in Production environment.
 
 
Regards,
Ankur Bhandari
Capgemini Development Lead
Envision Project
+1 847 345 8004
 
 
 

Thursday, March 26, 2009

Questions about INVOIC02 exits

Which user exits can be found in FI inbound processing of IDocs of category INVOIC01/02 and what can they be used for?
In the IDoc INVOIC01/02 how can you

    1. change the G/L account (BSEG-HKONT)?
    2. change the company code (BSEG-NEWBK)?
    3. fill or change the additional account assignments?
    4. fill the allocation number (BSEG-ZUONR)?
    5. fill the segment text (BSEG-SGTXT)?
    6. assign own names for the batch input sessions?
Other terms

EDI, IDOC_INPUT_INVOIC_FI, SAPLIEDI, OBCC, OBCE, OBCB, INVOIC01, INVOIC02, INVOIC, FEDI0001

Reason and Prerequisites
G/L account and company code
User exit 001

gives you the option of determining the G/L account and the company code for posting the delivery of goods/services.If no G/L account is determined, a corresponding exception can be triggered and a message generated as well. Up to and including Release 4.6C, you have to use the workaround described in note 330390 for the exceptions due to an error in the interface.
The exit is always called after an item segment was a processed completely and all of the data for this item is known (except for the additional account assignments and taxes).
The following data is available in the exit:
- the company code of this item
- the vendor account
- batch input fields and field contents of the current line item
Name of function module: EXIT_SAPLIEDI_001
The G/L account is determined from the settings in the Customizing Transaction OBCB by default.
The user exit cannot be used for changing the account assignment of any condition line items that may exist.For conditions, the account assignment is determined exclusively by means of the Customizing in OBCB.

Coding block
User exit 002

enables you to change the additional account assignments (COBL, coding block). When processing the line item data this is called directly after exit 001, but only if additional account assignments have already been made in the standard system or in exit 101.
As with 001 an exception and output of a message is supported here, too. (Up to and including Release 4.6C, take note 330390 into account.)
The following data is available in the exit:
- the company code of this item
- the vendor account
- date DATAB and DATBI
- batch input fields and field contents of the current line item
Name of function module: EXIT_SAPLIEDI_002
The additional account assignments are filled from the settings of the Customizing Transaction OBCC by default.

Allocation number
User exit 003

enables you to change the field BSEG-ZUONR (allocation number). As with 001 and 002 the exception NOT_FOUND can be triggered and a message generated as well. (Up to and including Release 4.6C, take note 330390 into account.)
The call is carried out after exit 002.
The following data is available in the exit:
- the company code of this item
- the vendor account
- batch input fields and field contents of the current line item
Name of function module: EXIT_SAPLIEDI_003
The allocation number is not filled as a default.

Segment text
User exit 004

enables you to set line item text (BSEG-SGTXT) for the G/L account lines. If a text is to be added for the vendor line item, you can use user exit 102. Exit 004 is called after exit 003 and has the same data and the same exception. (Up to and including Release 4.6C, take note 330390 into account.)
The following data is available in the exit:
- the company code of this item
- the vendor account
- batch input fields and field contents of the current line item
Name of function module: EXIT_SAPLIEDI_004
Only the first line of the segment text is transferred as a default.

Name of the batch input session
User exit 005

This exit is only relevant if you have set processing of the INVOIC01 IDocs for batch input sessions in the Customizing Transaction OBCE.These sessions receive a description as a default according to the schema: IV_ <Partner>. <Partner> is the name of the partner from the IDoc control record.
You are advised to distinguish the BDC sessions by using different names. You can do this with user exit 005.
The following data is available in the exit:
- the company code of this item
- the vendor account
Name of function module: EXIT_SAPLIEDI_005

Customer-defined segments and qualifiers
User exit 101

is called up for every segment after standard processing. Customer-defined segments can be processed this way.Furthermore, qualifiers that are not used in the standard system can be evaluated this way. In the case of incorrect specifications in the IDoc, a message can be generated. The message must be notified to the program in a structure FIMSG (see ABAP Dictionary). The messages are issued in the IDoc status record.A message of category E (Error) causes the IDoc to receive status 51 (incorrect).
The message is displayed in the status record of the IDoc.
The exit contains the following information:
- Control record information (in table IDOC_CONTRL)
- the index of the current IDoc in IDOC_CONTRL_INDEX (usually
  irrelevant, since at present the IDocs are always processed separately)
- the complete IDoc data (segment name, segment data in IDOC_DATA)
- the index of the segment processed currently (in IDOC_DATA_INDEX)
- the header and item data processed up to now for the call of
  transaction FB01 (in DOCUMENT_DATA)
- the tax data processed up to now (in TAX_DATA)
- the additional account assignments for CO, CO-PA and
  Business area (in ADDITIONAL_DATA) processed up to now
- the number of the currently processed line item (in DOCUMENT_LINE)

Procedure to process customer-defined segments or qualifiers:

    1. Call up segment name: IDOC_DATA-SEGNAM;
    2. place IDOC_DATA-SDATA in the structure related to the segment;
    3. evaluate data and append the result to the corresponding internal table (for example, DOCUMENT_DATA). The meaning of the fields:

STYPE: 'K' for document header data and 'P' for line item data
COUNT: Number of the item (is transferred in DOCUMENT_LINE)
FNAM : batch input name of the field to be appended (for example, 'COBL-KDPOS')
       The field name must be entered in upper case.
FVAL : required field contents

Name of function module: EXIT_SAPLIEDI_101

Change or check Posting data (complete document)
User exit 102

enables the validation and adjustment of the document data along the same lines as for user exit 101.However, it is called after all segments of the IDoc are read.At this point all data for the document is known. For the documents to be split, only the clearing lines are missing. For the vendor posting, item 1 is reserved. At this point it time, it is still incomplete. If you want to add data, that is not filled in the standard system (for example, the segment text), add the respective entry to table DOCUMENT_DATA.
An example for the segment text for the vendor line item:
STYPE = 'P', COUNT = 1, FNAM = 'BSEG-SGTXT', FVAL = <your text>

The exit contains the following information:
- Control record information (in table IDOC_CONTRL)
- the index of the current IDoc in IDOC_CONTRL_INDEX (usually
  irrelevant, since at present the IDocs are always processed separately)
- the complete IDoc data (segment name, segment data in IDOC_DATA)
- all header and item data for the document (except for vendor and
  clearing items (in DOCUMENT_DATA)
- all tax data (in TAX_DATA)
- all additional account assignments for CO, CO-PA and business area
  (in ADDITIONAL_DATA). Changes in this table, however,
  no longer have any effect on the document, since the processing of the
  items has already been completed.

Name of function module: EXIT_SAPLIEDI_102

You can obtain additional information from the documentation for the corresponding function module using Transaction SE37.
If you find the documentation does not exist in your own language, you should read Note 126192.



--
Ankur Bhandari.
SAP Consultant

Friday, March 20, 2009

Enable password saving in SAPLOGON shortcut

Standard SAP GUI doesn't allows to save password in the shortcuts. This can be achieved by doing these two steps.
1.) Executing sapshcut.exe which normally exists at C:\Program Files\SAP\FrontEnd\SAPgui.
Once this step is done then the variables which needs to be modified in REGEDIT are available for editing.
2.) Go to Command Prompt and type in REGEDIT -> HKEY_CURRENT_USER --> Software --> SAP --> SAPShortcut --> Security, Change the variable Enable Password from O to 1.
 
 
Regards,
Ankur Bhandari
 
 

Tuesday, March 17, 2009

sapnote_0000842318.pdf

Open the fields for Substitution GGB1

Many times Fields will not be readily available for Substitution like for example BKPD-BUDAT is not available for substitutuon but however if we need this field to be substituted. SAP provides a table which decides which field is available for substitution in GGB1. The table name is GB01 and the Maintenance view VWTYGB01 to remove the exclude field check can be achieved.
 
Regards,
Ankur Bhandari
 

Wednesday, March 04, 2009

ABAP Program to fix Released Transport tasks.

*&---------------------------------------------------------------------*
*& Report  YBAS_TRANS_FIX
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  YBAS_TRANS_FIX.
 
* this program helps to fix some problems with tasks that have been
* released but are not setup correct.
* be carefull what you do and make shure you understand what the
* problem was, in the first place.
*
TABLES: TLOCK, E070, E070C, TDEVC.
PARAMETERS: CORRNR LIKE TLOCK-TRKORR.
parameters: newmand like sy-mandt.
PARAMETERS: NEWdev LIKE TADIR-DEVCLASS.
PARAMETERS: KNOWIT AS CHECKBOX.
PARAMETERS: TARdum AS CHECKBOX DEFAULT ' '.
PARAMETERS: CHTARCLI AS CHECKBOX DEFAULT ' '.
PARAMETERS: SRCCLI AS CHECKBOX DEFAULT ' '.
PARAMETERS: DELLOCK AS CHECKBOX DEFAULT ' '.
PARAMETERS: DISLOCK AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETLOCA AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETTRAN AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETTRCP AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETCORR AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETREPA AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETDEVC AS CHECKBOX DEFAULT ' '.
PARAMETERS: SETOWN  AS CHECKBOX DEFAULT ' '.
PARAMETERS: relcorr AS CHECKBOX DEFAULT ' '.
PARAMETERS: reltran AS CHECKBOX DEFAULT ' '.
 
IF KNOWIT <> 'X'.
   EXIT.
ENDIF.
IF DISLOCK = 'X'.
   SELECT * FROM TLOCK WHERE TRKORR = CORRNR.
   WRITE: / '* lock entry: ', TLOCK-OBJECT, TLOCK-TRKORR, TLOCK-AUTHOR .
   IF DELLOCK = 'X'.
     DELETE TLOCK.
   ENDIF.
   ENDSELECT.
ENDIF.
 
IF TARdum = 'X'.
   SELECT * FROM E070 WHERE TRKORR = CORRNR.
     WRITE: / '* e070 entry: ', E070.
     MOVE 'DUM' TO E070-TARSYSTEM.
     MODIFY E070.
     WRITE: / '* e070 entry: ', E070.
   ENDSELECT.
ENDIF.
 
IF CHTARCLI = 'X'.
  SELECT * FROM E070C WHERE TRKORR = CORRNR.
    WRITE: / '* e070C entry: ', E070C.
    MOVE newmand TO E070C-TARCLIENT.
    MODIFY E070C.
    WRITE: / '* e070C entry: ', E070C.
  ENDSELECT.
ENDIF.
 
IF SRCCLI = 'X'.
  SELECT * FROM E070C WHERE TRKORR = CORRNR.
    WRITE: / '* e070C entry: ', E070C.
    MOVE newmand TO E070C-CLIENT.
    MODIFY E070C.
    WRITE: / '* e070C entry: ', E070C.
  ENDSELECT.
ENDIF.
 
IF SETLOCA = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'L' TO E070-TRFUNCTION.
    MOVE 'L' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
IF SETTRAN = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'K' TO E070-TRFUNCTION.
    MOVE 'L' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
IF SETTRCP = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'T' TO E070-TRFUNCTION.
    MOVE 'L' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
IF SETREPA = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'R' TO E070-TRFUNCTION.
    MOVE 'D' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
IF SETCORR = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'S' TO E070-TRFUNCTION.
    MOVE 'D' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
IF relcorr = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'S' TO E070-TRFUNCTION.
    MOVE 'R' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
IF reltran = 'X'.
  SELECT * FROM E070 WHERE TRKORR = CORRNR.
    WRITE: / '* e070 entry: ', E070.
    MOVE 'K' TO E070-TRFUNCTION.
    MOVE 'R' TO E070-TRSTATUS.
    MODIFY E070.
    WRITE: / '* e070 entry: ', E070.
  ENDSELECT.
ENDIF.
 
 
 
* if setdevc = 'X'.
*  select * from tdevc where devclass = newdev.
*    write: / '* tdevc entry: ', tdevc.
*    move '   ' to tdevc-intsys.
*    move '   ' to tdevc-consys.
*    move '    '  to tdevc-pdevclass.
*    move ' '  to tdevc-korrflag.
*    modify tdevc.
*    write: / '* tdevc entry: ', tdevc.
*  endselect.
*  commit work.
* endif.
 
IF SETOWN = 'X'.
   SELECT * FROM E070 WHERE TRKORR = CORRNR.
     WRITE: / '* e070 entry: ', E070.
     MOVE SY-UNAME TO E070-AS4USER.
     MODIFY E070.
     WRITE: / '* e070 entry: ', E070.
   ENDSELECT.
ENDIF.
 
p.s: Courtesy Rene M for sharing this.

Monday, March 02, 2009

Usage and Benefits of Parallel Cursor in ABAP

Conventional Method
loop at lt_vbpa into wa_vbpa.  
loop at lt_kna1 into wa_kna1 where kunnr = wa_vbpa-kunnr.
****** Your Actual logic within inner loop ******
endloop.
endloop.
Parallel Cursor Method.
sort: lt_vbpa by kunnr, "Sorting by key is very important
lt_kna1 by kunnr. "Same key which is used for where condition is used here
loop at lt_vbpa into wa_vbpa.
read lt_kna1 into wa_kna1 " This sets the sy-tabix
with key kunnr = wa_vbpa-kunnr
binary search.
if sy-subrc = 0. "Does not enter the inner loop
v_kna1_index = sy-tabix.
loop at lt_kna1 into wa_kna1 from v_kna1_index. "Avoiding Where clause
if wa_kna1-kunnr <> wa_vbpa-kunnr. "This checks whether to exit out of loop
exit.
endif.

****** Your Actual logic within inner loop ******

endloop. "KNA1 Loop
endif.
endloop. " VBPA Loop
Regards,
Ankur Bhandari

Sunday, March 01, 2009

Avoid Log out and Log in after changes ...

Whenever any changes were made to the user authorizations, normally it is required to log-out
and log-in again to make these changes effective. Here is an alternative:

Execute the report RSUSR405 in SE38. This would refresh all user-related buffers and changes
to the authorizations are made effective immediately.

--
Ankur Bhandari.

iDoc special reports

1) RBDMANIN - Start Error Handling for Non-Posted IDocs

Description: This report attempts to post the inbound IDocs with status '51' (Application document not posted)

2) RBDAGAIN - Process Outbound IDocs with Errors Again

Description: This report reprocesses outbound IDocs which contain errors. IDocs containing errors have one of the following statuses:

  • 02: Error transmitting data to port
  • 04: Error in EDI subsystem control information
  • 05: Error in conversion
  • 25: Continue processing despite syntax error (outbound)
  • 29: Error in ALE service

3) RBDAGAIE - Reprocessing of Edited IDocs

Description: This report reprocesses an edited IDoc in inbound or outbound processing. The edited IDoc has one of the following statuses:

  • 32: IDoc edited (outbound)
  • 69: IDoc edited (inbound)

4) RBDAGAI2 - Re-processing of IDocs after ALE Input Error

Description: You use this report to reprocess inbound IDocs containing errors. IDocs containing errors have one of the following statuses:

  • 56: IDoc containing errors added
  • 61: Continue processing despite syntax error (inbox)
  • 63: Error passing IDoc to the application
  • 65: Error in ALE service

5) RBDAPP01 - Inbound Processing of IDocs Ready for Transfer

Description: Report for processing inbound IDocs not passed to the application immediately. This report forwards all IDocs with:

  • Status 64 "ready to be passed to application"
  • Status 66 "IDoc is waiting for predecessor IDoc (serialization)



Saturday, February 28, 2009

Workflow: Change defaults


Sometimes the Workflow steps are not available for drag and download. This can be achieved by changing the default setting from
SWDD --> Extras -->Options --> Check Normal Drag & Drop Procedure.
Regards,
Ankur Bhandari

Thursday, February 26, 2009

Security Tip: RSCSAUTH

Authorization Group

Authorization group to which the program is assigned.

The assignment of a program to an authorization group plays a role when the system checks whether the user is authorized to:

  • Execute a program
    --> Authorization object S_PROGRAM
  • Edit a program (-Include) in the ABAP Workbench
    --> Authorization object S_DEVELOP

Programs that are not assigned to an authorization group are not protected against display and execution.
Security-related programs should, therefore, always be assigned to an authorization group.

Report RSCSAUTH can also be used to assign programs to authorization groups. This report is documented in detail.

 
Regards,
 

Tuesday, February 24, 2009

Debug programs in background

Debug programs in background
 
Steps
1. Create variant called BACKGROUND for program to be debugged.
2. Execute ZDEBUGBG (pgm code below) in background for immediate processing.
3. Execute transaction SM50.
4. Select process that runs ZDEBUGBG.
5. Goto 'Program/Session' 'Program' 'Debugging'.
A se80 debug session will open.
6. Change variable W_EXIT to 'E'.
7. Step thru (F6) until ZWBTEST comes up.

Wala



*&---------------------------------------------------------------------*
*& Report ZDEBUGBG *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT zdebugbg.

DATA:
w_exit TYPE c.

FIELD-SYMBOLS <fs> TYPE ANY.

SELECTION-SCREEN BEGIN OF BLOCK one.
PARAMETERS: p_repid LIKE trdir-name DEFAULT 'ZWBTEST'.
SELECTION-SCREEN END OF BLOCK one.

START-OF-SELECTION.
PERFORM loop_time.
PERFORM submit_time.

END-OF-SELECTION.

*---------------------------------------------------------------------*
* FORM loop_time *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM loop_time.
DO.
IF w_exit = 'E'.
EXIT.
ENDIF.
ENDDO.
ENDFORM.

*---------------------------------------------------------------------*
* FORM submit_time *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM submit_time.
ASSIGN p_repid TO <fs>.
SUBMIT (<fs>)
USING SELECTION-SET 'BACKGROUND'.
ENDFORM.
 
 

Thursday, September 07, 2006

Find print programs...

Another way to find.

1.) GO to Se71 --> Enter the sapscript name.

2.) Press Display/ F7

3.) Click on Menu FORM --> CHECK --> TEXTS ---> Enter

4.) Wow it gives you all the associated print programs with this Sapscript.

 

Regards,

Ankur Bhandari.

 

 

Purchase Order texts in table

T166K: Header Texts in Purchasing Document Printouts

 

Regards,

Wednesday, August 16, 2006

Add your own texts to the logon screen

You can add your own texts to the logon screen in different ways. For more information, see SAP Note 205487

 

 

 

Logo on screen...

You can attach an image such as your company logo to the right side of the screen. This image can be assigned throughout the system and is valid for all clients. Given that you have authorization to do so, you can find a detailed description of the settings that are required to do this by choosing Extras --> Administration information. Please note that the graphic is stored in the system and transported to the front-end every time SAP Easy Access is called. Although it is transported in compressed form, the graphic should not exceed 20 KB. You can also prevent the graphic from being called by choosing the setting Low Speed Connection in the SAP Logon program (see SAP Note 161053), or by choosing Extras --> Settings in the SAP Easy Access screen. See also "User Settings".

 

 

Wednesday, May 31, 2006

Useful exits

CUST1        MENUS000+C01            Customer option in the Office menu
CUST2        MENUS000+C02            Customer option in the Logistics menu
CUST3        MENUS000+C03            Customer option in the Accounting menu
CUST4        MENUS000+C04            Customer option in the Human Resources menu
CUST5        MENUS000+C05            Customer option in the Information Systems menu
CUST6        MENUS000+C06            Customer option in the Tools menu
CUST7        MENUS000+C07            Customer option in the System menu

ZXUSRU01    Exit_saplsusf_001   At login time
SAPMF02D    Exit_sapmf02d_001   When saving customer master data
SAPMF02K    Exit_sapmf02k_001   When saving vendor master data
M61X0001    Exit_saplm61c_001   When processing MRP planning
M61X0001    Exit_sapmm61x_001   When processing MRP planning
FYTX0001    Exit_saplv61a_001   Modifications in pricing procedures
MBCF0002    Exit_sapmm07m_001   Checks for materials documents
SDVFX002    Exit_saplv60b_002   Link between SD and FI documents
M06B0003    Exit_sapmm06b_001   When saving MM documents

Regards,
Ankur Bhandari
SAP Consultant.
+1 847 636 0883(c)
+1 847 578 2568(w)








 
 Cardinal Health -- Working together. For life. (sm) _________________________________________________  This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.  Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email 

Exit at logon time ...

EXIT_SAPLSUSF_001

Regards,
Ankur Bhandari
SAP Consultant.
+1 847 636 0883(c)
+1 847 578 2568(w)








 
 Cardinal Health -- Working together. For life. (sm) _________________________________________________  This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.  Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email 

Tuesday, May 30, 2006

Useful tables to find a transaction

Useful tables to find a transaction
 SMENSAPT and SMENSAP.

Regards,
Ankur Bhandari

 
 Cardinal Health -- Working together. For life. (sm) _________________________________________________  This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.  Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email 

Friday, May 19, 2006

To popup a message on a user in SAP

RSPOPUP is the program name which can be used,
Also TH_POPUP function module does the same thing

Regards,
Ankur Bhandari








 
 Cardinal Health -- Working together. For life. (sm) _________________________________________________  This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.  Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email 

Thursday, February 02, 2006

Setting Default values in Material Master

Hi,

 

You have following options for setting defaults, evaluate these and implement whichever suits (or in combination):

Option 1: On create material (MM01) screen from Menu path click on à Defaults à Settings

 

à Industry Sector

 

à Organizational Levels

\Here you defaults values for following fields.

Company Code                         

Plant                                

Storage Location                      

Valuation Type                       

Sales Org.             

Distr. Channel    

Warehouse No.                        

Storage Type       

 

Option 2: On a particular field (which you want to default) you can find out the parameter ID associated by clicking F1 (Help) and F9 (Note: F9 works if help is in model dialog box otherwise see Technical Info when you have help in performance assistance).

You can maintain default value for each parameter id in Systems à User Profiles à Own data. Transaction SU3 will be launched.

Click on Parameters tab and maintain the Parameter ID and value. (Be sure to enter Parameter ID all in caps).

This is available for selected fields only.

 

Option3: Use HOLD data SET Data method from System à User Profile à Hold data/Set data when user is running MM01 transaction and wants to save local and temporary defaults. Note that this is a temporary provision and specific to that logon session. It is useful when user needs to populate repeated data while creating material master one after another manually.

 

Option4: Use SHD0 transaction to make a screen variant/ Standard variant / transaction variant. This is very powerful solution, and it can default all in one go.

You can create multiple versions for specific variants so that specific defaults can be stored respective to ROH/ HALB/FERT etc. and use authorization to restrict use of the variant by identified users. (See more info on online help for transaction and screen variants)

 

Should you need more info, Contact.

 

Thanks & regards,

Manish

 

          

 


From: Anant Vasudeo Lokapur
Sent: Wednesday, January 18, 2006 4:29 PM
To: SAP Practice
Subject: Setting Default values in Material Master

 

Hello All

 

There is a client request for populating default values in select Material Master fields (in MM01, list attached)…

 

It would be very helpful if inputs on these, if any, could be mailed…

 

Best Regards

Anant

 

DC APAC – Logistics

China Rollout (MB Passenger CBU)

+91-9845730855

Friday, January 20, 2006

Transaction code authority check

Transaction code authority check

 

 
The following code demonstrates how to check that a user has the correct authority for a particular 
transaction code. Useful to check if a user has the correct authority before executing a transaction via 
BDC input.

 

 

 
authority-check object 'S_TCODE'
                id     'TCD' 
                field  'SM35'.
 
if sy-subrc ne 0.
*   User does not have authority for transaction SM35!!!
endif.

 

 

Regards,

Ankur Bhandari

Authorisation trace analysis 1. Open two sessions

Authorisation trace analysis

1. Open two sessions
2. Execute transaction ST01 in one of the sessions
3. Select the authorisation checkbox, note the other traces 
   you can perform (SQL, RFC, Table Buffer etc)  
4. Click the 'Trace On' button
5. Within your other session execte the transaction/report 
   you want to trace or get the user in question to do it
6. Return to the session where you turned the trace on and 
   click on 'Trace Off' otherwise it will continue to record 
   all athorisation checks
7. Click on the 'Analysis' button
8. Enter appropriate data into selection screen such as 
   Username, type of trace records (i.e. Authorization check)
9. Click on the Execute button. 
10. Report displaying trace results will now be displayed  
 

 

 

Regards,

Ankur Bhandari

Modify thru SE16

Debug SE16 to allow record changes

 

 
If you are not authorised to change table entries or the table has been create without table maintenance 
allowed (all SAP tables), you can still change entries via data browser (SE16) by means of debugging. The 
process is as follows:

 

 

 
1. Display record entries for desired table via SE16 or SE11.
2. Select record which requires updating by highlighting it and pressing the display icon (glasses, F7).
3. Type /h in command box and press enter. 
4. Now press enter again and you should enter debugging mode
5. Change the value of code from ‘SHOW’ to ‘EDIT’, remember to press the ‘change field contents’ 
    icon (pencil) in-order to store new value.
6. Press F8 (execute) to leave debug.
7. You should now have change access to the selected record. 
8. Hit ‘SAVE’ to save any changes. 
9. Remember there is a reason why you can’t do this without debugging it, one reason being that it could 
    introduce inconsistencies in the table data.

 

 

Regards,

Ankur Bhandari

Thursday, January 12, 2006

Tables for transport proposal

CTWFACTLOG                     Transport Proposal: Action Log          

CTWFNUMBER                     Transport Proposal: Number Assignment   

CTWFPROPOS                     Transport Proposal: Header              

CTWFREQUST                     Transport Proposal: Requests for Import 

CTWFTARGET                     Transport Proposal: Target Systems/Target

 

Regards,

Ankur Bhandari

Saturday, January 07, 2006

Transaction SU21 for finding any authorization objects.

Transaction SU21 for finding any authorization objects.

 

Regards,

Ankur Bhandari