cancel
Showing results for 
Search instead for 
Did you mean: 

Error at executing RFC in a dynpro project but not at executing in R3

Former Member
0 Kudos

Hi experts,

I have a problem whit my RFC. When I execute it from the R3 there's no problem, I got the result that I expected. But I conect the RFC in a dynpro project and when I executed it I got an error.

Supose that my RFC receives a USER as parameter and returns me a table of type RPM_TT_ORG_UNIT.

The structure of my RFC is something like this


* First I obtain the position of the user

CALL FUNCTION 'HRHAP_SEL_POSITION_OF_PERSON'
...

* If error
IF SY-SUBRC = 1.
    MOVE: 'E' TO error-msgty,
          '1' TO error-msgno,
          'Postion not found for the user in the UO' TO error-msgv1,
          SY-MSGV1 TO error-msgv2,
          SY-MSGV2 TO error-msgv3,
          SY-MSGV3 TO error-msgv4.
    APPEND error.
  ELSE.
    IF Sy-SUBRC = 2.
      MOVE: 'E' TO error-msgty,
          '2' TO error-msgno,
          'An error not expected has ocurred' TO error-msgv1,
          SY-MSGV1 TO error-msgv2,
          SY-MSGV2 TO error-msgv3,
          SY-MSGV3 TO error-msgv4.
      APPEND error.
  ELSE.

When I executing it from my dynpro project I got the first error 'Postion not found for the user in the UO'. I tought that maybe the USER parameter was not sending correctly, but then I returned the parameter in one of the 4 error messages and turns out that it was sended correctly.

I hope that someone can help me.

P.S Sorry for my english.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ilse,

There is a raised exception in ABAP code which gives dump from Front End DynPro Project.

This raises exception remotely but RFC executes fine when executed from R/3 End.

Put an external breakpoint at CALL FUNCTION 'HRHAP_SEL_POSITION_OF_PERSON'

So as to check why SY-SUBRC = 1 after processing.

Regards,

Hanif

Former Member
0 Kudos

Hi Hanif,

Can you explain me a litle more because I put the external breackpoint in my abap function but when I try to execute my dynpro project, ir executes like it was no breakpoint at all.

I was trying with something else ...

First, I create a web service from my function module from the R/3. When I try the web service it works fine and I though "OK, this is the solution" but when I import the module in my dynpro project it turns out that the destination and metadata is incorrect. I put one that its like the "default" when all the webservices are, but this web service is not located at this destination. Then I try to put another destination where the RFC is located to, but it didn't work.

My second option was to execute it directly from a simple Java Class using the libraries of sap com.sap.mw.jco and it works fine, but we thing that this is no the correct way of executing it. My code is something like this:


mConnection = JCO.createClient (<parameters>);
mConnection.connect();

repository = JCO.createRepository("MiRepository", mConnection);
ftemplate = repository.getFunctionTemplate("Z_RFC_FM".toUpperCase());
myFunction = ftemplate.getFunction();

// Here I pass the parameters hardcoded
myFunction.getImportParameterList().setValue("HCURA841", "USUARIO");
myFunction.getImportParameterList().setValue("50001129","ORGUNITID");

mConnection.execute(myFunction);

// Here I get the result
JCO.Table table = myFunction.getTableParameterList().getTable("SUP_JERARQUICO");

int rows = tabla.getNumRows();
System.out.println("Rows:" + rows);
			
for(int i=0; i<rows; i++){
      // Get the result on the column ONAME
      System.out.println(tabla.getValue("ONAME"));
      tabla.nextRow();
}

I don't know if it could be also a proble o permission of the user.

former_member185879
Active Contributor
0 Kudos

Hello Ortiz,

Is there any specific reason to convert it to WebService? Are you converted it to XI WebService?

Why can't you import the RFC directly in webdynpro and execute it. In this scenario only JCo's are required(Hope SLD is already there) and configure it.

Try and execute, it should work fine. Also keep the breakpoint for the User Configured in JCo.

Regards

Nizamudeen SM

Former Member
0 Kudos

Hi Ilse,

The user ID logged in to set external breakpoint in SAP system and the User ID set in code to execute should be same to set and make external breakpoint work.

Ask your ABAPer to give his UID Password and hard code that in your Java program.

Ask him to login into that system and set the external breakpoint.

Run your application.

Thanks,

Hanif

Former Member
0 Kudos

Hi Hanif,

I use the same user to logued into the R/3 system and to execute the dynpro project but it doesn't work, well the debuguer doesn't start, it just run the dynpro aplication like if there's no breakpoint at the abap function.

I don't know if there's a "special" configuration for the server that allow me to debug a RFC from dynpro or if this is automatic.

Former Member
0 Kudos

Dear Ilse,

Please check the System you have configured in Java code and the client if there are many.

Also check if the method to execute RFC is called by printing some msg statements in the screen.

Regards,

Hanif

Former Member
0 Kudos

Hi Hanif,

I still not able to run the debug. I also maybe explain wrong, the dynpro application is in the SAP Portal and it was developed in SAP Netweaver Development. I just go to the portal to the Content Management to find the dynpro application and just preview it.

Also, I logued to the Portal with the same user id as I loguin to the R/3.

But I was searching a litle more in the ABAP function and I found that the functions that I use have a call to the function RH_READ_INFTY_1001_EXT, and I supose that this function is the one that isn't working fine.

The functions of ABAP that I use are these:

- HRHAP_SEL_POSITION_OF_PERSON

- HRHAP_SEL_ORG_UNIT_OF_POSITION

- HRHAP_SEL_ORG_UNIT_OF_ORG_UNIT

And all of these functions use the function RH__READ_INFTY_1001_EXT_ and loops a table that this function returns. If the function don't return anything then raises an error. So the error most propably is in the function RH_READ_INFTY_1001_EXT.

And I don't know now if it's probably a cuestion of permission to acces de data or something else.

Any suggestions?

Answers (2)

Answers (2)

former_member185879
Active Contributor
0 Kudos

Hello Lise,

What is the USER you are passing while executing RFC?

is that sy-uname or you are passing by having some parameters?

if it is sy-uname then you need to configure the same name in JCo.

if it is parameter from import then you can pass directly that.

Hope it helps, revert for any queries.

I Hope Case Sensitive doesn't matters as RFC will convert it to case sensitive.

Regards

Nizamudeen SM

Edited by: Nizamudeen SM on Dec 20, 2010 11:20 AM

Former Member
0 Kudos

Hi,

Please try to pass the UserID as a hard coded text and also ensure the case sensitivity too.

Kind regards

Saravanan K