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'.
Thursday, October 29, 2009
How to modify any code in Quality or Production without the need for a access key.
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'.
Assign a role to a USER
Report Program to find which transaction was used by which User in the past month.
*----------------------------------------------------------------------
*
* 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.
DATA: BEGIN OF SERVLIST OCCURS 25.
INCLUDE STRUCTURE MSXXLIST.
DATA: END OF SERVLIST.
DATA: BEGIN OF i_APPLICATION_STATISTIC OCCURS 5000.
INCLUDE STRUCTURE SAPWLUSTCX.
DATA: END OF i_APPLICATION_STATISTIC.
DATA: BEGIN OF I_trans_user OCCURS 100,
entry_id like I_APPLICATION_STATISTIC-entry_id,
account like usr21-bname.
DATA: END 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(20) eq 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
Run T-Code in SAP without authority
- ALINK_CALL_TRANSACTION
- C160_TRANSACTION_CALL
- RSDEMO04
Thursday, October 22, 2009
Find the BADI in a different way.
- Enter SE37, display Function Module - SXV_GET_CLIF_BY_NAME.
- Set a BREAKPOINT in call function SXV_ADD_PREFIX .
- 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
![]() |
Thursday, October 01, 2009
Workflow Container.
Wednesday, July 01, 2009
Customizing Directly in Production
- Find the IMG activity which needs to be directly maintained in Production environment.- T549A
- Find the table view – By going to SE11 and we find V_T549a
- Go to SOBJ and find the view – enter V_T549a
- Click Current settings, Save now this Customizing activity will be maintainable in Production environment.
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?
EDI, IDOC_INPUT_INVOIC_FI, SAPLIEDI, OBCC, OBCE, OBCB, INVOIC01, INVOIC02, INVOIC, FEDI0001
Reason and PrerequisitesG/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.
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.
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.
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.
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
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
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
Tuesday, March 17, 2009
Open the fields for Substitution GGB1
Wednesday, March 04, 2009
ABAP Program to fix Released Transport tasks.
*& Report YBAS_TRANS_FIX
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* 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 ' '.
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.
SELECT * FROM E070 WHERE TRKORR = CORRNR.
WRITE: / '* e070 entry: ', E070.
MOVE 'DUM' TO E070-TARSYSTEM.
MODIFY E070.
WRITE: / '* e070 entry: ', E070.
ENDSELECT.
ENDIF.
SELECT * FROM E070C WHERE TRKORR = CORRNR.
WRITE: / '* e070C entry: ', E070C.
MOVE newmand TO E070C-TARCLIENT.
MODIFY E070C.
WRITE: / '* e070C entry: ', E070C.
ENDSELECT.
ENDIF.
SELECT * FROM E070C WHERE TRKORR = CORRNR.
WRITE: / '* e070C entry: ', E070C.
MOVE newmand TO E070C-CLIENT.
MODIFY E070C.
WRITE: / '* e070C entry: ', E070C.
ENDSELECT.
ENDIF.
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.
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.
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.
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.
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.
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.
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.
* 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.
SELECT * FROM E070 WHERE TRKORR = CORRNR.
WRITE: / '* e070 entry: ', E070.
MOVE SY-UNAME TO E070-AS4USER.
MODIFY E070.
WRITE: / '* e070 entry: ', E070.
ENDSELECT.
ENDIF.
Monday, March 02, 2009
Usage and Benefits of Parallel Cursor in ABAP
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.
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
Sunday, March 01, 2009
Avoid Log out and Log in after changes ...
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
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.
Tuesday, February 24, 2009
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.