(13) PROGRAMMING TECHNIQUES :
ENTERING DATA AND EXECUTING
FUNCTIONS:
a)Sample Code: Filling the BDCDATA Structure
b)Identifying a Screen
c)Entering a Value in a Field
d)Executing a Function
e)Entering Values in Loop Fields
f)Positioning the Cursor
g)Ending a Transaction
a)Sample Code: Filling the BDCDATA Structure:
The following form routine shows how the BDCDATA structure should be filled. Build the structure line by line using MOVE and APPEND statements. Before building each line, reset the header line of the internal table with the CLEAR statement.
Special techniques, such as placing the cursor, are not shown in this example.
Example:
Assume in this example that the BDCDATA structure has been declared as BDCDAT in the ABAP/4 program:
FORM Fill-BDC-Table
REFRESH BDCDAT
" Start new DYNPRO
CLEAR BDCDAT
MOVE: TO BDCDAT-PROGRAM.
TO BDCDAT-DYNPRO.
'X' TO BDCDAT-DYNBEGIN.
APPEND BDCDAT.
" Enter fields and values for DYNPRO
CLEAR BDCDAT.
MOVE: TO BDCDAT-FNAM.
TO BDCDAT-FVAL.
APPEND BDCDAT.
CLEAR BDCDAT.
MOVE: TO BDCDAT-FNAM.
TO BDCDAT-FVAL.
APPEND BDCDAT.
...
...
" Start next DYNPRO
CLEAR BDCDAT.
MOVE: TO BDCDAT-PROGRAM.
TO BDCDAT-DYNPRO.
'X' TO BDCDAT-DYNBEGIN.
APPEND BDCDAT.
ENDFORM.
b) Identifying a Screen:
The first record for each screen must contain information that identifies the screen: program name, screen name and a start-of-screen indicator. You record this information in the PROGRAM, DYNPRO, and DYNBEGIN fields of the BDCDATA structure.
This sample BDCDATA starts a screen. The record specifies the program and screen identifiers. With BDCDATA-DYNBEGIN, the record shows that batch input data for a new screen is starting:
Example:
BDCDATA-PROGRAM = 'sapms38m'.
BDCDATA-DYNPRO = '0100'.
BDCDATA-DYNBEGIN = 'x'.
APPEND BDCDATA.
c) Entering a Value in a Field:
After the dynpro-start record, you must add a record for each field that is to receive a value. You need fill only the FNAM and FVAL fields.
This sample BDCDATA enters a value into a field. The FNAM field identifies the target field by its table and field names. FVAL specifies the value that is to be entered:
Example:
BDCDATA-FNAM = 'RS38M-FUNC_EDIT'.
BDCDATA-FVAL = 'x'.
APPEND BDCDATA.
d)Executing a Function:
You can execute a function in a transaction by entering the function code or function key number in the command field of an SAP session. You use the FNAM and FVAL fields to enter this information, just as you would for normal screen fields.
The command field is identified by a special name in batch input, BDC_OKCODE. This name is constant and always identifies the command field.
This sample record would execute the save function. It uses the function key assignment of save, which is F11. A function key number must be prefixed with the / (slash) character:
Example:
BDCDATA-FNAM = 'BDC_OKCODE'.
BDCDATA-FVAL = '/11'.
This sample record also executes save, but uses the function code instead of the function key assignment. All functions, whether they are displayed in menus or as buttons, are identified by function codes. A function code must be prefixed with the = character.
Example:
BDCDATA-FNAM = 'BDC_OKCODE'.
BDCDATA-FVAL = '=UPDA'.
e)Entering Values in Loop Fields
Some screen fields need multiple values, one on each line. To provide input to one of these loop fields, you must use an explicit line index :
Example:
BDCDATA-FNAM = 'fieldx(5)'.
BDCDATA-FVAL = 'value'.
The line index (in the example: (5), line 5) indicates in which loop line on the screen values are to appear.
f)Positioning the Cursor:
To position the cursor on a particular field, you must use the special cursor field:
Example:
BDCDATA-FNAM = 'BDC_CURSOR'.
BDCDATA-FVAL = 'fieldx'.
To position the cursor on a loop field, you must use again an index:
Example:
BDCDATA-FNAM = 'BDC_CURSOR'.
BDCDATA-FVAL = 'fieldy(5)'.
g)Ending a Transaction:
You can successfully complete processing of a transaction in batch input in either of two ways:
leave the transaction and return to the SAP main menu.
trigger an update of the database.
Ending a Transaction
Example:
Returning to the SAP main menu: From the text input screen in the ABAP/4 editor, for example, the following BDCDATA records are necessary to leave the transaction:
BDCDATA-PROGRAM = 'SAPMSEDT'. "Leave text input field
BDCDATA-DYNPRO = '2310'.
BDCDATA-DYNBEGIN = 'X'.
BDCDATA-FNAM = 'BDC_OKCODE'.
BDCDATA-FVAL = '/3'. "Back function key
BDCDATA-PROGRAM = 'SAPMS38M'. "Leave ABAP/4 editor
BDCDATA-DYNPRO = '0100'.
BDCDATA-DYNBEGIN = 'X'.
BDCDATA-FNAM = 'BDC_OKCODE'.
BDCDATA-FVAL = '/15'. "Quit function key
BADI, BAPI'S, BDC, HR, Interview Questions, Programming, Reports, RFC, TCodes, ABAP-Java, ALE, IDOCs, ALV's, BSP, BTE, Data Dictionary, Dialog Programming, FICO, SD, MM, Function Modules, Interactive Reports, Internal Tables, Locking, Logical Database, OOPS,PM,PP,QM,R/3,BW,SCRIPTS,SMART FORMS
Thursday, June 12, 2008
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(112)
-
▼
June
(57)
- TABLE TYPES IN SAP
- TYPES OF VIEWS IN SAP
- ABAP DATA BASE UPDATES COMPLETE
- SAP LOCK CONCEPT
- ORGANIZING DATABASE UPDATES
- ENHANCEMENTS TO DICTIONERY ELEMENTS IN SAP
- LESSON 5 DATA BASE DIALOG
- LESSON 12 ABAP DICTIONARY
- LESSON 13 PERFORMANCE DURING TABLE ACCESS
- LESSON 15 DEPENDENCIES OF DICTIONARY OBJECTS
- LESSON 16 CHANGES TO DATA BASE TABLES
- LESSON17 VIEWS IN ABAP
- LESSON 18 SEARCH HELP
- EFFECTIVE CODING IN ABAP 1
- EFFECTIVE CODING IN ABAP 2
- mySAP ABAP Certification - Criteria For Application
- BDC AND LSMW COMPARISION
- TABLE CONTROL IN BDC
- BDC 1
- BDC 2
- BDC 3
- BDC 4
- BDC5
- BDC 6
- BDC 7
- BDC 8
- BDC 10
- ABAP BDC TABLE CONTROL
- Creating Update Function Modules-BDC
- Standard Function Module : BDC , Miscellaneous ,Fi...
- Free Download SAP ABAP BDC & LSMW pdf book
- What is SAP ABAP BDC and How you use it?
- Free Download SAP BDC Presentation
- SAP BDC Notes
- Defining ABAP BAPI Methods in the BOR
- EXAMPLE SHOWING HOW TO CREATE A BAPI
- HOW TO CREATE OWN BAPI’S
- Free Download BAPI User Guide (CA-BFA)
- Create BAPI step by step procedure (by Dinesh desh...
- Difference Between SAP BADI and User Exits
- Learn BADI - A Quick Look at BADI
- LOCKS IN ABAP
- REPLACE COMMENTARY IN ALV
- ALV WITH POV SAMPLE CODE
- ALV HIRACHICAL REPORT SAMPLE CODE
- ALV LIST DISPLAY SAMPLE CODE
- ALV LAYOUT DISPLAY SAMPLE CODE
- ALV BLOCK SAMPLE REPORT
- ALV CHECK BOXES SAMPLE CODE
- ALV INTERACTIVE REPORT SAMPLE CODE
- ALV DOUBLE CLICK SAMPLE CODE
- ALV SIMPLE SAMPLE CODE
- ALV COLURING SAMPLE CODE
- ABAP ALV IN BRIEF
- ALV DOCUMENTATION COMPLETE
- OOPS AT A GLANCE
- ALV IN BRIEF
-
▼
June
(57)
No comments:
Post a Comment