简单的BDC例子

  REPORT  y_is_lhx_test_003. data bdcdata like bdcdata OCCURS 0 WITH HEADER LINE. data messtab like bdcmsgcoll OCCURS 0 WITH HEADER LINE. databegin of record, * data element: TABNAME         TABLENAME_001(030), * data element: TABNAME         TABLENAME_002(030), * data element: S_CARR_ID         CARRID_003(003), * data element: S_CONN_ID         CONNID_004(004), * data element: LAND1         COUNTRYFR_005(003), * data element: S_FROM_CIT         CITYFROM_006(020), * data element: S_TO_CITY         CITYTO_007(020), * data element: S_FLTIME         FLTIME_008(011), * data element: S_DEP_TIME         DEPTIME_009(008), * data element: S_ARR_TIME         ARRTIME_010(008), * data element: S_DISTANCE         DISTANCE_011(012), * data element: S_DISTID         DISTID_012(003), * data element: S_FLTYPE         FLTYPE_013(001),       end of record. data table like table of record. record-tablename_001 = 'SPFLI'. record-tablename_002 = 'SPFLI'. record-carrid_003    = 'AC'. record-connid_004    = '900'. record-fltime_008  = '10'. record-deptime_009 = '121212'. record-arrtime_010 = '121212'. append record to table. record-tablename_001 = 'SPFLI'. record-tablename_002 = 'SPFLI'. record-carrid_003    = 'AC'. record-connid_004    = '910'. record-fltime_008  = '10'. record-deptime_009 = '121212'. record-arrtime_010 = '121212'. append record to table. record-tablename_001 = 'SPFLI'. record-tablename_002 = 'SPFLI'. record-carrid_003    = 'AC'. record-connid_004    = '920'. record-fltime_008  = '10'. record-deptime_009 = '121212'. record-arrtime_010 = '121212'. append record to table. record-tablename_001 = 'SPFLI'. record-tablename_002 = 'SPFLI'. record-carrid_003    = 'AC'. record-connid_004    = '930'. record-fltime_008  = '10'. record-deptime_009 = '121212'. record-arrtime_010 = '121212'. append record to table. perform bdc_dynpro      using 'SAPLSETB' '0230'. perform bdc_field       using 'BDC_CURSOR'                               'DATABROWSE-TABLENAME'. perform bdc_field       using 'BDC_OKCODE'                               '=ANZE'. perform bdc_field       using 'DATABROWSE-TABLENAME'                               record-TABLENAME_001. perform bdc_dynpro      using '/1BCDWB/DBSPFLI' '1000'. perform bdc_field       using 'BDC_OKCODE'                               '/EE'. perform bdc_field       using 'BDC_CURSOR'                               'I1-LOW'. perform bdc_dynpro      using 'SAPLSETB' '0230'. perform bdc_field       using 'BDC_CURSOR'                               'DATABROWSE-TABLENAME'. perform bdc_field       using 'BDC_OKCODE'                               '=ANLE'. LOOP AT table INTO record. perform bdc_field       using 'DATABROWSE-TABLENAME'                               record-TABLENAME_002. perform bdc_dynpro      using '/1BCDWB/DBSPFLI' '0101'. perform bdc_field       using 'BDC_CURSOR'                               'SPFLI-PERIOD'. perform bdc_field       using 'BDC_OKCODE'                               '=SAVE'. perform bdc_field       using 'SPFLI-CARRID'                               record-CARRID_003. perform bdc_field       using 'SPFLI-CONNID'                               record-CONNID_004. perform bdc_field       using 'SPFLI-COUNTRYFR'                               record-COUNTRYFR_005. perform bdc_field       using 'SPFLI-CITYFROM'                               record-CITYFROM_006. perform bdc_field       using 'SPFLI-CITYTO'                               record-CITYTO_007. perform bdc_field       using 'SPFLI-FLTIME'                               record-FLTIME_008. perform bdc_field       using 'SPFLI-DEPTIME'                               record-DEPTIME_009. perform bdc_field       using 'SPFLI-ARRTIME'                               record-ARRTIME_010. perform bdc_field       using 'SPFLI-DISTANCE'                               record-DISTANCE_011. perform bdc_field       using 'SPFLI-DISTID'                               record-DISTID_012. perform bdc_field       using 'SPFLI-FLTYPE'                               record-FLTYPE_013. ENDLOOP. perform bdc_dynpro      using '/1BCDWB/DBSPFLI' '0101'. perform bdc_field       using 'BDC_OKCODE'                               '/EBACK'. perform bdc_field       using 'BDC_CURSOR'                               'SPFLI-CARRID'. perform bdc_dynpro      using 'SAPLSETB' '0230'. perform bdc_field       using 'BDC_OKCODE'                               '/EBACK'. perform bdc_field       using 'BDC_CURSOR'                               'DATABROWSE-TABLENAME'. call transaction 'SE16' using bdcdata                         MODE  'A'                         UPDATE 'S'                         MESSAGES INTO messtab. write 'ok'. *----------------------------------------------------------------------* *        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.

你可能感兴趣的:(简单的BDC例子)