Skip to Content
0
Former Member
Jul 02, 2007 at 12:38 PM

Recording via SHDB

22 Views

I have a problem.

I have made a program via recording in SHDB for doing changes in PA40 for all employees. The input is a text file and the mode i.e. E , A or N.

The issue is that when i run it on development server by giving text file and E (stop only at error) as input then it works fine and stops only at errors..

But when I transport it to QA Server and run it by giving text file and E (stop only at error) as input then it stops at every screen.

I have more than 1000 employees, i want it to stop only at error.

Can anybody have idea that why its behaving different on QA server??

The code is below:

REPORT ZHR_INF8_AI NO STANDARD PAGE HEADING LINE-SIZE 255.

*****************************************************

*****************Input

PARAMETERS : FILENAME(128) OBLIGATORY.

PARAMETERS : MODE(1) TYPE C OBLIGATORY.

******************************************************

*****************DATA

TABLES: PA0000, PERNR, PA0001, RP50G, PA0008 , PSPAR.

DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

CONSTANTS: NODATA VALUE ''.

DATA : BEGIN OF ITAB OCCURS 0,

PERNR LIKE PERNR-PERNR,

  • Group

EMPLOYEE_GROUP LIKE PSPAR-PERSG,

  • Sub group

EMPLOYEE_SUBGROUP LIKE PSPAR-PERSK,

  • Area

EMPLOYEE_AREA LIKE PA0008-TRFGB,

END OF ITAB.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

CHANGING

FILE_NAME = FILENAME.

**********************************************************

**************MAIN PROGRAM

START-OF-SELECTION.

PERFORM READ_FILE.

LOOP AT ITAB.

WRITE:/ ITAB-PERNR.

perform bdc_dynpro using 'SAPMP50A' '2000'.

perform bdc_field using 'BDC_CURSOR'

'RP50G-PERSK(05)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RP50G-PERNR'

ITAB-PERNR.

perform bdc_field using 'RP50G-EINDA'

'01.07.2007'.

perform bdc_field using 'RP50G-SELEC(05)'

'X'.

perform bdc_field using 'RP50G-PERSK(05)'

ITAB-EMPLOYEE_SUBGROUP.

perform bdc_dynpro using 'SAPMP50A' '2000'.

perform bdc_field using 'BDC_CURSOR'

'RP50G-PERNR'.

perform bdc_field using 'BDC_OKCODE'

'=PICK'.

perform bdc_field using 'RP50G-PERNR'

ITAB-PERNR.

perform bdc_field using 'RP50G-EINDA'

'01.07.2007'.

perform bdc_dynpro using 'MP000000' '2000'.

perform bdc_field using 'BDC_CURSOR'

'PSPAR-PERSK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'P0000-BEGDA'

'01.07.2007'.

perform bdc_field using 'PSPAR-PERSG'

ITAB-EMPLOYEE_GROUP.

perform bdc_field using 'PSPAR-PERSK'

ITAB-EMPLOYEE_SUBGROUP.

perform bdc_dynpro using 'MP000000' '2000'.

perform bdc_field using 'BDC_CURSOR'

'P0000-BEGDA'.

perform bdc_field using 'BDC_OKCODE'

'=UPD'.

perform bdc_field using 'P0000-BEGDA'

'01.07.2007'.

perform bdc_field using 'PSPAR-PERSG'

ITAB-EMPLOYEE_GROUP.

perform bdc_field using 'PSPAR-PERSK'

ITAB-EMPLOYEE_SUBGROUP.

perform bdc_dynpro using 'MP000100' '2000'.

perform bdc_field using 'BDC_OKCODE'

'/ENXT'.

perform bdc_field using 'BDC_CURSOR'

'P0001-BEGDA'.

perform bdc_dynpro using 'MP900700' '2000'.

perform bdc_field using 'BDC_OKCODE'

'/ENXT'.

perform bdc_field using 'BDC_CURSOR'

'P9007-BEGDA'.

perform bdc_dynpro using 'MP000700' '2000'.

perform bdc_field using 'BDC_OKCODE'

'/ENXT'.

perform bdc_field using 'BDC_CURSOR'

'P0007-BEGDA'.

perform bdc_dynpro using 'MP000800' '2010'.

perform bdc_field using 'BDC_CURSOR'

'P0008-TRFGB'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'P0008-BEGDA'

'01.07.2007'.

perform bdc_field using 'P0008-ENDDA'

'31.12.9999'.

perform bdc_field using 'P0008-TRFGB'

ITAB-EMPLOYEE_AREA.

perform bdc_dynpro using 'MP000800' '2010'.

perform bdc_field using 'BDC_CURSOR'

'P0008-BEGDA'.

perform bdc_field using 'BDC_OKCODE'

'=UPD'.

perform bdc_field using 'P0008-BEGDA'

'01.07.2007'.

perform bdc_field using 'P0008-ENDDA'

'31.12.9999'.

perform bdc_field using 'P0008-TRFGB'

ITAB-EMPLOYEE_AREA.

perform bdc_dynpro using 'MP004100' '2000'.

perform bdc_field using 'BDC_OKCODE'

'/ENXT'.

perform bdc_field using 'BDC_CURSOR'

'P0041-BEGDA'.

perform bdc_dynpro using 'SAPMP50A' '2000'.

perform bdc_field using 'BDC_OKCODE'

'/EBCK'.

perform bdc_field using 'BDC_CURSOR'

'RP50G-PERNR'.

CALL TRANSACTION 'PA40' USING BDCDATA MODE MODE.

CLEAR: BDCDATA[].

ENDLOOP.

----


  • FORM READ_FILE *

----


  • ........ *

----


FORM READ_FILE.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

CODEPAGE = 'IBM'

FILENAME = FILENAME

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ITAB

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • FILE_OPEN_ERROR = 2

  • FILE_READ_ERROR = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " READ_FILE

----


  • FORM BDC_FIELD *

----


  • ........ *

----


  • --> FNAM *

  • --> FVAL *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> NODATA.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

----


  • FORM BDC_DYNPRO *

----


  • ........ *

----


  • --> PROGRAM *

  • --> DYNPRO *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

Regards,

Aisha Ishrat

ICI Pakistan.