10-06-2010 5:51 AM
Hi Experts,
Actually i am working on dynamically generated the funtion module.
It has four input parametrs.. IT_TAB_REFERENCE - Table reference, IS_STR_REFERENCE is Structure Reference and
two more fields are input fields.. one contains employee reference and other is calmonth..
Getting row mismatch and please find the code below. error is at the loop statement.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IT_TAB_REFERENCE) TYPE REF TO DATA
*" REFERENCE(IS_STR_REFERENCE) TYPE REF TO DATA
*" REFERENCE(ID_SOURCEFIELD1) TYPE REF TO DATA
*" REFERENCE(ID_SOURCECALMONT1) TYPE REF TO DATA
*" EXPORTING
*" REFERENCE(LS_OUTTAB_REFERENCE) TYPE REF TO DATA
*" CHANGING
*" REFERENCE(CD_SOURCEFIELD1) TYPE REF TO DATA
*" REFERENCE(CD_SOURCEFIELD2) TYPE REF TO DATA
*"----------------------------------------------------------------------
FIELD-SYMBOLS:<it_tab_reference> TYPE ANY TABLE,
<ls_str_reference> TYPE ANY.
FIELD-SYMBOLS: <id_sourcefield1> TYPE /bi0/oiemployee,
<id_sourcecalmont1> TYPE /bi0/oicalmonth.
DATA: ld_calday TYPE sy-datum.
CONSTANTS: lc_day TYPE char2 VALUE '01'.
ASSIGN it_tab_reference->* TO <it_tab_reference>.
ASSIGN is_str_reference->* TO <ls_str_reference>.
ASSIGN id_sourcefield1->* TO <id_sourcefield1>.
ASSIGN id_sourcecalmont1->* TO <id_sourcecalmont1>.
IF <it_tab_reference> IS ASSIGNED. " data in internal table?
*... Get the First Day Of the Month
CONCATENATE <id_sourcecalmont1> lc_day INTO ld_calday.
*... Calculate the Last Day Of the Month
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = ld_calday
IMPORTING
last_day_of_month = ld_calday
EXCEPTIONS
day_in_not_valid = 1
OTHERS = 2.
*... Get the Date to Salary Group using the employee and calday.
LOOP AT <it_tab_reference>
ASSIGNING <ls_str_reference>
WHERE /bic/emp_dspec = <id_sourcefield1> AND
datefrom LE ld_calday AND
dateto GE ld_calday.
ENDLOOP.
IF sy-subrc EQ 0.
GET REFERENCE OF <ls_tab_reference> INTO ls_outtab_reference.
ENDIF.
ENDIF. " it_zhrbi_th_emp_dspec[] IS NOT INITIAL
Thanks in advance,
Sunil
10-06-2010 9:23 AM
Hi,
As stated in the Help :
Dynamic specification of a component through bracketed character-type data objects is not possible.
Since it is possible through READ TABLE statement, I would advise changing your LOOP logic by a DO. READ TABLE ... ENDDO one. (not very pleasant but not much choice, isn't it?)
Best regards,
Guilllaume