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

BDC HELP

Former Member
0 Likes
943

Hii Experts,

I am using abap trail version so i can't access the material master or vendor master table.so can anyone give me an example of a bdc program which doesn't include material or vendor master.

i don't have any idea about bdc so i want the example in details.can anybody help me with this??

regards

abhinab.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
843

Ab,

BDC is a script to process data. When you create BDC process (thru SM35==> Recording) you basically walk thru the process of performing what ever transaction want.

After you do this, you save the recording. You are then able to create a program based on that recording and "plug in" code from this generated program that will specifially perform the parts you want with the values you want.

This is an example of a BDC generated program.


report YPTC_BDC_MIGO2
       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: GOACTION
        ACTION_001(003),
* data element: REFDOC
        REFDOC_002(003),
* data element: BWART
        BWART_003(003),
* data element: EBELN
        PO_NUMBER_004(010),
* data element: EBELP
        PO_ITEM_005(005),
* data element: BLDAT
        BLDAT_006(010),
* data element: BUDAT
        BUDAT_007(010),
* data element: WEVER
        WEVER_008(018),
* data element: BWART
        BWART_009(003),
* data element: BLDAT
        BLDAT_010(010),
* data element: BUDAT
        BUDAT_011(010),
* data element: WEVER
        WEVER_012(018),
* data element: MBLPO
        DETAIL_ZEILE_013(004),
* data element: ERFME
        ERFME_014(003),
* data element: MB_ERFMG
        ERFMG_015(017),
* data element: MIGO_ELIKZ
        MIGO_ELIKZ_016(012),
* data element: BWART
        BWART_017(003),
* data element: MB_TAKE_IT
        DETAIL_TAKE_018(001),
      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 'SAPLMIGO' '0001'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OK_GO'.
perform bdc_field       using 'GODYNPRO-ACTION'
                              record-ACTION_001.
perform bdc_field       using 'GODYNPRO-REFDOC'
                              record-REFDOC_002.
perform bdc_field       using 'GODEFAULT_TV-BWART'
                              record-BWART_003.
perform bdc_field       using 'BDC_CURSOR'
                              'GODYNPRO-PO_ITEM'.
perform bdc_field       using 'GODYNPRO-PO_NUMBER'
                              record-PO_NUMBER_004.
perform bdc_field       using 'GODYNPRO-PO_ITEM'
                              record-PO_ITEM_005.
perform bdc_field       using 'GOHEAD-BLDAT'
                              record-BLDAT_006.
perform bdc_field       using 'GOHEAD-BUDAT'
                              record-BUDAT_007.
perform bdc_field       using 'GOHEAD-WEVER'
                              record-WEVER_008.
perform bdc_dynpro      using 'SAPLMIGO' '0001'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OK_POST1'.
perform bdc_field       using 'GODEFAULT_TV-BWART'
                              record-BWART_009.
perform bdc_field       using 'GOHEAD-BLDAT'
                              record-BLDAT_010.
perform bdc_field       using 'GOHEAD-BUDAT'
                              record-BUDAT_011.
perform bdc_field       using 'GOHEAD-WEVER'
                              record-WEVER_012.
perform bdc_field       using 'GODYNPRO-DETAIL_ZEILE'
                              record-DETAIL_ZEILE_013.
perform bdc_field       using 'BDC_CURSOR'
                              'GOITEM-ERFME'.
perform bdc_field       using 'GOITEM-ERFME'
                              record-ERFME_014.
perform bdc_field       using 'GOITEM-ERFMG'
                              record-ERFMG_015.
perform bdc_field       using 'GOITEM-MIGO_ELIKZ'
                              record-MIGO_ELIKZ_016.
perform bdc_field       using 'GOITEM-BWART'
                              record-BWART_017.
perform bdc_field       using 'GODYNPRO-DETAIL_TAKE'
                              record-DETAIL_TAKE_018.
perform bdc_transaction using 'MIGO'.

enddo.

perform close_group.
perform close_dataset using dataset.

4 REPLIES 4
Read only

Former Member
0 Likes
844

Ab,

BDC is a script to process data. When you create BDC process (thru SM35==> Recording) you basically walk thru the process of performing what ever transaction want.

After you do this, you save the recording. You are then able to create a program based on that recording and "plug in" code from this generated program that will specifially perform the parts you want with the values you want.

This is an example of a BDC generated program.


report YPTC_BDC_MIGO2
       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: GOACTION
        ACTION_001(003),
* data element: REFDOC
        REFDOC_002(003),
* data element: BWART
        BWART_003(003),
* data element: EBELN
        PO_NUMBER_004(010),
* data element: EBELP
        PO_ITEM_005(005),
* data element: BLDAT
        BLDAT_006(010),
* data element: BUDAT
        BUDAT_007(010),
* data element: WEVER
        WEVER_008(018),
* data element: BWART
        BWART_009(003),
* data element: BLDAT
        BLDAT_010(010),
* data element: BUDAT
        BUDAT_011(010),
* data element: WEVER
        WEVER_012(018),
* data element: MBLPO
        DETAIL_ZEILE_013(004),
* data element: ERFME
        ERFME_014(003),
* data element: MB_ERFMG
        ERFMG_015(017),
* data element: MIGO_ELIKZ
        MIGO_ELIKZ_016(012),
* data element: BWART
        BWART_017(003),
* data element: MB_TAKE_IT
        DETAIL_TAKE_018(001),
      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 'SAPLMIGO' '0001'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OK_GO'.
perform bdc_field       using 'GODYNPRO-ACTION'
                              record-ACTION_001.
perform bdc_field       using 'GODYNPRO-REFDOC'
                              record-REFDOC_002.
perform bdc_field       using 'GODEFAULT_TV-BWART'
                              record-BWART_003.
perform bdc_field       using 'BDC_CURSOR'
                              'GODYNPRO-PO_ITEM'.
perform bdc_field       using 'GODYNPRO-PO_NUMBER'
                              record-PO_NUMBER_004.
perform bdc_field       using 'GODYNPRO-PO_ITEM'
                              record-PO_ITEM_005.
perform bdc_field       using 'GOHEAD-BLDAT'
                              record-BLDAT_006.
perform bdc_field       using 'GOHEAD-BUDAT'
                              record-BUDAT_007.
perform bdc_field       using 'GOHEAD-WEVER'
                              record-WEVER_008.
perform bdc_dynpro      using 'SAPLMIGO' '0001'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OK_POST1'.
perform bdc_field       using 'GODEFAULT_TV-BWART'
                              record-BWART_009.
perform bdc_field       using 'GOHEAD-BLDAT'
                              record-BLDAT_010.
perform bdc_field       using 'GOHEAD-BUDAT'
                              record-BUDAT_011.
perform bdc_field       using 'GOHEAD-WEVER'
                              record-WEVER_012.
perform bdc_field       using 'GODYNPRO-DETAIL_ZEILE'
                              record-DETAIL_ZEILE_013.
perform bdc_field       using 'BDC_CURSOR'
                              'GOITEM-ERFME'.
perform bdc_field       using 'GOITEM-ERFME'
                              record-ERFME_014.
perform bdc_field       using 'GOITEM-ERFMG'
                              record-ERFMG_015.
perform bdc_field       using 'GOITEM-MIGO_ELIKZ'
                              record-MIGO_ELIKZ_016.
perform bdc_field       using 'GOITEM-BWART'
                              record-BWART_017.
perform bdc_field       using 'GODYNPRO-DETAIL_TAKE'
                              record-DETAIL_TAKE_018.
perform bdc_transaction using 'MIGO'.

enddo.

perform close_group.
perform close_dataset using dataset.

Read only

0 Likes
843

the transaction migo doesn't exists for me..

Read only

0 Likes
843

Abhinab,

You can create your own .. my code was meerly an example of the results.

To create your own

SM35

Push the Recording button

Push the New Recording button

give some name (AbhTEST)

give the Trancode you want to record

move thru the transaction and complete all the data you need

SAVE or whatever the transaction you used uses to finsih

You will be shown a BDC Script.

Hit the SAVE button at the top

then the GREEN Arrow button

You will be given a list of recordings that have been made.

Select your recording and hit the PROGRAM Button.

Give a name for the program (it should be started with a Y for local code not to be transported)

hit the Transfer from Recording radion button

and then the Green Check

Fill in the Required fields here and push the Source Code button

then the Local Object button

You are then presented with the source code. This code will compile and run as is.

However, this code is very raw and will need to be modified to be placed into your code that you would this action from.

Read only

Former Member
0 Likes
843

Hi,

I can't as such explain complete BDC but I can give you an idea where, when and how it's used.

BDC is used to upload data. Other concepts in ABAP along with BDC that are used to upload data are LSMW, BAPI etc.

When talking about BDC we have 2 approaches.

1. Call transaction

2. Session method.

For the differences between these you have to search this forum to have a very clear idea. Each method has it's own advantages and error handling as well.

For what ever the transaction say vendor master, material or customer......you have to goto that transaction and do recording.

Recording is done using SHDB or SM35 tcodes.

You have to populate the BDCDATA in your program with screen no, screen name, field name, field value, program name.

They are DYNPRO, DYNBEGIN, FNAM, FVAL, PROGRAM.

I an not sure what else to write.......

If you have more questions please get back.

hope it helps.

thanks.