Question:
Can anybody please explain,how to convert BDC into BAPIs and object oriented programming in abap? where can i find material for them? Thanks in advance
Answer:
Hi,
U can convert a BDC into a BAPI. It depends what kind of conversion you are looking at. You can either embedd the BDC in the BAPI or Do Database updates in the same way the transaction does (this is tough one).
If u are just embedding BDC in BAPI then u need to use 'CALL TRANSACTION TCODE USING BDCDATA' in synchronoues mode. You cannot use session method as the successful execution of BDC cannot be determined until it runs in the same work process as the BAPI.
Wat ever message is returned from 'TRANSACTION TCODE USING BDCDATA'should be sent back in the table BAPI_RET structure. If the message contains 'E' type message then the TCode has failed.
Answer:
the sap shop has good material on abap objects.
m@t
_________________
TULY The quality of answers is roughly proportional to the quality of the question.
The downside of being better than everyone else is that people tend to assume you're pretentious.
Answer:
Thanks for the reply. But if possible can you please explain how to embed bdc into bapis
Answer:
Hi,
You can create BAPI using SE37 (the same way you creat RFCs). Here you can have import parameters such as BDC data which is populated into table of structure BDCDATA. In the tables section you can have table of structure BAPIRET2.
Once you pass the BDCDATA table which was built in the calling program.
In the BAPI you need to use 'CALL TRANSACTION tcode USING bdcdata MESSAGES INTO msg_itab (BDCMSGCOLL structure) UPDATE 'S' MODE 'N''.
After the successful execution or failed execution the messages will be in msg_itab which has the structure BDCMSGCOLL. Then loop at this table and call the FM as below.
loop at msg_itab
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = msg_itab-msgty
CL = msg_itabmsgid
NUMBER = msg_itabmsgno
PAR1 = msg_itabmsgv1
PAR2 = msg_itabmsgv2
PAR3 = msg_itabmsgv3
PAR4 = msg_itabmsgv4
IMPORTING
RETURN = l_f_return.
append l_f_return to BAPIRET2.
endloop.
Answer:
Thanks preetham
Answer:
preetham's solution doesn't however register the BAPI (since it should be implemented as an object method and be available in tcode BAPI to be a true BAPI) and not just an RFC enabled FM with a naming convention.
Please search the forum, there are detailed posts on custom BAPIs
_________________
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru
Answer:
Hi,
I agree with Rosie. You need to register BAPI for it appear in Tcode BAPI. I have just given a basic approach how to use BDC in BAPI. More emphasis is on using CALL TRANSACTION so that BAPI returns results immediately. I would appreciate if some light is thrown on registering process.
thanks....