‎2019 Sep 02 1:55 PM
Hi Experts,
I have a requirement to call sales order create/change BAPIs from my report program . These BAPIS do not exist in development environment but available at RFC destination. I need to write logic to call them from development environment and test it from development itself.
Can you please advice how can i define structures and table to pass the data to BAPI function as BAPI structures are not available in development.
‎2019 Sep 02 3:39 PM
You could use in your program a variable for the FM name, and could create dynamic internal structure and table from ddic structure reference get from a RFC enabled FM such as DDIF_FIELDINFO_GET using class such as cl_abap_structdescr or cl_abap_tabledescr, so what is your exact problem?
bapi_name = 'BAPI_SALESDOCU_CREATEFROMDATA1'.
CALL FUNCTION bapi_name DESTINATION target
EXPORTING
sales_header_in = <header>
sales_header_inx = <headerx>
IMPORTING
salesdocument_ex = <v_vbeln>
TABLES
return = return
sales_items_in = <item>.
" ...
‎2019 Sep 02 2:43 PM
What do you expect from us? You can define structures/internal tables either in your program or in DDIC. But I think this is not the answer you want to hear, do you?
‎2019 Sep 02 3:06 PM
Thanks for replying back on my post. I should have been more specific.
I have a requirement to call multiple BAPI's which are not available in development environment, not even their structures, for example in below example i need to define header, headerx, v_vbeln......etc in data declaration but structure bapisdhead1, bapisdhead1x.. etc are not available in development system. I do not want to create all structures in DDIC as these are many .I am looking if i can create structure type dynamically.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
‎2019 Sep 02 3:39 PM
You could use in your program a variable for the FM name, and could create dynamic internal structure and table from ddic structure reference get from a RFC enabled FM such as DDIF_FIELDINFO_GET using class such as cl_abap_structdescr or cl_abap_tabledescr, so what is your exact problem?
bapi_name = 'BAPI_SALESDOCU_CREATEFROMDATA1'.
CALL FUNCTION bapi_name DESTINATION target
EXPORTING
sales_header_in = <header>
sales_header_inx = <headerx>
IMPORTING
salesdocument_ex = <v_vbeln>
TABLES
return = return
sales_items_in = <item>.
" ...