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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax Error, don't know how to solve

Former Member
0 Kudos

I've got an syntax error in the following report. The compiler says: "SPACE" could not be interprated.

It focus this code section:

 

rp-provide-from-last p0001 space keyda keyda.
rp-provide-from-last p0002 space keyda keyda.

Here you can see the complete report:



*&---------------------------------------------------------------------*
*& Report  Z_SAP_HR_LDAP                                               *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  Z_SAP_HR_LDAP USING DATABASE PNP.

DATA: PLVAR            LIKE OBJEC-PLVAR,
      OBJID            LIKE HROBJECT-OBJID,
      KEYDA            LIKE PLOG-BEGDA,
      P_OBJECTS        LIKE HROBJECT OCCURS 0,
      P_OBJECTS_WA     LIKE HROBJECT,
      S_OBJECTS        LIKE HROBJECT OCCURS 0,
      S_OBJECTS_WA     LIKE HROBJECT,
      I1001_ITAB       LIKE P1001 OCCURS 0 WITH HEADER LINE,
      I1001_ITAB2      LIKE P1001 OCCURS 0 WITH HEADER LINE,
*      LDAPDESTINATION LIKE LDA_TYPES-LDAPDESTINATION,
*      LDAPSERVER LIKE LDA_TYPES-LDAPSERVER,
      ldapinitialrun like lda_types-flag,
      LOGSYS LIKE TBDLS-LOGSYS,
      ERRORS LIKE BAPIRET2 OCCURS 0,
      ERRORS_WA LIKE BAPIRET2.

* structure for short ldap-attributes
* fieldnames must be equal to basis strucutre LDA-ATTR_S (for RFC_CALL)
TYPES:  BEGIN OF TS_LDAP_ATTR_S,
         PERNR LIKE LDA_TYPES-PERNR,
         ATTR_TAB LIKE LDA_TYPES-ATTR_TABNAME,
         ATTR_FIELD LIKE LDA_TYPES-ATTR_FIELDNAME,
         VALUE LIKE LDA_TYPES-VALUE_S,
        END OF TS_LDAP_ATTR_S.

data: attributes type ts_ldap_attr_s occurs 0,
      attributes_wa type ts_ldap_attr_s.

infotypes: 0001, 0002.
tables: pernr, rfcdes.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_TEST default 'X' AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B1.

Parameters: LDAPSRV Default 'SAPHRLDAP' LIKE LDA_TYPES-LDAPSERVER,
            LDAPDEST Default 'LDAPDEST' LIKE rfcdes-rfcdest.

* ---------------------------------------------------------------------
at selection-screen.

clear: p_objects[], s_objects[], attributes[].

CALL FUNCTION 'RH_GET_PLVAR'
 IMPORTING
  PLVAR = PLVAR
 EXCEPTIONS
  no_plvar = 1
  OTHERS = 2.
if sy-subrc <> 0.
 MESSAGE E015(HRLDAP).
endif.
KEYDA = sy-datum.

* --------------------------------------------------------------------
get pernr.

rp-provide-from-last p0001 space keyda keyda.
rp-provide-from-last p0002 space keyda keyda.
ATTRIBUTES_WA-PERNR = p0001-pernr.

* lastname
 attributes_wa-attr_tab = 'EMPLOYEE'.
 attributes_wa-attr_field = 'LASTNAME'.
 attributes_wa-value = p0002-nachn.
 append attributes_wa to attributes.

* firstname
 attributes_wa-attr_tab = 'EMPLOYEE'.
 attributes_wa-attr_field = 'FIRSTNAME'.
 attributes_wa-value = p0002-vorna.
 append attributes_wa to attributes.

* sAMAccountName
 attributes_wa-attr_tab = 'EMPLOYEE'.
 attributes_wa-attr_field = 'SAMACCOUNTNAME'.

* --------------------------------
* Using the employee number a unique name is created
* for the sAMAccountName
* --------------------------------

 concatenate ‘E’ p0001-pernr into attributes_wa-value.
 append attributes_wa to attributes.

* other attributes have to added here.
* for each additional attribute an appropriate field
* has to defined in the structure EMPLOYEE
* for example you can choose the following:
*
* attributes_wa-attr_tab = 'EMPLOYEE'.
* attributes_wa-attr_field = 'TELEPHONE'.
*
* if you want to transfer the telephone number
* of an employee from SAP HR to Active Directory
* In the web Application Server an appropriate mapping
* has to be defined using transaction LDAP for each new
* attribute (here called TELEPHONE).
* ---------------------------------------------------------------------

end-of-selection.

* get own logical system
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
 IMPORTING
  OWN_LOGICAL_SYSTEM = LOGSYS
 EXCEPTIONS
  OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1
  OTHERS = 2.

IF SY-SUBRC NE 0.
* TODO: Komprimierung sy-mandt: 3 -> 2 Stellen !!!
  CONCATENATE SY-SYSID SY-MANDT INTO LOGSYS.
ENDIF.

loop at attributes into attributes_wa.
 write: / ATTRIBUTES_WA-PERNR , attributes_wa-attr_tab.
 write: attributes_wa-attr_field ,attributes_wa-value.
endloop.

IF P_TEST = 'X'.
 EXIT.
ENDIF.

* ---------------------------------------------------------------------
* send attributes to ldap client
* send attributes
CALL FUNCTION 'SPLDAP_RECEIVE_ATTRIBUTES'
 DESTINATION LDAPDEST
EXPORTING
     LOGSYS = LOGSYS
     SERVERID = LDAPSRV
     ATTRIBUTES_S = attributes[]
     INITIAL_RUN = LDAPINITIALRUN
*      ATTRIBUTES_L = TOTAL_ATTRS_L[]
*      ATTRIBUTES_X = TOTAL_ATTRS_X[].
IMPORTING
 RETURN = ERRORS[].

IF NOT ERRORS[] IS INITIAL.
  READ TABLE ERRORS INDEX 1 INTO ERRORS_WA.
  MESSAGE ID ERRORS_WA-ID TYPE ERRORS_WA-TYPE
   NUMBER ERRORS_WA-NUMBER
   WITH ERRORS_WA-MESSAGE_V1 ERRORS_WA-MESSAGE_V2
        ERRORS_WA-MESSAGE_V3 ERRORS_WA-MESSAGE_V4.
ENDIF.

14 REPLIES 14

suresh_datti
Active Contributor
0 Kudos

Hi Christopher,

What version are you on ? it looks interesting.. I have been using the same statement ie

'rp-provide-from-last p0001 space pn-begda pn-endda.' from 3.1h to 47 ext2 and never had any syntax errors . the problem is probably elsewhere. I would comment those two statements & try to compile.. and go from there..

Good Luck,

Suresh Datti

Former Member
0 Kudos

Move the "tables" statement up -- before the "infotypes" statement.

Kshitij

0 Kudos

@Kshitij Devre

The syntax error still exists. Some more ideas where the error can be? I've got no idea.

0 Kudos

Hi Christoph,

Why don't replace the space with ' ' and see if it compiles?

rp-provide-from-last p0001 ' ' keyda keyda.

Good Luck,

Suresh Datti

0 Kudos

I've copied/pasted your code in my system. It is working fine. We are on 46c. I'm not familiar with logical databases, could you use the literal ' ' instead?



rp-provide-from-last p0001 ' ' keyda keyda.
rp-provide-from-last p0002 ' ' keyda keyda.

Regards,

Rich Heilman

0 Kudos

I did the same thing(in 46c) but I got a different syntax error "'E'" is not defined as a data...."

This is coming at the concatenate statement in your code. So how come we are all getting different results?

What logical database does the program refer to? Check in table TRMAC to see what code lines you have in there for this macro. See if it makes sense.

I am baffled.

Srinivas

0 Kudos

Hi Christoph,

Can you please verify the attributes and see if your Program is tied to the Logical Database PNPCE? If so, change it to PNP & you should be fine.

Good Luck,

Suresh Datti

0 Kudos

Thanks for your help. I solved the problem with changing the logical database to PNP. Now the following error occurs:

"programm ... is not registered"

On an erlier test the following error occurs:

"SLDAP_RECEIVE-ATTRIBUTES is not available"

What did i wrong? The second error came only once.

0 Kudos

the second error was obviously a typo. ie '-' instead of '_' in 'SLDAP_RECEIVE_ATTRIBUTES'.

Can you cut & paste your complete code & the error you are currently getting?

Good luck,

Suresh Datti

0 Kudos

If i test this report, he can access the HR employee data an read my selection but if i run it really the following error occurs:

Laufzeitfehler CALL_FUNCTION_OPEN_ERROR

aufgetreten am 10.05.2005 um 22:22:26

"program LDAP_SAP_ADS_DC_1 not registered" / &CT.

He stands at the following line:

> CALL FUNCTION 'SPLDAP_RECEIVE_ATTRIBUTES'

I think it's a problem with that function.

I found this function in my R/3 System.

0 Kudos

Try testing the function module 'SPLDAP_RECEIVE_ATTRIBUTES' in SE37 and seei you can get a successful LDAP connection to the server.

Suresh

0 Kudos

Yes i can connect to the LDAP Server.

0 Kudos

The Report is running. The errors are history. But now the function SPLDAP_RECEIVE ATTRIBUTES is not available. I've got this function in my system. Why can't he communicate with this function?

0 Kudos

Hi,

I am experiencing the same problem, did you found out how to solve this issue?

many thanks,

Nathalie