Skip to Content
avatar image
Former Member

about bdc.

how to use table control in bdc . have any sample code for it .Please reply.

Points sure. thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 04:13 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 04:15 AM

    HI,

    see this code

    report ZBH_PURORDER no standard page heading line-size 255.

    PARAMETERS:P_FILE LIKE IBIPPARMS-PATH.

    DATA FILENAME TYPE STRING.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    program_name = sy-cprog

    dynpro_number = sy-dynnr

    IMPORTING

    file_name = P_FILE.

    START-OF-SELECTION.

    FILENAME = P_FILE.

    DATA:BEGIN OF XTAB OCCURS 0,

    TYP,

    DES(255) TYPE C,

    END OF XTAB.

    DATA:BEGIN OF ITAB OCCURS 0,

    SUPERFIELD LIKE MEPO_TOPLINE-SUPERFIELD,

    EKORG LIKE MEPO1222-EKORG,

    EKGRP LIKE MEPO1222-EKGRP,

    BUKRS LIKE MEPO1222-BUKRS,

    END OF ITAB.

    DATA:BEGIN OF JTAB OCCURS 0,

    N(4) TYPE C,

    EMATN LIKE MEPO1211-EMATN,

    MENGE(13) TYPE C,

    NETPR(13) TYPE C,

    NAME1 LIKE MEPO1211-NAME1,

    END OF JTAB.

    DATA:BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

    DATA:DELIMITER VALUE '*'.

    DATA A TYPE I.

    DATA M(4) TYPE N.

    DATA L_FNAM(30) TYPE C.

    CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

    FILENAME = FILENAME

    FILETYPE = 'ASC'

    TABLES

    DATA_TAB = XTAB.

    LOOP AT XTAB.

    IF XTAB-TYP = 'H'.

    SPLIT XTAB-DES AT DELIMITER INTO ITAB-SUPERFIELD ITAB-EKORG ITAB-EKGRP

    ITAB-BUKRS.

    JTAB-N = JTAB-N + 1.

    APPEND ITAB.

    ELSEIF XTAB-TYP = 'I'.

    SPLIT XTAB-DES AT DELIMITER INTO JTAB-EMATN JTAB-MENGE JTAB-NETPR

    JTAB-NAME1.

    APPEND JTAB.

    ENDIF.

    ENDLOOP.

    CALL FUNCTION 'BDC_OPEN_GROUP'

    EXPORTING

    CLIENT = SY-MANDT

    GROUP = 'PORDER'

    KEEP = 'X'

    USER = SY-UNAME.

    LOOP AT ITAB.

    A = SY-TABIX.

    REFRESH BDCTAB.

    perform bdc_dynpro using 'SAPLMEGUI' '0014'.

    perform bdc_field using 'BDC_CURSOR'

    'MEPO_TOPLINE-SUPERFIELD'.

    perform bdc_field using 'MEPO_TOPLINE-BSART'

    'NB'.

    perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'

    ITAB-SUPERFIELD.

    perform bdc_field using 'MEPO_TOPLINE-BEDAT'

    '09.02.2007'.

    perform bdc_field using 'DYN_6000-LIST'

    ' 1'.

    perform bdc_field using 'BDC_OKCODE'

    '=MEV4000BUTTON'.

    perform bdc_dynpro using 'SAPLMEGUI' '0014'.

    perform bdc_field using 'MEPO_TOPLINE-BSART'

    'NB'.

    perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'

    ITAB-SUPERFIELD.

    perform bdc_field using 'MEPO_TOPLINE-BEDAT'

    '09.02.2007'.

    perform bdc_field using 'BDC_CURSOR'

    'MEPO1222-EKORG'.

    perform bdc_field using 'MEPO1222-EKORG'

    ITAB-EKORG.

    perform bdc_field using 'MEPO1222-EKGRP'

    ITAB-EKGRP.

    perform bdc_field using 'MEPO1222-BUKRS'

    ITAB-BUKRS.

    perform bdc_field using 'DYN_6000-LIST'

    ' 1'.

    perform bdc_field using 'BDC_OKCODE'

    '=MEV4001BUTTON'.

    perform bdc_dynpro using 'SAPLMEGUI' '0014'.

    perform bdc_field using 'MEPO_TOPLINE-BSART'

    'NB'.

    perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'

    ITAB-SUPERFIELD.

    perform bdc_field using 'MEPO_TOPLINE-BEDAT'

    '09.02.2007'.

    perform bdc_field using 'MEPO1222-EKORG'

    ITAB-EKORG.

    perform bdc_field using 'MEPO1222-EKGRP'

    ITAB-EKGRP.

    perform bdc_field using 'MEPO1222-BUKRS'

    ITAB-BUKRS.

    M = 1.

    LOOP AT JTAB.

    IF JTAB-N = A.

    WRITE:/ JTAB.

    CONCATENATE 'MEPO1211-EMATN(' M ')' INTO L_FNAM.

    perform bdc_field using 'BDC_CURSOR'

    L_FNAM.

    perform bdc_field using L_FNAM

    JTAB-EMATN.

    CONCATENATE 'MEPO1211-MENGE(' M ')' INTO L_FNAM.

    perform bdc_field using L_FNAM

    JTAB-MENGE.

    CONCATENATE 'MEPO1211-NETPR(' M ')' INTO L_FNAM.

    perform bdc_field using L_FNAM

    JTAB-NETPR.

    CONCATENATE 'MEPO1211-NAME1(' M ')' INTO L_FNAM.

    perform bdc_field using L_FNAM

    JTAB-NAME1.

    M = M + 1.

    ENDIF.

    ENDLOOP.

    perform bdc_field using 'DYN_6000-LIST'

    ' 1'.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    perform bdc_dynpro using 'SAPLMEGUI' '0014'.

    perform bdc_field using 'MEPO_TOPLINE-BSART'

    'NB'.

    perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'

    ITAB-SUPERFIELD.

    perform bdc_field using 'MEPO_TOPLINE-BEDAT'

    '09.02.2007'.

    perform bdc_field using 'MEPO1222-EKORG'

    ITAB-EKORG.

    perform bdc_field using 'MEPO1222-EKGRP'

    ITAB-EKGRP.

    perform bdc_field using 'MEPO1222-BUKRS'

    ITAB-BUKRS.

    perform bdc_field using 'DYN_6000-LIST'

    ' 1'.

    perform bdc_field using 'BDC_CURSOR'

    'MEPO1319-MATKL'.

    perform bdc_field using 'MEPO1319-SPINF'

    'X'.

    perform bdc_field using 'BDC_OKCODE'

    '=MESAVE'.

    CALL FUNCTION 'BDC_INSERT'

    EXPORTING

    TCODE = 'ME21N'

    TABLES

    DYNPROTAB = BDCTAB.

    ENDLOOP.

    CALL FUNCTION 'BDC_CLOSE_GROUP'.

    FORM BDC_DYNPRO USING PROGRAM DYNPRO.

    CLEAR BDCTAB.

    BDCTAB-PROGRAM = PROGRAM.

    BDCTAB-DYNPRO = DYNPRO.

    BDCTAB-DYNBEGIN = 'X'.

    APPEND BDCTAB.

    ENDFORM.

    FORM BDC_FIELD USING FNAM FVAL.

    CLEAR BDCTAB.

    BDCTAB-FNAM = FNAM.

    BDCTAB-FVAL = FVAL.

    APPEND BDCTAB.

    ENDFORM.

    FLAT FILE:

    H1171611000001*1000

    ICPU116000*1000

    ILEY BOARD1010000*1000

    IMOUSE66000*1000

    H1171711000001*1000

    ICPU580000*1000

    H1171701000001*1000

    IMOUSE33000*1000

    ILEY BOARD1010000*1000

    <b>reward if helpful</b>

    rgds,

    bharat.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 20, 2007 at 04:17 AM
    Add comment
    10|10000 characters needed characters exceeded