Skip to Content
0
Former Member
Apr 13, 2009 at 05:40 AM

BDC for Customer Master upload

649 Views

Hi Experts,

I would like to know how to handle the table controls in bdc. Here Iam pasting the code which i got after recording of XD01 transaction. Here I pasted the code which I wrote.please tell me how to add table control logic for the fields knva-ablad,knva-knfak,knvi-taxkd.

report ZSD_XD01BDC

no standard page heading line-size 255.

TYPE-POOLS: truxs.

include bdcrecx1.

data:begin of it_xd01 occurs 0,

kunnr(16) type c,

BUKRS(4) TYPE C,

VKORG(4) TYPE C,

VTWEG(2) TYPE C,

SPART(2) TYPE C,

KTOKD(4) TYPE C,

ANRED(15) TYPE C,

NAME1(35) TYPE C,

SORTL(10) TYPE C,

STRAS(35) TYPE C,

ORT01(35) TYPE C,

PSTLZ(10) TYPE C,

ORT02(35) TYPE C,

LAND1(3) TYPE C,

SPRAS(3) TYPE C,

ABLAD(25) TYPE C,

KNFAK(2) TYPE C,

AKONT(10) TYPE C,

ZUAWA(3) TYPE C,

  • KZAZU(1) TYPE C,

VSBED(2) TYPE C,

VWERK(4) TYPE C,

ANTLF(1) TYPE C,

TAXKD(1) TYPE C,

END OF IT_XD01.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_file TYPE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

DATA: v_raw TYPE truxs_t_text_data,

v_kstar type KSTAR.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = p_file.

start-of-selection.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

  • I_LINE_HEADER =

i_tab_raw_data = v_raw

i_filename = p_file

tables

i_tab_converted_data = it_xd01

  • EXCEPTIONS

  • CONVERSION_FAILED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

start-of-selection.

perform open_group.

loop at it_xd01.

perform bdc_dynpro using 'SAPMF02D' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-KTOKD'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02D-KUNNR'

IT_XD01-KUNNR..

perform bdc_field using 'RF02D-BUKRS'

IT_XD01-BUKRS..

perform bdc_field using 'RF02D-VKORG'

IT_XD01-VKORG.

perform bdc_field using 'RF02D-VTWEG'

IT_XD01-VTWEG.

perform bdc_field using 'RF02D-SPART'

IT_XD01-SPART.

perform bdc_field using 'RF02D-KTOKD'

IT_XD01-KTOKD.

perform bdc_dynpro using 'SAPMF02D' '0110'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-SPRAS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'KNA1-ANRED'

IT_XD01-ANRED.

perform bdc_field using 'KNA1-NAME1'

IT_XD01-NAME1.

perform bdc_field using 'KNA1-SORTL'

IT_XD01-SORTL.

perform bdc_field using 'KNA1-STRAS'

IT_XD01-STRAS.

perform bdc_field using 'KNA1-ORT01'

IT_XD01-ORT01.

perform bdc_field using 'KNA1-PSTLZ'

IT_XD01-PSTLZ.

perform bdc_field using 'KNA1-ORT02'

IT_XD01-ORT02.

perform bdc_field using 'KNA1-LAND1'

IT_XD01-LAND1.

perform bdc_field using 'KNA1-SPRAS'

IT_XD01-SPRAS.

perform bdc_dynpro using 'SAPMF02D' '0120'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-LIFNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02D' '0125'.

perform bdc_field using 'BDC_CURSOR'

'KNA1-NIELS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02D' '0130'.

perform bdc_field using 'BDC_CURSOR'

'KNBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPMF02D' '0340'.

perform bdc_field using 'BDC_CURSOR'

'KNVA-KNFAK(15)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

***changes****

perform bdc_field using 'KNVA-ABLAD(01)'

it_xd01-ablad.

perform bdc_field using 'KNVA-ABLAD(02)'

'point2'.

perform bdc_field using 'KNVA-ABLAD(03)'

'point3'.

perform bdc_field using 'KNVA-ABLAD(04)'

'point4'.

perform bdc_field using 'KNVA-ABLAD(05)'

'point5'.

perform bdc_field using 'KNVA-ABLAD(06)'

'point6'.

perform bdc_field using 'KNVA-ABLAD(07)'

'point7'.

perform bdc_field using 'KNVA-ABLAD(08)'

'point8'.

perform bdc_field using 'KNVA-ABLAD(09)'

'point9'.

perform bdc_field using 'KNVA-ABLAD(10)'

'point10'.

perform bdc_field using 'KNVA-ABLAD(11)'

'point11'.

perform bdc_field using 'KNVA-ABLAD(12)'

'point12'.

perform bdc_field using 'KNVA-ABLAD(13)'

'point13'.

perform bdc_field using 'KNVA-ABLAD(14)'

'point14'.

perform bdc_field using 'KNVA-ABLAD(15)'

'point15'.

perform bdc_field using 'KNVA-KNFAK(01)'

it_xd01-knfak.

perform bdc_field using 'KNVA-KNFAK(02)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(03)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(04)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(05)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(06)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(07)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(08)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(09)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(10)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(11)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(12)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(13)'

'in'.

perform bdc_field using 'KNVA-KNFAK(14)'

'IN'.

perform bdc_field using 'KNVA-KNFAK(15)'

'in'.

perform bdc_dynpro using 'SAPMF02D' '0340'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPMF02D' '0340'.

perform bdc_field using 'BDC_CURSOR'

'RF02D-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

perform bdc_dynpro using 'SAPMF02D' '0210'.

perform bdc_field using 'BDC_CURSOR'

'KNB1-ZUAWA'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'KNB1-AKONT'

IT_XD01-AKONT.

perform bdc_field using 'KNB1-ZUAWA'

IT_XD01-ZUAWA.

perform bdc_dynpro using 'SAPMF02D' '0315'.

perform bdc_field using 'BDC_CURSOR'

'KNVV-VWERK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'KNVV-KZAZU'

'X'.

perform bdc_field using 'KNVV-VSBED'

IT_XD01-VSBED.

perform bdc_field using 'KNVV-VWERK'

IT_XD01-Vwerk.

perform bdc_field using 'KNVV-ANTLF'

IT_XD01-ANTLF.

perform bdc_dynpro using 'SAPMF02D' '1350'.

perform bdc_field using 'KNVI-TAXKD(01)'

it_xd01-taxkd.

perform bdc_field using 'KNVI-TAXKD(02)'

'0'.

perform bdc_field using 'KNVI-TAXKD(03)'

'0'.

perform bdc_field using 'KNVI-TAXKD(04)'

'0'.

perform bdc_transaction using 'XD01'.

endloop.

perform close_group.