Skip to Content
0
Oct 15, 2009 at 09:16 AM

Problem with UPDATE

15 Views

hello all,

i m updating standard table from XL, but problem is that it is updating only one record, for second record it is showing sy-subrc = 4 at run time. plz help me.

codes :

REPORT zfix_vendor NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES : eord.

TYPES : BEGIN OF itab1 ,

matnr LIKE eord-matnr,

werks LIKE eord-werks,

lifnr LIKE eord-lifnr,

END OF itab1 .

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

DATA : itab TYPE STANDARD TABLE OF itab1 WITH HEADER LINE .

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

DATA : bdcdata TYPE STANDARD TABLE OF bdcdata WITH HEADER LINE .

DATA : messtab TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE .

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

DATA: BEGIN OF l_intern OCCURS 0.

INCLUDE STRUCTURE alsmex_tabline.

DATA: END OF l_intern.

DATA : l_index TYPE i,

ctr TYPE i VALUE 0,

l_mstring(480),

s_locnr1(6) TYPE c.

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

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_file LIKE rlgrap-filename

DEFAULT '' OBLIGATORY. " File Name

SELECTION-SCREEN : SKIP 3.

SELECTION-SCREEN : PUSHBUTTON 35(10) a1 USER-COMMAND update,

PUSHBUTTON 55(10) a2 USER-COMMAND delete.

SELECTION-SCREEN END OF BLOCK b1.

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

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

  • EXPORTING

  • PROGRAM_NAME = SYST-REPID

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

  • STATIC = ' '

  • MASK = ' '

CHANGING

file_name = p_file

  • EXCEPTIONS

  • MASK_TOO_LONG = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

----


AT SELECTION-SCREEN.

PERFORM upload_file TABLES itab

USING p_file.

CASE sy-ucomm.

WHEN 'UPDATE'.

LOOP AT itab.

UPDATE eord SET flifn = 'X' WHERE matnr = itab-matnr AND werks = itab-werks AND lifnr = itab-lifnr .

IF sy-subrc = 0.

LEAVE TO LIST-PROCESSING.

WRITE : / itab-matnr , 'UPDATED IN SOURCE LIST.' COLOR 7 .

ELSE.

WRITE : / itab-matnr , 'ALREADY UPDATED IN MATERIAL NO.' COLOR 5.

ENDIF.

ENDLOOP.

ENDLOOP.

ENDCASE.

Regards saurabh.i