cancel
Showing results for 
Search instead for 
Did you mean: 

To Create Sales Order GETDETAIL & GETLIST BAPI Wrapper

Former Member
0 Kudos

Hi,

I've to create Sales Order GETDETAIL & GETLIST BAPI Wrapper for MI 7.1.

But only "BAPI_SALESORDER_GETLIST" standard BAPI is available. Also this Std. BAPI appears to be GETDETAIL Bapi rather than GETLIST Bapi.

How to use the above standard BAPI to create GETDETAIL & GETLIST BAPI Wrapper??????

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

well, I guess you have done some missconfigs. First the BADI must be RFC enabled, then MI asks for some fields in the return. Make sure these are available. check the developer dokumentation available under Help.sap.com for the exact fields.

With this you should be able to select the Badis.

Regards,

Oliver

Former Member
0 Kudos

Looking at the BAPI you are trying to use, you are required to have a customer #. So you might want to go around the standard code to pull this data down to the device.

If you delve through the code you find that there are multiple tables containing the Sales Order information, so you may need to identify exactly what data you want to pull down to the device, and create your own data structure.

In the GetList function, you may want to select from VBUK which has the document # and the status fields you will probably want to use to limit the download only to active orders.

For GetDetails you may want to use pieces from the following tables:

VBAK has header data

VBUP has the item level status

VBAP has the document item data

VBEP has the schedule line data

VBPA has partner data

VBKD has sales doc data

Your first task is to determine what data you need on the device and the structure it needs to be in. If you are using a standard BAPI for modification, you need to make sure you have the correct data and structure to pass into that BAPI...

Hope this helps a little.

Brian Timothy

Former Member
0 Kudos

Hi Brian,

Pls verify following steps to be followed while creating GETLIST BAPI Wrapper,

1. I've to call BAPI_SALESORDER_GETLIST.

2. Import & export parameters should be blank

3. In the tabels tab BAPIORDERS & VBUK are to be indicated.

While creating GETDETAIL BAPI Wrapper, what should be import & export parameters & what tabels to be called alongwith BAPIORDERS????????

Former Member
0 Kudos

It really depends on the specification of the application you are making.

1. I would not use BAPI_SALESORDER_GETLIST. This BAPI is made for getting a list for a specific customer. The customer # is manditory. I would do a select from VBUK combined with other tables to give you a listing of sales orders. Then in the GetDetail use the sales order # to get details for the sales order from the other tables.

2. You could put the BAPIRET2 structure here.

Function Module Name: Z_SALES_ORDER_GET_LIST

IMPORT Parameters: None

EXPORT Parameters: RETURN TYPE BAPIRET2

TABLES Parameters: SOLIST STRUCTURE ????

Code Description / Pseudo Code

FUNCTIONZ_SALES_ORDER_GET_LIST.

*"----


""Local Interface:

*" EXPORTING

*" VALUE(RETURN) TYPE BAPIRET2

*" TABLES

*" SOLIST STRUCTURE

*"----


*The GetList function gets the header data.

*An associated GetDetail will get the line items.

*BAPIRET2 is an SAP structure to return errors to a remote system.

*Exceptions are not transferred to remote systems, so all exceptions need to

*be caught and sent in the BAPIRET2 table. If more than one error can be sent

*the structure should be placed in the TABLES section. If only one error or

*status message is going to be sent, then the structure is placed in EXPORTING.

*Here we add the code to get all of the header information

*We only want to get the inventories that are open so we will select

*on where closed by is not filled in.

*SAMPLE CODE

SELECT * FROM VBUK INTO TABLE SOLIST

WHERE ( BESTK = 'A' ).

*END SAMPLE CODE

ENDFUNCTION.

The GetDetail will have the key fields from the SOLIST structure as the import parameters.

Function Module Name: Z_SALES_ORDER_GET_DETAILS

IMPORT Parameters: DOCNUM TYPE ??SOLIST_KEY??

EXPORT Parameters: RETURN TYPE BAPIRET2

SOITEM TYPE ???Same structure as SOLIST

TABLES Parameters: ?? Whatever the output needs to be to for the rest of the application

Code Description / Pseudo Code

FUNCTION Z_SALES_ORDER_GET_DETAILS .

*"----


""Local Interface:

*" IMPORTING

*" VALUE(DOCNUM) TYPE ??VBELN??

*" EXPORTING

*" VALUE(RETURN) TYPE BAPIRET2

*" VALUE(SOITEM) TYPE ??SOLIST??

*" TABLES

*" SODETAILS STRUCTURE ???

*"----


*The GetDetails function gets the line item data associated with

*a row from the Header table.

*SAMPLE CODE

*Get current header record that matches the given criteria

*The criteria are the keys to the header table

SELECT * FROM VBAK INTO ??

WHERE VBELN = DOCNUM.

ENDSELECT.

*Get all of the items that are associated

*with the header information

SELECT * FROM VBAP INTO ??

WHERE VBELN = DOCNUM.

*END SAMPLE CODE

ENDFUNCTION.

Without knowing what you are doing with the data, what data is needed, etc...I hope this helps.

Brian