Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

TABLE MODIFICATION ERROR THROUGH BDC

*BDC program to update 10 records table ZGKMASTER

Report ZGKBDCMOD

TABLES ZGKMASTER.

TYPES : BEGIN OF WAREA,

ENAME TYPE ZGKMASTER-ENAME,

END OF WAREA.

DATA : ITABLE TYPE TABLE OF WAREA WITH HEADER LINE,

PTABLE TYPE TABLE OF BDCDATA WITH HEADER LINE,

PTABLE1 TYPE TABLE OF BDCDATA WITH HEADER LINE,

OTABLE TYPE WAREA,

INT TYPE I.

SELECT * FROM ZGKMASTER.

ENDSELECT.

INT = SY-DBCNT.

CALL FUNCTION 'UPLOAD'

TABLES

DATA_TAB = ITABLE.

PERFORM SCREENS TABLES PTABLE USING 'SAPMSRD0' '102' 'X'.

PERFORM FIELDS TABLES PTABLE USING:

'RSRD1-TBMA' 'X'

'RSRD1-TBMA-VAL' 'ZGKMASTER'

'BDC-OKCODE' 'EDIT'.

*DATA BROWSER - SELECTION SCREEN

PERFORM SCREENS TABLES PTABLE USING 'SAPLSD41' '2200' 'X'.

PERFORM FIELDS TABLES PTABLE USING 'BDC-OKCODE' 'TDSH'.

*SELECT ENTRIES SCREEN

PERFORM SCREENS TABLES PTABLE USING '/1BCDWB/DBZGKMASTER' '1000' 'X'.

PERFORM FIELDS TABLES PTABLE USING 'BDC-OKCODE' 'ONLI'.

*SELECT ENTRIES-MARK SCREEN

PERFORM SCREENS TABLES PTABLE USING 'SAPMSSY0' '0120' 'X'.

PERFORM FIELDS TABLES PTABLE USING 'BDC-OKCODE' 'MARK'.

*SELECT ENTRIES-CHANGE SCREEN

PERFORM SCREENS TABLES PTABLE USING 'SAPMSSY0' '0120' 'X'.

PERFORM FIELDS TABLES PTABLE USING 'BDC-OKCODE' 'AEN2'.

LOOP AT ITABLE INTO OTABLE.

PERFORM SCREENS TABLES PTABLE USING '/1BCDWB/DBZGKMASTER' '101' 'X'.

PERFORM FIELDS TABLES PTABLE USING :

'ZGKMASTER-ERNAME' OTABLE-ERNAME,

'BDC-OKCODE' 'SAVE'.

WRITE SY-INDEX. *ITS SHOWING ZERO TEN TIMES I DONT KNOW WHY,I EXPECTED IT TO BE 1 2 3..10

PERFORM SCREENS TABLES PTABLE USING '/1BCDWB/DBZGKMASTER' '101' 'X'.

PERFORM FIELDS TABLES PTABLE USING 'BDC-OKCODE' 'NEXT'

ENDLOOP.

CALL TRANSACTION 'SE11' USING PTABLE MODE 'N'

FORM SCREENS TABLES WTABLE STRUCTURE BDCDATA USING WPROG WDYNP WDYNB.

WTABLE-PROGRAM = WPROG.

WTABLE-DYNPRO = WDYNP.

WTABLE-DYNBEGIN = WDYNB.

APPEND WTABLE.

CLEAR WTABLE.

ENDFORM.

FORM FIELDS TABLES WTABLE STRUCTURE BDCDATA USING WFNAM WFVAL.

WTABLE-FNAM = WFNAM.

WTABLE-FVAL = WFVAL.

APPEND WTABLE.

CLEAR WTABLE.

ENDFORM.

*END OF PROGRAM

TABLE STRUCTURE:

EID ENAME

1 GOPI

2 RAJESH

- -


10 MAHESH

WANT TO UPDATE AS

EID ENAME

1 XXX

2 XXX

- -


10 XXX

EXCEL FILE (TAB DELIMITER):

XXX *UPTO 10 COLUMNS AS NUMBER OF RECORDS IS 10

OBSERVATIONS AND QUERIES

1)IF I GIVE LEAVE PROGRAM INSIDE LOOP,THE PROGRAM IS EXITING WITHOUT GOING TO ANY SCREEN.

THE PROGRAM EXITS AFTER I SELECT EXCEL FILE.WHY?I EXPECT THE PROGRAM TO EXIT ONCE THE CONTROL

ENTERS LOOP STATEMENT.WHY?

2)IF I USE 'A' MODE THE RECORDS ARE UPDATING AND AT LAST RECORD 'FUNCTION CODE CANNOT BE SELECTED'

ERROR IS COMING.THE CHANGES ARE SAVED TO THE TABLE.PROBABLY THE ERROR IS THAT AT LAST RECORD,NEXT

CANNOT BE EXECUTED.I WANT TO QUIT ONCE LAST RECORD IS REACHED.HOW?

3)IF I USE 'N' OR 'E' MODE THE CHANGES ARE NOT SAVED TO TABLE AND SAME FUNCTION CODE ERROR IS COMING.THE

CHANGES ARE NOT SAVED SINCE THE PROGRAM ABORTED.IS IT CORRECT?

4)WHEN I USE 'UPLOAD',IT SAYS UPLOAD IS ABSOLUTE USE 'GUI_UPLOAD'.WHEN 'GUI_UPLOAD' IS USED

'FIELD INPUT DATA IS NOT VALID' ERROR CAME WITH THAT EXCEL FILE.WHY?

5)'UNABLE TO INTERPRET NUMBER' ERROR IS COMING WITH THAT 'INT = SY-DBCNT'.WHY?

NOTE:I TYPED ALL THESE.IGNORE IF THERE IS ANY SYNTAX TYPING ERROR.

THANKS FOR OUR VALUABLE HELP.KEEP ROCKING

Former Member
Not what you were looking for? View more on this topic or Ask a question