on 11-11-2005 4:12 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.