5 1 1 1 1 1 Rating 100% (6 Votes)
Please be aware that accessing private or protected data may have unpredictible consequences! Use it at your own risk.
From time to time, it happens that you want to access private data or methods from CL_GUI_ALV_GRID, which is normally not possible.
When you look into the class definition you'll notice that there is only one global friend - interface IF_ALV_RM_GRID_FRIEND which has no attributes or methods declared. Quite strange, isn't it?
When you'll search were this interface is used then you'll notice that it's helping to get access to private grid data. So why not to use it the same way?
Read more ...

5 1 1 1 1 1 Rating 100% (11 Votes)
Everybody sends mails from SAP, some are still using old FM SO_NEW_DOCUMENT_ATT_SEND_API1 but some CL_BCS class. This class is really powerful but it has one disadvantage - it does commit work, and not only when sending emails but also during adding of attachments. In this case it's really not safe to use this class in BADIs or User-Exits, but there is one replacement for CL_BCS -> CL_BCS_MESSAGE. This class only collects the data, and when send method is run then calling a FM SBCS_SEND with destination NONE, or SBCS_SEND_UPDATE in update task, depending what attributes are passed to the class. It means you can use it also in BADIs or User-Exits where commits are not welcomed.
Read more ...

5 1 1 1 1 1 Rating 100% (8 Votes)
I was lately trying to find an HTML WYSIWYG editor for ABAP, but I failed. I though or this was not needed so far, or the solution was not posted anywhere. So I've tried several times and thanks to NICEdit and this tread on SCN I found the way to make HTML WYSIWYG editor for ABAP.
My editor use CL_GUI_HTML_VIEWER to display NICEdit in container, and then thanks to POST method I put changes back to SAP. ZCL_HTML_EDITOR class, which is attached to this post, raises an event whenever someone click on save button in the editor, so you can easily handle it and then use new HTML for your purposes. Video bellow shows the demo of usage.
Read more ...

5 1 1 1 1 1 Rating 100% (13 Votes)
In my article about cl_progress_indicator I've mentioned that sometimes progress showing is more time consuming than the action which is described by it, so you must be careful when using progress indicator in ABAP. I've said also that it's better to cl_progress_indicator instead of FM SAPGUI_PROGRESS_INDICATOR because of built-in function to show progress only once per 10 seconds. But sometimes when using standard SAP FM we can see that progress showing is taking too much time (like SAP_CONVERT_TO_CSV_FORMAT for example), and as we should not do any modification of the system code then we need to use a small trick to get rid of such progress indicators.
If you look into code of SAPGUI_PROGRESS_INDICATOR then you'll notice that showing of progress depends on parameter called SIN :-) 
Read more ...

5 1 1 1 1 1 Rating 100% (10 Votes)
When you're used to create buttons in ALV Grid dynamically then you think why SAP doesn't allow create dynamically buttons on GUI STATUS. You can change icon or text if you defined that function has dynamic text but you cannot create buttons at runtime and you always have to create GUI STATUS and GUI TITLE in SE41, which personally I don't like, as in most small reports you have to create usually one to five buttons. 
So what I want to present to you today is a way to create buttons dynamically at program runtime without a need to create GUI STATUS and GUI TITLE for each program. In fact whole trick is to create firstly a GUI STATUS in empty program which will contain only functions with dynamic texts, and then to fill properly static class attribute.
So let's begin with creating our program to keep GUI STATUS and GUI TITLE. I will call it ZAB_DYNAMIC_GUI_STATUS. In the source code you do not need to put anything beside report keyword.

"! Dummy program for keeping GUI STATUS and TITLE
"! Do not delete it!!!
report zab_dynamic_gui_status.

Yes, that's all from the code point of view in this program. As said it's only to keep GUI STATUS and GUI TITLE
Lets create GUI STATUS firstly and call it DYNAMIC_STATUS. Items on application toolbar will have the same naming pattern Fxx, so F01, F02 etc. Each of this function code should have dynamic function text with pattern ZCA_AB_DYNAMIC_GUI=>BUTTONS-Fxx where Fxx you have to replace by current function code.
Additionally to application toolbar, fill also function keys for save, up, back, exit, print... etc so you can also use it in your programs.
Read more ...

5 1 1 1 1 1 Rating 100% (4 Votes)
When you open standard transaction you may be surprised sometimes that although you're able to attach standard attachments while creating document, you're not able to attach business document at this time. It's because business documents needs to have specified an object to which it is linked and in case of GOS for standard transactions it's always called without object id (in creation mode). When you develop own transaction and you use GOS for standard or Z object then there is a possibility to omit that restriction, as during creation of GOS manager you can assign temporary object name to it. At save (or after save) you can move attachments and business documents from temporary object to final one. 
The question is what will happen when you'll attach business document to temporary object but you will not save the document at the end? The document itself will be kept so you have to be sure that it will be deleted next archiving run. 
I will show you an example on Purchase Requisition object which is used in Z-tcode.
Read more ...

4.66666666667 1 1 1 1 1 Rating 93% (3 Votes)
In article Link Attachments of Purchase Requisition to Purchase Order I've shown how to link standard attachments from purchase requisition to purchase orders, but to have full set of options we also need a a method to link business documents of PR to PO. This is not so hard as we have in disposition class cl_alink_connection which allows to do such operations. Of course the time when you're copying the link depends on you, you can do it during posting of PO (as I do, to be sure that I will copy only this documents and attachments which are linked to PR's used in the PO ), you can do it after the PO is save with your some background job or you can try to insert the object directly to the GOS of purchase order.  I didn't do direct attachment to GOS of PO but as I mention in the comments of Attachments article you can connect to GOS from class CL_PO_HEADER_HANDLE_MM which contains method GET_GOS_MANAGER. You can do it for example in PROCESS_ITEM method of ME_PROCESS_PO_CUST . You'll need to get header object firstly (type ref to if_purchase_order_mm ) and then call GET_GOS_MANAGER method.
Anyway, I will present you the method which I used in POST method of ME_PROCESS_PO_CUST BADI. As I said, it's quite simple if you know class cl_alink_connection. Firstly we need to check if any business document is attached to PR, I will do it with method cl_alink_connection=>find. Then when we have list of all business documents we can insert link to it to PO with  cl_alink_connection=>insert.
Read more ...

5 1 1 1 1 1 Rating 100% (2 Votes)
As we got a short description of ESDUS and ESRUO and connected FMs in previous parts, then now it's time for examples. Let's start with scenarios which I described in first part
1. When you open one of the MM t-codes like ME22N, ME51N or MIGO you see that always you got on the screen one of the latest open document there. Sometimes not last but one of the lasts and you want to make it always last.
To be sure you get last document you have to select data from ESRUO table directly, sort it by timestamp and get last object. Then update setting of default document for transaction, in my example for ME52N/53N/54N.

datafs_esruo type esruo.
dataft_esruo type standard table of esruo.
dataf_active type esdus-active.
dataft_esduscom type standard table of esduscom.  

select into corresponding fields of table ft_esruo
from esruo
where uname eq sy-uname
  and   object_typ eq 'BUS2105'.
sort ft_esruo by timestamp descending.
  read table ft_esruo index into fs_esruo.
  concatenate fs_esruo-object_id 'A' into f_active.

call function 'ES_READ_USER_SETTINGS'
    iaction       'MEPO'
*   IUNAME        = IUNAME
*   IDB           = IDB
*   ILIKE         = ILIKE
    iesdus        ft_esduscom

  iaction        'MEPO'
  ielement       'Application         Req_Process'
*  iactive        =
*  IUNAME          = IUNAME
*  isave           = 'X'
*   IESDUS          = IESDUS
   not_found       1
   others          2
if sy-subrc eq 0.


  iaction        'MEPO'
  ielement       'Application         Req_Process'
  iactive        f_active
*   IUNAME         = IUNAME
  isave          'X'
*   IESDUS         = IESDUS

Read more ...
Page 2 of 5

ABAP Favorites Eclipse plugin

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client