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

OBJECTS_OBJREF_NOT_ASSIGNED

Former Member
0 Likes
11,770

Hi,

I get the above error when a Z program runs in background don't know if it is a program error

I found this solution but it is not clear what to do:

http://www.slashsap.com/2012/07/runtime-error-objectsobjrefnotassigned.html

Thanks

Best regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
9,015

Hello,

First thing is check the statement on which dump has occured.

if it is an object then there will be some statement like for eg. a->b

here a stands for the object ref.

Check for the statement "create object" where this statement is called.

Now using JDBG, run the same job and check if statement "create object" is getting called or not.

If it is getting called then the reference create is cleared either by free object command.

Hope this helps.

24 REPLIES 24
Read only

former_member209120
Active Contributor
0 Likes
9,015

Hi a a,

Please check  OSS note 1061148

Read only

0 Likes
9,015

Hi,

my error is "Dump objects_objref_not_assigned" and not "Dump objects_objref_not_assigned in the SUS ASN"

snote trx says the note is not implementable in my system

Thanks

Read only

former_member213275
Contributor
0 Likes
9,015

Hi,

Can you paste the dump from ST22? The link which you mentioned says that the error is caused by a program with functionality of accessing a file on frontend machine and the program is ran in background because of file is on frontend machine the program fails when program tries to open the file on frontend machine. so eiher move the file to application server while running a background job.

Uploading a flat file that's sitting on a client workstation (Presentation Layer) is not possible. You will either have to execute the upload from the client workstation in foreground mode or FTP the file to the SAP BW application server and then read and load the flat file from there in background mode.

Srikanth.

Read only

0 Likes
9,015

I paste the error analysis

Error analysis

    You attempted to use a 'NULL' object reference (points to 'nothing')

    access a component (variable: " ").

    An object reference must point to an object (an instance of a class)

    before it can be used to access components.

    Either the reference was never set or it was set to 'NULL' using the

    CLEAR statement.

Read only

venkateswaran_k
Active Contributor
0 Likes
9,015

Hi,

It would be better if you paste the Dump message in order to find the error.

Secondly, as per your update,

1. In a background scheduled program, you cannot use any GUI_UPLOAD functions. 

2. You cannot read file from your desktop.

Please review at above points in your program

Regards,

Venkat

Read only

Former Member
0 Likes
9,016

Hello,

First thing is check the statement on which dump has occured.

if it is an object then there will be some statement like for eg. a->b

here a stands for the object ref.

Check for the statement "create object" where this statement is called.

Now using JDBG, run the same job and check if statement "create object" is getting called or not.

If it is getting called then the reference create is cleared either by free object command.

Hope this helps.

Read only

0 Likes
9,015

Hi,

this is the statement where the program fails:

FUNCTION DP_CONTROL_ASSIGN_TABLE.

What do you mean about "using JDBG"?

Thanks

Regards

Read only

0 Likes
9,015

Read Starting and Directly Debugging ABAP Programs in online help.sap.com, look for

Background Jobs:

In the job overview (SM37):

  • Select an inactive job.
  • Enter jdbg in the command line of the system function bar.

But did you look in your z-program for GUI function/class not available ion background ?

Regards,

Raymond

PS: Read text description of FM DP_CONTROL_ASSIGN_TABLE : "Assigning a Structured Table to a Control".

Read only

0 Likes
9,015

Hello,

Kindly read this post:

http://scn.sap.com/thread/1067064

Is this the reason for your problem?

Is your report running fine when executing in foreground?

Read only

0 Likes
9,015

Yes, when running in foreground the program runs correctly

Read only

0 Likes
9,015

Ok but this error is in Z program or in a standard program?

Read only

0 Likes
9,015

You write yourself

I get the above error when a Z program runs in background

So someone in your system used a control oriented FM without checking GUI availabiliy (would not be the first...) this FM starts with a DP_CREATE FM which check if JAVA-GUI or WINDOWS-GUI is available...

Regards,

Raymond

Read only

0 Likes
9,015

I'm telling the above statement because there is also a list of standard programs in ST22 log

Read only

Former Member
0 Likes
9,015

Hello,

Can you please paste the Dump message here,so that we can help you much better.

Thanks

Katrice

Read only

0 Likes
9,015

Hello,

Error analysis is:

    "You attempted to use a 'NULL' object reference (points to 'nothing')

    access a component (variable: " ").

    An object reference must point to an object (an instance of a class)

    before it can be used to access components.

    Either the reference was never set or it was set to 'NULL' using the

    CLEAR statement."

Regards

Read only

Former Member
0 Likes
9,015

The most likely cause for your program to fail in background mode is the fact that you're currently employing static methods such as:

cl_gui_frontend_services=>directory_browse

cl_gui_frontend_services=>directory_exist

cl_gui_frontend_services=>directory_create

cl_gui_frontend_services=>gui_download

Since these methods directly trigger according actions in the SAP GUI (aka frontend) e.g. they check the existence of a directory (directory_exist) in the filesystem of the frontend system (which is the PC that actually runs your SAP GUI).

When you run such a program in batch mode there is no such thing as a frontend (or SAP GUI) - which is the explanation why you get an invalid reference (null) when you use such a method in batch mode.

To solve this issue you should track all cl_gui_frontend_services method calls and find suitable function modules to replace their functionality with plain application level logic (no frontend involved, e.g. UPLOAD function module is not a good idea either)

Regards,

  Chris

Read only

0 Likes
9,015

Hi,

in the abap program I can read the code:

   CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

In this case what fm do I have to change?

I tried to change the above code like this:

  1. FILE_READ_AND_CONVERT_SAP_DATA=>DIRECTORY_LIST_FILES
  2. FILE_READ_AND_GET_TAB=>DIRECTORY_LIST_FILES
  3. ARCHIVFILE_CLIENT_TO_CLIENT=>DIRECTORY_LIST_FILES
  4. ARCHIVFILE_CLIENT_TO_SERVER=>DIRECTORY_LIST_FILES
  5. ARCHIVFILE_CLIENT_TO_TABLE=>DIRECTORY_LIST_FILES

But it won't work:

The type "FILE_READ_AND_CONVERT_SAP_DATA=>DIRECTORY_LIST_FILES" is  unknown.

Is there any FM which could work in a background job?

Read only

0 Likes
9,015

Hi!

The problem you're currently facing is the fact that in batch mode there is no such thing as a presentation layer or frontend since your program is running autonomously in background on the application layer. And this is the reason why all your client-related calls fail.

If you look at this illustration you see a scenario where you as a user communicate with the application layer through the SAP GUI.

All the methods that you listed are relying on the SAP GUI being in place - which for batch execution is not the case.

What you could use is the following scenario:

In this scenario the file(s) that your program uses in batch mode are first put onto an FTP server from where they are retrieved via function module calls such as:

CALL FUNCTION 'HTTP_SCRAMBLE'

CALL FUNCTION 'FTP_CONNECT'

CALL FUNCTION 'FTP_R3_TO_SERVER'

CALL FUNCTION 'FTP_CLIENT_TO_R3'

CALL FUNCTION 'FTP_DISCONNECT'

Regards,

  Chris

Read only

0 Likes
9,015

Hi,

ok, it is clear by a basis point of view but when I change "CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES" into

"ARCHIVFILE_CLIENT_TO_SERVER=>DIRECTORY_LIST_FILES", 

the program generates the error ARCHIVFILE_CLIENT_TO_SERVER=>DIRECTORY_LIST_FILES" is  unknown.

Thanks

Regards

Read only

0 Likes
9,015

Hi,

Which means that file is not supported by GUI.

Srikanth.

Read only

0 Likes
9,015

ARCHIVFILE_CLIENT_TO_SERVER is a function module and not a class, so there cannot possibly exist any methods for it.

Unfortunately there is no 1:1 transition from the various CL_GUI_FRONTEND_SERVICES methods to application layer based methods or function modules.

One - admittedly - very simple way to solve your problem would be to upload a file to the application layer (transactions AL11, CG3Y, CG3Z) and then read it locally using OPEN DATASET ... FOR INPUT.

Regards,

Chris

Read only

0 Likes
9,015

Ok,

I verified AL11, from this trx I can see system could upload only bin or asc files.

Not clear if CG3Z could work as background job and with many pdf files at the time

Is there any way to do the same with pdf files?

I also find this post but it seems not possible to use the program suggested to upload pdf files

http://scn.sap.com/thread/1048375

Thanks

Best regards

Read only

0 Likes
9,015

AL11 is the transaction to define and maintain user defined directory locations (directory parameters) on your application layer where you can store and retrieve files (regardless of their type, e.g. PDF, XLS etc.).

This is only creates a mapping between a directory parameter and a physical directory on your SAP server. The entry can later be retrieved from the table USER_DIR. For further explanations see below.

You're free to reuse an existing one (such as DIR_TRANS for instance) or create one of your own choosing (using <SHIFT>+<F1>) - if you decide to create your own, talk to your base admin first because he/she will need to create the physical directory for you.

To place a file in that directory prior to processing you can use transaction CG3Z (bin transfer mode is ok for almost all file types including PDF)

Please note: CG3Z also utilizes the presentation layer (frontend) and therefore won't work in batch mode!

As stated earlier if you have to operate the program entirely in batch mode you should consider to retrieve the file from an FTP or an NFS server - again your base admin sure can help you with this.

Assuming that you now have the file on the application layer's file system you can determine the physical path associated with the directory parameter by using this short statement:


SELECT SINGLE dirname INTO lv_physical_path FROM user_dir WHERE aliass = 'DIR_TRANS'


At first sight this seems to be a bit over-complicated but has the huge advantage, that the directory can be physically moved around the server and all that needs to be adapted is the directory parameter - no code changes etc.

So once you've got your physical path all you need to do is concatenate the file name to it and open it by

CONCATENATE lv_physical_path '/my_document.pdf' INTO lv_physical_path.

OPEN DATASET lv_physical_path FOR INPUT IN BINARY MODE.

" do something

CLOSE DATASET lv_physical_path.

Hope that helps.

   Chris


Read only

0 Likes
9,015

Hi,

Use FM  "C13Z_FILE_UPLOAD_ASCII"  to upload file to application server in batch mode then use open data set read dataset and close data set.

Srikanth.