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

syntax error

Former Member
0 Likes
1,127

hi all,

i've used the code below to output text from a HR infotype text field in adhoc query. However, i'm getting a syntax error,

"LIKE" expected, not "LINE", when i run a code check for this, can anyone assist? thanks, Code below:

DATA:

lrf_message_handler TYPE REF TO if_hrpa_message_handler,

lt_text_tab TYPE hrpad_text_tab ,

lv_string TYPE string .

FIELD-SYMBOLS:

<hrpad_text> LIKE LINE OF lt_text_tab.

IF P0016-ITXEX IS NOT INITIAL.

CALL FUNCTION 'HR_ECM_READ_TEXT_INFOTYPE'

EXPORTING

pernr = pernr-pernr

infty = '0102'

begda = p0102-begda

endda = p0102-endda

message_handler = lrf_message_handler

IMPORTING

text_tab = lt_text_tab.

LOOP AT lt_text_tab ASSIGNING <hrpad_text>.

CONCATENATE lv_string <hrpad_text> INTO lv_string.

ENDLOOP.

zhr_infotype_text = lv_string.

ELSE.

CLEAR zhr_infotype_text.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,069

DATA:

lrf_message_handler TYPE REF TO if_hrpa_message_handler,

lt_text_tab TYPE hrpad_text_tab ,

lv_string TYPE string .

FIELD-SYMBOLS:

<hrpad_text> LIKE LINE OF lt_text_tab.

change to <hrpad_text> type hrpad_text_tab.

Your internal table and your field symbol use the same TYPE....

8 REPLIES 8
Read only

Former Member
0 Likes
1,069

If hrpad_text_tab is a table type then your code seems to be correct. Perhaps save and activate it? What line does the syntax error occur?

Read only

Former Member
0 Likes
1,070

DATA:

lrf_message_handler TYPE REF TO if_hrpa_message_handler,

lt_text_tab TYPE hrpad_text_tab ,

lv_string TYPE string .

FIELD-SYMBOLS:

<hrpad_text> LIKE LINE OF lt_text_tab.

change to <hrpad_text> type hrpad_text_tab.

Your internal table and your field symbol use the same TYPE....

Read only

0 Likes
1,069

hi dave,

thanks for that. getting another error message now:

Statement concluding with "...ASSIGNING" ended unexpectedly.

code now as follows:

DATA:

lrf_message_handler TYPE REF TO if_hrpa_message_handler,

lt_text_tab TYPE hrpad_text_tab ,

lv_string TYPE string .

FIELD-SYMBOLS:

<hrpad_text> type hrpad_text_tab.

IF P0102-ITXEX IS NOT INITIAL.

CALL FUNCTION 'HR_ECM_READ_TEXT_INFOTYPE'

EXPORTING

pernr = pernr-pernr

infty = '0102'

begda = p0102-begda

endda = p0102-endda

message_handler = lrf_message_handler

IMPORTING

text_tab = lt_text_tab.

LOOP AT lt_text_tab ASSIGNING .

CONCATENATE lv_string INTO lv_string.

ENDLOOP.

ELSE.

CLEAR zhr_infotype_text.

ENDIF.

zhr_infotype_text = lv_string.

ELSE.

CLEAR zhr_infotype_text.

ENDIF.

Read only

0 Likes
1,069

That doesn't make sense because he obviously wants to use the field-symbol as a workarea for lt_text_tab. If they have the same type this doesn't work. hrpad_text_tab is a table type for HRPAD_TEXT. So the field-symbol should be TYPE HRPAD_TEXT or how he already did it by using the LIKE LINE OF-statement. The error message is either old or generated elsewhere.

Read only

0 Likes
1,069

that's because you didn't specify the field-symbol after ASSIGNING.

Read only

0 Likes
1,069

hi roel/keshav

thanks for your updates. unfortunately, i understand precisely no abap at all!.. how should i amend the code?

Read only

0 Likes
1,069

Your initial code was correct. The last code you wrote here is not. Revert it back to LIKE LINE OF lt_text_tab and activate your sourcecode (CTRL+F3). See if it still gives an error message.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,069

Just goto se11 and check the line type of hrpad_text_tab .

then try

field-symbols:<fs> type <line type of hrpad_text_tab>