Skip to Content
0
Former Member
Jan 19, 2011 at 06:42 AM

Insert Into data base

30 Views

Hi All,

How can i insert the field value in to data base for the below code?

wd_context->get_attribute(

EXPORTING

name = 'LABOUR_DATASOURCE'

IMPORTING

value = lw_labour_datasource ).

DATA : conv2 TYPE REF TO CL_ABAP_CONV_IN_CE.

  • Creates a Conversion Instance

CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE

EXPORTING

INPUT = lw_labour_datasource

ENCODING = 'UTF-8'

REPLACEMENT = '?'

IGNORE_CERR = ABAP_TRUE

RECEIVING

CONV = conv2.

conv2->READ( importing data = lw_labour_string ).

  • get the data of file

split lw_labour_string at cl_abap_char_utilities=>CR_LF

into TABLE lt_labour_data.

  • delete the header

DELETE lt_labour_data INDEX 1.

  • get all the field name

LOOP AT lt_labour_data into lw_labour_string.

  • SPLIT lw_labour_string at cl_abap_char_utilities=>horizontal_tab

  • into table lt_labour_field.

SPLIT lw_labour_string at ',' into table lt_labour_field.

***get all the fields of one line

READ TABLE lt_labour_field INTO lv_labour_field INDEX 1.

ls_labour_context-DEALER_CODE = lv_labour_field.

READ TABLE lt_labour_field INTO lv_labour_field INDEX 2.

ls_labour_context-CLAIM_TYPE = lv_labour_field.

READ TABLE lt_labour_field INTO lv_labour_field INDEX 3.

ls_labour_context-CLAIM_SI_NO = lv_labour_field.

READ TABLE lt_labour_field INTO lv_labour_field INDEX 4.

ls_labour_context-REP_OPERATION_CODE = lv_labour_field.

READ TABLE lt_labour_field INTO lv_labour_field INDEX 5.

ls_labour_context-LABOUR_CLAIMED = lv_labour_field.

append ls_labour_context to lt_labour_context.

  • append wa_context to lt_context.

ENDLOOP.

  • bind table

lo_node_labour = wd_context->get_child_node( 'LABOUR_TABLE' ).

  • lo_node->bind_table( lt_context ).

lo_node_labour->bind_table( lt_labour_context ).