How to use BDC in programs.
5:13 PM
Do not be afraid to use bdc. It is just as easy as ABC.
Pre. Req: - Know how, Get the user, functional or test on the transaction that you want to create.
Step 1
1. Transaction code : SHDB (Transaction Recorder: Recording Overview)
- Click on "New Recording". Example below.
2. Start the recording. And after doin the FB01 transaction within this sample it will show the screen below.
Press the button save.
3.Then go back to the main screen. shdb. Find the recorded coding and click. Function module.
- create the function group if it havent exist. in this example i will be using a local copy just to copy out the codes.
4. Go to se37. copy the codings out.
------------
From the line starting
perform open_group
.
.
.
.
perform bdc_transaction
Please do remember to copy the sub routine ( double click into it )
* notes to remeber. in the
it will consist of putting the bdc in batch or direct processing
IF P_CTU <> 'X'. "batch processing
CALL FUNCTION 'BDC_INSERT'
EXPORTING TCODE = P_TCODE
TABLES DYNPROTAB = BDCDATA
EXCEPTIONS OTHERS = 1.
ELSE. "direct processing
CALL TRANSACTION P_TCODE USING BDCDATA
MODE P_MODE
UPDATE P_UPDATE
MESSAGES INTO P_MESSTAB.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING TCODE = P_TCODE
TABLES DYNPROTAB = BDCDATA
EXCEPTIONS OTHERS = 1.
ELSE. "direct processing
CALL TRANSACTION P_TCODE USING BDCDATA
MODE P_MODE
UPDATE P_UPDATE
MESSAGES INTO P_MESSTAB.
ENDIF.
TIPS: - If you are having problem saving debug using MODE 'L'. It will show you where is going wrong during BDC.
CALL TRANSACTION CN_FB01 USING TA_bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO lt_messtab.
* the value you can check in the function module example
*"*"Local Interface:*" IMPORTING*" VALUE(CTU) LIKE APQI-PUTACTIVE DEFAULT 'X'*" VALUE(MODE) LIKE APQI-PUTACTIVE DEFAULT 'N'*" VALUE(UPDATE) LIKE APQI-PUTACTIVE DEFAULT 'L'*" VALUE(GROUP) LIKE APQI-GROUPID OPTIONAL*" VALUE(USER) LIKE APQI-USERID OPTIONAL*" VALUE(KEEP) LIKE APQI-QERASE OPTIONAL*" VALUE(HOLDDATE) LIKE APQI-STARTDATE OPTIONAL*" VALUE(NODATA) LIKE APQI-PUTACTIVE DEFAULT '/'*" VALUE(BLDAT_001) LIKE BDCDATA-FVAL DEFAULT '28.11.2014'*" VALUE(BLART_002) LIKE BDCDATA-FVAL DEFAULT 'SA'*" VALUE(BUKRS_003) LIKE BDCDATA-FVAL DEFAULT 'A100'*" VALUE(BUDAT_004) LIKE BDCDATA-FVAL DEFAULT '05.12.2014'*" VALUE(MONAT_005) LIKE BDCDATA-FVAL DEFAULT ''*" VALUE(WAERS_006) LIKE BDCDATA-FVAL DEFAULT 'RM'*" VALUE(XBLNR_007) LIKE BDCDATA-FVAL DEFAULT 'awdadreversechar'*" VALUE(DOCID_008) LIKE BDCDATA-FVAL DEFAULT '*'*" VALUE(NEWBS_009) LIKE BDCDATA-FVAL DEFAULT '40'*" VALUE(NEWKO_010) LIKE BDCDATA-FVAL DEFAULT '0015201050'*" VALUE(WRBTR_011) LIKE BDCDATA-FVAL DEFAULT '60'*" VALUE(FWBAS_012) LIKE BDCDATA-FVAL DEFAULT '1000'*" VALUE(MWSKZ_013) LIKE BDCDATA-FVAL DEFAULT 'I1'*" VALUE(NEWBS_014) LIKE BDCDATA-FVAL DEFAULT '50'*" VALUE(NEWKO_015) LIKE BDCDATA-FVAL DEFAULT '0020201290'*" VALUE(WRBTR_016) LIKE BDCDATA-FVAL DEFAULT '60'*" VALUE(FWBAS_017) LIKE BDCDATA-FVAL DEFAULT '1000'*" VALUE(MWSKZ_018) LIKE BDCDATA-FVAL DEFAULT 'O1'*" EXPORTING*" VALUE(SUBRC) LIKE SYST-SUBRC*" TABLES*" MESSTAB STRUCTURE BDCMSGCOLL OPTIONAL