Skip to Content
0
Former Member
Mar 31, 2011 at 10:12 AM

Using BDC Background/Foreground

110 Views

Hello everyone,

I am writing a BDC batch program to upload details via the PO13 (Maintain Position) screen. Everything appears to work

ok. A BDC session is created and I can see this in SM35.

If I run the session in the foreground everyting works ok and the new records are entered.

However, If I run the session in the background then errors appear and no records are committed.

I get the error 'Runtime error RAISE_EXCEPTION has occurred'.

Would anyone know looking at my code below what I need to do in order to get things working.

I would really appreciate any help on this.

Thanks

Andy

 

  LOOP AT excel_tab INTO excel_wa WHERE error IS INITIAL.

    PERFORM bdc_dynpro USING 'SAPMH5A0'          '5100'.
    PERFORM bdc_field  USING 'BDC_CURSOR'        'PM0D1-SEARK'.
    PERFORM bdc_field  USING 'BDC_OKCODE'        '/00'.
    PERFORM bdc_field  USING 'PPHDR-PLVAR'       '01'.
    PERFORM bdc_field  USING 'PM0D1-SEARK'       excel_wa-position.
    PERFORM bdc_field  USING 'PM0D1-TIMR6'       'X'.
    PERFORM bdc_field  USING 'PPHDR-BEGDA'       '01.03.2011'.
    PERFORM bdc_field  USING 'PPHDR-ENDDA'       '31.12.9999'.
    PERFORM bdc_dynpro USING 'SAPMH5A0'          '5100'.
    PERFORM bdc_field  USING 'BDC_OKCODE'        '=INSE'.
    PERFORM bdc_field  USING 'PPHDR-PLVAR'       '01'.
    PERFORM bdc_field  USING 'BDC_CURSOR'        'TT_T777T-ITEXT(08)'.
    PERFORM bdc_field  USING 'PM0D1-SEARK'       excel_wa-position.
    PERFORM bdc_field  USING 'BDC_CURSOR'        'PPHDR-BEGDA'.
    PERFORM bdc_field  USING 'PM0D1-TIMR6'       'X'.
    PERFORM bdc_field  USING 'PPHDR-BEGDA'       '01.03.2011'.
    PERFORM bdc_field  USING 'PPHDR-ENDDA'       '31.12.9999'.
    PERFORM bdc_field  USING 'MARKFELD(08)'      'X'.

    PERFORM bdc_dynpro USING 'MP101000'          '2000'.
    PERFORM bdc_field  USING 'BDC_OKCODE'        '=UPD'.
    PERFORM bdc_field  USING 'P1010-SUBTY'       '0011'.
    PERFORM bdc_field  USING 'PX010-HILFM(01)'   excel_wa-hilfm.

    PERFORM bdc_dynpro USING 'SAPMH5A0'          '5100'.
    PERFORM bdc_field  USING 'BDC_OKCODE'        '=BACK'.

    PERFORM bdc_field  USING 'PPHDR-PLVAR'       '01'.
    PERFORM bdc_field  USING 'PM0D1-SEARK'       excel_wa-position.

    PERFORM session_insert USING 'PO13'.


  ENDLOOP.