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

Bapi

Former Member
0 Likes
727

Hi

Can we replace BAPI with any BDC??

Any links with one example plz?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
704

Hi

? But do you want to replace a BDC with a BAPI, or BAPI with BDC?

- If you want to replace a BAPI with BDC:

It depends on which kind of trx you shoudl simulate in the BDC.

Only the most trxs have a std BDC program, so it's probabbly u should replace the BAPI with a custom BDC (so a program done by yourself). The problem is the join transactions could not supported the BDC or it can have transactions use the table control without the functionalities to scroll the page (it could be very hard to simulate the table control).

So generally you can replace a BAPI with a BDC, but sometimes it could be very hard to do that.

- If you want to replace a BDC with BAPI: try to see <a href="http://ifr.sap.com/catalog/query.asp">here</a>, you can find all methods available.

Max

9 REPLIES 9
Read only

Former Member
0 Likes
704

ya u can if there is any bapi for perticular transaction process...

Read only

0 Likes
704

Hi Kishan

Any example how to start with?

Any scenario you had come thru?

Thanks

Read only

Former Member
0 Likes
705

Hi

? But do you want to replace a BDC with a BAPI, or BAPI with BDC?

- If you want to replace a BAPI with BDC:

It depends on which kind of trx you shoudl simulate in the BDC.

Only the most trxs have a std BDC program, so it's probabbly u should replace the BAPI with a custom BDC (so a program done by yourself). The problem is the join transactions could not supported the BDC or it can have transactions use the table control without the functionalities to scroll the page (it could be very hard to simulate the table control).

So generally you can replace a BAPI with a BDC, but sometimes it could be very hard to do that.

- If you want to replace a BDC with BAPI: try to see <a href="http://ifr.sap.com/catalog/query.asp">here</a>, you can find all methods available.

Max

Read only

0 Likes
704

Assume iam doing ME21,if iam using BAPI,do i still need to use SHDB even if i want to go thru BAPI.

How do i upload Flat file if iam using BAPI?

Which part of coding it changes?

Do i need to use gui_upload to upload file or directly BAPI can read that??

Please help me with suggestions.

Thanks

Read only

0 Likes
704

1) no u don't need for recording using SHDB..

2)use gui_upload to upload file or directly IN TO INTERNAL TABLE.

3) use this internal table in bapi BAPI_PO_CREATE this bapi is use for po create.

Read only

0 Likes
704

Hi

The structure of interface program, so a program has to laod the data from a legacy to SAP, is the same.

The only real difference is the structure to be used.

If you have a BDC program you have to transfer the data from file to BDC table and then do the CALL TRANSACION or create the SESSION;

if you have a BAPI you have to transfer the data from file to BAPI structures and then call the BAPI;

So if you should change only the part of the program where these structures are filled, but you have to manage a file by the same way for both methods.

When you have to load the data you should only ask yourself: Is there a BAPI? If yes It's better to use it, else use a BDC.

U can use a little difference if you have to read the file in the APPLICATION SERVER or PRESENTATION SERVER.

If the file is on PRESENTATION SERVER, you have to use fm as GUI_UPLOAD or WS_UPLOAD and so the file has to be loaded in an internal table before eleborating.

CALL FUNCIONT GUI_UPLOAD
 ..........
 TABLES
   T_DATA = T_FILE.


LOOP AT T_FILE.
----> Elaborate file
ENDLOOP.

If the file is on APPLICATION SEREVER, you can elaborate a record just after reading the record. 

[code]OPEN DATASET <FILE>. 

DO.
  READ DATASET <FILE> INTO T_FILE.
  IF SY-SUBRC <> 0. EXIT. ENDIF.
----> Elaborate file
ENDDO.

Max

Read only

0 Likes
704

Hi

Thanks max and kishan,

Iam going the threads i found this code and i have doubts....Please

Why don't you use BAPI BAPI_PRICES_CONDITIONS instead?

Please check this sample code from other thread.

wtable1-table_no = '306'.

wtable1-applicatio = 'V'.

wtable1-cond_type = 'ZPR0'.

wtable1-operation = '009'.

wtable1-varkey = '13001001USD 000000000050068946'.

wtable1-valid_to = '99991231'.

wtable1-valid_from = '20051101'.

wtable1-cond_no = '$000000001'.

APPEND wtable1 TO table1.

wtable2-operation = '009'.

wtable2-cond_no = '$000000001'.

wtable2-created_by = sy-uname.

wtable2-creat_date = '20051022'.

wtable2-cond_usage = 'A'.

wtable2-table_no = '110'.

wtable2-applicatio = 'V'.

wtable2-cond_type = 'ZPR0'.

wtable2-varkey = '13001001USD 000000000050068946'.

wtable2-valid_from = '20051101'.

wtable2-valid_to = '99991231'.

APPEND wtable2 TO table2.

wtable3-operation = '009'.

wtable3-cond_no = '$000000001'.

wtable3-cond_count = '01'.

wtable3-applicatio = 'V'.

wtable3-cond_type = 'ZPR0'.

wtable3-scaletype = 'A'.

wtable3-scalebasin = 'C'.

wtable3-scale_qty = '1'.

wtable3-cond_p_unt = '1'.

wtable3-cond_unit = 'EA'.

wtable3-calctypcon = 'C'.

wtable3-cond_value = '454'.

wtable3-condcurr = 'USD'.

APPEND wtable3 TO table3.

CALL FUNCTION 'BAPI_PRICES_CONDITIONS'

  • EXPORTING

  • PI_initialmode = 'X'

  • PI_BLOCKNUMBER =

TABLES

ti_bapicondct = table1

ti_bapicondhd = table2

ti_bapicondit = table3

ti_bapicondqs = table4

ti_bapicondvs = table5

to_bapiret2 = table6

to_bapiknumhs = table7

to_mem_initial = table8

EXCEPTIONS

update_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

here he is appending 6 tables and passing to BAPI and finally he is reading 6 table.

Why he is appending 3 internal tables and what scenarios??

cant we upload in to 1 table and pass to BAPI?

Read only

0 Likes
704

i mean to say why he is appenging that many tables and also what data he is appending?

same as flatfile data?

Read only

0 Likes
704

Hi

Every table of the interface has some information about the price to be loaded.

- TI_BAPICONDCT (table1) has the tecnical informations

- TI_BAPICONDHD (table2) has the header data;

- TI_BAPICONDIT (table 3) has the price

- TO_BAPIRET2 (table 6) return the messages

These are the main structures to load the data, the problem is all table parameters of the BAPI are mandatary so it has to transfer all tables but here table4, table5, table7 and table8 are empty, because you don't need to transfer any data there.

Max