cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI Program to create sales order

karthisaki
Explorer
0 Kudos

Question : i want the return messages into the fields to display in the alv display.If there any function module available for that.

Requirement : Using BAPI Function Module, to create sales order from the excel file input and after the creation of sales order, the sales document number is created in VBELN field and finally have to get the whole fields to show the status of the sales order created or not in the message.

Accepted Solutions (0)

Answers (3)

Answers (3)

lingaiahvanam
Active Contributor

Hi,

It is possible to create a sales order and get the log in ALV format with successful and failed records. Check the following Wiki page to create a sales order via BAPI.

https://wiki.scn.sap.com/wiki/display/Snippets/ABAP+-+Simple+program+to+create+sales+order+using+BAP...

Provide the details to the technical team so that they can write the logic based on your requirements. My suggestion is to include the simulation mode this option will verify the data records before data uploaded into SAP database tables.if all records are fine then use active mode to upload the data (both condition log can be generated).

Best Regards,

Lingaiah

karthisaki
Explorer
0 Kudos

Sir, Kindly send me the Function Module to get the messages from the return strucuture like (BAPI_MESSAGE_GETDETAIL).

Send me which parameters i have to pass in the export paramaeter

pataselano
Active Contributor
0 Kudos

For create sales order, you can use BAPI_SALESORDER_CREATEFROMDAT2.

You can found result (success, error or warning) in 'return' table of that BAPI.

For get detail message from 'return' table, you can use fm MESSAGE_TEXT_BUILD.

Please discuss more detail with your ABAPER.

0 Kudos

You can use FM 'C14ALD_BAPIRET2_SHOW' to display message in popup window. For ALV display of same you can use class cl_salv_table.

data : it_alv type any table.

DATA: go_alv TYPE REF TO cl_salv_table,
go_columns TYPE REF TO cl_salv_columns_table.
DATA: go_display TYPE REF TO cl_salv_display_settings.

TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = it_alv[] ).

CATCH cx_salv_msg.
ENDTRY.

DATA: lr_functions TYPE REF TO cl_salv_functions_list.

lr_functions = go_alv->get_functions( ).
lr_functions->set_all( 'X' ).

go_columns = go_alv->get_columns( ).
go_columns->set_optimize( if_salv_c_bool_sap=>true ).

go_display = go_alv->get_display_settings( ).
go_display->set_list_header( i_title ).

IF go_alv IS BOUND.

"If popup required - start

IF i_popup = 'X'.

go_alv->set_screen_popup(
start_column = i_start_column
end_column = i_end_column
start_line = i_start_line
end_line = i_end_line ).
ENDIF.

"If popup required - end

go_alv->display( ).

ENDIF.