Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

how to check z-program used memory/buffer cleared or not after executed the program.

0 Kudos

Hi Experts,

I have an issue with excel upload, as per my requirement i need to read more then 10K the records from excel. So I copied the ALSM fm(ALSM_EXCEL_TO_INTERNAL_TABLE) into the z-ALSM. Accordingly i have changed the source code in the FM. So now every thing working fine. now i am able to read the records more than 10K from excel.

But the problem is If I run the z-program more (2 or 3) times continuously. upload is failing, even single record also not reading from the excel. I checked the standard code inside the FM. there is clipboard import method is failing to read the records check in below code and previously i thought excel clipboard was not cleared. But the excel clipboard is cleared by the method: cl_gui_frontend_services=>clipboard_export by passing empty excel_tab internal table inside the standard code itself.
If i restarted/shutdown my sap gui logon and again i tried to upload the records from excel, it is working fine. Could you please me on this issue. while restarting the sap gui logon which memory/buffer is cleared?. and also while executing /after executed the z-program, is there any possibility to monitor the z-program used memory cleared or not in sap. could you Please help on this issue this is urgent.

* read clipboard into ABAP

   CALL METHOD cl_gui_frontend_services=>clipboard_import


       data       = excel_tab


       cntl_error = 1

*     ERROR_NO_GUI         = 2


       OTHERS     = 4.

   IF sy-subrc <> 0.

     MESSAGE a037(alsmex).


Thanks & Regards



Active Contributor
0 Kudos

How is the upload failing? Is there any sy-subrc code from clipboard_import? And if yes, what is in system message? Or it is just empty excel_tab?

You can try cl_gui_cfw=>flush before import. But it is called automatically after clipboard_export....

-- Tomas --

0 Kudos

Hi Tomas,

Thanks for your response,

I tried your suggested method cl_gui_cfw=>flush before clipboard_import method but the issue is not solved and also after the execution of clipboard_import method  sy-subrc is zero. which means success and but the import parameter of method,the internal table(excel_tab) is empty.                       Please help on this.



0 Kudos


I have used FM TEXT_CONVERT_XLS_TO_SAP to upload more than 1lac records in single run successfully. You may try it.

If still issue is there, please check system buffers.

0 Kudos

Hi Rachit,

Thanks for your response.

Yes we can upload by this FM TEXT_CONVERT_XLS_TO_SAP, but my requirement is, I need to read the records to internal table from multiple sheets from same excel file, that's why I choose ALSM fm copied into z-fm.



Former Member
0 Kudos

Are you up-to-date with your SAP GUI? The issue sounds like there is a buffer problem in the SAP GUI program.

0 Kudos

Hi Armin,

Thanks for your response,

In my system SAP GUI version is 7.30 and Patch level 13. Could you please help on this how to solve this problem in sap gui program.



0 Kudos

Well, the most recent version for SAP GUI 7.30 is patch level 15. But there is also a new version 7.40. Can you update the SAP GUI and check the behavior again? Maybe the issue is already solved by a more recent version/patch level.

Active Contributor
0 Kudos

Are you sure the problem comes from clipboard, check that the Excel is actually running and has selected and copied some data to the clipboard, check every return code during OLE2 call?


  • Check for not fully closed Excel sessions in your station (Ctrl+Alt+Del)
  • Check your SAP GUI and Excel installations



0 Kudos

Hi Raymond,

Thanks for your response,

Yes i am sure the clipboard method is not reading the records from the excel. and also i have checked in my system(Ctrl+Alt+Del), no excel extensions are opened. My SAP GUI version is 7.30 and Patch level 13.

Imp Note: when this issue occurred, for testing purpose, i have uploaded the excel file with less records around 9 thousand records. So in this case the clipboard method is reading the records.  But as per my requirement excel file each time contains the records more than 30 thousand.                            

As above mentioned details i.e If we restart/shut down the SAP GUI LOGON then I can able to upload excel file which contains more 30 thousand records. Could you please help on this.