2010 Feb 19 1:59 PM
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.
2010 Feb 19 2:14 PM
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....
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.
2010 Feb 19 2:09 PM
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?
2010 Feb 19 2:14 PM
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....
2010 Feb 19 2:25 PM
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.
2010 Feb 19 2:27 PM
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.
2010 Feb 19 2:28 PM
that's because you didn't specify the field-symbol after ASSIGNING.
2010 Feb 19 2:35 PM
hi roel/keshav
thanks for your updates. unfortunately, i understand precisely no abap at all!.. how should i amend the code?
2010 Feb 19 2:38 PM
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.
2010 Feb 19 2:28 PM
Just goto se11 and check the line type of hrpad_text_tab .
then try
field-symbols:<fs> type <line type of hrpad_text_tab>
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |