• Home
  • About me
  • FALV
  • ALV Grid in the nutshell
    • Basic Information
    • Field catalog
  • Articles
    • Tricks
    • FALV (Fast ALV Grid)
    • ALV Grid in the nutshell
    • Tips
    • How to...
    • For beginners
    • Thoughts
  • By Topic
    • ALV
    • ALV OO
    • SALV
    • GOS
    • Selection screen
    • Purchase Requisitions
    • Purchase Orders
    • Attachments
    • Others
    • Characteristics
    • Sample Programs
    • ZIP
    • OLE
    • Mails
    • Routings
    • EWB
    • Excel
  • Keywords
  • RSS
  • Download
  • Home
  • Articles
  • Tricks

How to access private or protected data and methods of CL_GUI_ALV_GRID

Details
Łukasz Pęgiel
Tricks
26 May 2016
Hits: 59631
Tags: CL_GUI_ALV_GRID , IF_ALV_RM_GRID_FRIEND , FALV
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?
 
Add a comment
Read more ...

Send mail in BADI or User-Exit without commiting

Details
Łukasz Pęgiel
Tricks
22 February 2016
Hits: 35994
Tags: CL_BCS , CL_BCS_MESSAGE , SBCS_SEND , SBCS_SEND_UPDATE , RSBCS_EXAMPLE_EMAIL , RSBCS_EXAMPLE_EMAIL_SIMPLE
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.
 
 
Add a comment
Read more ...

WYSIWYG HTML Editor in ABAP

Details
Łukasz Pęgiel
Tricks
20 January 2016
Hits: 31825
Tags: CL_GUI_HTML_VIEWER , GUI HTML EDITOR , ABAP HTML
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.
 
 
Add a comment
Read more ...

The SIN of progress indicator

Details
Łukasz Pęgiel
Tricks
19 August 2015
Hits: 16550
Tags: SAPGUI_PROGRESS_INDICATOR , CL_PROGRESS_INDICATOR , SAP_CONVERT_TO_CSV_FORMAT
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 :-) 
 
Add a comment
Read more ...

Dynamic GUI STATUS & TITLE with ABAP code

Details
Łukasz Pęgiel
Tricks
11 July 2015
Hits: 84727
Tags: DYNAMIC GUI STATUS , GUI STATUS , GUI TITLE , SE41 , SMP_DYNTXT , RSFUNC_TXT
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
"! Used by ZCA_AB_DYNAMIC_GUI
"! 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.
 
Add a comment
Read more ...

GOS - How to add business documents at creation of object

Details
Łukasz Pęgiel
Tricks
25 April 2014
Hits: 64447
Tags: CL_GOS_SERVICE_TOOLS=>MOVE_LINKED_OBJECTS , CL_ALINK_CONNECTION=>FIND , CL_ALINK_CONNECTION=>INSERT , CL_ALINK_CONNECTION=>DELETE , CL_ALINK_CONNECTION=>UPDATE , CL_ALINK_CONNECTION , CL_GOS_SERVICE_TOOLS , CL_GOS_MANAGER
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.
Add a comment
Read more ...

GOS - Link Business Documents from PR to PO

Details
Łukasz Pęgiel
Tricks
25 April 2014
Hits: 21923
Tags: CL_ALINK_CONNECTION=>FIND , CL_ALINK_CONNECTION=>INSERT , CL_PO_HEADER_HANDLE_MM , CL_ALINK_CONNECTION , IF_PURCHASE_ORDER_MM , CL_PO_HEADER_HANDLE_MM->GET_GOS_MANAGER , ME_PROCESS_PO_CUST
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.
Add a comment
Read more ...

ESDUS, ESRUO - MM settings table - Part 3/3

Details
Łukasz Pęgiel
Tricks
14 April 2014
Hits: 28629
Tags: ES_READ_USER_OBJECTS , ES_APPEND_USER_OBJECTS , ES_READ_USER_SETTINGS , ES_APPEND_USER_SETTINGS , ES_DELETE_USER_OBJECTS , ES_SAVE_USER_OBJECTS , ES_SAVE_USER_SETTINGS , ES_DELETE_USER_SETTINGS , ESDUS , ESRUO
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.

data: fs_esruo type esruo.
data: ft_esruo type standard table of esruo.
data: f_active type esdus-active.
data: ft_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 1 into fs_esruo.
  concatenate fs_esruo-object_id 'A' into f_active.

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

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

endif.

call function 'ES_APPEND_USER_SETTINGS'
exporting
  iaction        = 'MEPO'
  ielement       = 'Application         Req_Process'
  iactive        = f_active
*   IUNAME         = IUNAME
  isave          = 'X'
* TABLES
*   IESDUS         = IESDUS
  .

Add a comment
Read more ...

More Articles ...

  1. ESDUS, ESRUO - MM settings table - Part 2/3
  2. ESDUS, ESRUO - MM settings table - Part 1/3
  3. Enhanced MB51 Part 6 - ZMB51 program
  4. Enhanced MB51 Part 5 - Export from MB51
  5. Enhanced MB51 Part 4 - Call MB51
  6. Enhanced MB51 Part 3 - Get selection parameters
  7. Enhanced MB51 Part 2 - Structure for data
  8. Enhanced MB51 Part 1 - Goal and prerequisites
  9. Range to search in lower case fields
  10. Extend allowed runtime of a program
  11. Copy routing (create on a base of existing one)
  12. Create XLSX/MHTML file from internal table in background
  13. Subtotal lines of ALV GRID OO as content separator
  14. Refresh ALV GRID and keep position and current cell
  15. Save message with attachment in Outlook's Drafts
  16. Zipping in IZArc with ABAP directly on PC
  17. Link Attachments of Purchase Requisition to Purchase Order
  18. Free global data of a program at once
Page 2 of 5
  • Start
  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next
  • End


Łukasz Pęgiel
SAP SCRIPT TOOL ACCESS RSDBRUNT COC1 FEATURE CHECK FIELDCATALOG ESRUO - MM settings table - Part 3 GUI ALV GRID EXPORT TO MEMORY ID PURCHASE REQUISITION SET TABLE FOR FIRST DISPLAY LVC FCAT RM07DOCS CTMS DDB HAS VALUES INTERNAL SALV UTIL ALV GRID IN THE NUTSHELL ALV GRID SAP TechEd ZCL CMD CUSTOMER MESSAGE HANDLER VARIANT CONTENTS Why I like to code in ABAP in Eclipse ORDER LEX ADT SIGN RESET REJ ALLOWED OUTLOOK APPLICATION How to teach ABAP Custom selection-screen fields for MD07 MS07 COMPONENTS REFRESH APPEND USER OBJECTS FALV Convert date to and from external date type MB51 ALV POPUP DFIELDNANE MB51 ENHANCEMENT KKEK CONVERT FLOAT CURR HOW TO START WITH ALV SCMS XSTRING BINARY VALUE DELETE Speed-up your Eclipse installation ALV Grid in the nutshell Field catalog - col id - ALV control Column ID OLE2 OBJECT FILL MDLB FROM EBAN Field catalog - domname - Domain name Save message with attachment in Outlook's Drafts CHART ENGINE JSON2ABAPtype The SIN of progress indicator ESRUO CVIC MAP CONTACT SAVE SETTINGS PROGRESS INDICATOR RELATION
  • Laserowe usuwanie blizn Tychy
  • Laserowe usuwanie zmarszczek Tychy
  • Salon Kosmetyczny Tychy
  • Trycholog Tychy
  • Wypadanie włosów Tychy
Tweets by abapblog

Eclipse Plugins for ABAP

ABAP Favorites

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

ABAP ADT Extensions

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

ABAP Quick Fixes

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

 

Latest Articles

  • ABAP in Eclipse - Install, Configure, Use, and Enhance Your ADT
  • ALV Grid in the nutshell: Field catalog - col_id - ALV control: Column ID
  • ALV Grid in the nutshell: Field catalog - dfieldname – Fieldname for column group
  • ALV Grid in the nutshell: Field catalog - Hotspot - ALV control: SingleClick-sensitive
  • ALV Grid in the nutshell: Field catalog - sp_group - Group key
  • ALV Grid in the nutshell: Field catalog - domname - Domain name
  • ALV Grid in the nutshell: Field catalog - reprep - ALV control: Value is selection criterion for rep./rep.intf.
  • ALV Grid in the nutshell: Field catalog - reptext – Heading
  • ALV Grid in the nutshell: Field catalog - lowercase - Lowercase letters allowed/not allowed
  • ALV Grid in the nutshell: Field catalog - intlen - Internal Length in Bytes
  • Downloading Exchange Rates from NBP (National Bank of Poland)
  • Downloading Exchange Rates from Central Bank of Turkey
  • ABAP Extensions - Automatic Logon
  • ALV Grid in the nutshell: Field catalog - inttype - ABAP data type (C,D,N,...)
  • ALV Grid in the nutshell: Field catalog - datatype

Most Read

  • Create XLSX/MHTML file from internal table in background
  • Refresh ALV GRID and keep position and current cell
  • Create XLSX file from internal table in background v2
  • FALV (Fast ALV Grid)
  • ATC Pseudo Comments list
  • Call standard F4 search help with customized parameters
  • Dynamic GUI STATUS & TITLE with ABAP code
  • Create fieldcatalog from internal table
  • Link Attachments of Purchase Requisition to Purchase Order
  • GOS - How to add business documents at creation of object
  • Endless loop in BADI ME_PROCESS_PO_CUST
  • Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 3 - Chart Data and render
  • How to access private or protected data and methods of CL_GUI_ALV_GRID
  • Subtotal lines of ALV GRID OO as content separator
  • Popup with multi-select ALV
feed-image Feed Entries

Latest Comments

ABAP code and articles provided on http://abapblog.com, if it is not statet otherwise, were created by Łukasz Pęgiel. You can use the code in your SAP instance for commercial and non-commercial use without any warranty from side of the author. You cannot sell the code as a full program or a part of it.
Replicating of the articles and code is prohibited unless the agreement of the author is given to you. 

Bootstrap is a front-end framework of Twitter, Inc. Code licensed under MIT License. Font Awesome font licensed under SIL OFL 1.1.