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: 

BDC in function module...

former_member599326
Participant
0 Kudos

hi,

I have recorded BDC for FB70 and now I have inserted all the bdc code in the function module.. however it gives me following error..

"Include BDCRECX1

Within FORM routines and function modules, the SELECTION-SCREEN statement is not allowed"

How we should handle this BDC in function module..??

Regards,

7 REPLIES 7

former_member222709
Contributor
0 Kudos

Hi Santosh,

This can be very easily handled in the FM by copying the include 'BDCRECX1' into customer namespace i.e. 'ZBDCRECX1' and commenting the selection screen.

The standard include has the subroutines defined which are used by the BDC and hence only those nned to be activated. The other code of the selection screen needs to be commented and then activate your FM.

Regards,

Pranav.

surajarafath
Contributor
0 Kudos

still you can achieve it.

Remove the include, Parameters, and open_group, close_group.

and change Call BDC transaction as CALL TRANSACTION ...

Copy paste these two subroutines.. just follow the sample code here..

DATA:  it_bdcdata TYPE TABLE OF bdcdata,
       wa_bdcdata TYPE bdcdata.
DATA:  gt_message TYPE TABLE OF bdcmsgcoll,
       wa_message TYPE bdcmsgcoll.

TYPES: BEGIN OF ty_record,
          kunnr(016),        
          kkber(004),       
          d0210(001),       
          klimk(020),        
          ctlpc(003),        
         END OF ty_record.

  DATA:  it_record  TYPE TABLE OF ty_record,
         record     TYPE ty_record.
* you can fill it_record with your data
*{...................}
*  
  
  LOOP AT it_record INTO record.

    PERFORM bdc_dynpro      USING 'SAPMF02C' '0100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RF02L-D0210'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'RF02L-KUNNR'
                                  record-kunnr.
    PERFORM bdc_field       USING 'RF02L-KKBER'
                                  record-kkber.
    PERFORM bdc_field       USING 'RF02L-D0210'
                                  record-d0210.
    PERFORM bdc_dynpro      USING 'SAPMF02C' '0210'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'KNKK-CTLPC'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=UPDA'.
    PERFORM bdc_field       USING 'KNKK-KLIMK'
                                  record-klimk.
    PERFORM bdc_field       USING 'KNKK-CTLPC'
                                  record-ctlpc.
    PERFORM bdc_dynpro      USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=YES'.

    CALL TRANSACTION 'FD32' USING it_bdcdata MODE 'N' UPDATE 'S'
    MESSAGES INTO gt_message.
    CLEAR it_bdcdata.
  ENDLOOP.


*BDC Subroutines
*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
  CLEAR wa_bdcdata.
  wa_bdcdata-program  = program.
  wa_bdcdata-dynpro   = dynpro.
  wa_bdcdata-dynbegin = 'X'.
  APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.                    "

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
  CLEAR wa_bdcdata.
  wa_bdcdata-fnam = fnam.
  wa_bdcdata-fval = fval.
  APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.                    "BDC_FIELD

0 Kudos

what about import,i have to fill my import parameter with the required fields right,and after that above code as ur example

Former Member
0 Kudos

santosh....

in SHDB, after recording, you have button on the application toolbar Function Module(with a create symbol). click on that, it creates a FM from your recording. problem solved

Former Member
0 Kudos

Buddy Please do check your recording procedure.

Something looks fishy Over there

Pratik2228
Participant
0 Kudos

if you have done bdc in function module please tell me also ,i have same issue ,

please tell the procedure you have done.

Pratik2228
Participant
0 Kudos

Hey PLEASE FORWARD DETAILS IF FUNCTION MODULE IN BDC..

Avoid Using Upper Case in conversations, despite your intentions  to not  offend anyone.

Message was edited by: Venkat Gowrishankar