Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Type conflict when calling a function module (field length).

Former Member
0 Likes
2,689

Hi,

I am getting a dump for this report when I call the FM.

Type conflict when calling a function module (field length).

What could be the reason for this.I don't want to use occurs in my table declartions.because I will be using this in a Webdynpro app.

report x.

DATA: doc_header TYPE STANDARD TABLE OF bapidochdrp .
  DATA: doc_items TYPE STANDARD TABLE OF bapiskfitm  .
  DATA: return TYPE STANDARD TABLE OF bapiret2 .

  DATA: wa_header TYPE  bapidochdrp .
  DATA: wa_doc TYPE  bapiskfitm  .
  DATA: wa_return TYPE bapiret2 .

  wa_header-co_area = 1000.
  wa_header-docdate = sy-datum.
  wa_header-username = Sy-UNAME.

  APPEND wa_header TO doc_header.

wa_doc-statkeyfig = '2002'.
wa_doc-stat_qty = '2'.
WA_DOC-REC_WBS_EL = '102094005-8505'.

APPEND wa_doc to doc_items .


wa_doc-statkeyfig = '2000'.
wa_doc-stat_qty = '3'.
WA_DOC-REC_WBS_EL = '102094005-1000-01-01-01'.

APPEND wa_doc to doc_items .

wa_doc-statkeyfig = '2000'.
wa_doc-stat_qty = '4'.
WA_DOC-REC_WBS_EL = '102094005-2030-01-01-01'.

APPEND wa_doc to doc_items .

wa_doc-statkeyfig = '2002'.
wa_doc-stat_qty = '5'.
WA_DOC-REC_WBS_EL = '102094005-5000-01-01-01'.

APPEND wa_doc to doc_items .

wa_doc-statkeyfig = '2001'.
wa_doc-stat_qty = '5'.
WA_DOC-REC_WBS_EL = '102094005-3500'.

APPEND wa_doc to doc_items .




CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
  EXPORTING
    doc_header            = doc_header
*   IGNORE_WARNINGS       = ' '
* IMPORTING
*   DOC_NO                = DOC_NO
  TABLES
    doc_items             = doc_items
    return                = return
*   CUSTOMER_FIELDS       = CUSTOMER_FIELDS
          .

  COMMIT WORK.

  IF sy-subrc IS INITIAL.

    READ TABLE return INTO wa_return INDEX 1.
    WRITE : wa_return-message.

  ENDIF.

Rgds

Praveen

1 ACCEPTED SOLUTION
Read only

former_member376453
Contributor
0 Likes
1,260

In the BAPI, Doc_header is a structure not a table. but you are passing value through a table. Just pass the wa_header instead doc_header.

Kuntal

5 REPLIES 5
Read only

former_member376453
Contributor
0 Likes
1,261

In the BAPI, Doc_header is a structure not a table. but you are passing value through a table. Just pass the wa_header instead doc_header.

Kuntal

Read only

Former Member
0 Likes
1,260

Try with return = return[]

Read only

Former Member
0 Likes
1,260

This issue occurs when you function modules parameters are of different type

and the parameters you are passing does not match.

Just Goto->SE37>OPEN-->'BAPI_ACC_STAT_KEY_FIG_POST'

Check the types for doc_header ,doc_items , return

there will be a mismatch.

Just the declare the same types in your program.

CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
  EXPORTING
    doc_header            = *doc_header*
*   IGNORE_WARNINGS       = ' '
* IMPORTING
*   DOC_NO                = DOC_NO
  TABLES
    doc_items             = *doc_items*
    return                = *return*
*   CUSTOMER_FIELDS       = CUSTOMER_FIELDS

Regards,

gurpreet

Read only

former_member156446
Active Contributor
0 Likes
1,260

This works:

REPORT  zj_test LINE-SIZE 162.

DATA: doc_header TYPE STANDARD TABLE OF bapidochdrp .
DATA: doc_items TYPE STANDARD TABLE OF bapiskfitm  .
DATA: return TYPE STANDARD TABLE OF bapiret2 .

DATA: wa_header TYPE  bapidochdrp .
DATA: wa_doc TYPE  bapiskfitm  .
DATA: wa_return TYPE bapiret2 .

wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.

APPEND wa_header TO doc_header.

wa_doc-statkeyfig = '002002'.
wa_doc-stat_qty = '00000000000002'.
wa_doc-rec_wbs_el = '0000000000102094005-8505'.

APPEND wa_doc TO doc_items .


CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
  EXPORTING
    doc_header            = wa_header
*   IGNORE_WARNINGS       = ' '
* IMPORTING
*   DOC_NO                = DOC_NO
  TABLES
    doc_items             = doc_items
    return                = return
*   CUSTOMER_FIELDS       = CUSTOMER_FIELDS
          .

COMMIT WORK.

IF sy-subrc IS INITIAL.

  READ TABLE return INTO wa_return INDEX 1.
  WRITE : wa_return-message.

ENDIF.

Read only

0 Likes
1,260

Thank you Kuntal.

That's it.I made mistake by passing table to a structure.

rgds

Praveen