Skip to Content
0
Former Member
Jul 02, 2007 at 04:02 PM

Dynamic internal table problem in FM - HR_INFOTYPE_OPERATIONS

53 Views

Dear All,

I have a problem when I use a Dynamic internal table in FM - HR_INFOTYPE_OPERTATION..

Please suggest me on the way to overcome this problem..

We wanted to have a dynamic Program for Info type operations which can be used for any info types as we are changing only BEGDA and the related actions

So in my program I have the parameters to accept

P_BEGDA - 01.10.2007

P_INFTY - P0008

P_ACTIO - COPY

I am able to create a dynamic table based on the parameters P_INFTY and able to read it also using the FM - HR_READ_INFOTYPE

BUT when I pass the dynamic internal table to a FM - HR_INFOTYPE_OPERTATION I am getting a DUMP

The DUMP is at the below statement from FM - HR_INFOTYPE_OPERTATION

ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode

It gives the below possiblities

"ASSIGN_BASE_TOO_SHORT" C

"SAPLHRMM" or "LHRMMU03"

"HR_INFOTYPE_OPERATION"

But If I use the below internal table

Data : g_t_0008 like P0008 occurs 0 with header line.

And If I use the internal table g_t_0008 instead of dynamic tables then it works. So I strongly feel it's due to not having a header in the dynamic table below see below the sample code on how I am generating a dynamic internal table

field-symbols: <dyn_table> type standard table.

data: dy_table type ref to data,

dy_line type ref to data,

xfc type lvc_s_fcat,

ifc type lvc_t_fcat.

  • to get the srurcute

perform get_structure using l_f_table.

perform create_dynamic_itab .

assign dy_table->* to <dyn_table>.

perform get_data tables <dyn_table01>

using pernr-pernr p_infty.

  • below are the forms routineĀ….

form get_structure using p_table.

data : idetails type abap_compdescr_tab,

xdetails type abap_compdescr.

data : ref_table_des type ref to cl_abap_structdescr.

clear : ifc[], dy_table.

  • Get the structure of the table.

ref_table_des ?=

cl_abap_typedescr=>describe_by_name( p_table ).

idetails[] = ref_table_des->components[].

loop at idetails into xdetails.

clear xfc.

xfc-fieldname = xdetails-name .

xfc-datatype = xdetails-type_kind.

xfc-inttype = xdetails-type_kind.

xfc-intlen = xdetails-length.

xfc-decimals = xdetails-decimals.

append xfc to ifc.

endloop.

endform.

form create_dynamic_itab.

  • Create dynamic internal table and assign to FS

call method cl_alv_table_create=>create_dynamic_table

exporting

it_fieldcatalog = ifc

importing

ep_table = dy_table.

endform.

&----


*& Form get_data

&----


form get_data tables p_table

using p_pernr

p_infty.

clear : p_table, p_table[].

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

PERNR = P_PERNR

INFTY = p_infty

BEGDA = p_datum

ENDDA = p_datum

TABLES

INFTY_TAB = p_table

EXCEPTIONS

INFTY_NOT_FOUND = 1

OTHERS = 2.

CHECK SY-SUBRC EQ 0.

IF lines( p_table ) GT 0.

*write :/'Record exist' , 'IT', p_infty.

clear p_table.

PERFORM hr_operation tables p_table

using g_t_t588d-actio g_t_t588d-INFTY

g_t_t588d-SUBTY.

else.

PERFORM append_status using g_t_itab-pernr p_infty ' '

'Error' 'No records'.

ENDIF.

endform. " get_data

form hr_operation tables p_table

using p_actio P_INFTY P_SUBTY.

data: l_f_return LIKE bapireturn1.

ASSIGN COMPONENT 'BEGDA' OF STRUCTURE p_table TO <l_field>.

<l_field> = p_begda.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = P_infty

number = G_T_ITAB-PERNR

subtype = P_subty

validityend = g_f_endda

validitybegin = P_datum

record = P_TABLE

operation = p_actio

IMPORTING

return = l_f_return.

IF sy-subrc NE 0.

**

ENDIF.

ENDFORM.