cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi delivery creation for sales order

suryakumar1223
Explorer
0 Kudos
796

Hi ,

I'm getting error message as inconsistent data in the Bapi call... could you please help me out..

TYPE-POOLS: slis.

TABLES: vbak, vbap.

DATA: BEGIN OF itab_vbak OCCURS 0,

vbeln TYPE vbak-vbeln,

kunnr TYPE vbak-kunnr,

vkorg TYPE vbak-vkorg,

vtweg TYPE vbak-vtweg,

spart TYPE vbak-spart,

bstdk TYPE vbak-bstdk,

END OF itab_vbak.

DATA: BEGIN OF itab_vbap OCCURS 0,

vbeln TYPE vbap-vbeln,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

werks TYPE vbap-werks,

meins TYPE vbap-meins,

vrkme TYPE vbap-vrkme,

END OF itab_vbap.

TYPES: BEGIN OF it_final,

vbeln TYPE vbak-vbeln,

kunnr TYPE vbak-kunnr,

vkorg TYPE vbak-vkorg,

vtweg TYPE vbak-vtweg,

spart TYPE vbak-spart,

bstdk TYPE vbak-bstdk,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

werks TYPE vbap-werks,

meins TYPE vbap-meins,

vrkme TYPE vbap-vrkme,

status TYPE char200,

END OF it_final. *

DATA: gt_final TYPE TABLE OF it_final.

DATA: gv_final TYPE it_final.

TYPES: BEGIN OF ty_message,

status TYPE char200,

END OF ty_message.

DATA: gt_message TYPE STANDARD TABLE OF ty_message,

gv_message TYPE ty_message.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv, gs_fieldcat TYPE slis_fieldcat_alv,

gs_layo TYPE slis_layout_alv.

**Table to Hold Delivery Request

DATA: lv_text TYPE string.

DATA: BEGIN OF tbl_request OCCURS 0.

INCLUDE STRUCTURE bapideliciousrequest. DATA: END OF tbl_request.

*Table to hold Line Items Created

DATA: BEGIN OF tbl_items OCCURS 0.

INCLUDE STRUCTURE bapideliciouscreateditems. DATA: END OF tbl_items.

*Table to hold BAPI Return Messages

DATA: BEGIN OF tbl_return OCCURS 0. INCLUDE STRUCTURE bapiret2.

DATA: END OF tbl_return.

DATA: wa_return TYPE bapiret2.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:S_VBELN FOR VBAK-VBELN. SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

SELECT vbeln

vkorg

vtweg

spart

bstdk

kunnr FROM vbak INTO CORRESPONDING FIELDS OF TABLE itab_vbak

WHERE vbeln IN s_vbeln.

IF sy-subrc EQ 0.

IF itab_vbak[] IS NOT INITIAL.

SELECT vbeln posnr matnr meins werks vrkme FROM vbap INTO CORRESPONDING FIELDS OF TABLE itab_vbap

FOR ALL ENTRIES IN itab_vbak

WHERE vbeln = itab_vbak-vbeln.

ENDIF.

ENDIF.

gs_fieldcat-col_pos = '1'.

gs_fieldcat-fieldname = 'status'.

gs_fieldcat-seltext_l = 'STATUS'.

gs_fieldcat-outputlen = '200'.

APPEND gs_fieldcat TO gt_fieldcat.

CLEAR gs_fieldcat.

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC' TABLES request = tbl_request

createditems = tbl_items

return = tbl_return.

LOOP AT tbl_return INTO wa_return. CLEAR:gv_message.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING id = wa_return-id

lang = sy-langu

no = wa_return-number

v1 = wa_return-message_v1

v2 = wa_return-message_v2

v3 = wa_return-message_v3

v4 = wa_return-message_v4

IMPORTING msg = lv_text

EXCEPTIONS not_found = 1 OTHERS = 2. gv_message-status = lv_text.

APPEND gv_message TO gt_message.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING it_fieldcat = gt_fieldcat

TABLES

t_outtab = gt_message

EXCEPTIONS

program_error = 1

OTHERS = 2.

SimoneMilesi
Active Contributor
0 Kudos

Hello,

please, use CODE button to make easier to read your code.
First of all, i see the BAPI is in test phase, so it's not really stable.


Second, it looks like you are passing NO VALUES!!

Did you try to debug your code and see what are you passing to the BAPI?
Which are the full messages in Return table?

Astashonok
Participant
0 Kudos

> First of all, i see the BAPI is in test phase

are you checking BAPI_DELIVERYPROCESSING_EXEC? i haveno such warning on my system

Accepted Solutions (0)

Answers (2)

Answers (2)

venkateswaran_k
Active Contributor
0 Kudos

Hi

I can see that in your code your data to the FM-BAPI is not having any data. So the error.

Please ensure that you filled the data and then call the BAPI

t_request == Loop your sales order item table vbap and filled in this table.

        CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
          TABLES
            request      = t_request
            createditems = t_created
            return       = t_return.
 
suryakumar1223
Explorer
0 Kudos

How to get return messages in tbl_return...while calling function module BAPI DELIVERY PROCESSING EXEC ....how to fetch data to that tbl_return