Skip to Content
0
Former Member
Jan 21, 2008 at 12:05 PM

doubt in HR-ABAP BDC Program

19 Views

hi all,

My BDC program is going to dump while execution. Below I'm pasting the report.

TYPES : BEGIN OF IT_INPUT,

PERNR TYPE PERNR_D,

CHOIC TYPE CHOIC,

BEGDA TYPE CHAR10,

ENDDA TYPE CHAR10,

ANREX TYPE ANREX,

NACHN TYPE NACHN,

VORNA TYPE VORNA,

GBPAS TYPE GBPAS,

SPRSL TYPE SPRSL,

END OF IT_INPUT.

TYPES : BEGIN OF IT_RAW,

LINE TYPE CHAR120,

END OF IT_RAW.

  • INTERNAL TABLES

DATA : IT_FINAL TYPE STANDARD TABLE OF IT_INPUT.

DATA : IT_RAW TYPE STANDARD TABLE OF IT_RAW.

DATA : IT_ERROR TYPE STANDARD TABLE OF BDCMSGCOLL.

  • WORK AREA

DATA : WA_FINAL TYPE IT_INPUT.

DATA : WA_RAW TYPE IT_RAW.

DATA : WA_ERROR TYPE BDCMSGCOLL.

CONSTANTS : C_TAB TYPE C value '/'.

INCLUDE : BDCRECXY.

START-OF-SELECTION.

  • SUBROUTINE TO READ DATA FROM FLAT FILE

PERFORM READ_DATA_FROM_FF.

  • SUBROUTINE TO MAP DATA TO SCREEN FIELDS

PERFORM DATA_MAPPING.

&----


*& Form READ_DATA_FROM_FF

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM READ_DATA_FROM_FF .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'E:\RAG\BDC1.txt'

TABLES

DATA_TAB = IT_RAW

.

IF sy-subrc eq 0.

LOOP AT IT_RAW INTO WA_RAW.

SPLIT WA_RAW

AT C_TAB

INTO WA_FINAL-PERNR

WA_FINAL-CHOIC

WA_FINAL-BEGDA

WA_FINAL-ENDDA

WA_FINAL-ANREX

WA_FINAL-NACHN

WA_FINAL-VORNA

WA_FINAL-GBPAS

WA_FINAL-SPRSL.

APPEND WA_FINAL TO IT_FINAL.

WRITE : WA_FINAL.

CLEAR WA_FINAL.

ENDLOOP.

ENDIF.

ENDFORM. " READ_DATA_FROM_FF

&----


*& Form DATA_MAPPING

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DATA_MAPPING .

LOOP AT IT_FINAL INTO WA_FINAL.

  • FIRST SCREEN INFORMATION FOR PA30

perform bdc_dynpro using 'SAPMP50A' '1000'.

perform bdc_field using 'RP50G-PERNR'

WA_FINAL-PERNR.

*perform bdc_field using 'BDC_CURSOR'

  • 'T582S-ITEXT(03)'.

perform bdc_field using 'RP50G-SELEC(03)'

'X'.

perform bdc_field using 'RP50G-TIMR6'

'X'.

perform bdc_field using 'RP50G-CHOIC'

'0002'.

perform bdc_field using 'BDC_OKCODE'

'=INS'.

  • SECOND SCREEN INFORMATION 0002

perform bdc_dynpro using 'MP000200' '2001'.

*perform bdc_field using 'BDC_CURSOR'

  • 'Q0002-GBPAS'.

perform bdc_field using 'BDC_OKCODE'

'UPD'.

perform bdc_field using 'P0002-BEGDA'

WA_FINAL-BEGDA.

perform bdc_field using 'P0002-ENDDA'

WA_FINAL-ENDDA.

perform bdc_field using 'Q0002-ANREX'

WA_FINAL-ANREX.

perform bdc_field using 'P0002-NACHN'

WA_FINAL-NACHN.

perform bdc_field using 'P0002-VORNA'

WA_FINAL-VORNA.

perform bdc_field using 'Q0002-GBPAS'

WA_FINAL-GBPAS.

perform bdc_field using 'P0002-SPRSL'

WA_FINAL-SPRSL.

perform bdc_transaction tables it_error using 'PA30' 'x' 'a' 'a'.

IF it_ERROR[] IS NOT INITIAL.

LOOP AT it_ERROR INTO wa_ERROR.

WRITE : wa_ERROR.

ENDLOOP.

REFRESH it_ERROR.

ENDIF.

ENDLOOP.

Error which I was getting is 'UNABLE TO INTERPRET '/ ' AS A NUMBER'.