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

ISSUE:BDC In user exit

Former Member
0 Likes
1,270

Hi all,

I have used BDC inside user exit.I am getting an error while activating the user exit .

The error is before the statement 'FORM' the structure included by 'FUNCTION' must be ended by 'ENDFUNCTION'.(Not getting what 'FUNCTION' is mentioned in error message)

CALL TRANSACTION 'MM02' USING bdcdata MODE v_mode UPDATE 'S'

MESSAGES INTO it_bdcmsg1.

ENDLOOP.

FORM bdc_dynpro USING program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

ENDFORM. "BDC_DYNPRO

----


  • Insert field *

----


FORM bdc_field USING fnam fval.

  • IF fval <> nodata.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

  • ENDIF.

ENDFORM. "BDC_FIELD

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
939

Hi,

This is beacuse you are trying to nest the processing block, more strictly procedures. This is not possible in ABAP.


"Your customer exit simply lies between  these statements introducing procedure (funtion module)
FUNCTION....

INCLUDE some_customer_exit_here.  

ENDFUNCTION 

You can't put any new procedure nor processing block inside this FUNCTION....ENDFUNCTION block.

Instead you have two possibilities:

- check function group of that function module, usually starts with X... for customer exists, add and include inside it, following SAP standard naming conventions for subroutines. It must be like inlcude ...F01 . Go inside there and create your subroutine (forms) here. Now in your cutomer exit simply use that form by calling it.

- create another program of type S (subroutine pool) and place your forms here. Now call it from customer include using PERFORM YOUR_NEW_PROGRAM_NAME(subroutine_name).

Regards

Marcin

5 REPLIES 5
Read only

MarcinPciak
Active Contributor
0 Likes
940

Hi,

This is beacuse you are trying to nest the processing block, more strictly procedures. This is not possible in ABAP.


"Your customer exit simply lies between  these statements introducing procedure (funtion module)
FUNCTION....

INCLUDE some_customer_exit_here.  

ENDFUNCTION 

You can't put any new procedure nor processing block inside this FUNCTION....ENDFUNCTION block.

Instead you have two possibilities:

- check function group of that function module, usually starts with X... for customer exists, add and include inside it, following SAP standard naming conventions for subroutines. It must be like inlcude ...F01 . Go inside there and create your subroutine (forms) here. Now in your cutomer exit simply use that form by calling it.

- create another program of type S (subroutine pool) and place your forms here. Now call it from customer include using PERFORM YOUR_NEW_PROGRAM_NAME(subroutine_name).

Regards

Marcin

Read only

Former Member
0 Likes
939

The reason for this error is your form endform.

In case of exits you are not allowed to write form endform directly, instead you can create a function module or an include which contains the form and use it.

when the system encounters sequencially the form statement it is unable to interpret.

Regards,

Lalit Mohan Gupta.

Read only

Former Member
0 Likes
939

Hi Sanu,

If possible use a BAPI to solve your requirement or create a Function module for the logic and call it inside the exit.

Regards,.

Kumaar.S

Read only

Former Member
0 Likes
939

hi write ur bdc in a report and call the report that means submit report .

for this u have to export values from user exit and import in report.

Read only

Former Member
0 Likes
939

other wise put ur values in selection screen with no display ,and submit ur report by giving the values.