ABAP BDC OK CODE
11:40 PM Posted by Isha
In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this:
Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:
In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event.
Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.
In your application programs, the first step in PAI processing should be to save the function code in an auxiliary variable and then initialize the OK_CODE field. You can then read the function code from the auxiliary variable (for example, using a CASE structure), and control the program flow from there.
The OK_CODE field can have a different name on each screen. However, common practice is to use the same name for the field on each screen of an ABAP program. You then only need one field in the ABAP program, with the same name, into which the function code is placed, and from which you can read it.
RELATED POSTS
shown here.
IMPORTANCE OF BADI IN SAP ABAP
COMPARISON OF ENHANCEMENTS IN ABAP
BADI DEFINITION WITH SCREEN SHOTS
BADI IMPELEMTATION
BADI IMPLEMENTATION PART TWO
MENU ENHANCEMENTS USING SAP BADI
SCREEN ENHANCEMENTS USING SAP BADI
IMPLEMENTATION OF SCREEN ENHANCEMENTS USING BADI
BADI IMPLEMENTATION WITH FORMULA BAR
FILTER DEPENDENT BADI IMPLEMENTATION PART ONE
FILTER DEPENDENT BADI IMPLEMENTATION PART TWO
SAP ABAP FILTER DEPENDENT BADI IMPLEMENTATION
BADI AND OTHER ENHANCEMENTS COMPARISON
SAP ABAP BADI PART ONE
ABAP BADI PART TWO
ABAP BADI PART THREE
ABAP BADI PART FOUR
BADI PART FIVE
ABAP BADI PART SIX CALLING BADI AND ITS USES
BADI INTRODUCTION
RELATED POST
BAPI IN SAP ABAP COMPLETE COURSE
OOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface
Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:
In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event.
Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.
In your application programs, the first step in PAI processing should be to save the function code in an auxiliary variable and then initialize the OK_CODE field. You can then read the function code from the auxiliary variable (for example, using a CASE structure), and control the program flow from there.
The OK_CODE field can have a different name on each screen. However, common practice is to use the same name for the field on each screen of an ABAP program. You then only need one field in the ABAP program, with the same name, into which the function code is placed, and from which you can read it.
RELATED POSTS
shown here.
IMPORTANCE OF BADI IN SAP ABAP
COMPARISON OF ENHANCEMENTS IN ABAP
BADI DEFINITION WITH SCREEN SHOTS
BADI IMPELEMTATION
BADI IMPLEMENTATION PART TWO
MENU ENHANCEMENTS USING SAP BADI
SCREEN ENHANCEMENTS USING SAP BADI
IMPLEMENTATION OF SCREEN ENHANCEMENTS USING BADI
BADI IMPLEMENTATION WITH FORMULA BAR
FILTER DEPENDENT BADI IMPLEMENTATION PART ONE
FILTER DEPENDENT BADI IMPLEMENTATION PART TWO
SAP ABAP FILTER DEPENDENT BADI IMPLEMENTATION
BADI AND OTHER ENHANCEMENTS COMPARISON
SAP ABAP BADI PART ONE
ABAP BADI PART TWO
ABAP BADI PART THREE
ABAP BADI PART FOUR
BADI PART FIVE
ABAP BADI PART SIX CALLING BADI AND ITS USES
BADI INTRODUCTION
RELATED POST
BAPI IN SAP ABAP COMPLETE COURSE
ABAP TOPIC WISE COMPLETE COURSE
BDCOOPS ABAP
ALE
IDOC'S
BADI
BAPI
Syntax Check
Interview Questions
ALV Reports with sample code
ABAP complete course
ABAP Dictionary
SAP Scripts
Script Controls
Smart Forms
Work Flow
Work Flow MM
Work Flow SD
Communication Interface