Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding bdc

Former Member
0 Likes
482

Hi all,

Plz tell me basis concepts of BDC in ABAP

What are its type?

Give some ex? and also the link

3 REPLIES 3
Read only

Former Member
0 Likes
453

Hi,

It is just to upload data from flat file Into SAP tables through standard transactions..

Record through tcode SHDB

Example code

report ZMMDKTEST
       no standard page heading line-size 255.
DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
tables : mara.
data : begin of itab occurs 0,
        matnr like mara-matnr,
        werks like marc-werks,
       end of itab.
DATA : viewno(2) TYPE n,
       ch(1) TYPE c,
       n(2) type n value 1,
       aktiv(15),
       dytxt(20),
       kzsel(20),
        i_t133a LIKE t133a OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'UPLOAD'
 EXPORTING
   FILENAME                      = 'C:'
   FILETYPE                      = 'DAT'
  TABLES
    data_tab                      = itab
          .

start-of-selection.
loop at itab.
refresh bdcdata.
perform viewchk.
CONCATENATE 'MSICHTAUSW-DYTXT(' viewno ')' INTO dytxt.
CONCATENATE 'MSICHTAUSW-KZSEL(' viewno ')' INTO kzsel.

perform bdc_dynpro      using 'SAPLMGMM' '0060'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-MATNR'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'RMMG1-MATNR'
                              itab-matnr.  "'1150327'.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              dytxt.   "'MSICHTAUSW-DYTXT(17)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using kzsel    "'MSICHTAUSW-KZSEL(17)'
                              'X'.
perform bdc_dynpro      using 'SAPLMGMM' '0080'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-WERKS'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'RMMG1-WERKS'
                              itab-werks.   "'3000'.
perform bdc_dynpro      using 'SAPLMGMM' '4000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=PB01'.
*perform bdc_field       using 'MAKT-MAKTX'
*                              'BALL BEARING 208K/6208K'.
*perform bdc_field       using 'MARA-MEINS'
*                              'NOS'.
*perform bdc_field       using 'MARC-KZDKZ'
*                              'X'.
perform bdc_field       using 'BDC_CURSOR'
                              'MARA-QMPUR'.
perform bdc_field       using 'MARA-QMPUR'
                              ' '.
*perform bdc_field       using 'MARC-SSQSS'
*                              '0007'.
perform bdc_dynpro      using 'SAPLQPLS' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMQAM-AKTIV(10)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=WEIT'.
*perform bdc_field       using 'RMQAM-INSMK'
*                              'X'.
*perform bdc_field       using 'RMQAM-EIN'
*                              'X'.
*perform bdc_field       using 'RMQAM-QKZVERF'
*                              '06'.
*perform bdc_field       using 'RMQAM-DYN'
*                              'X'.
*perform bdc_field       using 'RMQAM-AVE'
*                              'X'.
n = 1.
do 10 times.
concatenate 'RMQAM-AKTIV(' n ')' into aktiv.
perform bdc_field       using aktiv     "'RMQAM-AKTIV(01)'
                                      ' '.
n = n + 1.
enddo.
*perform bdc_field       using 'RMQAM-AKTIV(02)'
*                              ' '.
*perform bdc_field       using 'RMQAM-AKTIV(03)'
*                              ' '.
perform bdc_dynpro      using 'SAPLMGMM' '4000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BU'.
call transaction 'MM02' using bdcdata mode 'A' update 'S'.
endloop.
*perform bdc_field       using 'BDC_CURSOR'
*                              'MAKT-MAKTX'.
*perform bdc_field       using 'MAKT-MAKTX'
*                              'BALL BEARING 208K/6208K'.
*perform bdc_field       using 'MARA-MEINS'
*                              'NOS'.
*perform bdc_field       using 'MARC-KZDKZ'
*                              'X'.
*perform bdc_field       using 'MARA-QMPUR'
*                              'X'.
*perform bdc_field       using 'MARC-SSQSS'
*                              '0007'.
*perform bdc_transaction using 'MM02'.

*perform close_group.

*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = PROGRAM.
  BDCDATA-DYNPRO   = DYNPRO.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
    CLEAR BDCDATA.
    BDCDATA-FNAM = FNAM.
    BDCDATA-FVAL = FVAL.
    APPEND BDCDATA.
ENDFORM.

FORM viewchk .

 SELECT SINGLE * FROM  mara WHERE  matnr = itab-matnr.
  IF sy-subrc <> 0.
    CLEAR mara.
  ENDIF.
  SELECT * FROM  t133a INTO CORRESPONDING FIELDS OF TABLE i_t133a
         WHERE bilds EQ '11'
         AND   guifu LIKE 'SP%'.
  LOOP AT i_t133a.
    ch = i_t133a-pstat.
    IF mara-vpsta NA ch.
      DELETE i_t133a.
      CONTINUE.
    ENDIF.
  ENDLOOP.
  SORT i_t133a BY guifu.
  viewno = 0.
  LOOP AT i_t133a.
    viewno = viewno + 1.
    IF i_t133a-guifu = 'SP23'.        " MRP 1  - as per table t133a.
      EXIT.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " viewchk
*

Regards,

V.Balaji

Reward if Usefull...

Read only

Former Member
0 Likes
453

BDC means Batch Data Communication

nothing but uploading data from NON SAP system to SAP system.

If a company is implementing SAP then there data should be moved to SAP systems.,to move the data to SAP system we use BDC.

This is one of the technique to upload data.

Different types in BDC.

1. DIRECT INPUT.

2. CALL TRANSACTION

3. SESSION METHOD