3.BAPI-Difference Between Non Dialog & Dialog BAPI With Example
3.BAPI-Difference Between Non Dialog & Dialog BAPI With Example
Dialog BAPIs usually calls the Screen where the user is required and it can not be executed
in background where as with Non Dialog BAPIs can be called in Background mode without
any User intervention. The below post shows the difference between the two types.
-------------------------------------------------------------------------------------------------------------Step1. Go to Tx- SWO1 & open the BO- BUS2032 Sales order. The two methods creates
the Sales Order but one without dialog mode and other is with dialog mode.
Step3. Create the below report which created the Sales Order By Non Dialog BAPI FM call.
_________________________________________________________________________
________
PARAMETERS : p_no_so TYPE int4.
DATA : ls_ord_hdr TYPE bapisdhd1,
ls_ord_hdrx TYPE bapisdhd1x,
so_num
TYPE bapivbeln-vbeln,
lt_so_num
LIKE TABLE OF so_num,
lt_ret
TYPE TABLE OF bapiret2,
lt_item
TYPE TABLE OF bapisditm,
ls_item
TYPE bapisditm,
lt_itemx
TYPE TABLE OF bapisditmx,
ls_itemx
TYPE bapisditmx,
lt_part
TYPE TABLE OF bapiparnr,
ls_part
TYPE bapiparnr,
lt_schd
TYPE TABLE OF bapischdl ,
ls_schd
lt_schdx
ls_schdx
TYPE bapischdl,
TYPE TABLE OF bapischdlx,
TYPE bapischdlx.
START-OF-SELECTION.
******* Fill the Sales Order Header ****************
ls_ord_hdr-doc_type = 'TA'. " ORDER Type : OR->TA as per TVAK table
ls_ord_hdr-sales_org = 'AB99'.
ls_ord_hdr-distr_chan = 'WS'.
ls_ord_hdr-division = 'LT'.
ls_ord_hdr-purch_no_c = 'ORDER_100'.
ls_ord_hdrx-updateflag = 'X'.
ls_ord_hdrx-doc_type ='X'.
ls_ord_hdrx-sales_org = 'X'.
ls_ord_hdrx-distr_chan = 'X'.
ls_ord_hdrx-division = 'X'.
ls_ord_hdrx-purch_no_c = 'X'.
*********FILL PARTNERS TABLE ******************
ls_part-partn_role = 'AG'. " SOLD TO PARTY
ls_part-partn_numb = '0000099994'.
APPEND ls_part TO lt_part.
CLEAR ls_part.
ls_schdx-itm_number = '10'.
ls_schdx-req_qty = 'X'.
ls_schdx-updateflag = 'X'.
APPEND ls_schdx TO lt_schdx.
CLEAR ls_schdx.
IF p_no_so > 0.
DO p_no_so TIMES.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = ls_ord_hdr
order_header_inx = ls_ord_hdrx
IMPORTING
salesdocument
= so_num
TABLES
return
= lt_ret
order_items_in
= lt_item
order_items_inx = lt_itemx
order_partners
= lt_part
order_schedules_in = lt_schd
order_schedules_inx = lt_schdx.
IF sy-subrc = 0.
APPEND so_num TO lt_so_num.
CLEAR so_num.
COMMIT WORK.
ENDIF.
ENDDO.
ENDIF.
END-OF-SELECTION.
IF lt_so_num IS NOT INITIAL.
LOOP AT lt_so_num INTO so_num.
WRITE :/ 'Sales Order Generated By BAPI call-', sy-tabix , ':', so_num.
ENDLOOP.
ENDIF.
_________________________________________________________________________
_______
Step4. Create the below report which created the Sales Order By Dialog BAPI FM call.
_________________________________________________________________________
________
PARAMETERS : p_no_so TYPE int4.
DATA : ls_ord_hdr
TYPE bapisdhead1,
ls_ord_hdrx TYPE bapisdhead1x,
so_num
TYPE bapivbeln-vbeln,
lt_so_num
LIKE TABLE OF so_num,
lt_ret
TYPE TABLE OF bapiret2,
lt_item
TYPE TABLE OF bapisditem,
ls_item
lt_itemx
ls_itemx
lt_part
ls_part
lt_schd
ls_schd
lt_schdx
ls_schdx
TYPE bapisditem,
TYPE TABLE OF bapisditmx,
TYPE bapisditmx,
TYPE TABLE OF bapipartnr,
TYPE bapipartnr,
TYPE TABLE OF bapischedule,
TYPE bapischedule,
TYPE TABLE OF bapischedulex,
TYPE bapischedulex.
START-OF-SELECTION.
******* Fill the Sales Order Header ****************
ls_ord_hdr-doc_type = 'TA'. " ORDER Type : OR->TA as per TVAK table
ls_ord_hdr-sales_org = 'AB99'.
ls_ord_hdr-distr_chan = 'WS'.
ls_ord_hdr-division = 'LT'.
ls_ord_hdr-purch_no_c = 'ORDER_100'.
ls_ord_hdrx-doc_type ='X'.
ls_ord_hdrx-sales_org = 'X'.
ls_ord_hdrx-distr_chan = 'X'.
ls_ord_hdrx-division = 'X'.
ls_ord_hdrx-purch_no_c = 'X'.
*********FILL PARTNERS TABLE ******************
ls_part-partn_role = 'AG'. " SOLD TO PARTY
ls_part-partn_numb = '0000099994'.
APPEND ls_part TO lt_part.
CLEAR ls_part.
ls_schdx-itm_number = '10'.
ls_schdx-req_qty = 'X'.
ls_schdx-updateflag = 'X'.
APPEND ls_schdx TO lt_schdx.
CLEAR ls_schdx.
IF p_no_so > 0.
DO p_no_so TIMES.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEWITHDIA' " Calls VA01 Transaction
EXPORTING
sales_header_in
= ls_ord_hdr
sales_header_inx
= ls_ord_hdrx
IMPORTING
SALESDOCUMENT_EX
= so_num
TABLES
return
= lt_ret
sales_items_in
= lt_item
sales_items_inx
= lt_itemx
sales_partners
= lt_part
sales_schedules_in
= lt_schd
sales_schedules_inx
= lt_schdx.
IF sy-subrc = 0.
APPEND so_num TO lt_so_num.
CLEAR so_num.
COMMIT WORK.
ENDIF.
ENDDO.
ENDIF.
END-OF-SELECTION.
IF lt_so_num IS NOT INITIAL.
LOOP AT lt_so_num INTO so_num.
WRITE :/ 'Sales Order Generated By BAPI call-', sy-tabix , ':', so_num.
ENDLOOP.
ENDIF.
_________________________________________________________________________
________
Step5. Execute both the report and see the output.
Step6. The first one directly creates the Sales Order & the other Dialog BAPI calls the
transaction VA01 and waits for the user action like Save or modifying something in the
Screen.
Step7.
View comments
TECHSAP
Sidebar
Home
Topic Tutorials
FPM Tutorials
6.Smartfrom: How to call a Smartform progrmatically that works in development, quality & production?
Part4 : FPM OVP Application -Integrating Search UIBB and List UIBB: Displaying POPUP Screen
Part3 : FPM OVP Application -Integrating Search UIBB and List UIBB: Message Display
Part2 : FPM Integrating Search UIBB and List UIBB into FPM OVP Application : Link to action
Part1 : FPM Integrating Search UIBB and List UIBB into FPM OVP Application
qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per mixed part of the
Queues
qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per Queue Call
qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW for Multiple QUEUE Calls
Step3. Still we can open any document by specifying the appropriate executable file,
location of the directory of the file and providing the file name.
Step4. Here is one example how we can open a PDF file by the method
cl_gui_frontend_services=>execute.
View comments
Loading