Estrutura Dinâmica

Embed Size (px)

DESCRIPTION

3h4rhrhweher

Citation preview

FUNCTION zfi_f_grava_dados_msg_spb.*"----------------------------------------------------------------------*"*"Interface local:*" IMPORTING*" REFERENCE(I_MSG_SPB_CAB) TYPE ZFI_T_MSGSPB_CAB OPTIONAL*" REFERENCE(VALOR_ESTRUTURA) TYPE XFELD*" REFERENCE(NOME_ESTRUTURA) TYPE TYPENAME*" REFERENCE(DADOS_ESTRUTURA)*" TABLES*" VALORES_TAG STRUCTURE ZFI_T_MSGSPB_ITM OPTIONAL*"---------------------------------------------------------------------- DATA: ifc TYPE lvc_t_fcat. PERFORM get_structure USING nome_estrutura CHANGING ifc. PERFORM create_dynamic_structure USING ifc dados_estrutura.ENDFUNCTION.*&---------------------------------------------------------------------**& Form GET_STRUCTURE*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->P_NOME_ESTRUTURA text* describe_by_name( pi_estrutura ). idetails[] = ref_table_des->components[]. LOOP AT idetails INTO xdetails. CLEAR xfc. xfc-fieldname = xdetails-name .* Correction by Paul Robert Oct 28, 2009 17:04* xfc-datatype = xdetails-type_kind. CASE xdetails-type_kind. WHEN 'C'. xfc-datatype = 'CHAR'. WHEN 'N'. xfc-datatype = 'NUMC'. WHEN 'D'. xfc-datatype = 'DATE'. WHEN 'P'. xfc-datatype = 'PACK'. WHEN 'T'. xfc-datatype = 'TIMS'. WHEN OTHERS. xfc-datatype = xdetails-type_kind. ENDCASE. xfc-inttype = xdetails-type_kind. xfc-intlen = xdetails-length. xfc-decimals = xdetails-decimals. APPEND xfc TO pe_ifc. ENDLOOP.ENDFORM. " GET_STRUCTURE*&---------------------------------------------------------------------**& Form CREATE_DYNAMIC_STRUCTURE*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->P_IFC text* create_dynamic_table EXPORTING it_fieldcatalog = pi_ifc i_length_in_byte = 'X' "added by Paul Robert Oct 28, 2009 17:04 IMPORTING ep_table = dy_table. ASSIGN dy_table->* TO .* Create dynamic work area and assign to FS CREATE DATA dy_line LIKE LINE OF . ASSIGN dy_line->* TO . MOVE pi_dados TO .ENDFORM. " CREATE_DYNAMIC_STRUCTURE