It is possible. I've done it. But 8051 variants really don't like doing this. If you're interested in why they don't like doing this, read up on Harvard Architecture.
The first reply in the thread you linked actually told you the two different ways this can be achieved. The first, mapping XDATA over your code memory and then using the XDATA assembly instructions to write into that space is more trouble than it's worth. I say this because your micro does contain those "magic instructions" that the poster references.
You need to link in a library that you can get from the Atmel website and then you can make calls to these magic instructions and write to the flash via In-System Programming (ISP) also called In-Application Programming (IAP) in the literature.
Have a look at the datasheet. You should probably read all of Section 24. But the important part is Section 24.10.
24.10 API Call Description
The IAP allows to reprogram a microcontroller on-chip Flash memory
without removing it from the system and while the embedded application
The user application can call some Application Programming Interface
(API) routines allowing IAP. These API are executed by the bootloader.
To call the corresponding API, the user must use a set of Flash_api
routines which can be linked with the application.
Example of Flash_api routines are available on the Atmel web site on
the software application
C Flash Drivers for the AT89C51RD2/ED2
The API calls description and arguments are shown in Table 24-10.
The application selects an API by setting R1, ACC, DPTR0 and DPTR1
All calls are made through a common interface “USER_CALL” at the
The jump at the USER_CALL must be done by LCALL instruction to be able
to comeback in the application.
Before jump at the USER_CALL, the bit ENBOOT in AUXR1 register must be