Bdc Recording

43
http://moryhanry.com/sapbdcwritetransfer.html SAP SM35 BDC RECORDING PROCEDURE SAP SM35 BDC RECORDING 1. Go to SAP Tcode SM35 . 2. Press “RECORDING” 3. Enter the recording session name [always start with Z] use “CREATE” function. 4. Enter Tcode to be used in the session. Press “ENTER”. 5. Enter the required data in the corresponding screen in SAP & make change if necessary. Press “SAVE”. [During this whole process, the BDC records the movements of the cursor and the data change made in these field , so do not repeat any cursor movements which can re-record the movement and go back to a field where the data has been changed or entered] 6. In Batch Input will appear Recording screen , listing the screens, data fields, etc recorded. 7. Press “GET TRANSACTION”. SAVE the recording. 8. Go back [F3] to the previous screen. Press “OVERVIEW” “Recording: Overview” will appear. Choose the "recording done" Press "GENERATE PROGRAM". A popup appears and enter the Program name [start the name with Z always] Press "ENTER". 9. Enter the title of the program Enter the other attributes : Type - 1[Online program], Status - T[Test program] Application - *[Not application-specific]. SAVE the attributes of the program & create the object as a LOCAL OBJECT. 10. Press "SOURCE CODE" and the code generated by the program is displayed. 11. To check the program created, Change the data back to the original values as in the original record.

Transcript of Bdc Recording

Page 1: Bdc Recording

http://moryhanry.com/sapbdcwritetransfer.html

SAP SM35BDC RECORDING PROCEDURE

SAP SM35 BDC RECORDING

1. Go to SAP Tcode SM35 . 2. Press “RECORDING” 

3. Enter the recording session name [always start with Z]        use “CREATE” function.    

4. Enter Tcode to be used in the session.    Press “ENTER”.

5. Enter the required data in the corresponding screen in SAP     &  make change if necessary.    Press “SAVE”.           [During this whole process, the BDC records the           movements of the cursor and the data change made in           these field , so do not repeat any cursor movements            which can re-record the movement and go back to a           field where the data has been changed or entered]    6. In Batch Input will appear Recording screen ,     listing the screens, data fields, etc recorded. 7. Press “GET TRANSACTION”.    SAVE the recording. 8. Go back [F3] to the previous screen.    Press “OVERVIEW”    “Recording: Overview” will appear.    Choose the "recording done"     Press "GENERATE PROGRAM".     A popup appears and enter the Program name     [start the name with Z always]    Press "ENTER". 9. Enter the title of the program           Enter the other attributes :            Type - 1[Online program],             Status - T[Test program]             Application - *[Not application-specific].     SAVE the attributes of the program      & create the object as a LOCAL OBJECT. 10. Press "SOURCE CODE"       and the code generated by the program is displayed. 11. To check the program created,      Change the data back to the original values as in the      original record.         Check the program for any syntax errors.     Use the menu path - Program > Execute.            Enter the name of the session       & the authorization group for the session.      Press "EXECUTE" [F8].           Use T/CodeSM35 to go back to the "BDC session overview".

Page 2: Bdc Recording

      Choose the session and process in the background. 

      (see   SM35   BDC overview screenshot)                    Go back to the record to see the changes made by the       current BDC session. 

SAP  SM35Process Batch Input Session  

SAP SM35 Batch input session Procedure  :

1. Go to SAP Tcode  SM35 

2. or Go to System ->Services->Batch Input->Sessions 

3. Check the session name , ID of who create the session and date on which the file was created. 

4. Highlight the file created in the previous step and click the   button in upper left corner of screen to process the file. 

5. Click radio button of "background" to begin processing the work file in the background 

Page 3: Bdc Recording

This message will display

6. Click   to check if the session ran successfully without error . 

7. Return to “Batch Input: Log Overview” screen. 

8. Highlight the session and

click 

9. This will be appeared 

NoteIf any errors are encountered during the SAP background processing the session will be written to the ‘Incorrect’ tab of the “Batch Input: Session Overview” screen. 

These errors will need to be looked into by BCPO or the Office of Attorney General’s Comptroller’s Office. 

Page 4: Bdc Recording

Cross Functional Dependencies:

SAP  SHDBBDC example for MM02  SAP BDC example for MM02 steps  :

1. Go to SAP Tcode  SHDB

2. Click "New Recording" 

3.  Enter Recording Name : example : ZGT_TEST_BDC     Enter Transaction code : MM02     Click : "Start Recording" button

Page 5: Bdc Recording

4. MM02 screen will be displayed     Enter Material number     Click "Organizational levels" Button

5. Select views of organizational levels 

Page 6: Bdc Recording

6. Click "Save"

Page 7: Bdc Recording

 

7. Self generated code after recording completed

Page 10: Bdc Recording

12. Recording was saved 

13.  After Complete Click on "Program Button" in Application Tollbar      Program name : Give Z/Y name for generate SE38 program      Field Content   : Select "transfer from recording " 

Page 11: Bdc Recording

14. Click on source code

15. Click on local object

Page 12: Bdc Recording

 16. Recording Program Code in SE38       a. Add Required  code. 2)      b. Save 3)      c. Active 

Page 13: Bdc Recording

4)      d. Execute 

17. Press "F4" button     Function: 1)  KD_GET_FILENAME_ON_F4      

Function:  2)  WS_UPLOAD

Page 14: Bdc Recording

Update mode

File upload successfully

Insert a special Tab Delimited Character

Page 15: Bdc Recording

REPORT Z_DELIMIT_DOWNLOAD.

* Inserting a Tab Delimited between the Fields in the Internal Table ** This program allows you to insert any Tab Delimited characters easily.** You have to create the customized Function in SE37 First.** The customized functions will replace all the fields in your internal table* with your desired Tab Delimited characters.** Written by : SAP Basis, ABAP Programming and Other IMG Stuff*              http://www.sap-img.com***Replace DELIMIT with ","  in the function

DATA: BEGIN OF ITAB OCCURS 100,      TXT01(10),      TXT02(10),      END OF ITAB.

SELECTION-SCREEN BEGIN OF BLOCK FILE_OP WITH FRAME TITLE TEXT-030.SELECTION-SCREEN BEGIN OF LINE.PARAMETERS:      DLOAD AS CHECKBOX DEFAULT ' '.SELECTION-SCREEN COMMENT 4(30) TEXT-027.PARAMETERS:      FILE LIKE RLGRAP-FILENAME                      DEFAULT 'C:\TEMP\ZTEST.TXT'.SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK FILE_OP.

ITAB-TXT01 = 'TEXT01'.ITAB-TXT02 = 'TEXT01'.APPEND ITAB.

ITAB-TXT01 = 'TEXT02'.ITAB-TXT02 = 'TEXT02'.APPEND ITAB.

PERFORM DOWNLOAD.*---------------------------------------------------------------------**       FORM DOWNLOAD                                                 **---------------------------------------------------------------------**       ........                                                      **---------------------------------------------------------------------*FORM DOWNLOAD.

  DATA: BEGIN OF DUMP OCCURS 0,        C(2048) TYPE C,        END OF DUMP.

  REFRESH DUMP.  CALL FUNCTION 'Z_DELIMIT_DOWNLOAD'       EXPORTING            DELIMIT           = ','

Page 16: Bdc Recording

       TABLES            INTAB             = ITAB            OUTTAB            = DUMP       EXCEPTIONS            CONVERSION_FAILED = 01.

  LOOP AT DUMP.     WRITE:/ DUMP.  ENDLOOP.

  CALL FUNCTION 'WS_DOWNLOAD'       EXPORTING            FILENAME            = FILE            FILETYPE            = 'DAT'            MODE                = ' '       TABLES            DATA_TAB            = DUMP       EXCEPTIONS            FILE_OPEN_ERROR     = 01            FILE_WRITE_ERROR    = 02            INVALID_FILESIZE    = 03            INVALID_TABLE_WIDTH = 04            INVALID_TYPE        = 05            NO_BATCH            = 06            UNKNOWN_ERROR       = 07.ENDFORM.

************************************************** This Function modules need to be created first.*************************************************FUNCTION Z_DELIMIT_DOWNLOAD .*"----------------------------------------------------------------------*"*"Local interface:*"  IMPORTING*"     REFERENCE(DELIMIT)*"  TABLES*"      INTAB*"      OUTTAB*"----------------------------------------------------------------------

  FIELD-SYMBOLS: <F>.

  DATA: LEN TYPE I,        NUM TYPE I,        DELIMIT_LEN TYPE I.

  DELIMIT_LEN = STRLEN( DELIMIT ).

  LOOP AT INTAB.    CLEAR OUTTAB.    NUM = 0.    DO.*  Get name of next structure field into <f>      ASSIGN COMPONENT SY-INDEX OF STRUCTURE INTAB TO <F>.      IF SY-SUBRC <> 0. EXIT. ENDIF.   " No more fields in structure

Page 17: Bdc Recording

      LEN = STRLEN( <F> ).      WRITE: <F> TO OUTTAB+NUM(LEN).   " Write field to output table      NUM = NUM + LEN.

      WRITE: DELIMIT TO OUTTAB+NUM(DELIMIT_LEN).      NUM = NUM + DELIMIT_LEN.    ENDDO.    APPEND OUTTAB.  ENDLOOP.ENDFUNCTION.

Example how Views are dealt in BDC

Can any body tell me some views of MM  that we can use in BDC?

Rashi

Well here is an example for you to see how the views are dealt with in BDC's...

*********************************************************This is a BDC for Semi finished Materials********report ZBDC_SEMIFIN       no standard page heading line-size 255.

include bdcrecx1.

Tables: Mara,"General Material Data        mard,"Storage Location Data for Material        mvke,"Sales Data for Material        Makt,"Material Descriptions        marc,"Plant Data for Material        mbew,"Material Valuation        rlgrap."Program Fields/Screen Fields for SAPLGRAP

Data: begin of ITAB occurs 0,"Internal table for Semi-Finished Material

*  Initial data      matnr like mara-matnr,  "Material Code      mbrsh like mara-mbrsh,  "Industry Data      mtart like mara-mtart,  "Material Type

*  Org Data      Werks like marc-werks,  "Plant      lgort like mard-lgort,  "Storage Location      vkorg like mvke-vkorg,  "Sales Orgnization      vtweg like mvke-vtweg,  "Distribution Chanel

*  Basic 1      Maktx Like makt-maktx,  "Description      meins like mara-meins,  "Uom      matkl like mara-matkl,  "Material Group      BISMT LIKE MARA-BISMT, " Old Material Number      spart like mara-spart,  "Division

Page 18: Bdc Recording

      brgew(7),"like mara-brgew,  "Gross Weight      gewei like MARA-GEWEI,  "Weight Unit      ntgew(7)," like mara-ntgew,  "Net Weight

* Purchasing       MAKTL LIKE MARA-MATKL, "Material Group       ekwsl like MARA-EKWSL, " Purchasing Value Key       ekgrp like MARC-EKGRP, " Purchasing Group

*  Mrp 1      disgr like MARC-DISGR,  "Mrp Group*     ekgrp like MARC-EKGRP,  "Purchasing group      dismm like MARC-DISMM,  "Mrp Type      dispo like MARC-DISPO,  "Mrp Controller      disls like MARC-DISLS,  "Lot Size       BSTMI like MARC-BSTMI,      BSTMA like MARC-BSTMA,      BSTRF like MARC-BSTRF,      BSTFE like MARC-BSTFE,

*  Mrp 2      beskz like MARC-BESKZ,  "Procurement type      lgpro like MARC-LGPRO,  "Production Storage Location      dzeit(3),"like MARC-DZEIT,  "In house Production time      plifz(3),"like MARC-PLIFZ,  "Planned delivery time      fhori(3),"like MARC-FHORI,  "Sched margin key      eisbe like MARC-EISBE,  "Safety stock

*  Mrp 3      PERKZ LIKE MARC-PERKZ,      vrmod like MARC-VRMOD,  "Consumption mode      vint1(3)," like MARC-VINT1,  "Backward Consumption period      vint2(3),"like MARC-VINT2,  "Forward Consumption period      mtvfp like MARC-MTVFP,  "Availability Check

*  Mrp 4      sbdkz like MARC-SBDKZ,  "Individual/ Collective      SAUFT like MARC-SAUFT,  "Repetitive Manufacturing      SFEPR like MARC-SFEPR,  "REM Profile

*  Work Scheduling View      ausme like MARC-AUSME,  "Unit of issue      FEVOR LIKE MARC-FEVOR, "Production Scheduler      SFCPF like MARC-SFCPF, "Production Scheduler Profile      umren(5)," like RMMZU-UMREN,  "Val for base uom      umrez(5) ,"like RMMZU-UMREz,  "Value for uo issue

* Accounting 1      bklas like MBEW-BKLAS,  "Valuation Class      vprsv like MBEW-VPRSV,  "Price Control Indicator      verpr(7)," like MBEW-VERPR,  "Value/Price      STPRS like MBEW-STPRS,

*COSTING     EKALR LIKE MBEW-EKALR," With qty str

Page 19: Bdc Recording

     LOSGR like MARC-LOSGR, " Costing Lot size    end of ITAB.

**********************************************************Data: W_record type  I,  "Record Allready exists.      w_trecord type I. "Total record processed

start-of-selection.perform upload.        "Upload Data from Text File

Perform Open_group.    "Create a session

clear : w_record,w_trecord.perform semi. "Create Semi Finish Materials

if w_trecord gt 0 or w_record gt 0.  perform batch_job.endif.

perform close_group.   "Close session

FORM SEMI.loop at ITAB.*   Check for material in master  *************************      select single * from mara where matnr eq ITAB-matnr.         if sy-subrc ne 0.          w_trecord = w_trecord + 1.

*Initial Screenperform bdc_dynpro      using 'SAPLMGMM' '0060'.perform bdc_field       using 'BDC_CURSOR'                              'RMMG1-MTART'.perform bdc_field       using 'BDC_OKCODE'                              '=AUSW'.perform bdc_field       using 'RMMG1-MATNR'                              ITAB-MATNR.perform bdc_field       using 'RMMG1-MBRSH'                              'M'.perform bdc_field       using 'RMMG1-MTART'                              'HALB'.***********************Views***********************************Select Viewsperform bdc_dynpro      using 'SAPLMGMM' '0070'.perform bdc_field       using 'BDC_CURSOR'                              'MSICHTAUSW-DYTXT(17'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'                               'X'.perform bdc_field       using 'MSICHTAUSW-KZSEL(09)'                              'X'.perform bdc_field       using 'MSICHTAUSW-KZSEL(12)'                              'X'.perform bdc_field       using 'MSICHTAUSW-KZSEL(13)'                              'X'.perform bdc_field       using 'MSICHTAUSW-KZSEL(14)'

Page 20: Bdc Recording

                              'X'.perform bdc_field       using 'MSICHTAUSW-KZSEL(15)'                              'X'..perform bdc_field       using 'MSICHTAUSW-KZSEL(17)'                              'X'.***********************Views**********************************

*perform bdc_dynpro      using 'SAPLMGMM' '0070'.*perform bdc_field       using 'BDC_CURSOR'*                              'MSICHTAUSW-DYTXT(01)'.*perform bdc_field       using 'BDC_OKCODE'*                              '/00'.*perform bdc_dynpro      using 'SAPLMGMM' '0070'.*perform bdc_field       using 'BDC_CURSOR'*                              'MSICHTAUSW-DYTXT(17)'.*perform bdc_field       using 'BDC_OKCODE'*                              '/00'.*perform bdc_field       using 'MSICHTAUSW-KZSEL(17)'*                              ITAB-KZSEL_17_011.*perform bdc_dynpro      using 'SAPLMGMM' '0070'.*perform bdc_field       using 'BDC_CURSOR'*                              'MSICHTAUSW-DYTXT(01)'.*perform bdc_field       using 'BDC_OKCODE'*                              '/00'.*perform bdc_dynpro      using 'SAPLMGMM' '0070'.*perform bdc_field       using 'BDC_CURSOR'*                              'MSICHTAUSW-DYTXT(13)'.*perform bdc_field       using 'BDC_OKCODE'*                              '=ENTR'.*perform bdc_field       using 'MSICHTAUSW-KZSEL(13)'*                              ITAB-KZSEL_13_012.

*Org Dataperform bdc_dynpro      using 'SAPLMGMM' '0080'.perform bdc_field       using 'BDC_CURSOR'                              'RMMG1-LGORT'.perform bdc_field       using 'BDC_OKCODE'                              '=ENTR'.perform bdc_field       using 'RMMG1-WERKS'                              ITAB-WERKS.perform bdc_field       using 'RMMG1-LGORT'                              ITAB-LGORT.

*Basic 1perform bdc_dynpro      using 'SAPLMGMM' '4004'.perform bdc_field       using 'BDC_OKCODE'                              '=SP09'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARA-MEINS'                              ITAB-MEINS.perform bdc_field       using 'MARA-MATKL'                              ITAB-MATKL.perform bdc_field       using 'MARA-BISMT'                              ITAB-BISMT.perform bdc_field       using 'MARA-SPART'                              ITAB-SPART.

Page 21: Bdc Recording

perform bdc_field       using 'MARA-MTPOS_MARA'                              'NORM'.perform bdc_field       using 'BDC_CURSOR'                              'MARA-NTGEW'.perform bdc_field       using 'MARA-BRGEW'                              ITAB-BRGEW.perform bdc_field       using 'MARA-GEWEI'                              ITAB-GEWEI.perform bdc_field       using 'MARA-NTGEW'                              ITAB-NTGEW.

*Purchasingperform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP12'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARA-MEINS'                              ITAB-MEINS.perform bdc_field       using 'MARC-EKGRP'                              ITAB-EKGRP.perform bdc_field       using 'MARA-MATKL'                              ITAB-MATKL.perform bdc_field       using 'BDC_CURSOR'                              'MARA-EKWSL'.perform bdc_field       using 'MARA-EKWSL'                              ITAB-EKWSL.

*MRP 1perform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP13'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARA-MEINS'                              ITAB-MEINS.perform bdc_field       using 'MARC-EKGRP'                              ITAB-EKGRP.perform bdc_field       using 'MARC-DISMM'                              ITAB-DISMM.perform bdc_field       using 'MARC-DISPO'                              ITAB-DISPO.perform bdc_field       using 'BDC_CURSOR'                              'MARC-DISLS'.perform bdc_field       using 'MARC-DISLS'                              ITAB-DISLS.IF ITAB-DISLS EQ 'EX'   .perform bdc_field       using 'MARC-BSTMI'                              ITAB-BSTMI."MIN LOT SIZEperform bdc_field       using 'MARC-BSTMA'                              ITAB-BSTMA."MAX LOT SIZEperform bdc_field       using 'MARC-BSTRF'                              ITAB-BSTRF."RNDINGELSEIF ITAB-DISLS EQ 'FX'.perform bdc_field       using 'MARC-BSTFE'                              ITAB-BSTFE.

Page 22: Bdc Recording

ENDIF.

*MRP 2perform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP14'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARC-BESKZ'                              ITAB-BESKZ.perform bdc_field       using 'MARC-LGPRO'                              ITAB-LGPRO.perform bdc_field       using 'MARC-DZEIT'                              ITAB-DZEIT.perform bdc_field       using 'MARC-PLIFZ'                              ITAB-PLIFZ.perform bdc_field       using 'MARC-FHORI'                              ITAB-FHORI.perform bdc_field       using 'BDC_CURSOR'                              'MARC-EISBE'.perform bdc_field       using 'MARC-EISBE'                              ITAB-EISBE.

*MRP 3perform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP15'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARC-PERKZ'                              ITAB-PERKZ.perform bdc_field       using 'MARC-VRMOD'                              ITAB-VRMOD.perform bdc_field       using 'MARC-VINT1'                              ITAB-VINT1.perform bdc_field       using 'MARC-VINT2'                              ITAB-VINT2.perform bdc_field       using 'BDC_CURSOR'                              'MARC-MTVFP'.perform bdc_field       using 'MARC-MTVFP'                              ITAB-MTVFP.

*MRP 4perform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP17'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARC-SBDKZ'                              ITAB-SBDKZ.perform bdc_field       using 'BDC_CURSOR'                              'MARC-SFEPR'.perform bdc_field       using 'MARC-SAUFT'                              ITAB-SAUFT.perform bdc_field       using 'MARC-SFEPR'                              ITAB-SFEPR.

Page 23: Bdc Recording

*Work Schedulingperform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP24'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'BDC_CURSOR'                              'MARC-SFCPF'.perform bdc_field       using 'MARA-MEINS'                              ITAB-MEINS.perform bdc_field       using 'MARC-FEVOR'                              ITAB-FEVOR.perform bdc_field       using 'MARC-LGPRO'                              ITAB-LGPRO.perform bdc_field       using 'MARC-SFCPF'                              ITAB-SFCPF.perform bdc_field       using 'MARC-DZEIT'                              ITAB-DZEIT.

*Check for Conversation Factor          if ITAB-MEINS ne iTAB-ausme and iTAB-umren gt  0                                      and iTAB-umrez gt  0.

          perform bdc_dynpro      using 'SAPLMGMM' '0510'.          perform bdc_field       using:                                  'BDC_OKCODE'    '=ENTR',                                  'RMMZU-UMREN'   ITAB-UMREN,                                  'RMMZU-UMREZ'   ITAB-UMREZ.        endif.perform bdc_field       using 'MARC-LGPRO'                              itab-LGPRO.perform bdc_field       using 'MARC-DZEIT'                              itab-DZEIT.

*Accountingperform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=SP26'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'MARA-MEINS'                              ITAB-MEINS.perform bdc_field       using 'MARA-SPART'                              ITAB-SPART.perform bdc_field       using 'BDC_CURSOR'                              'MBEW-STPRS'.perform bdc_field       using 'MBEW-BKLAS'                              ITAB-BKLAS.perform bdc_field       using 'MBEW-VPRSV'                              ITAB-VPRSV.perform bdc_field       using 'MBEW-STPRS'                              ITAB-STPRS.IF ITAB-VPRSV = 'S'.perform bdc_field       using 'MBEW-STPRS' "FILLS STD PRICE                              ITAB-VERPR.ELSEIF ITAB-VPRSV ='V'.

Page 24: Bdc Recording

perform bdc_field       using 'MBEW-VERPR' "FILLS VALUE                              ITAB-VERPR.ENDIF.

*Cost Estimateperform bdc_dynpro      using 'SAPLMGMM' '4000'.perform bdc_field       using 'BDC_OKCODE'                              '=BU'.perform bdc_field       using 'MAKT-MAKTX'                              ITAB-MAKTX.perform bdc_field       using 'BDC_CURSOR'                              'MARC-PRCTR'.perform bdc_field       using 'MARA-MEINS'                              ITAB-MEINS.perform bdc_field       using 'MBEW-EKALR'                              ITAB-EKALR.perform bdc_field       using 'MARC-LOSGR'                              ITAB-LOSGR.perform bdc_transaction using 'MM01'.

REFRESH BDCDATA.

*  *************************************************************    else.         w_record = w_record + 1.    endif.

ENDLOOP.ENDFORM.

form Upload.

CALL FUNCTION 'UPLOAD' EXPORTING   CODEPAGE                      = ' '   FILENAME                      = ' '   FILETYPE                      = ' '  TABLES    DATA_TAB                      = ITAB EXCEPTIONS   CONVERSION_ERROR              = 1   INVALID_TABLE_WIDTH           = 2   INVALID_TYPE                  = 3   NO_BATCH                      = 4   UNKNOWN_ERROR                 = 5   GUI_REFUSE_FILETRANSFER       = 6   OTHERS                        = 7.ENDFORM.

form batch_job.    uline.      format color col_heading.

        if w_trecord gt 0.        Write:/ 'Background Job has been Created for ',              w_trecord right-justified, 'Semi-Fin', 80 ''.

Page 25: Bdc Recording

        write:/ 'Please follow the following steps to run this job',                                                           80 ''.

        write:/ 'as listed below.', 80 ''.        format color col_normal.        skip.        write:/05 '1.Goto Transaction SM35', 80 ''.        write:/05 '2.Select your Session Name', 80 ''.        write:/05 '3.Click On Execute Button', 80 ''.       endif.       if w_record gt 0.         format color col_negative.         write:/ w_record ,'records already existed', 80 ''.         format color off.       endif.    uline.endform.

http://www.sap-img.com/bdc.htm

BDC Example: Using Table Control in BDC

Among beginners, using table control in BDC is always a puzzle.

Following is a sample code of handling table control in BDC.

REPORT Y730_BDC5 .*HANDLING TABLE CONTROL IN BDCDATA : BEGIN OF IT_DUMMY OCCURS 0,       DUMMY(100) TYPE C,       END OF IT_DUMMY.DATA : BEGIN OF IT_XK01 OCCURS 0,       LIFNR(10) TYPE C,       BUKRS(4)  TYPE C,       EKORG(4)  TYPE C,       KTOKK(4)  TYPE C,       NAME1(30) TYPE C,       SORTL(10) TYPE C,       LAND1(3)  TYPE C,       SPRAS(2)  TYPE C,       AKONT(6)  TYPE C,       FDGRV(2)  TYPE C,       WAERS(3)  TYPE C,       END OF IT_XK01,       BEGIN OF IT_BANK OCCURS 0,       BANKS(3)  TYPE C,       BANKL(10) TYPE C,       BANKN(10) TYPE C,       KOINH(30) TYPE C,       LIFNR(10) TYPE C,       END OF IT_BANK.DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,       IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

Page 26: Bdc Recording

CALL FUNCTION 'WS_UPLOAD' EXPORTING   FILENAME                      = 'C:\VENDOR.TXT'   FILETYPE                      = 'ASC' TABLES   DATA_TAB                      = IT_DUMMY.

LOOP AT IT_DUMMY.  IF IT_DUMMY-DUMMY+0(2) = '11'.    IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).    IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).    IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).    IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).    IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).    IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).    IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).    IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).    IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).    IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).    IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).    APPEND IT_XK01.  ELSE.    IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).    IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).    IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).    IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).    IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).    APPEND IT_BANK.  ENDIF.ENDLOOP.

LOOP AT IT_XK01.REFRESH IT_BDCDATA.perform bdc_dynpro      using 'SAPMF02K' '0100'.perform bdc_field       using 'BDC_CURSOR'                              'RF02K-REF_LIFNR'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_field       using 'RF02K-LIFNR'                              IT_XK01-LIFNR.perform bdc_field       using 'RF02K-BUKRS'                              IT_XK01-BUKRS.perform bdc_field       using 'RF02K-EKORG'                              IT_XK01-EKORG.perform bdc_field       using 'RF02K-KTOKK'                              IT_XK01-KTOKK.perform bdc_dynpro      using 'SAPMF02K' '0110'.perform bdc_field       using 'BDC_CURSOR'                              'LFA1-TELX1'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_field       using 'LFA1-NAME1'                              IT_XK01-NAME1.perform bdc_field       using 'LFA1-SORTL'                              IT_XK01-SORTL.perform bdc_field       using 'LFA1-LAND1'                              IT_XK01-LAND1.

Page 27: Bdc Recording

perform bdc_field       using 'LFA1-SPRAS'                              IT_XK01-SPRAS.perform bdc_dynpro      using 'SAPMF02K' '0120'.perform bdc_field       using 'BDC_CURSOR'                              'LFA1-KUNNR'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_dynpro      using 'SAPMF02K' '0130'.perform bdc_field       using 'BDC_CURSOR'                              'LFBK-KOINH(02)'.perform bdc_field       using 'BDC_OKCODE'                              '=ENTR'.DATA : FNAM(20) TYPE C,       IDX      TYPE C.  MOVE 1 TO IDX.LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.  CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.  perform bdc_field       using FNAM                                IT_BANK-BANKS.

  CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.  perform bdc_field       using FNAM                                IT_BANK-BANKL.

  CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.  perform bdc_field       using FNAM                                IT_BANK-BANKN.

  CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.  perform bdc_field       using FNAM                                IT_BANK-KOINH.  IDX = IDX + 1.ENDLOOP.

perform bdc_dynpro      using 'SAPMF02K' '0130'.perform bdc_field       using 'BDC_CURSOR'                              'LFBK-BANKS(01)'.perform bdc_field       using 'BDC_OKCODE'                              '=ENTR'.perform bdc_dynpro      using 'SAPMF02K' '0210'.perform bdc_field       using 'BDC_CURSOR'                              'LFB1-FDGRV'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_field       using 'LFB1-AKONT'                              IT_XK01-AKONT.perform bdc_field       using 'LFB1-FDGRV'                              IT_XK01-FDGRV.perform bdc_dynpro      using 'SAPMF02K' '0215'.perform bdc_field       using 'BDC_CURSOR'                              'LFB1-ZTERM'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_dynpro      using 'SAPMF02K' '0220'.perform bdc_field       using 'BDC_CURSOR'                              'LFB5-MAHNA'.perform bdc_field       using 'BDC_OKCODE'

Page 28: Bdc Recording

                              '/00'.perform bdc_dynpro      using 'SAPMF02K' '0310'.perform bdc_field       using 'BDC_CURSOR'                              'LFM1-WAERS'.perform bdc_field       using 'BDC_OKCODE'                              '/00'.perform bdc_field       using 'LFM1-WAERS'                              IT_XK01-WAERS.perform bdc_dynpro      using 'SAPMF02K' '0320'.perform bdc_field       using 'BDC_CURSOR'                              'WYT3-PARVW(01)'.perform bdc_field       using 'BDC_OKCODE'                              '=ENTR'.perform bdc_dynpro      using 'SAPLSPO1' '0300'.perform bdc_field       using 'BDC_OKCODE'                              '=YES'.CALL TRANSACTION 'XK01' USING IT_BDCDATA                        MODE  'A'                       UPDATE 'S'                     MESSAGES INTO IT_BDCMSGCOLL.ENDLOOP.

FORM BDC_DYNPRO USING PROG SCR.  CLEAR IT_BDCDATA.  IT_BDCDATA-PROGRAM = PROG.  IT_BDCDATA-DYNPRO  = SCR.  IT_BDCDATA-DYNBEGIN = 'X'.  APPEND IT_BDCDATA.ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.  CLEAR IT_BDCDATA.  IT_BDCDATA-FNAM = FNAM.  IT_BDCDATA-FVAL  = FVAL.  APPEND IT_BDCDATA.ENDFORM.

Hope that would clear the matters for freshers.

BDC program for Purchase Info Records*&---------------------------------------------------------------------**&   REPORT ZMM0069                                                    **&---------------------------------------------------------------------**& Module : MM                                                         |*& Application : The program loads the Purchasing Inforecords          |*&                                                                     |*----------------------------------------------------------------------**| Modification Log                                                    |*| ----------------                                                    |*| Programmer      Date       CC#    Chg.Ref        Description of*|                                                       Change        |*| ------------- -----------  ----  -----------  ----------------------|*| Rajesh Singh  23-AUG-2005                        Initial*|                                                  development.       |*----------------------------------------------------------------------*

Page 29: Bdc Recording

  REPORT zmm0069 NO STANDARD PAGE HEADING                                  MESSAGE-ID z0                                  LINE-SIZE  132                                  LINE-COUNT 65(2).

*----------------------------------------------------------------------**                      Internal Tables                                 **----------------------------------------------------------------------*

*Internal table for the purchasing info records fields.

  DATA: BEGIN OF i_inforecord OCCURS 0,

        matnr(18),        lifnr(10),        uom(3),        ekgrp(3),        planned_time(3),        under_tol(3),        over_tol(3),        qty(10),        price_cat(5),        inco(3),        designation(28),        netpr(13),        scale_qty1(10),        scale_pr1(13),        scale_qty2(10),        scale_pr2(13),        scale_qty3(13),        scale_pr3(10),        scale_qty4(13),        scale_pr4(10),        scale_qty5(13),        scale_pr5(10),        scale_qty6(13),        scale_pr6(10),        scale_qty7(13),        scale_pr7(10),        scale_qty8(13),        scale_pr8(10),        scale_qty9(13),        scale_pr9(10),        scale_qty10(13),        scale_pr10(10),

        END OF i_inforecord.

** Internal table for Old and New Vendor number  DATA : BEGIN OF i_lfb1 OCCURS 1,

         lifnr(10),         altkn(10),

         END   OF i_lfb1.

Page 30: Bdc Recording

** Declare internal table for Call Transaction and BDC Session  DATA: i_bdc_table LIKE bdcdata OCCURS 0 WITH HEADER LINE.

*----------------------------------------------------------------------**                      Global Variables                                **----------------------------------------------------------------------*

  DATA: g_counter(2) TYPE n,        g_field_name(18) TYPE c,        zc_yes  TYPE syftype VALUE 'X'.

*----------------------------------------------------------------------**                      Selection Screen                                **----------------------------------------------------------------------*

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

  PARAMETERS: p_fname1 TYPE localfile .

  SELECTION-SCREEN SKIP 1.

  SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-002.  PARAMETERS: p_rloc1 AS CHECKBOX  DEFAULT 'X'.

  SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-003.  PARAMETERS p_group(12) OBLIGATORY DEFAULT 'ZPURCHINFO'.

  SELECTION-SCREEN END OF BLOCK c.  SELECTION-SCREEN END OF BLOCK b.  SELECTION-SCREEN END OF BLOCK a.

**WRITE the report header  TOP-OF-PAGE.    INCLUDE zheading.

*----------------------------------------------------------------------**                      Start of selection                              **----------------------------------------------------------------------*

  START-OF-SELECTION.

* Load Input file    PERFORM f_load_input_file.

* Create BDC records.    PERFORM create_bdc_records .

*&---------------------------------------------------------------------**&      Form  Create_BDC_records*&---------------------------------------------------------------------**       Perform the BDC for the records in the internal table*----------------------------------------------------------------------*

Page 31: Bdc Recording

  FORM create_bdc_records .

    IF NOT i_inforecord[] IS INITIAL.

** Open BDC session

      PERFORM open_bdc_session.

      SELECT lifnr altkn FROM lfb1 INTO TABLE i_lfb1                          FOR ALL ENTRIES IN i_inforecord                          WHERE altkn = i_inforecord-lifnr.

* Sorting the Internal table for better performance

      SORT i_lfb1 BY altkn.

      LOOP AT i_inforecord.

***Mapping Old Vendor number to the new Vendor number

        READ TABLE i_lfb1 WITH KEY altkn = i_inforecord-lifnr BINARY                                                              SEARCH.

        IF sy-subrc EQ 0.          i_inforecord-lifnr = i_lfb1-lifnr.        ENDIF.

        CLEAR i_bdc_table[].        PERFORM insert_screen_header.*      call transaction 'ME11' using i_bdc_table*                    mode 'A'.*      CLEAR i_bdc_table.

      ENDLOOP.      CLEAR i_inforecord[].

      PERFORM close_bdc_session.

** Release the BDC sessions created      PERFORM release_bdc.    ENDIF.

  ENDFORM.                    " open_group

*&---------------------------------------------------------------------**&      Form  bdc_dynpro_start*&---------------------------------------------------------------------**       Start the screen for the transfer of fields*----------------------------------------------------------------------*

  FORM bdc_dynpro_start  USING    p_g_program_1                                  p_g_screen.

Page 32: Bdc Recording

    CLEAR i_bdc_table.    i_bdc_table-program  = p_g_program_1.    i_bdc_table-dynpro   = p_g_screen.    i_bdc_table-dynbegin = 'X'.    APPEND i_bdc_table.

  ENDFORM.                    " bdc_dynpro_start_start

*&---------------------------------------------------------------------**&      Form  bdc_insert_field*&---------------------------------------------------------------------**        Insert field                                                  **----------------------------------------------------------------------*  FORM bdc_insert_field USING f_name f_value.    IF f_value <> space.      CLEAR i_bdc_table.      i_bdc_table-fnam = f_name.      i_bdc_table-fval = f_value.      APPEND i_bdc_table.    ENDIF.  ENDFORM.                    "bdc_insert_field

*&--------------------------------------------------------------------**&      Form  open_bdc_session*&--------------------------------------------------------------------**       Open a BDC session*---------------------------------------------------------------------*  FORM open_bdc_session .

** Open BDC session and create and update records

    CALL FUNCTION 'BDC_OPEN_GROUP'      EXPORTING        client                    = sy-mandt*       DEST                      = FILLER8        group                     = p_group*       HOLDDATE                  = FILLER8        keep                      = 'X'        user                      = sy-uname*       RECORD                    = FILLER1*       PROG                      = SY-CPROG*     IMPORTING*       QID                       =   EXCEPTIONS     client_invalid            = 1     destination_invalid       = 2     group_invalid             = 3     group_is_locked           = 4     holddate_invalid          = 5     internal_error            = 6     queue_error               = 7     running                   = 8     system_lock_error         = 9

Page 33: Bdc Recording

     user_invalid              = 10     OTHERS                    = 11              .    IF sy-subrc <> 0.      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.    ENDIF.

  ENDFORM.                    " create_bdc_session*&---------------------------------------------------------------------**&      Form  insert_screen_header*&---------------------------------------------------------------------**       Screen flow for the transfer of fields*----------------------------------------------------------------------*

  FORM insert_screen_header .

* First Screen 100

    PERFORM bdc_dynpro_start USING 'SAPMM06I' '0100'.

    PERFORM bdc_insert_field USING:'BDC_CURSOR' 'EINA-LIFNR',

                                   'BDC_OKCODE' '/00',

                                   'EINA-LIFNR' i_inforecord-lifnr,

                                   'EINA-MATNR' i_inforecord-matnr,

                                   'EINE-EKORG' '1000',

                                   'RM06I-NORMB' zc_yes.

*****----------------------------------------********

* Next Screen 101

    PERFORM bdc_dynpro_start USING 'SAPMM06I' '0101'.

    PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'EINA-MAHN1',

                                     'BDC_OKCODE' '/00',

                                     'EINA-MEINS' i_inforecord-uom.

*****----------------------------------------*********Next Screen 102

    PERFORM bdc_dynpro_start USING 'SAPMM06I' '0102'.

    PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'EINE-INCO2',

                                 'EINE-APLFZ' i_inforecord-planned_time,

                                 'EINE-EKGRP' i_inforecord-ekgrp,

Page 34: Bdc Recording

                                 'EINE-NORBM' i_inforecord-qty.

    PERFORM bdc_insert USING  'EINE-UEBTK' ' '.

    PERFORM bdc_insert_field USING:'EINE-PEINH' i_inforecord-scale_qty1,

                                   'EINE-BPRME' i_inforecord-uom,

                                   'EINE-UNTTO' '5',

                                   'EINE-UEBTO' '25',

                                   'EINE-MEPRF' i_inforecord-price_cat,

                                   'EINE-NETPR' i_inforecord-netpr,

                                   'EINE-INCO1' i_inforecord-inco,

                                  'EINE-INCO2' i_inforecord-designation.

* Checking for Scale quantities

    IF i_inforecord-scale_qty2 = space.

      PERFORM bdc_insert_field  USING 'BDC_OKCODE' '=BU'.

      PERFORM insert_bdc_new.

    ELSE.

      PERFORM bdc_insert_field  USING 'BDC_OKCODE' '=KO'.

*****----------------------------------------********* Next Screen 201

      PERFORM bdc_dynpro_start USING 'SAPMV13A' '0201'.

      PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'RV13A-DATAB',

                                        'BDC_OKCODE' '=PSTF'.

*****----------------------------------------********* Next Screen 201

      PERFORM bdc_dynpro_start USING 'SAPMV13A' '0201'.

      PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'KONP-KSCHL(01)',

                                       'BDC_OKCODE' '=PSTF',

                                       'RV130-SELKZ(01)' zc_yes.

*****----------------------------------------********* LAST SCREEN 303

      PERFORM bdc_dynpro_start USING 'SAPMV13A' '0303'.

Page 35: Bdc Recording

      PERFORM bdc_insert_field USING : 'BDC_CURSOR' 'KONM-KBETR(03)',

                                       'BDC_OKCODE' '=SICH'.

* Counter to Loop the Item level entry      g_counter = 0.

      PERFORM scale_entry USING i_inforecord-scale_qty2                                i_inforecord-scale_pr2.

      PERFORM scale_entry USING i_inforecord-scale_qty3                                i_inforecord-scale_pr3.

      PERFORM scale_entry USING i_inforecord-scale_qty4                                i_inforecord-scale_pr4.

      PERFORM scale_entry USING i_inforecord-scale_qty5                                i_inforecord-scale_pr5.

      PERFORM scale_entry USING i_inforecord-scale_qty6                                i_inforecord-scale_pr6.

      PERFORM scale_entry USING i_inforecord-scale_qty7                                i_inforecord-scale_pr7.

      PERFORM scale_entry USING i_inforecord-scale_qty8                                i_inforecord-scale_pr8.

      PERFORM scale_entry USING i_inforecord-scale_qty9                                i_inforecord-scale_pr9.

      PERFORM scale_entry USING  i_inforecord-scale_qty10                                 i_inforecord-scale_pr10.

      PERFORM insert_bdc_new.

    ENDIF.  ENDFORM.                    " insert_screen_header

*&---------------------------------------------------------------------**&      Form  insert_bdc*&---------------------------------------------------------------------**       Insert BDC*----------------------------------------------------------------------*

  FORM insert_bdc_new .

    CALL FUNCTION 'BDC_INSERT'       EXPORTING         tcode                  = 'ME11'*       POST_LOCAL             = NOVBLOCAL*       PRINTING               = NOPRINT*       SIMUBATCH              = ' '

Page 36: Bdc Recording

*       CTUPARAMS              = ' '       TABLES         dynprotab              = i_bdc_table    EXCEPTIONS      internal_error         = 1      not_open               = 2      queue_error            = 3      tcode_invalid          = 4      printing_invalid       = 5      posting_invalid        = 6      OTHERS                 = 7               .    IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    CLEAR i_bdc_table[].

  ENDFORM.                    " insert_bdc

*&---------------------------------------------------------------------**&      Form  close_bdc_session*&---------------------------------------------------------------------**      Close the BDC session*----------------------------------------------------------------------*

  FORM close_bdc_session .

    CALL FUNCTION 'BDC_CLOSE_GROUP'         EXCEPTIONS              not_open    = 1              queue_error = 2              OTHERS      = 3.

    IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

  ENDFORM.                    " close_bdc_session

*&---------------------------------------------------------------------**&      Form  f_load_input_file*&---------------------------------------------------------------------**       Upload the file*----------------------------------------------------------------------*

  FORM f_load_input_file.

* Check always Local file for upload

Page 37: Bdc Recording

    IF p_rloc1 = zc_yes.

      CALL FUNCTION 'WS_UPLOAD'           EXPORTING                filename                = p_fname1                filetype                = 'DAT'           TABLES                data_tab                = i_inforecord           EXCEPTIONS                conversion_error        = 1                file_open_error         = 2                file_read_error         = 3                invalid_type            = 4                no_batch                = 5                unknown_error           = 6                invalid_table_width     = 7                gui_refuse_filetransfer = 8                customer_error          = 9                OTHERS                  = 10.

      IF sy-subrc <> 0.

        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

        STOP.

      ENDIF.

    ENDIF.*  ENDFORM.                    " f_load_input_file*&---------------------------------------------------------------------**&      Form  release_bdc*&---------------------------------------------------------------------**      Release the session*----------------------------------------------------------------------*

  FORM release_bdc.

    SUBMIT rsbdcsub WITH mappe EQ p_group                    WITH von EQ sy-datum                    WITH bis EQ sy-datum                    WITH fehler EQ '.'                    EXPORTING LIST TO MEMORY                    AND RETURN.

  ENDFORM.                    " release_bdc

*&---------------------------------------------------------------------**&      Form  scale_entry*&---------------------------------------------------------------------**       Populate the Scale quantities*----------------------------------------------------------------------**      -->P_SCALE_QTY*      -->P_SCALE_PRICE

Page 38: Bdc Recording

*----------------------------------------------------------------------*  FORM scale_entry USING    p_scale_qty                            p_scale_price.

* Increment the Counter

    g_counter = g_counter + 1.

    IF p_scale_qty <> space.

      CONCATENATE 'KONM-KSTBM('  g_counter  ')' INTO g_field_name.

      PERFORM bdc_insert_field USING g_field_name p_scale_qty.

      CONCATENATE 'KONM-KBETR('  g_counter  ')' INTO g_field_name.

      PERFORM bdc_insert_field USING g_field_name p_scale_price.

    ENDIF.

  ENDFORM.*&---------------------------------------------------------------------**&      Form  bdc_insert*&---------------------------------------------------------------------**       To uncheck the Unlimited (UEBTK)*----------------------------------------------------------------------*

  FORM bdc_insert USING  f_name f_value.    CLEAR i_bdc_table.    i_bdc_table-fnam = f_name.    i_bdc_table-fval = f_value.    APPEND i_bdc_table.  ENDFORM.                    " bdc_insert

http://www.blogcatalog.com/blogs/all-sap-abap-programming/posts/tag/abap+bdc+complete/