Application Development 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: 

BADI Error

Former Member
0 Kudos

Hi Experts

I am developing a Bapi into a Badi, regarding automatic postings, now am facing the following error.

I am using following oops method

IF_EX_BADI_SD_BILLING~INVOICE_DOCUMENT_CHECK

Iam getting the Error :

CALL_FUNCTION_CONFLICT_LENG

"HEAD" is the correct type, its length is incorrect.

My Coding :

TYPES : begin of ggoodsmvt_header1,

ref_doc_no type bapi2017_gm_head_01-ref_doc_no,

pstng_date type bapi2017_gm_head_01-pstng_date,

doc_date type bapi2017_gm_head_01-doc_date,

pr_uname type bapi2017_gm_head_01-pr_uname,

END OF ggoodsmvt_header1.

*internal table

DATA : HEAD TYPE TABLE OF ggoodsmvt_header1.

*work area

DATA : WAH TYPE ggoodsmvt_header1.

WAH-ref_doc_no = wa_vbrk-vbeln.

WAH-pstng_date = sy-datum.

WAH-doc_date = sy-datum.

WAH-pr_uname = sy-uname.

APPEND WAH TO HEAD.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = HEAD

goodsmvt_code = ggoodsmvt_code

  • TESTRUN = ' '

IMPORTING

  • GOODSMVT_HEADRET =

materialdocument = gmaterialdocument

matdocumentyear = gmatdocumentyear

TABLES

goodsmvt_item = itabw

  • GOODSMVT_SERIALNUMBER =

return = greturn

What could be the error, i think HEAD is the problem, bcoz

usually we give

DATA : ggoodsmvt_header TYPE STANDARD TABLE OF bapi2017_gm_head_01 WITH HEADER LINE.

but in oops we cant assign header line, is it, pls advise me solve this problem.

Thanks in advance.

Regards

Rajaram

1 ACCEPTED SOLUTION

vinod_vemuru2
Active Contributor
0 Kudos

Hi Raja,

Check below things.


--TYPES : begin of ggoodsmvt_header1,--
--ref_doc_no type bapi2017_gm_head_01-ref_doc_no,--
--pstng_date type bapi2017_gm_head_01-pstng_date,--
--doc_date type bapi2017_gm_head_01-doc_date,--
--pr_uname type bapi2017_gm_head_01-pr_uname,--
--END OF ggoodsmvt_header1.--

*internal table
--DATA : HEAD TYPE TABLE OF ggoodsmvt_header1.--
*work area
--DATA : WAH TYPE ggoodsmvt_header1.--
DATA: wah TYPE BAPI2017_GM_HEAD_01. "Add this

WAH-ref_doc_no = wa_vbrk-vbeln.
WAH-pstng_date = sy-datum.
WAH-doc_date = sy-datum.
WAH-pr_uname = sy-uname.
--APPEND WAH TO HEAD.--

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
--goodsmvt_header = HEAD--
goodsmvt_header = wah  "Add
goodsmvt_code = ggoodsmvt_code

TESTRUN = ' ' 
IMPORTING

GOODSMVT_HEADRET = 
materialdocument = gmaterialdocument
matdocumentyear = gmatdocumentyear
TABLES
goodsmvt_item = itabw

GOODSMVT_SERIALNUMBER = 
return = greturn

Comment the code which i striked off and put the code where i have comment ADD.

This will solve ur issue.

Thanks,

Vinod.

12 REPLIES 12

Former Member
0 Kudos

Hi Raja,

the header structure is mismatching i think. try this code.

DATA : ggoodsmvt_header TYPE bapi2017_gm_head_01.

hear header table only hold one record at a time. so that ggoodsmvt_header should be workarea.

Reward if found helpful.

Regards,

Boobalan Suburaj

0 Kudos

Hi Boopalan

I tried ur idea but I am getting the same error yar,

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

How to correct this yar,

Regards

Rajaram

0 Kudos

Hi Raja,

Check the below links. this links are explain with example code.

[|]

[http://www.saptechies.com/bapi_goodsmvt_create-to-post-goods-movement/|http://www.saptechies.com/bapi_goodsmvt_create-to-post-goods-movement/]

Regards,

Boobalan Suburaj

Former Member
0 Kudos

Hi,

You should define your header like this:

DATA:

head TYPE BAPI2017_GM_HEAD_01. (this is not a table!)

Regards,

John.

0 Kudos

Hi john

Actually i had used like this.

DATA : ggoodsmvt_header TYPE STANDARD TABLE OF bapi2017_gm_head_01.

Regards

Rajaram

0 Kudos

Hi John

I tried urs also, but not working yar, how can i correct yar.

0 Kudos

Perhaps you are on another release than I am. Just check the parameter definition of 'BAPI_GOODSMVT_CREATE' in your system and use the same TYPE definition for your header.

Regards,

John.

vinod_vemuru2
Active Contributor
0 Kudos

Hi Raja,

Check below things.


--TYPES : begin of ggoodsmvt_header1,--
--ref_doc_no type bapi2017_gm_head_01-ref_doc_no,--
--pstng_date type bapi2017_gm_head_01-pstng_date,--
--doc_date type bapi2017_gm_head_01-doc_date,--
--pr_uname type bapi2017_gm_head_01-pr_uname,--
--END OF ggoodsmvt_header1.--

*internal table
--DATA : HEAD TYPE TABLE OF ggoodsmvt_header1.--
*work area
--DATA : WAH TYPE ggoodsmvt_header1.--
DATA: wah TYPE BAPI2017_GM_HEAD_01. "Add this

WAH-ref_doc_no = wa_vbrk-vbeln.
WAH-pstng_date = sy-datum.
WAH-doc_date = sy-datum.
WAH-pr_uname = sy-uname.
--APPEND WAH TO HEAD.--

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
--goodsmvt_header = HEAD--
goodsmvt_header = wah  "Add
goodsmvt_code = ggoodsmvt_code

TESTRUN = ' ' 
IMPORTING

GOODSMVT_HEADRET = 
materialdocument = gmaterialdocument
matdocumentyear = gmatdocumentyear
TABLES
goodsmvt_item = itabw

GOODSMVT_SERIALNUMBER = 
return = greturn

Comment the code which i striked off and put the code where i have comment ADD.

This will solve ur issue.

Thanks,

Vinod.

0 Kudos

Hi Vinod

When i try as you said, am getting the error as

In the function module interface, you can specify only

fields of a specific type and length under "GOODSMVT_ITEM".

Although the currently specified field

" " is the correct type, its length is incorrect.

How can we correct yar.

Regards

Rajaram

0 Kudos

Hi Rajaram,

How u defined the itab itabw.? This is not the problem with header work area declaration change. Check all ur FM parameter declarations.

Open BAPI_GOODSMVT_CREATE fm in SE37. check the data type for all the FM parameters. All the parameters u r passing to the FM must be of same type as they defined in the FM.

Rest all things will not change as i suggested earlier. Only data declaration will change.

Paste all ur declarations so that it will be easy to find out the problem.

Thanks,

Vinod.

0 Kudos

Hi Vinod

This is my declarations.

DATA : ggoodsmvt_header TYPE bapi2017_gm_head_01.

TYPES : begin of itab5,

move_type type BAPI2017_GM_ITEM_CREATE-move_type,

mvt_ind type BAPI2017_GM_ITEM_CREATE-mvt_ind,

material type BAPI2017_GM_ITEM_CREATE-material,

entry_qnt type BAPI2017_GM_ITEM_CREATE-entry_qnt,

move_stloc type BAPI2017_GM_ITEM_CREATE-move_stloc,

stge_loc type BAPI2017_GM_ITEM_CREATE-stge_loc,

po_number type BAPI2017_GM_ITEM_CREATE-po_number,

po_item type BAPI2017_GM_ITEM_CREATE-po_item,

batch type BAPI2017_GM_ITEM_CREATE-batch,

plant type BAPI2017_GM_ITEM_CREATE-plant,

end of itab5.

DATA : itabw TYPE TABLE OF itab5.

DATA: wah TYPE BAPI2017_GM_HEAD_01. "Add this

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = wah

goodsmvt_code = ggoodsmvt_code

  • TESTRUN = ' '

IMPORTING

  • GOODSMVT_HEADRET =

materialdocument = gmaterialdocument

matdocumentyear = gmatdocumentyear

TABLES

goodsmvt_item = itabw

  • GOODSMVT_SERIALNUMBER =

return = greturn

Regards

Rajaram

0 Kudos

Hi Raja Ram,

Never use ur own structures for defining parameters passed to any FM. Change ur declarations like below. It will work fine.

Delete this piece of code from here

DATA : ggoodsmvt_header TYPE bapi2017_gm_head_01.

TYPES : begin of itab5,

move_type type BAPI2017_GM_ITEM_CREATE-move_type,

mvt_ind type BAPI2017_GM_ITEM_CREATE-mvt_ind,

material type BAPI2017_GM_ITEM_CREATE-material,

entry_qnt type BAPI2017_GM_ITEM_CREATE-entry_qnt,

move_stloc type BAPI2017_GM_ITEM_CREATE-move_stloc,

stge_loc type BAPI2017_GM_ITEM_CREATE-stge_loc,

po_number type BAPI2017_GM_ITEM_CREATE-po_number,

po_item type BAPI2017_GM_ITEM_CREATE-po_item,

batch type BAPI2017_GM_ITEM_CREATE-batch,

plant type BAPI2017_GM_ITEM_CREATE-plant,

end of itab5.

DATA : itabw TYPE TABLE OF itab5.

DATA: wah TYPE BAPI2017_GM_HEAD_01. "Add this

to here and replace with below declarations


DATA: wah TYPE BAPI2017_GM_HEAD_01,
          ggoodsmvt_code TYPE BAPI2017_GM_CODE,
          gmaterialdocument TYPE BAPI2017_GM_HEAD_RET-MAT_DOC,
          gmatdocumentyear TYPE BAPI2017_GM_HEAD_RET-DOC_YEAR,
         itabw TYPE STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE,
         greturn TYPE STANDARD TABLE OF BAPIRET2.

"Replace declaration for work area of itabw also if u have any 
"with TYPE BAPI2017_GM_ITEM_CREATE.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wah
goodsmvt_code = ggoodsmvt_code

*TESTRUN = ' ' 
IMPORTING

*GOODSMVT_HEADRET = 
materialdocument = gmaterialdocument
matdocumentyear = gmatdocumentyear
TABLES
goodsmvt_item = itabw
*GOODSMVT_SERIALNUMBER = 
return = greturn.

If u carefully observe the declarations all are of same type as they are in FM.

Thanks,

Vinod.