Application Development 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: 

BDC Doubt

Former Member
0 Kudos

Hi Experts

I am very new to BDC programs, i created a recording for the transaction CO08(Production order Creation) using SHDB then, i converted into the following program.

Can anyone tell me, now what are the steps to be taken. I don't know the process, how to change the program and the input and run the program also.

Regards

Rajaram

report ZVD

no standard page heading line-size 255.

include bdcrecx1.

parameters: dataset(132) lower case.

      • DO NOT CHANGE - the generated data section - DO NOT CHANGE ***

*

  • If it is nessesary to change the data section use the rules:

  • 1.) Each definition of a field exists of two lines

  • 2.) The first line shows exactly the comment

  • '* data element: ' followed with the data element

  • which describes the field.

  • If you don't have a data element use the

  • comment without a data element name

  • 3.) The second line shows the fieldname of the

  • structure, the fieldname must consist of

  • a fieldname and optional the character '_' and

  • three numbers and the field length in brackets

  • 4.) Each field must be type C.

*

      • Generated data section with specific formatting - DO NOT CHANGE ***

data: begin of record,

  • data element: CO_KDAUF

KDAUF_001(010),

  • data element: CO_KDPOS

KDPOS_002(006),

  • data element: CO_MATNR

MATNR_003(018),

  • data element: WERKS_D

WERKS_004(004),

  • data element: CO_PWERK

PWERK_005(004),

  • data element: PP_AUFART

PP_AUFART_006(004),

  • data element: GAMNG

GAMNG_007(017),

  • data element: CO_GMEIN

GMEIN_008(003),

  • data element: TERMKZ

TERKZ_009(001),

  • data element: FHORI

FHORI_010(003),

  • data element: CO_GLTRP

GLTRP_011(010),

  • data element: GAMNG

GAMNG_012(017),

  • data element: CO_GMEIN

GMEIN_013(003),

  • data element: CO_GLTRP

GLTRP_014(010),

  • data element: CO_GSTRP

GSTRP_015(010),

  • data element: TERMKZ

TERKZ_016(001),

  • data element: FHORI

FHORI_017(003),

end of record.

      • End generated data section ***

start-of-selection.

perform open_dataset using dataset.

perform open_group.

do.

read dataset dataset into record.

if sy-subrc <> 0. exit. endif.

perform bdc_dynpro using 'SAPLCOKO1' '0220'.

perform bdc_field using 'BDC_CURSOR'

'AUFPAR-PP_AUFART'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'AFPOD-KDAUF'

record-KDAUF_001.

perform bdc_field using 'AFPOD-KDPOS'

record-KDPOS_002.

perform bdc_field using 'CAUFVD-MATNR'

record-MATNR_003.

perform bdc_field using 'CAUFVD-WERKS'

record-WERKS_004.

perform bdc_field using 'AFPOD-PWERK'

record-PWERK_005.

perform bdc_field using 'AUFPAR-PP_AUFART'

record-PP_AUFART_006.

perform bdc_dynpro using 'SAPLCOKO1' '0115'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'CAUFVD-GAMNG'.

perform bdc_field using 'CAUFVD-GAMNG'

record-GAMNG_007.

perform bdc_field using 'CAUFVD-GMEIN'

record-GMEIN_008.

perform bdc_field using 'CAUFVD-TERKZ'

record-TERKZ_009.

perform bdc_field using 'CAUFVD-FHORI'

record-FHORI_010.

perform bdc_field using 'CAUFVD-GLTRP'

record-GLTRP_011.

perform bdc_dynpro using 'SAPLCOKO1' '0115'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'CAUFVD-GAMNG'.

perform bdc_field using 'CAUFVD-GAMNG'

record-GAMNG_012.

perform bdc_field using 'CAUFVD-GMEIN'

record-GMEIN_013.

perform bdc_field using 'CAUFVD-GLTRP'

record-GLTRP_014.

perform bdc_field using 'CAUFVD-GSTRP'

record-GSTRP_015.

perform bdc_field using 'CAUFVD-TERKZ'

record-TERKZ_016.

perform bdc_field using 'CAUFVD-FHORI'

record-FHORI_017.

perform bdc_transaction using 'CO08'.

enddo.

perform close_group.

perform close_dataset using dataset.

3 REPLIES 3

Madhu2004
Active Contributor
0 Kudos

hai,

Do the following steps:

1) after creating the recording,GOTO SHDB, select the recording u have done

2) select the TAB "Create program" from tool bar

3)give program name and select the radio button "transfer from recording "

4) now declare the attributes which are used in the perform statements

5)check the mandatory parametrs and pass the values by uploading the file.

Thanks and regards,

Madhu

Former Member
0 Kudos

hi Raja ram,

BDC standss for batch data communication, this is required to transfer large , bulky , legacy data to your sap system.

This can be performed using : 1) SESSION METHOD

2) CALL TRANSACTION METHOD

the code given by you is a session method.

->Initially , start your recording in SHDB ,

->then generate the program ( click on the push button called program )

->after getting the program copy it n save it in SE38(editor) .

->you can directly run that program or

->you can see the "include bdcrecx1" . if u want to change the program then, rewrite that include as per ur requirements.

check these links for further reference.....

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d62292b3-0301-0010-df98-aaac31cd...

ABAP Code Sample to Upload with BDC and Display Result in Report :

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f562eb90-0201-0010-5ba8-ecdce4de...

Step by Step approach to ceate simple BDC session program :

/people/milind.upasani/blog/2007/03/07/step-by-step-approach-to-ceate-simple-bdc-session-program-using-reusable-template

Former Member
0 Kudos

Upload the desired file from presentation or application server in an internal table. this can be done using GUI upload.

loop at itab.

perform bdc_dynpro using 'SAPLCOKO1' '0220'.

perform bdc_field using 'BDC_CURSOR'

'AUFPAR-PP_AUFART'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'AFPOD-KDAUF'

itab-KDAUF_001.

perform bdc_field using 'AFPOD-KDPOS'

itab-KDPOS_002.

perform bdc_field using 'CAUFVD-MATNR'

itab-MATNR_003.

perform bdc_field using 'CAUFVD-WERKS'

itab-WERKS_004.

perform bdc_field using 'AFPOD-PWERK'

itab-PWERK_005.

perform bdc_field using 'AUFPAR-PP_AUFART'

itab-PP_AUFART_006.

perform bdc_dynpro using 'SAPLCOKO1' '0115'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'CAUFVD-GAMNG'.

perform bdc_field using 'CAUFVD-GAMNG'

itab-GAMNG_007.

perform bdc_field using 'CAUFVD-GMEIN'

itab-GMEIN_008.

perform bdc_field using 'CAUFVD-TERKZ'

itab-TERKZ_009.

perform bdc_field using 'CAUFVD-FHORI'

itab-FHORI_010.

perform bdc_field using 'CAUFVD-GLTRP'

itab-GLTRP_011.

perform bdc_dynpro using 'SAPLCOKO1' '0115'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'CAUFVD-GAMNG'.

perform bdc_field using 'CAUFVD-GAMNG'

itab-GAMNG_012.

perform bdc_field using 'CAUFVD-GMEIN'

itab-GMEIN_013.

perform bdc_field using 'CAUFVD-GLTRP'

itab-GLTRP_014.

perform bdc_field using 'CAUFVD-GSTRP'

itab-GSTRP_015.

perform bdc_field using 'CAUFVD-TERKZ'

itab-TERKZ_016.

perform bdc_field using 'CAUFVD-FHORI'

itab-FHORI_017.

perform bdc_transaction using 'CO08'.

endloop.

perform close_group.

perform close_dataset using dataset.

*******************************************************************

the fields whose data exists on the screen while recording the BDC is also included in the BDC program. These data can be deleted. i have assumed that i have uploaded a tab deliminated text file from presentation server using GUI upload function module. then i have looped on the internal table and the internal table data is used to perform the BDC (the record is replaced with itab). While executing check the option<b> keep Session</b>. Then go to transaction SM35 and process and u can moniter the BDC progress. the errors or messages acn be found by double clicking on the session name.

points if useful..