cancel
Showing results for 
Search instead for 
Did you mean: 

doubt on bdc's

Former Member
0 Kudos

i was trying my first bdc program. i wanted to record mm03 transaction.

so i went to tcode SHDB, pressed new recording, gave a recording name and t-code mm03 and

started recording. it asked for material number, i just entered one and pressed back to stop recording.

i saved it. then i selected my recording name and pressed on function module to see the code generated.

is this how u do it. does all BDC programs work just by starting with SHDB or its not needed. should a BDC

be written in se38 or se37.

can any bdc program be written without ever recording.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I've created many BDCs and almost never use SHDB. With SHDB, every keystroke (including errors) are recorded. I either step through the transaction and collect the information I need or copy a similar BDC.

Having said that, for transactions with coding blocks like FB01, SHDB may make more sense if you don't have an existing BDC to look at.

Rob

Former Member
0 Kudos

How's that for contrary advice? It's a matter of personal preference.

But, I think most people use SHDB, so...

Rob

Message was edited by: Rob Burbank

Former Member
0 Kudos

Rich,

Could u explain more on CALL TRANSACTION USING BDC DATA. coul u also tell me whether u write in se37 or 38.

Former Member
0 Kudos

Example:

data: begin of bdcdata occurs 10.

include structure bdcdata.

data: end of bdcdata.

form post_goods_issue tables p_processing_protocol

structure ws_processing_protocol

using p_temp_vbeln.

clear bdcdata. refresh bdcdata.

perform bdc_dynpro using 'SAPMV50A' "Change Outbound Delivery

'4004'.

perform bdc_field using 'LIKP-VBELN' "Delivery number

p_temp_vbeln.

perform bdc_field using 'BDC_OKCODE'

'=WABU_T'. "PGI button

perform bdc_dynpro using 'SAPMSSY0' "Log screen

'0120'.

perform bdc_field using 'BDC_OKCODE' "Back

'=BACK'.

perform bdc_dynpro using 'SAPMV50A' "Change Outbound Delivery

'4004'.

perform bdc_field using 'BDC_OKCODE' "Back

'/EBACKE_T'.

clear attempts.

do.

clear msgtab. refresh msgtab.

bdcmode = 'N'.

call transaction 'VL02N' using bdcdata mode bdcmode update 'S'

messages into msgtab.

----


  • Start new screen *

----


form bdc_dynpro using program dynpro .

clear bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

append bdcdata.

endform. "bdc_dynpro

*----


  • Insert field

*----


form bdc_field using fnam fval.

clear bdcdata.

write fnam to bdcdata-fnam .

write fval to bdcdata-fval.

append bdcdata.

endform. "bdc_field

Former Member
0 Kudos

rob -- can u tell why we can't use code generated for va01.

can anyone give a small specification of what made them write a bdc and how they achieved that. this would be really great.

Former Member
0 Kudos

Please note, however, that BDCs are generally a poor idea. They can cause large SAP upgrade porblems. SAP can change SAP screens at will during an upgrade. If they change a screen that run a BDC against, you must change your BDC to reflect that.

Using BAPIs is the "proper/correct" solution with regards to upgrades... and hopefully, your organization is staying fairly current with SAP's releases.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

John, has given a good example here. Notice that he only has what he needs, in generating a program in SHDB, it INCLUDES an include program that has a selection screen and other stuff you don't need. Here John is only using two FORMs from that INCLUDE program and has copied them from the include into his custom program, he has also include just the BDC code from the generated program, and finishes up with the CALL TRANSACTION statement. This is basically how I've done every single BDC program.

Regards

Rich Heilman

Former Member
0 Kudos

Thanks, Rich.

Former Member
0 Kudos

so we should copy the generated bdc program to se38 and then customize it. do confirm whether its written in se38 or 37.

Former Member
0 Kudos

Its is SE38

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, SE38, unless you want to have this code in a function module which is entirely possible. In which case you would use SE37

Regards,

Rich HEilman

Message was edited by: Rich Heilman

Former Member
0 Kudos

where can i see the generated code. all now i was thinking to see the code i need to press on the function module button and assign a name for FM. then open it in se37 then copy the code in se38. i guess there should be a different process of seeing the generated bdc code. how to see it.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

After the transaction is ended, you should see a screen with a table control with some code in it. Click save here, and then BACK, Hightlight your recording that you just did and press the "Program" button. Enter the program name ZWHATEVER and click transfer from recording, then green check, you will then see the code inside of your ZWHATEVER program in SE38.

Regards,

Rich Heilman

Former Member
0 Kudos

thanks rich. that solved the problem.

Answers (2)

Answers (2)

Former Member
0 Kudos

Let me first say you are trying to update a transaction in display mode. that is MM03.You cannot write a BDC for MM03.

But if you want you can use for creat/change transaction. First do the SHDB. And again you cannot use the code that is generated by SHDB for all transactions.

fOR EG: VA01.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

That is how you will get your code. It is your choice whether you want to have it generate a function module, or a program. You can also, "steal" the code from the generated program an place it in a custom program where needed and use CALL TRANSACTION USING BDCDATA. This is what I usually do, I use SHDB just to generate the code, then I take it an implement how I want.

Regards

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, you can write your own BDC code, I have never done that because of the SHDB transaction. I don't need extra headaches, you know?

Regards,

Rich Heilman