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 error

Former Member
0 Likes
2,465

Hi all,

I am using    HR_MAINTAIN_MASTERDATA

Though I have declared correct parameters a runtime error is generating.

Type conflict while calling fm.

DATA : it_return TYPE TABLE OF  BAPIRETURN1,

        wa_return TYPE   BAPIRETURN1,

        it_message TYPE TABLE OF BAPIRETURN1,

        wa_message TYPE BAPIRETURN1.

CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

                      EXPORTING

                        PERNR                    = wa_final-pernr

                        ACTIO                    = 'INS'

                        TCLAS                    = 'A'

                        BEGDA                    = wa_final-begda

                        ENDDA                    = '99991231'

                        SEQNR                    = '000'

                        PLANS                    = '00000000'

                        DIALOG_MODE              = '0'

                        LUW_MODE                 = '1'

*                       NO_EXISTENCE_CHECK       = ' '

*                       NO_ENQUEUE               = ' '

                      IMPORTING

*                       RETURN                   =

                        RETURN1                  = it_return

*                       HR_RETURN                =

                       TABLES

                         proposed_values          = proposed_values

*                       MODIFIED_KEYS            =

1 ACCEPTED SOLUTION
Read only

0 Likes
2,427

Hi ,

The parameter RETURN1 is a STRUCTURE, not TABLE

Please change the statement "DATA : it_return TYPE TABLE OF  BAPIRETURN1,"

into "DATA : it_return like BAPIRETURN1," and try again.

Hope this would help~

Regards

Cheng

19 REPLIES 19
Read only

nishant_krishen3
Explorer
0 Likes
2,427

Hi ,

Please check the data type of all import and export parameter data type . All parameter should be same data type as declared in HR_MAINTAIN_MASTERDATA' this module.

Regards

Nishant

Read only

0 Likes
2,427

Nishant ,

I am getting this error in Return parameter. As you can see I have declared the return parameter same as there in the FM.

Read only

0 Likes
2,427

You have not declared the RETURN parameter as it is in the function module. RETURN is an EXPORTING parameter that is defined LIKE BAPIRETURN.

Read only

nishant_krishen3
Explorer
0 Likes
2,427

Hi ,

Declare this way,

DATA : it_return like  BAPIRETURN1,

         wa_return TYPE   BAPIRETURN1,

         it_message TYPE TABLE OF BAPIRETURN1,

         wa_message TYPE BAPIRETURN1.

DATA : proposed_values TYPE TABLE OF PPROP.


Regards

Nsihant

Read only

0 Likes
2,427

Actually I am using it_return in loop for getting messages.

LOOP AT it_return INTO wa_return .

       wa_message = wa_return.

       APPEND wa_message to it_message.

       clear wa_message.

   ENDLOOP.


so in your case the system will fire an error of header line.

I dont know but the declaration is correct though the runtime error is generated.

Read only

0 Likes
2,427

Hi ,

You can write this like,

it_return TYPE TABLE OF BAPIRETURN1 WITH HEADER LINE,


Than you can write-


loop at it_return .

   wa_message = it_return-message.

       APPEND wa_message to it_message.

       clear wa_message.

endloop.


Read only

0 Likes
2,427

If I write with header line then what is the need to declare workarea for it?

Read only

0 Likes
2,427

No need to declare.

Read only

0 Likes
2,427

Nishant Krishen wrote:

it_return TYPE TABLE OF BAPIRETURN1 WITH HEADER LINE,


This is BAD ADVICE. Never use tables with header lines. They are obsolete, and bad programming.

Read only

Former Member
0 Likes
2,427

hi,

please post the full error log.

with error line number.

and post the data declaration of proposed_values , wa_final.

Regards,

Satyen

Read only

0 Likes
2,428

Hi ,

The parameter RETURN1 is a STRUCTURE, not TABLE

Please change the statement "DATA : it_return TYPE TABLE OF  BAPIRETURN1,"

into "DATA : it_return like BAPIRETURN1," and try again.

Hope this would help~

Regards

Cheng

Read only

0 Likes
2,427

Panda I declared as you said. But when I loop on it_return gives 'Neither specified under tables'.

Read only

0 Likes
2,427

HI Yash,

Have you used my code. if there is any issue tell me.

Reagrds

Nishant

Read only

0 Likes
2,427

As wrote, this return parameter is not an internal table just a single structure, no LOOP required, append the unique record (if not initial) to your message itab.

IF it_return-message IS NOT INITIAL.
   wa_message = it_return-message. " if length/type differs
   APPEND wa_message TO it_message. " else just  APPEND it_return-message TO it_message.
ENDIF.

Take also the habit of using SCI to check your codes (Menu : Program, check, code inspector)

Regards,
Raymond

Read only

0 Likes
2,427

Hello Yash,

    The it_return works as a structure. So if you declare it as it_return TYPE bapireturn, I guess you can find the return message. As it's not internal table, you won't be able to LOOP on it.

Regards,

Anubhab

Read only

0 Likes
2,427

Thank you Nishant.

I tried with using with header line.

Thank you.

Read only

0 Likes
2,427

This message was moderated.

Read only

Former Member
0 Likes
2,427

HI ,

The parameter return1 is in IMPORTING parameter, not in tables.

So u pass wa_return instead of it_return. Your problem will be solved.

Thanks

vijay

Read only

0 Likes
2,427

If an importing parameter is affected to a table type (that is not the case)  it will be an internal table...

eg. : RETURN TYPE BAPIRET1_LIST. " is an internal table of records with BAPIRET1 structure

Regards,

Raymond