Tuesday, September 6, 2011

How to debug pop-up window

The okcode field is deactivated when a modal window (the technical name of popup windows) is displayed, so it seems impossible to enter the debugger (using /H okcode).

In common dialogs, the okcode field is available, so you can type /H to enter debug mode:
however,  it is not available in modal windows (we see it but we can't enter anything in it):

The solution is to create on the frontend a SAPGUI shortcut (file with extension .SAP), of type System Command and command /H, and drag and drop it from Windows desktop to the SAP modal window. You can create the SAPGUI shortcut as explained here:

- Click on the Create shortcut icon on a the toolbar in a SAPGUI session

- In the popup window enter teh values you need, in this case Type = System Command and Command = /H

- Press Finish and a shortcut on the Desktop (or the location you entered) will be created


Easily find BADIs called by any transaction

Several times we wonder what BADIs are available for a particular transaction. Follow the following steps to find out them:

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.

Compare table content between 2 clients

If you need to compare the content of any table between 2 clients (in the same or different environments) you may use transaction SCMP.

Friday, September 2, 2011

Update table content in SE16N

I suppose that most of you already know that you can insert, modify and delete entries in any SAP table from transaction SE16N, but just in case...

Go to SE16N and indicate the table which content you want to change. Then type &SAP_EDIT in command field:
and press INTRO. A message saying that editing fucntion is activated is displayed:

Now if you press F8 to retrieve the entries (of course you can specify any selection criteria), in the display of found entries you will find some buttons to insert, modify, delete or copy entries:


Warning!!!! You should not use this trick to change the content of any SAP standard table. You could use it, in exceptional cases, to change the content of your own custom tables, if necessary.

How to know application documents posted by one IDOC incoming from POS

If you need to get the application documents posted by one inbound IDOC from POS (Point Of Sale) you can use function module POS_SA_GET_DOCUMENT_STATUS. 

This FM is used in standard transaction WPER  (POS Interface Monitor) to show the documents posted as result of integrating an Inbound POS IDOC.

Wednesday, August 31, 2011

Do you need to execute a transaction you are not authorized for?

You need to execute a transaction for which you don't have authorization. You need to test something urgentely and you can wait to be authorized. What can you do?

You can set a breakpoint in function module AUTH_CHECK_TCODE, change the value of a variable when the breakpoint is reached and go on! Let see with an example:

I am not authorized for transaction MB11:


Go to SE37 and display the code of function module AUTH_CHECK_TCODE and set a breakpoint here:

  call 'AUTH_CHECK_TCODE'
       id 'TCODE' field tcode.

  if sy-subrc = 0. <--Set your breakpoint in this line*   auth_check_tcode enthält die Prüfungen von tcode_executable,
*   daher im OK-Fall keine Aufruf nötig.
  else.
    perform tcode_executable using tcode.
*   Keine Berechtigung für Transaktion &
    message i077(s#) with tcode raising not_authorized.
  endif.

This is a system function module, so execution won't stop at one breakpoint on it if you don't have System Debug activated. To activate System Debug: System --> Utilities --> Debug System

Once activated, we execute MB11 and the debugger is started:

Press F8 to continue until breakpoint is reached. When it is reached
double click over sy-subrc to be able to change its value from 4 to 0:

Change sy-subrc field content from 4 to 0, press the button with the pencil:
and F8 to continue with the execution and... 

Great! MB11 transaction's initial screen is showed:

  

Monday, August 29, 2011

How to create an incoming IDOC from ABAP program...

If you need to create an incoming IDOC by code in ABAP program, you can use the following function module: IDOC_INBOUND_SINGLE.

You will have to provide IDOC's Control Record information (parameter PI_IDOC_CONTROL_REC_40: structure parameter of type EDI_DC40) and the content of the IDOC you want to create (parameter PT_IDOC_DATA_RECORDS_40: table parameter with records of type EDI_DD40).