Mostly SAP related…
ABAP Code
Messages in the WebClient
Jan 26th
I liked the idea of Nigel James to post handy tips for his own future reference. I decided to shamelessly copy him and post some of my own tips here. I will try to post them as I come across them.
So, you can use the code below in a controller class to display messages to the user.
data: lr_msg_service type ref to cl_bsp_wd_message_service,
lv_msg type symsgv.lr_msg_service = view_manager->get_message_service( ).
lv_msg = '<YOUR_MESSAGE_VARIABLE>'.
CALL METHOD lr_msg_service->add_message
EXPORTING
iv_msg_type = if_genil_message_container=>mt_error
iv_msg_id = '<YOUR_MESSAGE_CLASS>'
iv_msg_v1 = lv_msg
iv_msg_number = '<YOUR_MESSAGE_NO>'
iv_important_info = abap_true.My Table Mover(Part 1)
Nov 27th
I am currently doing more development work than I want to or supposed to do. So, I will start this blog on a rather technical note by taking you through a small development I did the other day. Hopefully someone finds this useful.
I needed to move a table from one SAP system to another system in a different landscape. It was the ideal opportunity to do a bit of interesting coding for a change (you can normally do this using a transport, once you get past the bureaucracy).
Now, I am not going to discuss the merits of the program I did develop or if it should even be used in an SAP system. All I am going to say is that changing SAP tables directly is extremely risky and should never be done in Productive Systems. It just turns out that this program was ideal for showing some not so common ABAP techniques.
My requirements definition for the Table Mover were as follows:
- Download multiple tables at once
- Upload multiple tables at once
- Be able to open/edit the downloaded file in Excel
Ok, so in order to meet requirement 1 and 2 I needed to include the table name in download structure. Requirement 3 meant I needed to use tab-delimited text or CSV. So I ended up with the following definition for a line type:

So this program will upload and download files in Ascii format. The first 16 characters will contain the table name and the rest of the row will be table contents in tab delimited format.
The old GUI_UPLOAD, GUI_DOWNLOAD, etc. Function Modules have been flagged as Obsolete in NetWeaver 7.0(AKA 2004s or whatever SAP decides to rename it to in future). Therefore I used the following methods to do my file processing:
- cl_gui_frontend_services=>file_open_dialog
- cl_gui_frontend_services=>gui_upload
- cl_gui_frontend_services=>gui_download
I had to upload and download the files without taking the tab-separator into account because I don’t know the structure of the table until I have uploaded the record.
In the next post I will discuss the details of the uploading and downloading mechanism.
In the meantime, here is the source code of the program. I wrote the program very quickly, so apologies for lack of error checking, testing, structure, etc. Source Code – Table Mover