Ganaaati Adimulam

About the Author

Ganapati Adimulam is an SAP Technical Consultant. Having nearly four years of Experience in the SAP Domain, several successful implementation, and a background in training and technical documentation has afforded him many opportunities to observe all aspects of SAP implementation.

Mr. Ganapati did his M.C.A in 2002. He started his SAP career in 2003 March. He has worked for corporate giants like CGEY (CapGemini Ernest & Young), Infosys and Sat yam Computers and also for many other international clients as both onsite and offshore Technical consultant.

As his basic interest is in SAP training domain, he has turtf services after relieving from the corporate biggies. He is B training services in SAP through eM ax Technclogies.ji imparting SAP training to the corporate consultants. He is a big talk as a very good SAP corporate trainer.

into SAP training offering excellent lire for orporate

From eMIX Technologies.

ACKNOWLEDGEMENTS

Doing a book of this magnitude requires a team effort.

Every task is completely successful if and only if we acknowledge the efforts contributed by the individual personnel.

We acknowledge our sincere thanks to our Honorable Director, eM ax Technologies,

Mr. Rama Rao for his continuous guidance, support and co-operation through this project.

Ganapati Adimulam.

I want to take this opportunity to thank the entire management friends and several other individuals of eMax Technologie the quality checks of the accomplishments at every stage oft' IS

Finally I would like to extend my sincere thanks to my family u,,_,uU',",-,"U of my heart.

INDEX

1. BDC Programming 22,72

3. MODULE

grammmg

2. SAP SCRIPT

27

5.working ~~fb

29,

1. BDC Programming

,

1. Introduction to BDC Programming

2. Call Transaction Method

a. Processing Errors

3. Session Method

",:/Y

a. For Single~r~~s~ction

b.

For Multiple1J_l'ra

ctions in One Session

-~- - .. ~~"\-"

4.

~. ~

TatJte Cb,l&trol in BDC

5.

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

BDC (Batch Data Communication)

It is One of the Data Transfer Method.

Data transfer methods are divided as Outbound and Inbound.

Outbound: Transfer the data from the Source system to Target S ystem(Externalllnternal) .--------,

SAP

SAP

Non-SAP

Outbound is a data transfer from SAP to SAP / Non SAP. Note: Source System is always SAP.

Inbound: Data transfer from External System into SAP.

i.e. Inbound is a technique to transfer the Data from SAP/Non-SAP into SAP.

Note: Target System is always SAP.

SAP

Non-SAP

SAP

Note: BDC is an Inbound Data transfer Technique.

About Data Transfer in R/3 System

When a company decides to implement the SAP R/3 to manage business-critical data, it

Usually does not start from a no-data situation. Normally, a SAP R/3 project comes in to replace or complement to an existing application.

In the process of replacing current application and transferring application data,

two

Situations might occur:

Page 1 of22

By Ganapati AdimuJam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 --65976727, Cell No : 9948444808,9849034399, www.ernaxtech.corn

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

1. The first is when application data to be replaced is transferred at once and only once.

2. The second situation is to transfer data periodically from external system to SAP and

Vice versa.

There is a period of time when information has to be transferred from existing Application, to SAP Rl3, and often this process will be repetitive.

External system

SAP data

For reasons of efficiency, large volumes of data cannot be transferred manually from an external system into the Rl3 System. A data transfer is required that transfers the data automatically in the Background.

The SAP system offers Three methods for transferring data into SAP Systems

From non-SAP Systems or legacy system.

1. SESSION METHOD

2. CALL TRANSACTION

3. DIRECT INPUT.

Note: Both Session Method and Call Transaction, We call BACH INPUT Methods.

Where as Direct Inputs are standard programs to post the data into SAP.

Advantages offered by BATCH INPUT method:

1. Can process large data volumes in batch

2. Can be planned and submitted in the background

3. No manual interaction is required when data is transferred.

Page 2 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

Note: To implement one of the supported data transfers, you must often write the program that Exports the data from your non-SAP/SAP System. This program. known as a "data transfer" program must map the data from the external system into the data structure required by the SAP batch input program.

Writing a Data Transfer Program involves following prerequisites:

1. Analyzing transaction

'-

gf-~

.~

/ - ... _

Online

SAP Transaction

• Analyzing transaction Involves following steps.

• Which fields require input i.e., mandatory

• Which fields you can allow defaulting to standard values.

• The names. Types and lengths of the fields that are used by a transaction.

• Check whether some fields will need conversion of their data types and/or data lengths. Most of the data from the external system must be converted into SAP format. We call this "formatting" the data.

• Screen number and name of module pool program behind that

particular transaction

To analyze a transaction. do the following

• Start the transaction by menu or by entering the transaction code in the

command

Box

• Step through the transaction, by entering the data will be required for

processing your batch input data.

• On each screen, note the program name and screen (dynpro) number.

( dynpro = dyn + pro. Dyn = screen. Pro = number)

Page 3 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No : 9948444808,9849034399, ww\y.cmaxtcch.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

• you can get the program name ana screen number by pressing Fl on any field or button on the screen. the Technical info pop-up shows not only the field information but also the program and screen.

Note: Repeat the Procedure of finding the Program Name, Screen no, Field Name and their data type and length for each field on each screen for all the fields.

Note: At the end of analyzing the transaction code, we should have all the screen and fields Details So that we can write the DATA TRANSFER program.

Note: Since it is very difficult to collect all the screen and field details by pressing Fl -> Technical Information on each field when we have multiple screens and more fields , So SAP provided one transaction SHDB to record all the Screen and Field Details along with the Function roil,,11

The SHDB transaction ,records all the screen, field and OK_ Code details for any transaction.

2.Declaring internal tables.

First internal table similar to structure like Input Flat file(IT_DATA)

Second internal table(IT_BDCDATA) like DDIC Structure BDCDATA. (to maintain the screen and field details).

Third internal table(IT_BDCMSGCOLL) like DDIC Structure BDCMSGCOLL.

(This Internal table is required Only we work with Call Transaction to process' the

Errors in call transaction).

3. Transferring data from flat file to internal table(IT_DATA). This depends on the source of the File.

Source of file

Presentation server

Application server

Page 4 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

Call fuction module: '~UI UPLOAD"

Reading from file into

<itab>

Input

Filename = 'file name + path' record

Step 1 : open file.

Step 2 : Read record by

Output

from file append

to

<itab> = 'internal table to store the data from file"

<itab>.

Step 3 : close file.

4. Population of BDCDA T A into the Internal Table(IT_ BDCDA T A) And Process the transaction using the IT _ BDCDA T A For Each record in IT DATA.

i.e For each record in IT_DATA(Loop at IT_DATA).

A) At the beginning of each new screen, we must maintain the module pool name <program> " the screen number <dynpro> and a flag<dynbegin> :

WA __ BDCDATA-·J;>ROGRAM = <program>. WA_BDCDATA -DYNPRO = <dynpro>.

WA BDCDATA -DYNBEGIN = 'X'. APPEND WA BDCDATA TO IT BDCDATA.

_ -

CLEAR W A BDCDA T A.

B) For each field to which you want to assign values. insert an entry in the internal table IT _BDCDATA. Specify the technical field name <fnam> and the field content <fval> :

WA BDCDATA-FNAM = <fnam>. W A BDCDA TA-FV AL = <fval>.

APPEND W A BDCDA T A TO IT BDCDA T A.

_ _

CLEAR W A BDCDA T A.

Now specify which action is to be executed in this screen. You must determine the triggered function code <fcode> and assign this with the field FV AL. Note that the character' / I should always be placed before the function key number. The character I = I must be placed before all other function codes.

Assign value BDC_OKCODE to the field FNAM:

WA BDCDATA-FNAM = 'BDC OKCODE'.

_ _

Page 5 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.corn

/

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

WA BDCDATA -FVAL = <fcode>.

APPEND WA BDCDATA TO IT BDCDATA.

- -

CLEAR WA BDCDATA.

NOTE: Execute steps A and B for each additional screen in the transaction.

After the last screen in the transaction, internal table IT _BDCDATA is filled with all of the values required to process One record Completely.

IF Session Method,

Insert the IT _BDCDATA into the session by calling the Function Module BDC_INSERT.

ELSEIF CALL TRANSACTION METHOD.

CALL TRANSACTION <tcode> USING IT BDCDATA

MESSAGES INTO IT BDCMSGCOLL.

ENDLOOP. (FOR IT_DATA).

CALL TRANSACTION:

In the second method, the Conversion program uses the ABAP statement CALL TRANSACTION USING to run an SAP transaction. External data does not have to be deposited in a session for later processing. Instead, the entire batch input process takes place inline in your program.

Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.

Syntax:

CALL TRANSACTION <tcode>

USING <bdc tab>

MODE <mode>

UPDATE <update> Page 6 of22

By Ganapati Adimulam

eMax Technoiogies,Ameerpet,Hyderabad

Ph No ;+9140 -65976727, Cell No; 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

MESSAGES INTO <BDCMSGCOLL TAB>.

Details:

<tcode> : Transaction code

<bdc tab> : Internal table of structure BDCDAT A.

<mode> : Display mode:

A

Display all

E

Display errors only

N

No display

DISPLAY MODE Parameter

Use the MODE parameter to specify whether data transfer processing should be displayed as it happens. Y all can choose between three modes:

A Display all. All screens and the data that goes in them appear when we run your program.

N No display. All screens are processed invisibly, regardless of whether there are errors or not. Control returns to your program as soon as transaction processing is finished.

E Display errors only. The transaction goes into display mode as soon as an error in one of the screens is detected. You can then correct the error.

<update> : Update mode:

S

Synchronous

A

Asynchronous

L

Local update

The UPDATE Parameter

You use the UPDATE parameter to specify how updates produced by a transaction should be processed. You can select between these modes:

Page 7 of 22

By Ganapati Adimularn

eM ax Technologies,Ameel'pet,Hydel'abad

Ph No :+91 40 --65976727, Cell No : 9948444808,9849034399, w\vw.emaxtcch.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.

Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.

Error analysis and recovery is less convenient than with synchronous updating.

Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.

Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program.

The lVIESSAGES Parameter

The MESSAGES specification indicates that all system messages issued during a CALL TRANSACTION USING are written into the internal table

s:

<MESSTAB> . The internal table must have the structure BDCMSGCOLL.

Return codes:

Value Explanation
0 Successful
<=1000 Error in dialog program
> 1000 Error Handling in CALL TRANSACTION

When the records are uploaded in database table by Session Method error record is stored

Page 8 of22

By Ganapati Adimulam

eMax Technoiogies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

In the log file. In Call transaction there is no such log file available and error record is

Lost unless handled. Usually you need to give report of all the error records i.e. records

Which are not inserted or updated in the database table and this can be done by following

Method.

Steps for the error handling in CALL TRANSACTION Requirement:

LOOP AT IT_OAT A.( i.e For each data record) Populate IT_BDCTAB table

Call transaction <tr.code> using IT _ BDC DA T A Mode <AINIE>

U pdate<Si A>

Messages IT_BDCMSGCOLL.

Ifsy-subrc ne O. (Call transaction returns the sy-subrc ifnot successful In updation).

Call function FORMAT MESSAGE.

O.R

Call Function BAPI 'MESSAGE GETOETAIL

- -

OR

Querry the Message TEXT from the table T 100 for the Messages Collected into IT _ BDCMSGCOLL.

The Text in TIOO-TEXT would be maintained with Place Holders.

Replace the Place Holders with Variable Texts from IT_BDCMSGCOl~L(MSGVI. MSGV:2. MSGV3. MSGV4).

Either APPEN D the error message to another Internal table IT _ERRO and Display it Finally OR

Display the record and message immediately.

Endloop.

Page 9 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hydera bad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, ww\v.cmaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

ENTER

ENTER

Provide Name of the Cost Center, Person Responsible, Cost Center Category,

Page 10 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BOC (Batch Data Communication)

We Never Compromise in Quality, Would You'?

Hierarchy Area, Currency

~] Drilfdown

veno (rom

23 09 2003 To

31 12 9999

BasiC: data

Control

Ternptates 1 Address

Communication

History

blame

De s c nptton

Basic data

Person responsible Dep artrnent

Cost center category Hierarchy area Business area Funl:.\ional area Currency

PrOlit center

INR

(.140(1

,.C.11 (3).~8..oq) .. ;·~

;. 2 f'.jQt~p.:.d ... 1

SAVE.

Opens the recording details.

~ ..•

SA VE it and use in the BDC program.

Page 11 of 22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

Program Details:

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

* PROGRAM: ZDEMO UPLOAD COST CENTER DATA

_ -

* AUTHOR: GANAPATI. ADIMULAM

* PURPOSE : BDC PROGRAM TO UPLOAD ALL THE COST

* CENTER MASTER DATA INTO SAP USING

* CALL TRANSACTION METHOD

* REFERENCE: NA

* COPIED FROM: NA

* TRAPORT REQUEST NO : CllD2K9001

*

*

*

*

*

*

*

*

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

REPORT ZDEMO UPLOAD COST CENTER DATA.

- - - -

DATA: BEGIN OF WA_DATA,

KOKRS TYPE KOKRS, "CONTROLLING AREA KOSTL TYPE KOSTL, "COST CENTER

DATAB TYPEDATAB, "START DATE

DATBI TYPE DATBI, "END DATE

KTEXT TYPE KTEXT, "NAME

LTEXT TYPE L TEXT, "DESCRIPTION

VERAK TYPE VERAK, "PERSON RESPONSIBLE KOSAR TYPE KOSAR, "COST CENTER CATEGORY KHINR TYPE KHINR, "HIERARCHY AREA

END OF WA DATA.

DATA: IT_DATA LIKE TABLE OF WA_DATA, IT_BDCDATA LIKE TABLE OF BDCDATA, WA_BDCDATA LIKE LINE OF IT_BDCDATA, IT _ BDCMSGCOLL LIKE TABLE OF BDCMSGCOLL,

W A BDCMSGCOLL LIKE LINE OF IT BDCMSGCOLL.

_ _

DATA V FILE TYPE STRING.

* CONSTANTS

CONSTANTS: C_KSOI(4) TYPE C VALUE 'KSOI', C_X(l) TYPE C VALUE 'X',

C_A(1) TYPE C VALUE 'A'.

SELECTION-SCREEN BEGIN OF BLOCK Bl WITH FRAME TITLE TEXT- 000.

PARAMETER: PA FILE LIKE FC03TAB-PLOO FILE OBLIGATORY. SELECTION-SCREEN END OF BLOCK BI.

Page 12 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad .

Ph No :+9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

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

*

AT SELECTI9N-SCREEN ON VALUE-REQUEST

*

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

*EVENT TO BE TRIGGERED WHEN WI: PRESS F4.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FILE.

PERFORM GET F4 FOR FILE USING PA FILE.

_ _

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

*

STA Rr-OF-S FLEer! ON.

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

START-OF-SELECTION.

*WE NEED ro MOVE rur PA FILE mro ANO'flIER VARIABLE OF TYPE STRING

* AS WE ARE CjOING TO USE THE SAl\.IF IN TI-lF rIv1 : ('rUT trPU)/\D 'TTl [R[ 'II! F:

*FILF l\{PI~ [S STRIl\(i.

V FILE = P A FILE.

_ _

'UPLOAD TffF: DA'fA FROM FLA'[" FILE '1'0 <rrAB> PERFORM UPLOAD FILE TO IT AB USING V FILE

- - - -

CHANGING IT DATA.

*FILL 'fHE SCR[EN AND FIL·:LD DFT/,\j[,S LOOP AT IT DATA INTO WA DATA.

_ -

REFRESH IT BDCDA T A.

*FIS'r SCREEN DE'fAII.S

PERFORM FILL SCREEN DETAILS USING 'SAPLKMA l' '0200' 'X'.

_ _

'CURSOR DE;'fA'IL"S

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR' 'CSKSZ-

_ - _

KOKRS'.

*OKCODE DETAIl.S

PERFORM FILL FIELD DETAIL.S USING 'BDC OKCODE' '/00'.

_ ~ -

""CONTROLLING AREA

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KOKRS' WA DATA-

_ _ _

KOKRS.

*COST CENTER DETAILS

Page 13 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -659.76727, Cell No : 9948444808,9849034399, www.cma.\it.ch.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KOSTL' WA DATA-

- - -

KOSTL.

* START DATE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-DATAB ANFO'

- - -

WA DATA-DATAB.

* END DATE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-DATBI ANFO'

- - -

WA DATA-DATBI.

*NEXT SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLKMAl' '0299' 'X'.

- -

*OKCODE DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC OKCODE' '=BU'.

- - -

*SUBSCR FIELD DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC SUBSCR'

- - -

'BDC SUBSCR'.

*CURSOR DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR' 'CSKSZ-

- - -

WAERS'.

*NAME

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KTEXT' WA DATA-

- - -

KTEXT.

*DESCRlPTION

PERFORM FILL FIELD DETAILS USING 'CSKSZ-LTEXT' WA DATA-

- - -

LTEXT.

*PERSON RESPONSIBLE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-VERAK' WA DATA-

- - -

VERAK.

*COST CENTER CATEGORY

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KOSAR' WA DATA-

- - -

KOSAR.

*HIERARCHY AREA

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KHINR' WA DATA-

- - -

KHThTR.

Page 14 of22

By Ganapati Adimulam

eMax Technoiogies,Ameerpet,Hyderabad

Ph No :+9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com.

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

*CURRENCY KEY

PERFORM FILL FIELD DETAILS USING 'CSKSZ-WAERS' 'INR'.

- -

*CALL THE TRANSACTION

CALL TRANSACTION C KSOI USING IT BDCDA TA

- -

MODE C_A "A - ALL SCREENS

" N - NO SCREENS

" E - ERROR SCREENS ONL Y

UPDATE' A' "Aysnchronous

"Synchronous

MESSAGES INTO IT BDCMSGCOLL.

ENDLOOP.

*8[---------------------------------------------------------------------*

*8[ Form FILL SCREEN DETAILS

- -

*8[---------------------------------------------------------------------*

FORM FILL SCREEN DETAILS USING PROGRAM LIKE BDCDATA-

- -

PROGRAM

DYNPRO LIKE BDCDATA-DYNPRO DYNBEGIN LIKE BDCDATA-DYNBEGIN.

CLEAR W A BDCDA TA.

W A BDCDATA-PROGRAM = PROGRAM. WA BDCDATA-DYNPRO = DYNPRO.

WA BDCDATA-DYNBEGIN = DYNBEGIN. APPEND WA BDCDATA TO IT BDCDATA.

- -

END FORM. "FILL SCREEN DETAILS

- -

*~---------------------------------------------------------------------*

*~ Form FILL FIELD DETAILS

- -

*~---------------------------------------------------------------------*

* Fill Field Details

*----------------------------------------------------------------------*

FORM FILL FIELD DETAILS USING FNAM

- -

FVAL.

CLEAR W A BDCDA T A.

WA BDCDATA-FNAM = FNAM. WA BDCDATA-FVAL == FVAL.

APPEND WA BDCDATA TO IT BDCDATA.

_ _

ENDFORM.

Page 15 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No : 9948444808,9849034399, ww"v.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

*6t---------------------------------------------------------------------*

*& Form GET F4 FOR FILE

~'6t---------------------------------------------------------------------~,

* DISPLAY ALL FILES IN THE SYSTEM FOR SELECTION

*----------------------------------------------------------------------*

* -->P PA FILE NAME OF THE FILE

~~----------------------------------------------------------------------*

FORM GET F4 FOR FILE USING P P A FILE.

- - -

CALL FUNCTION 'KD GET FILENAME ON F4'

- - - -

EXPORTING

FIELD NAME = 'P A FILE'

- -

CHANGING

FILE NAME = P A FILE.

- -

IF SY-SUBRC <> O.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGVI SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

"GET F4 FOR FILE

*&---------------------------------------------------------------------~,

*& Form UPLOAD FILE TO ITAB

- --

~'&---------------------------------------------------------------------*

* SUBROUTINE TO UPLOAD THE DATA FROM PRE. SERVER FILE TO.

ITAB

~~----------------------------------------------------------------------*

* -->P V FILE - FILE NAME

* <--P IT DATA - INTERNAL TABLE TO STORE THE DATA

*----------------------------------------------------------------------*

FORM UPLOAD FILE TO IT AB USING FP V FILE

- - - - -

CHANGING FP IT DATA LIKE IT DATA.

CALL FUNCTION 'GUI UPLOAD' EXPORTING

FILENAME = FP V FILE HAS FIELD SEP ARA TOR = 'X'

- -

TABLES

DATA TAB = FP IT DATA.

ENDFORM.

"UPLOAD FILE TO ITAB

Execute the Program and Observe the Input and Output of the Program:

Step 1 : Execute the Program.

Page 16 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

Lookjn: P- Local Disk (c:)

.er'" ::.ho)r tcut to ::'AP IT') -=:!JroOl.l,i~.

TP_Ar··J5'~I~Tlc,r'·J( I~'C'E. t yt

. "j Documents end S.::ttinq:: " .. ~; Intel

.,,:;~}CII ecle

... :JProgram Files

rr··JF(lT' ... ·PES. T>~T k.eSl.txt

(&) t!.!.l!m

:Gi]F'RAKASH PP_AI~A5H I . Tn

I I. H~.' [)ocurr"or,';.

!M?I~Orn?~,el ..

r ~'J

I -:»

,t.:1.~,,'. ~:',Iet '~\'Clrl~ PI

File IJ·:lfl1e:

1~501.t:.:1_

Open as r80,j-onll'

.. "", .. _, _ ..1 _~l .. I:2_~~~?~.,J ( Q:j 3 SAP Lo ...• _.::-:._ , .1 .~.c" " •• __:._ ''' j

Select the file and Execute it.

(- "'1:';0 +,r"v" ~» ~ ,,- .. ~ "~»:~y t r ~~ v -.. , ",,"" 7",,:' '-"""-;;;~; fx.;

E\rogram ,,",dll QOjg" S,l!slelJ)< Hehp' .. '., .' .. ..' ... "

5:59 Atvl

I ~ Introducti(l

Page 17 of 22

By Ganapati Adimulam

eMax Technologies,Ameel'pet,Hydel'abad

Ph No :+91 40 --65976727, Cell No : 9948444808,9849034399, W\\'\v'cmaxtc('h.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

t" Screen:

Observe the data is transferred ~ ... n.~" .. h

ENTER

2nd Screen Details:

~ Dril\down

Page 18 of22

By Ganapati Adimulam

eMax Techno)ogies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, CeH No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You'?

ENTER

Master uata

Controlling area Cost center

Valid from

To

Reference

cost center Controlling area

Dr.-Code

; .0.:1_'1 q(I~~O~:I;1 ,,·r. ,Jl_8r~I.~_e.?.tl__ 11\1::::

~ ""J 2 'o.",/indol:'". ~I ~tep,:,d .. J ()!(';"!JJ~' ,~~>~. 6:CC ,u,("l

Observe it , AGAIN it called the same screen/s for the next Cost center and it repeats the Same procedure for the rest of the records.

Check for the Successful Creation Of Records:

Execute KS03 (Display the Cost Center)

F/' ~~~~ ~..,~ I ~ ,:_~ t;;;I1§i;;

.Q.ost I:;enlsr Edit :Q.o(o E;@r~S S~$tefn l:(91p N ~~

Master cats

Cost center

31336

Page 19 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No : 9948444808,9849034399, wWH.emaxtcch.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

ENTER

Hardware Centre i-rarov v 'are Exp anee s

MR.Ganapati

7 ser-tces

C1 81 0 Corporate

Repeat the same Procedure for all records and the Other way is check the Corresponding Database table for all the records.

i.e Open the Database table CSKS Cost center master data.

Execute SE16 and Provide the table Name as CSKS and click On Table Contents.

Page 20 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

C ol!::";';"L!_!1? (F S) ~ Cost center Exp.date

-::::1336

'0 '0 to

315561

@:

Std tuerercnv

10

I/\lidth Qr output list M:axin1UITI no. of hits:

250

-::"00

C1'1 (1) (800)'~ Qanap8tl IP.rS

I ,~';-llr.trc,d'Jcti':' ji-lV)35~p~~ ...... 12'Nlndo~· ... ···~1 ":' 2 Not;ep,::.d ~1-~:)D~71;b~ 6:14A['1J

Enter the Cost Centers from the File.

8' N ~ *'>;c> ~..-""~ - : ~'>"" ~ ~ ~, '" ~h ~ Z ~ e ..- v '" L~Y~ Z~

, £roglam' gail, 20)0" j2eltings ~~Jern 'Help \' " , , / ',,',::_

, .

CD (i, ~ ItI Number of entries

co Co' Exr

00 1 Single Val

00 Ranges

@o Singlevals ; 00 Ranges

:3td

VVic Ma,

':E> 'if q,.t3.~ El H Multiple selection. ~ x

J

.r\] Introductio .. I r ~ 3 SAP lo ... • ~ 2 Windo;"

Page 21 of22

By Ganapati Adimulam

eMax Technologies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No : 9948444808,9849034399, w\v\y.emaxtech.com

BDC (Batch Data Communication)

We Never Compromise in Quality, Would You?

Dl:'Jta BrOVifser: Yatde C:SKS setec: Entries ;g

S)'jij ChecK table ...

Yes, All the Cost Centers are Uploaded Successfully

T «b l i.: CSJ{:3

DispL~)"e(i t i sl ds : 19 (;T 14 Fi;~ed coius.ns :

14 L, st '.'11 dtll 0250

__ . 800 :····800

C 800

0801 0001 0081

8000031336 31 12. 9999 23. as 2004 0000031446 31.12. 9999 23 09.2005 0000031556 31 .12.9999 23.09.2006

Page 22 of22

By Ganapati Adimulam

eMax Technoiogies,Ameerpet,Hyderabad

Ph No :+91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Session Method

Summary: Offers management of sessions, support for playing back and

correcting sessions that contain errors, and detailed logging. ¥

Data Transfer program Create a session on the batch input queue.

It prepares the data and stores it in a batch input session. A session is a collection of transaction data for one or more transactions. Batch input sessions are maintained by the system in the batch input queue. We can process batch input sessions in the background processing system.

The program must open a session in the queue before transferring data to it, and must close it again afterwards. All of these operations are performed by making function module calls from the ASAP program.

The most important aspects of the s

o Asynchronous processing

o Transfers data for multiple transactions

o Synchronous database update

During processing, no transaction is started until the previous transaction has been written to the database.

o A batch input processing log is generated for each session

o Sessions cannot be generated in parallel

The batch input program must not open a session until it has closed the precedino session.

One ways to process batch input data is to store the data

in a You can then run this session in the Rl3 System to enter

the batch input data into the system.

STEPS TO WORK WITH SESSION METHOD:

1. Generate the batch input session using function module BDC OPEN GROUP.

2. Then proceed as follows for each transaction that the session contains:

a. In the BDCDATA structure, enter the value for all screens and fields that must be processed in the transaction: (I,e Fill the IT AB IT_BDCDATA ).

Page 1 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 ---65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

b. Use BDC INSERT to transfer the transaction and the IT BDCDATA

_ _

to the session.

3. Close the batch input session with BDC_CLOSE_GROUP

4. Process the Session Online through SM3S1 In Background through program RSBDCSUB.

Note: We need to repeat the Step 2, for each transaction, when we want to process multiple transactions through the same Session.

The above Steps in Detail: 1. Use the BDC_OPEN_GRO create a new session. Once you have created a session, < input data into it with BDC_INSERT.

CALL FUNCTION 'BDC_OPEN_GROUP'

You cannot re-open a session that already exists and has been closed. If you call BDC _ OPEN_GROUP with the name of an existing session, then an additional session with the same name is created.'

EXPORTING CLIENT GROUP HOLOOATE KEEP USER

<client>

<sess ion name> <lock date>

< deletion indicator> <batch user name>

BDC _ OPEN_GROUP takes the following EXPORTING parameters:

EXCEPTIONS RUNNING QUEUE_ERROR

CL IE NT _INVALID GROU P INVALID

1 2 3

Default: If you don't provide a value for this parameter, the default is the client under which the batch input program runs when the session is created.

Page 2 of72

By Ganapati Adimulam

• CLIENT

Client in which the session is to be processed.

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 --65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

• GROUP

Name of the session that is to be created. Default: None. You must specify a session name.

• HOLDDATE

Lock date. The session is locked and may not be processed until the date that you specify. Only a system administrator with the LOCK authorization for the authorization object Batch Input Authorizations can unlock and run a session before this date. '

Format: YYYYMMDD (8 digits).

Default: No lock date, session can be processed immediately. A lock date is optional.

• KEEP

the value X to have a A session that is kept deletes it.

Retain session after successful processing. session kept after it has been successfully remains in the input/output queue until an ... ,,"U.1UU'.,

Note: Sessions that contain errors in transactions are kept even if KEEP is not set.

.f

Default: If not set.then sessions that are successfully processed are deleted. Only the batch input log is kept.

USE

Auth

authorization" errors.

r background processing. This is the user name that is used ations if a session is started in background processing. The ized for all of the transactions and functions that are to be a seSSIOn. Otherwise, transactions will be terminated with "no

I

5. The procedure as follows for each transaction that the session contains: 6.

a. In the BDCDATA structure, enter the value for all screens and fields that must be processed in the transaction.

b. Use BDC INSERT to transfer the transaction and the BDCDATA structure to the session.

Page 3 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Adding Data to a Session: BDC_INSERT

CAll FUNCTION 'BOC INSERT

EXPORTING TCOOE

<trans action code>

TABLES OYNPROTAB

<bdc table>

EXCEPTIONS

INTE RNAl ERROR NOT OPEN QUEUE ERROR TCOO E INVALIO

1 Z 3 4

BDC INSERT takes the

ing parameters:

• TCODE

The codeof.the transaction that is to be run .

• DYNPROTAB

The BDCDATA structure that contains the data that is to be processed by the transaction.

DYNPROTAB is a table parameter in the function module

3. Close the batch input session with BDC CLOSE GROUP

Page 4 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad -

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Use the BDC _CLOSE _GROUP function module to close a session after you have inserted all of your batch input data into it. Once a session is closed, it can be processed.

BDC _CLOSE _ GROUP needs no parameters. It automatically closes the session that is currently open in your program.

You must close a session before you can open another session from the same prog~am.

You cannot re-open a session once it has been closed. A new call to BDC OPEN GROUP with the same session name creates a new session with the same name.

4. Start to rocess the

Session Can he Processed either Manually or in Background. Execute the transaction SM35 if Manually Else Schedule the Pr RSBDCSUB.

Managing Batch Input Sessions

Includes:

Processing the Sessions Analysis of Session.

Aba

is a set of one or more calls to transactions along with the by the transactions. The system normally executes the ssion non-interactively, allowing rapid entry of bulk data into

A session records transactions and data in a special format that can be interpreted by the Rl3 System. When the System reads a session, it uses the data in the session to simulate on-line entry of transactions and data.

For example, the data that a session enters into transaction screens is subject to the same consistency checking as in normal interactive operation. Further, batch input sessions are subject to the user-based authorization checking that is performed by the system.

Page 5 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 ~5976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

A Session Can be Processed

Automatically

Explicitly

Processing Sessions Automatically

Use

In most cases, batch input sessions can be processed necessary for a session to wait until a system admini processing of the session.

Prerequisites

must be scheduled as a periodic job in the Rl3 DCSUB checks for and starts any batch input chedules such sessions for immediate

The ABAP program RSBD, background processing syst sessions that have not yet be execution in the background

icallyin one or more background jobs.

eduled batc i input runs, you can schedule separate jobs ~~.ansfers. The start time for the RSBDCSUB job can be set according to tht'h input schedule. And you can use a variant to restrict RSBDCSURonlx, the batch input sessions that you expect.

If you have regularl for each of the schedul

• session name

Input For the Program RSBDCSUB:

• date and time of generation

• status: ready to run or held in the queue because of errors

Page 6 of 72 By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Result

Batch input sessions are started automatically rather than by hand. The RSBDCSUB program can be set up to start all sessions that arrive in an Rl3 System, or it can be fine-tuned to start only batch input sessions that you expect.

Starting Sessions Explicitly: Run Modes

Use

Running a batch input session executes the transactions in t data into an Rl3 System.

ssion and enters

• To correct transactions that had

• To check that the transactions in a session running the first several transactions

• To start a session on specialrequest (the session would not be started automatically or must be started right away).

Prereq uisites

Proc

put management tool: Select System 0 Service 0 Batch input .... ate: Enter transaction SM35.

ark the session and choose Process from the tool bar. You can then choose how to run a session and with what logging and display options.

You can start any session in new status that is not locked.

Page 7 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Run Modes

There are three ways to run a session:

Processlforeground Displav errors only Background

Process/foreground: You can interactively correct transactions that contained errors and step through transactions that have not yet been executed.

• Display errors only: This mode is like Processlforeground except that transactions that have not yet been run and which do not contain errors are run non-interactively.

If an error occurs, and the screen upon which the error occurred

is displayed.

Background: Use this a session for immediate processing in

the background processing

\'<";.(.<':>'-''-' for processing in the background

proces the session for processing.

Note: With Display errors only mode, you can also re-

the status Incorrect. Sessions with the status Processed

cannot be run again.

o If a transaction . session contained an error, the incorrect transaction

is aborted.i All other transactions are completed. The session remains in the. queue and is held in the Errors section of the list. You can correct the session in one of the interactive modes and run it to completion.

A transaction contains an error if it issues a message of type E (error) or type A (abnormal termination). Other messages are ignored and do not affect the execution of a session.

Analyzing Sessions through SM35. Use

Page 8 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 --65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Use the analysis functions to check on the actions performed by a batch input session. The analysis functions allow you to display the transactions, screens, and data in a session.

Procedure

You can use the analysis functions before or after a session has been run.

Note: Analysis of sessions that have been run is available only for sessions that contained an error or which were generated with the KEEP option. The KEEP option prevents the system from deleting a session that has b jii successfully run.

Statistics

You can analyze a session by marking the session selecting Goto 0 Analyze session or by selecting A session log screen.

For a quick summary statistics function: Goto 0 analysis function is that the

and contents of a session, you can use the r- ~ Stati~t·i~~:. The advantage over the yed more quickly.

Session Data

You can displ~X t~ed~ta~ntered on each screen of a session by switching to the Screens tab~·;~~~ig§~~.·ii

Here, you can have the data presented to you in two formats:

• The first data display presents data in list format by field name. Choose this display by choosing Options from the tool bar and marking the Field list check box.

Page 9 of 72

By Ganapati Adimulani

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

• data shown on it. Double-click on the screen in the Dynpro list. The system simulates the screen. No data is processed.

You can switch back and forth from one form of display to the other.

Correcting a Session

Use

This section explains how to correct errors in faulty transactions in a session.

Procedure

When a session is run in background-processing mode, the system marks transactions that contain errors as incorrect. All other transactions in the session are completed. The session itself is kept in the queue in the Errors section of the list.

of type E (error) or ignored and do not

A transaction contains an error if it generateslan type A (abnormal termination). Messages of affect the execution of a session.

You can correct and re-execute the incorrect transactions in an "Errors" session. There are two ways to do so:

1. Re-run the session in display-all or error-display mode. These modes offer the following advantages:

ips transactions that were successfully completed. Only incorrect ansactions that have not been executed are run.

- Yo

<

puts and add missing screens interactively as incorrect

. system logs all such changes.

The following topic provides more information on using display-all mode or error-display mode to correct a transaction.

2. As an alternative, you can analyze the session to determine what the error was.

With the analysis displays, you can check the screen that contained the error and the values that were entered in it. You can then correct the program that generated the session and regenerate the session.

Note: You must ensure that the new session does not include transactions (Records) that were successfully completed. Otherwise, the updates made by the transactions will be performed again.

Page 10 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Interrupting a Session

You can interrupt the interactive execution of a session by entering the Ibend OK code on any screen. Ibend terminates the transaction currently being executed in the session and marks the transaction with the status Incorrect. The session is kept in the queue and is displayed in the Errors section of the list. Changes made by the interrupted transaction are rolled back as long as the transaction uses only the RJ3 update facility.

You can use Ibend when testing sessions. For example, you may wish to run the first transactions of a large session in display-all mode sure that the session has been generated correctly.

lild then already

If the transactions are correct, you can then termina submit the session for background execution. The transactio been run will not be run again.

Restarting a Transaction

saction by entering the Ibbeg OK code on any , n that is currently being processed and then corded in the batch input session. Any bac~, as long as they were made only de directly to the database are not

You can restart processing screen. Ibbeg terminates the restarts the transaction fresh, changes made by the transacti

by way of t J update facil

rolled bac

You .can delete a tra~,i!~o~;>from a se~sio~ during interactive exec~tion by entenng the Ibdel OK co '.'Y'The transaction IS removed from the seSSIOn. The deleted transaction cannoj e run even if you restart the session, and you cannot take back the deletion.

The transaction is, however, available for analysis if the session was generated with the KEEP option set. The transaction is marked with the status Deleted in the analysis display. The deletion also is recorded in the log generated by the session.

Similarly we have some other OK Codes and their Functionalities :.

Page 11 of 72

By Ganapati Adimulam

eM ax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Te rrnin ate current batch in put an d mark as inca rrect

Delete curre nt batch inp ut fro rn session

R esta rt a tran sactio n

T e rmin ate batch in put processin g and rnark session as incorrect

Change display mode to process the on screen instead of displaying only

Change display mode to display only instea d of pro cessin g the sessions on

You can lock a session to prevent the system from running it before the date that you specify in the lock.

Locking and Unlocking Sessions

Use

session locked until the eleventh of November can be started only

a session for such reasons as

• preventing a session that contains errors from being re-started

• preventing a session that requires a special resource, such as printer forms or a specific tape, from being started unintentionally.

You can unlock a session by changing the lock date to the present date or by entering a space as the lock date.

Page 12 of 72

Procedure

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

You canlock sessions in the session queue by m~rking the sessions and choosing Lock ~ifrom the tool bar and similarly Unlock i~

Displaying Session Logs

Use

The batch input system keeps a detailed log of each session that is processed. The log contains not only progress messages from the batch input : .. ~stem itself, but also error messages from the transactions that are processedl~'

e

Prerequisites

To analyze an error in a session, you should start by relevant messages.

A session log is kept only if the session was generated with th

the session is aborted or .

Start the batch input HHOCHU1"," r:;JSessions or Logs. from the standard session logs. The 10

. Select System 0 Service 0 Batch input SM35P. You can display logs special separate transaction for

from the tool bar.

.. Session Log File

You should periodically use the ABAP/4 program RSBDCREO to reorganize the batch input log file. You can run RSBDCREO in the background or interactively.

Running the program reduces the size of the log file.

Session Status(Before and After Processing the Session either of the ways).

Sessions in the session queue are sorted by date and time of generation and are grouped in different lists according to their status.

Page 13 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Possible statuses are as follows:

Session was Created and recorded but not yet Processed.

• Incorrect

Held in the session queue because of errors in transactions (Errors in sessions)

Transactions that contained errors are aborted; all correct transactions are processed. The Tran. and Screen fields in the session display show how many incorrect transactions were found in the session.

Processed 'Processed

transactions with one of input system.

You can restart a session and correct the interactive execution modes ,\TTPrp'O

For further information on a session that successfully run, you can

display the log generated by the session. completed sessions generate a

log. You cannot run a completed session a second time.

Note: Only sessions that were generated with the KEEP option are held in the queue after processing. Other sessions are deleted after they are successfully completed.

this status only if you happen to display the queue while

You will usually see this status only if you happen to Process the Session in the Mode Background Mode (Display No Screens).

You will usually see this status only if you happen to display the queue while a session is being generated (entered into the session queue).

Page 14 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Locked

Status when the session is Loked i.e when the HOLD DATE III BDC OPEN GROUP is set.

Programming in Session Method:

Requirement: Upload all the List Of Profit Center Details into SAP using Session Method.

About Profit Center Master Data:

Profit Center Definition

A profit center is an organizational unit in accounting that reflects a managementoriented structure of the organization for the purpose of internal control.

A?

You can analyze operating r suIts for profit centers using either the cost-of-sales

or the period accounting ap

By calculating the investment centers.

can use your profit centers as

Use

t cen{~r level is based on costs and revenues.

Structure

The master data of a profit center includes

The name of the profit center,

the controlling area it is assigned to,

and the profit center's period of validity,

as well as information about the person responsible for the profit center,

the profit center's assignment to a node of the standard hierarchy, and data required for communication (address, telephone number and so on).

Every profit center is assigned to the organizational unit Controlling area. This assignment is necessary because Profit Center Accounting displays values in GIL accounts.

Page 15 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 --{;5976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

The system transfers all the data to Profit Center Accounting together with the GIL account to which the data was originally posted.

Transaction Code: KE51.

Note: SHDB is transaction to record all the steps while executing the Session Method.

Recording the KE51:

Steps to Work with Recording(SHDB) :

1. Execute SHDB and Click On New Recording.

Page 16 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Press Enter and Start Execute the transaction so that the steps will be recorded.

Enter the Profit Center number and press ENTER.

ENTER

Enter all the mandatory fields i.e ~A'Ulljlll" to),Name,Person responsible and ProfitCenter

alid From and Valid

Examination period

3.4123

01 .01.2003

Status To

IMactive: Create 31 .12.9999

MISCELLANeOUS

Mr.GanapatJ

Page 17 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Click On Activate

Examination period

34123

81 .81 .2803

Status To

Inactive: Create 31.12.9999

MISCELLANeOUS

Mr.GanapaU

SAVE the recording.

Page 18 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Note: We Use the above steps while writing the BDC program.

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

* PROGRAM : ZDEMO UPLOAD PROFIT CENTER *

- -

* AUTHOR : GANAPATI. ADIMULAM *

* PURPOSE : BDC PROGRAM TO UPLOAD ALL THE PROFIT * * MASTER DATA INTO SAP *

*

*

*

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

REPORT ZDEMO UPLOAD PROFIT CENTER.

*INCLUDE FOR ALL THE GLOBAL DECLARATIONS INCLUDE ZDEMO PROFIT CENTER TOP.

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

*

AT SELECTION-SCREEN ON VALUE-REQUEST

*

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

*EVENT TO BE TRIGGERED WHEN WE PRESS F4.

Page 19 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 99484 44808, 98490 34399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FILE.

PERFORM GET F4 FOR FILE USING PA FILE.

_ _

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

*

START-OF-SELECTION.

*

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

START-OF -SELECTION.

·WE NEED TO MOVE THE PA FILE INTO ANOTHER VARIABLE OF TYPE STRING

* AS WE ARE GOING TO USE THE SAME IN THE FM THERE THE

*FILE TYPE IS STRING.

V FILE = P A FILE.

_ _

·UPLOAD THE DATA FROM FLAT FILE TO <ITAB>

PERFORM UPLOAD ITAB USING V FILE DATA.

*FIRST SCREEN PERFORM FILL

DETAILS USING 'SAPLRKPM"0200' 'X'.

*PROFIT CENTER PERFORM FILL PRCTR.

* ENTER

PERFORMFILL FIELD DETAILS USING 'BDC OKCODE"/OO'.

_ _ _

DETAILS USING 'PRCT V-PRCTR' WA DATA-

_ _

*NEXT SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLRKPM"0298"X'.

_ _

*CURSOR DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR"PRCT V-

- - - -

KHINR'.

*OKCODE DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC OKCODE'

_ _ _

'=MD ACTIVATE'.

Page 20 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

*SUBSCR DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC SUBSCR'

- - -

'SAPLRKPM 0300SUBSCREEN EO'.

* START DATE

PERFORM FILL FIELD DETAILS USING 'PRCT V-DATAB' WA DATA-

- - --

DATAB.

*ENDDATE

PERFORM FILL FIELD DETAILS USING 'PRCT V-DATB!' WA DATA-

- - --

DATBI.

*NAME

PERFORM FILL FIELD DETAILS USING 'PRCT V-KTEXT' WA DATA-

KTEXT. - - --,

*PERSON RESPONSIBLE

PERFORM FILL FIELD DETAILS USING 'PRCT V-VERAK' WA DATA-

- - --

VERAK.

*HIERARCHIAL AREA PERFORM FILL_FIELD_DETAILS US·,· KHINR.

PERFORM BDC INSERT USING 'KE ' IT BDCDATA.

ENDLOOP.

PERFORM CLOSE SESSION.

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

* DEFINITIONS OF ALL THE ABOVE SUBROUTINES *

*****~*************************************

*

DETAILS

*

*------------------------------------------------------

FORM FILL SCREEN DETAILS USING PROGRAM DYNPRO DYNBEGIN.

- -

WA BDCDATA-PROGRAM = PROGRAM.

WA BDCDATA-DYNPRO=DYNPRO.

WA BDCDATA-DYNBEGIN = DYNBEGIN. APPEND WA BDCDATA TO IT BDCDATA.

- -

CLEAR WA BDCDATA.

END FORM. "FILL SCREEN DETAILS

- -

*~---------------------------------------------------------------------*

*~ Form FILL FIELD DETAILS

- -

Page 21 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

*8t---------------------------------------------------------------------*

FORM FILL FIELD DETAILS USING FNAM FVAL.

- -

WA BDCDATA-FNAM=FNAM.

WA BDCDATA-FVAL= FVAL.

APPEND WA BDCDATA TO IT BDCDATA.

- -

CLEAR WA BDCDATA.

ENDFORM. "FILL FIELD DETAILS

- -

~'6[---------------------------------------------------------------------*

*& Form UPLOAD FILE TO ITAB

- --

~'&---------------------------------------------------------------------*

* SUBROUTINE TO UPLOAD THE DATA FROM

ITAB

*

-->P V FILE - FILE NAME <--P IT DATA - INTERNAL TABLE TO STORE THE

*--------------------------------------------------------------

*

*---------------------------------------------------------------------~*

FORMUPLOAD FILE TO .. ABUSING FP V FILE

- -

CHANGIN IT DATA LIKE IT DATA.

- -

CALL FUNCTION 'GUI EXPORTn\JG FILENAME

HAS

FILE TO ITAB

ENDFORM.

* &---------~---:-------------

*& Form OPEN SES

* & ---'--------- -------------------------------------------- ----- *

* CREATES THE SESSION

~~--------------------------------------------------------------*

-->P P GROUP NAME OF THE SESSION

*--------------------------------------------------------------*

FORM OPEN SESSION USING FP P GROUP.

*CALL THE FUCTION MODEU BDC OPEN GROUP

- -

CALL FUNCTION 'BDC OPEN GROUP'

- -

EXPORTING

CLIENT = SY-MANDT GROUP = FP P GROUP KEEP = 'X'

Page 22 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

USER = SY-UNAME.

IF SY-SUBRC = O.

WRITE :/'PROCESS THE SESSION', FP _P _GROUP, 'USING SM35'.

ENDIF.

ENDFORM.

"OPEN SESSION

*~---------------------------------------------------------------------*

*~ Form GET F4 FOR FILE

*~---------------------------------------------------------------------*

* DISPLAY ALL FILES IN THE SYSTEM FOR SELECTION

CALL FUNCTION 'KD GET FILENAME

- -

EXPORTING

FIELD NAME = 'P A FILE'

- -

CHANGING

FILE NAME = PA FILE.

- -

IF SY-SUBRC <> O.

MESSAGE ID SY-MSGIDTYPE SY-MSGT BER SY-MSGNO

WITH SY-MSGVl SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*----------------------------------------------------------------------

* -->P PA FILE NAME OF THE FILE

*------------------------------------------------------------------

FORM GET F4 FOR FILE USING P PA FILE.

- 4

ENDFORM.

" GET F4 FOR FILE

*~---------------------------------------------------------------------*

*~ SE SESSION

*

*

*

F

ON.

*CALL MODULE 'BDC COLSE GROUP'

- -

CALL FUNCTION 'BDC CLOSE GROUP'

- -

* EXCEPTIONS

* NOT OPEN = 1

* QUEUE_ERROR =2

* OTHERS = 3

IF SY-SUBRC <> O.

MESSAGE ID SY-MSGID TYPE SY-MSGTYNUMBER SY-MSGNO WITH SY-MSGVl SY-MSGV2 SY-MSGV3 SY-MSGV4.

Page 23 of 72

By Ganapati Adimulam

eM ax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

ENDIF.

ENDFORM.

"CLOSE SESSION

~'~---------------------------------------------------------------------*

*~ Form BDC INSERT

*~---------------------------------------------------------------------*

*

text

*----------------------------------------------------------------------*

* -->P TCODE text

* -->P IT BDCDATA text

*----------------------------------------------------------------------*

FORM BDC INSERT USING FP TCODE TYPE SYTCODE

_ _

FP IT BDCDATALIKEIT BDCDATA.

*CALL FUCTION MODULE 'BDC INSERT' CALL FUNCTION 'BDC INSERT' EXPORTING TCODE =FP TABLES DYNPROTAB = FP IF SY-SUBRC <> O.

MESSAGE ID SY-MSGID MSGVl SY

NUMBER SY-MSGNO 3 SY-MSGV4.

ENDFORM.

~,----------------------------------------------------------------------*

* INCLUDE ZDEMO PROFIT CENTER TOP

_ _ _

*

*----------------------------------------------------------------------*

DATA: BEGIN OF WA_DATA,

PRCTR TYPE PRCTR, "Profit Center DATAB TYPE DATAB, "START DATE DATBI TYPE DATBI, "END DATE KTEXT TYPE KTEXT, "NAME

VERAK TYPE VERAK, "PERSON RESPONSIBLE KHINR TYPE KHINR, "HIERARCHY AREA

END OF WA DATA.

DATA: IT DATA LIKE TABLE OF WA DATA.

_ _

Page 24 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

DATA: IT_BDCDATA LIKE TABLE OF BDCDATA, WA BDCDATA LIKE LINE OF IT BDCDATA.

_ _

DATA V FILE TYPE STRING.

SELECTION-SCREEN BEGIN OF BLOCK Bl WITH FRAME TITLE TEXT- 000.

PARAMETER: PA_FILE LIKE FC031:AB-PLOO_FILE OBLIGATORY, P GROUP LIKE APQI-GROUPID OBLIGATORY.

SELECTION-SCREEN END OF BLOCK Bl.

Execution the Program, Observe the Input and 0

Execute ZDEMO UPLOAD PROFIT

CFfE!-tTE PROHT GENTER

Select the File and Provide the Session Name and Execute it.

Page 25 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad .

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

,jl_JHLxls fI INFOTVPES. TXT

:~l~

r~'i p Type: Text Document

~5 ~i~~~ ~;~~;~~/ 1/7/200310:38 PM

2IDT·~~. ~------------~ 11;; TRANSACTlONCODE.txt

2Document:s: and Settings ,:Jlntel

;:Jorade

L.JProgram Files

22JUsers

bWINDOW5

{)wmpub

(0 Copy of H;FOTYPES. TXT C) DOWNLOAD. TXT ®DOWNLOAD.XLS

Ci,l emp.txt

-~jemp.xls

:~_ Gone Fishing.bmp

kefi'l.txt

All Files

o Open as jeed-onfy

CREATE PROFiT CENTER

Page 26 ofn

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, ww\v.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

PROCESS THF. St';SS I. eH; nv _SESS I ON US t nrs St·1~';!;;

Session Processing through SM35 (Process the S~

1) Execute the Transaction SM35.

Page 27 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 99484 44808, 98490 34399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You1

Foreground(DispJay All Screen) Display errors

Background(No Screens)

LJ Expert mode

Click On Process.

First Screen Details

ENTER

Page 28 of72

s:

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

2nd Screen Details

Protlt center Examination period

Status To

30122OfT!

Note: Observe the Profit Center 18697 is created and calls the same sequence of screens For the rest of the Profit centers t00.

Revenues Furniture

. Hardware S/W product

Page 29 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 99484 44808, 98490 34399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

After Processing all the records from the above screens, a screen will be

SAIPRI3

Select the processed session and click on Analysis.

Page 30 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad .

Ph No: +9140 -fJ5976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Note: For More details about Batch Input Session, go through the Managing Batch Input Sessions in the same chapter.

Page 31 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 99484 44808, 98490 34399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Requirement:

Write a program to process more than one transaction through the same session(Upload Profit Center + Cost Center Master Data).

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

* PROGRAt1 * AUTHOR * PURPOSE

ZDEMO UPLOAD PROFIT CENTER GANAPATI . ADIMUL~l

BDC PROG~~ TO UPLOAD ALL THE PROFIT CENTER AND COST CENTER MASTER SAP THROUGH THE S~lE SESSION

*

*

>.. REFERENCE

*

NA

*

*

*

*

* COPIED FROM : NA

*

* TRAPORT REQUEST NO : CIID2K9001

*

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

REPORT ZDEMO UPLOAD PROFIT CENTER

*INCLUDE FOR ALL THE GLOBAL DECL}\RATI INCLUDE ZDEMO PROFIT CENTER TOP.

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

*

AT SELECTION-SCREEN ON VALUE-REQUEST

*

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

*EVENT TO BE TRIGGERED WHEN WE PRESS F4.

AT SELECTION-SCREEN ON VALUE __ REQUEST FOR PA FILE.

*

F4 FOR FILE USING PA FILE.

****

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

TART-OF-SELECTION.

*

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

*WE NEED TO MOVE THE PA FILE INTO ANOTHER VARIABLE OF TYPE STRING *AS WE ARE GOING TO USE THE SAME IN THE FM : GUI UPLOAD THERE THE *FILE TYPE IS STRING.

V FILE = PA FILE.

*UPLOAD THE DATA FROM FLAT FILE TO <ITAB>

PERFORM UPLOAD FILE TO ITAB USING V FILE

CHANGING IT DATA.

*OPENS A NEW SESSION , SAME SESSION FOR BOTH *COST CENTER AND PROFIT CENTER.

Page 32 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

PERFORM OPEN SESSION USING P GROUP.

*FOR EACH PROFIT CENTER.

LOOP AT IT DATA INTO WA DATA.

REFRESH IT BDCDATA.

*FIRST SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLRKPM' '0200' 'X'.

*PROFIT CENTER

PERFORM FILL FIELD DETAILS USING 'PRCT V-PRCTR' WA DATAPRCTR.

*ENTER

PERFORM FILL FIELD DETAILS USING 'BDC OKCODE' '/00'.

*NEXT SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLRKPM' '0298' 'X'. *CURSOR DETAILS

PERFORM FILL FIELD DETAILS US *OKCODE DETAILS PERFORM FILL FIELD DETAILS US *SUBSCR DETAILS PERFORM FILL FIELD DETAILS 'SAPLRKPM 0300SUBSCREEN EO'. *START DATE PERFORM FILL FIELD DETAILS USING 'PRCT V-DATAB' WA DATA-

'PRCT V-KHINR' .

'=MD ACTIVATE' .

DATAB. *END DATE

PERFORM FILL FIELD DETAILS USING 'PRCT V-DATBI' WA DATADATBI.

* NAME

PERFORM FILL FIELD DETAILS USING 'PRCT V-KTEXT' WA DATAKTEXT.

DETAILS USING 'PRCT V-VERAK' WA DATA-

IELD DETAILS USING 'PRCT V-KHINR' WA DATA-

*INSERT THE SCREEN AND FIELD DETAILS INTO THE SESSION FOR KE51 PERFORM BDC INSERT USING 'KE51'

IT BDCDATA.

ENDLOOP.

*BEFORE CLOSING THE SESSION f WE NEED TO INSERT *NEXT TRANSACTION DETAILS INTO THE SAME SESSION

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

* TO MAKE IT CLEAR WE DELCARE ALL THE RALATED THINGS *

Page 33 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

* TO UPLOAD THE COST CENTER MASTER DATA, BUT IN * * REAL TIME WE DON'T DELARE THE VARIABLES IN BETWEEN * * THE PROGRAM AND IT SHOULD BE ALWAYS AT THE BEGINNING*

* OF THE PROGRAM.

*

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

DATA : BEGIN OF WA_KSOI,
KOKRS TYPE KOKRS, "CONTROLLING AREA
KOSTL TYPE KOSTL, "COST CENTER
DATAB TYPE DATAB, "START DATE
DATBI TYPE DATBI, "END DATE
KTEXT TYPE KTEXT, "NAME
LTEXT TYPE LTEXT, "DESCRIPTION
VERAK TYPE VERAK, "PERSON RESPONSIBLE
KOSAR TYPE KOSAR, "COST CENTER CAT
KHINR TYPE KHINR, "HIERARCHY AREA
END OF WA KSOI. SELECTION-SCREEN BEGIN PARAMETER : PA KSOI LI SELECTION-SCREEN END

VALUE 'KSOI', VALUE 'X', VALUE 'A'.

DATA: IT KSOI LIKE TABLE OF WA KSOI.

*CONSTANTS CONSTANTS: C_KSOI(4) C_X(I) C_A(I)

WITH FRAME TITLE TEXT-OOI. OBLIGATORY .

R VARIABLE OF TYPE STRING FM : GUI UPLOAD THERE THE

EXPORTING

V FILE 'X'

TABLES

DATA TAB

IT KSOI.

*FILL THE SCREEN AND FIELD DETAILS LOOP AT IT KSOI INTO WA KSOI.

REFRESH IT BDCDATA.

*FIST SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLKMAI' '0200' 'X'.

*CURSOR DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR' 'CSKSZ-KOKRS'.

*OKCODE DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC OKCODE' '/00'.

Page 34 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

**CONTROLLING AREA

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KOKRS' WA KSOlKOKRS.

*COST CENTER DETAILS

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KOSTL' WA KSOI-KOSTL.

*START DATE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-DATAB ANFO' WA KSOlDATAB.

*END DATE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-DATBI ANFO' WA KSOlDATBI.

*NEXT SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLKMAl' '0299' 'X'.

*OKCODE DETAILS

PERFORM FILL FIELD DETAILS

*SUBSCR FIELD DETAILS

PERFORM FILL FIELD DETAILS

til 'BDC SUBSCR'.

*CURSOR DETAILS

PERFORM FILL FIELD DETAILS

* NAME

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KTEXT' WA KSOI-KTEXT.

*DESCRIPTION

PERFORM FILL FIELD DETAILS USING 'CSKSZ-LTEXT' WA KSOI-LTEXT.

*PERSON RESPONSIBLE

PE;R,t Ef)ILL FIELD DETAILS USING 'CSKSZ-VERAK' WA KSOI-VERAK.

*COS

IELD DETAILS USING 'CSKSZ-KOSAR' WA KSOI-KOSAR.

USING 'CSKSZ-KHINR' WA KSOI-KHINR.

*CURRENCY KEY

PERFORM FILL FIELD DETAILS USING 'CSKSZ-WAERS' 'INR'.

*INSERT THE SCREEN AND FIELD DETAILS INTO THE SESSION FOR KSOI PERFORM BDC INSERT USING 'KSOl'

IT BDCDATA.

REFRESH IT BDCDATA.

ENDLOOP. "END OF IT KSOI

*CLOSE THE SESSION

Page 35 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 --fJ5976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

PERFORM CLOSE SESSION.

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

*

DEFINITIONS OF ALL THE ABOVE SUBROUTINES

*

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

*&-----------------------------------------------------

*& Form FILL SCREEN DETAILS

*&-----------------------------------------------------

*

FILL SCREEN AND FIELD DETAILS

*------------------------------------------------------

FORM FILL SCREEN DETAILS USING PROGRAM WA BDCDATA-PROGRAM = PROGRAM.

WA BDCDATA-DYNPRO = DYNPRO.

WA BDCDATA-DYNBEGIN = DYNBEGIN. APPEND WA BDCDATA TO IT BDCDATA. CLEAR WA BDCDATA.

ENDFORM.

" FILL SCREEN DETAILS

*&-----------------------------------------------------*

*

FILL FIELD

*& Form

*&-------------------------*

*-------------------

------*

ENDFORM.

FILL FIELD DETAILS

------*

*& Form

*&------------------T~------------------------------------------------*

*

SUBROUTINE TO UPLOAD THE DATA FROM PRE. SERVER FILE TO

ITAB

* - - - - - - -'':_ - - -- - - - - - - - - - - - - - - - - - - - - - -- - -- - - - - - - - - - - - - - - - - - - - - - - - - --

------*

* -->P V FILE - FILE NAME

* <--P IT DATA - INTERNAL TABLE TO STORE THE DATA

*----------------------------------------------------------------

------*

FORM UPLOAD FILE TO ITAB USING FP V FILE

CHANGING FP IT DATA LIKE IT DATA.

CALL FUNCTION 'GUI UPLOAD' EXPORTING

FILENAME

HAS FIELD SEPARATOR

FP V FILE

'X'

Page 36 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

TABLES

DATA TAB

= FP IT DATA.

ENDFORM.

" UPLOAD FILE TO ITAB

*&-------------------------------------------------------------*

*& Form OPEN SESSION

*&-------------------------------------------------------------*

*

CREATES THE SESSION

*--------------------------------------------------------------*

* -->P P GROUP NAME OF THE SESSION

*--------------------------------------------------------------*

FORM OPEN SESSION USING

FP P GROUP.

*CALL THE FUCTION MODEU BDC OPEN GROUP CALL FUNCTION 'BDC OPEN GROUP' EXPORTING

CLIENT GROUP KEEP

SY-MANDT FP P GROUP

'X'

IF SY-SUBRC = O.

WRITE :/'PROCESS THE SESSION' ENDIF.

ING SM35'.

ENDFORM.

*&-------------------------------------

------*

*& Form GET F4 FOR FILE

*&-------------------------~------------------------------------------*

* DISPLAY ALL FILES IN THE SYSTEM FOR SELECTION

*--------~-------------------------------------------------------

------*

*

NAME OF THE FILE

LE USING

P PA FILE.

FORM

CA

D GET FILENAME ON F4'

NAME 'PA FILE'

CHANGING

FILE NAME

PA FILE.

IF SY-SUBRC <> O.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGVl SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

" GET F4 FOR FILE

*&--------------------------------------------------------------------*

*& Form CLOSE SESSION

Page 37 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

*&--------------------------------------------------------------------*

*

TO CLOSE THE ACTIVE SESSION

*----------------------------------------------------------------

------*

FORM CLOSE SESSION.

*CALL FUCTION MODULE 'BDC COLSE GROUP' CALL FUNCTION 'BDC CLOSE GROUP'

* EXCEPTIONS

* *

NOT OPEN QUEUE_ERROR OTHERS

1 2 3

*

IF SY-SUBRC <> O.

MESSAGE 10 SY-MSGID WITH SY-MSGVl SY-MSGV2 SY-MSGV

ENDIF.

ENDFORM.

" CLOSE SESSION

*&--------------------------------------~--------------*

*& Form

*&-------------------------*

* text

------*

*

*

------*

FORM BDC

SYTCODE

LIKE IT BDCDATA.

*CALL FUCTION MO CALL FUNCTION 'B EXPORTING TCODE TABLES DYNPROTAB

TCODE

FP IT BDCDATA.

IF SY-SUBRC <> O.

MESSAGEID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGVl SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

" BDC INSERT

Execute the Program

Page 38 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com.

Session Method

We Never Compromise in Quality, Would You?

C:\ke51.M NE~'J_SESS r ON

f.:RE.".TF.: PROFIT c.ENTEr~

PROC::::S::; THE :::;EZSI(I~J NE~"'_SCSSlt)N LlSING 5W35

13022001 13022005

30122007 30122008

Revenues Furn;ture

I

1-,,-< L-C-'-'-~~'-'--~~'-'c--"--,,-~,-,=----,,-c_,,.-c'--c~~~~~.:.:.__,-,--_j

Page 39 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Cost Center File:

12336 23446

23092004 23092005

31129999 31129999

I

L~~~~~

Process the Session through SM35 :

Execute SM35.

Select the already created

and click on Process.

Page 40 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

!

; c~, Processlforeground

(,' Display errors only -' Background Destination

[J Extended log

[JExpert mode

Page 41 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com $

Session Method

We Never Compromise in Quality, Would You?

2nd Screen:

OK·Code Em!lt'XijiltI.i.m

Prom center Examination period

16397

Status To

Inactive: Create 30122007

13822001

Name Long t8;.1

R8\·Y:lnU8S

:1,:1

-"-"

j'§'asic'dai;;7

f------'

! Person respons.

I Department

,

! Profit Ctr Group

Mr(,anap'iti

2nd Profit Center Master :

Page 42 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

After it Process the 2

OK-Code em···j·"'MI:I

Examination period

14567

1 3D2200.5

Status To

Inactive: Create 30122888

Name Long text

FUrniture

Pers cn re spons. Department Profit C1r Group

Page 43 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad .

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Create Cost Center: Bask: screen .[8 .. :~6rilJdOWn

..,;;,;,-~~~

Cost cenler category Hierarchv araa Business area Functional area Currency

C1 01 '"

HIR

Next Cost Center Details:

Page 44 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

SAP R!3

Page 45 of72

By Ganapati Adimulani

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

APUSER jSAPUSER !SAPUSER ISAPUSER !SAPUSER ISAPUSER i:,P,PUSER ISAPUSER ISAPusER ISAPUSER mmi

iB7 .11.2003 106.11 .2803 !29.1 8 .2883 1 03 88 !29.10.28831:00:05\

! ...• '. ,.... i

\29.10.2003:10:53' 56!

128.1. 0.2883,0615: 581 !SAPUSER

125.092003\23:17: 15! ISAPUSER

\25 09.28832380 :521 !SAi'USER

,::9 ~~-=~~"""'\l;R;'

:!

Authorization

I Locked until I Queue ID

L_~ __ .

SesSion 1::!orma~9n/

n~Etij~j NEH_SESS]{)N

Created on 08 .. 11 .2003

Created at 22: 59 : 03

Created by SAPUSER

03110822590325120003

SAPUSER

Transactions

Observe, All the 4 records( 2 - Profit center, 2-Cost Center s) are successfully Processed.

Total incorrect Processed Deleted

.f

Page 46 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Requirement:

Upload the Cost Center Master Data through Call Transaction, if there are any errors in processing the Call transaction,

Based On the Radio button Selected to Handle the errors IF Call Transaction Selected.

Collect the error Messages and display them.

ELSEIF Session Method Selected.

TI\JSERT that Error record into the Session.

ENDIF.

Program : ZDEMO_BDC_XDOl HNDALE_ERRORS

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

* PROGRAM * AUTHOR * PURPOSE

ZDEMO BDC XDOl HNDALE ERRORS GANAPATI . ADIMULAM

UPLOAD ALL THE COST USING

*

*

*

*

*

EITHER THROUGH SESSION * FOR SELECTION

*

* REFERENCE

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

REPORT
DATA : BEGIN
KOKRS
KOSTL
DATAB
DATBI
KTEXT TYPE KTEXT,
LTEXT TYPE LTEXT,
VERAK TYPE VERAK,
KOSAR TYPE KOSAR,
KHINR TYPE KHINR,
END OF WA DATA. AREA

"START DATE

"END DATE

"NAME

"DESCRIPTION

"PERSON RESPONSIBLE "COST CENTER CATEGORY "HIERARCHY AREA

DATA BEGIN OF WA ERROR,

INDEX TYPE C,

KOKRS TYPE KOKRS,

TEXT(lOO) TYPE C,

END OF WA ERROR.

DATA IT ERROR LIKE TABLE OF WA ERROR.

DATA IT DATA LIKE TABLE OF WA_DATA,

IT BDCDATA LIKE TABLE OF BDCDATA,

Page 47 of 72 By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

WA BDCDATA LIKE LINE OF IT_BDCDATA,

IT BDCMSGCOLL LIKE TABLE OFBDCMSGCOLL, WA BDCMSGCOLL LIKE LINE OF IT BDCMSGCOLL.

DATA

V_FILE TYPE STRING, V_INDEX TYPE I, V_TEXT(lOO) TYPE C, V_SESS(l) TYPE C.

·f

*CONSTANTS CONSTANTS: C_KSOl(4) C_X(l) C_A(l)

TYPE C VALUE 'KSOl', TYPE C VALUE 'X', TYPE C VALUE 'A'.

TEXT-OOO.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH PARAMETER : PA FILE LIKE P GROUP LIKE APQI-GROUPID SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK

PARAMETER

R CALL RADIOBUTTON

C1 DEFAULT

'X' ,

R SESS RADTOBUTTON SELECTION-SCREEN END OF BLOCK B2.

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

**********

*

AT SELECTION-SCREEN ON VALUE-

*

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

*EVENT TO BE TRIGGERED WHEN WE PRESS F4.

AT SELECTION-SCREEN ON VALUE-REQUEST fOR PA FILE.

PERfORM GET f4 fOR fILE USING PA fILE .

*IF MODE

. FIELD fOR THE SELECTED RADIO BUTTON

AT S

OUTPUT.

ON SELECTED, TURN THE SESSION NAME IN DISABLE

ETHOD SELECTED, ENABLE THE SESSION + TURN INTO r o. MODIfY SCREEN.

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

*

START-Of-SELECTION.

*

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

START-Of-SELECTION.

*WE NEED TO MOVE THE PA fILE INTO ANOTHER VARIABLE Of TYPE STRING *AS WE ARE GOING TO USE THE SAME IN THE fM : GUI UPLOAD THERE THE *fILE TYPE IS STRING.

Page 48 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -(}S976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

V FILE = PA FILE.

*UPLOAD THE DATA FROM FLAT FILE TO <ITAB>

PERFORM UPLOAD FILE TO ITAB USING V FILE

CHANGING IT DATA.

*FILL THE SCREEN AND FIELD DETAILS LOOP AT IT DATA INTO WA DATA.

V INDEX = SY-TABIX. REFRESH IT BDCDATA.

*FIST SCREEN DETAILS

PERFORM FILL SCREEN DETAILS USING 'SAPLKMA1' '0200' 'X'.

*CURSOR DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR' 'CSKSZ-KOKRS'.

*OKCODE DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC OKCODE' '/00'.

**CONTROLLING AREA

PERFORM FILL FIELD DETAILS US WA DATA-

KOKRS.

*COST CENTER DETAILS

PERFORM FILL FIELD DETAILS USING '

WA DATA-KOSTL.

*START DATE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-DATAB ANFO' WA DATADATAB.

*END DATE

PERFORM FILL FIELD DETAILS USING 'CSKSZ-DATBI ANFO' WA DATADATBI.

*NEXT 5?!~ prERF

7.-'

DETAILS USING 'SAPLKMA1' '0299' 'X'.

IELD DETAILS USING 'BDC OKCODE' '=BU'.

FILL FIELD DETAILS USING 'BDC SUBSCR' 'BDC SUBSCR'.

*CURSOR DETAILS

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR' 'CSKSZ-WAERS'.

* NAME

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KTEXT' WA DATA-KTEXT.

*DESCRIPTION

PERFORM FILL FIELD DETAILS USING 'CSKSZ-LTEXT' WA DATA-LTEXT.

*PERSON RESPONSIBLE

Page 49 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

PERFORM FILL FIELD DETAILS USING 'CSKSZ-VERAK' WA DATA-VERAK.

*COST CENTER CATEGORY

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KOSAR' WA DATA-KOSAR.

*HIERARCHY AREA

PERFORM FILL FIELD DETAILS USING 'CSKSZ-KHINR' WA DATA-KHINR.

*CURRENCY KEY

PERFORM FILL FIELD DETAILS USING 'CSKSZ-WAERS' 'INR'.

*CALL THE TRANSACTION

UPDATE C A MESSAGES INTO IT

* MODE ONLY * UPDATE S - SYNCHRONOUS A-

CALL TRANSACTION C KSOI USING IT BDCDA .•• MODE 'N'

A - ALL SCREENS N - NO SCREENS

IF R CALL

LOOP AT IT CALL

RS THROUGH CALL TRANSACTION

*IF THE CALL TRANSACTIO IF SY-SUBRC <> 0

GCOLL-MSGID

WA BDCMSGCOLL-MSGV3 WA BDCMSGCOLL-MSGV4

V TEXT

NOT FOUND 1

OTHERS 2.

IF SY-SUBRC = O.

WA ERROR-INDEX WA ERROR-TEXT

V INDEX. "RECORD NO

V TEXT. "MESSAGE TEXT

WA ERROR-KOKRS WA DATA-KOKRS. "COST CENTER

APPEND WA ERROR TO IT ERROR.

ENDIF.

ENDLOOP.

REFRESH IT BDCMSGCOLL.

ENDIF.

IF R SESS = C X. "ERRORS THROUGH SESSION

- -

*INSERT THE DATA INTO THE SESSION

CALL FUNCTION 'BDC INSERT' EXPORTING

Page 50 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

TCODE TABLES DYNPROTAB V SESS = 'X'.

ENDIF.

'KSOl'

IT BDCDATA.

ENDIF.

CLEAR WA BDCDATA.

ENDLOOP.

*CLOSE THE SESSION

CALL FUNCTION 'BDC CLOSE GROUP' * EXCEPTIONS

*

NOT OPEN QUEUE_ERROR OTHERS

1 2 3

*

*

*DISPLAY ERROR MESSAGES

IF NOT IT ERROR IS INITIAL.

WRITE: /30 'ERROR RECORDS

CLEAR ENDLOOP.

ENDIF.

15 SY-VLINE,
16 WA_ERROR-KOKRS,
25 SY-VLINE,
26 WA ERROR-TEXT.
WA ERROR. ROR MESSAGE' .

SKIP 1.

WRITE: /5 'RECORD NO', 15 16 'COST CENTER', 25

ULINE. LOOP AT IT ERROR INTO WA ERROR.

WRITE /5 WA ERROR-INDEX LEFT-

ARE INSERTED INTO SESSION'.

i _

*& Form FILL SCREEN DETAILS

*&---------------------------------------------------------------~ ------*

FORM FILL SCREEN DETAILS USING

PROGRAM LIKE DYNPRO LIKE

BDCDATA-PROGRAM BDCDATA-DYNPRO

DYNBEGIN LIKE BDCDATA-DYNBEGIN.

CLEAR WA BDCDATA.

WA BDCDATA-PROGRAM = PROGRAM. WA BDCDATA-DYNPRO = DYNPRO.

WA BDCDATA-DYNBEGIN = DYNBEGIN. APPEND WA BDCDATA TO IT BDCDATA.

Page 51 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

ENDFORM.

" FILL SCREEN DETAILS

*&--------------------------------------------------------------------*

*& Form FILL FIELD DETAILS

*&---------------------------------------------------------------

------*

* Fill Field Details

*----------------------------------------------------------------

------*

FORM FILL FIELD DETAILS USING

FNAM FVAL

CLEAR WA BDCDATA.

WA BDCDATA-FNAM = FNAM. WA BDCDATA-FVAL = FVAL.

APPEND WA BDCDATA TO IT BDCDATA.

ENDFORM.

FILE IF SY~SUBRt <> O.

MESSAGE 10 SY-MS

SYSTEM FOR SELECTION

*&-----------------------------------------------------*

*& Form GET F4 FOR F:r:LE

-/r

*&----------------------

------*

*

*-------------------

------*

*

*---------------

------*

FORM GET F CALL nJ

FILE. ON F4'

SY-MSGTY NUMBER SY-MSGNO SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

" GET F4 FOR FILE

*&---------------------------------------------------------------~

------*

*& Form UPLOAD FILE TO ITAB

*&--------------------------------------------------------------------*

* SUBROUTINE TO UPLOAD THE DATA FROM PRE. SERVER FILE TO

ITAB

*----------------------------------------------------------------

------*

* -->P V FILE - FILE NAME

* <--P IT DATA - INTERNAL TABLE TO STORE THE DATA

*----------------------------------------------------------------

------*

Page 52 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

FORM UPLOAD FILE TO ITAB USING

FP V FILE

CHANGING FP IT DATA LIKE IT DATA.

CALL FUNCTION 'GUI UPLOAD' EXPORTING

FILENAME

HAS FIELD SEPARATOR TABLES

DATA TAB

FP V FILE

'X'

FP IT DATA.

ENDFORM.

" UPLOAD FILE TO ITAB

*&---------------------------------------------------------------

------*

*& Form MODIFY SCREEN

*&--------------------------------------------------------------------*

* MODIFY THE SCREEN FOR SESSION NAME

*----------------------------------------------------------------

------*

FORM MODIFY SCREEN.

LOOP AT SCREEN.

IF SCREEN-NAME = 'P GROUP'.

IF R CALL = 'X'.

SCREEN-INPUT = O.

ELSEIF R SESS = 'X'.

SCREEN-INPUT = l~ ENDIF.

ENDIF.

MODI FY SCREEN.

ENDLOOP.

ENDFORM.

" MODIFY SCREEN

Execute the Program: ZDEMO_BDC_XDOl_HNDALE_ERRORS.

Page 53 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

23092004-~---· 31129999 23092005 31129999

~2>J HardwarE:::J softwarE

Cost Center 23446 is Already Created, So that It should be displayed as Error Record:

....

.......

cr eat e cost center- nast er data

ERROR RECORDS DETAILS REGORf) NO I COST cnn I ERROR t'1ESSP,GE

12344 f, I Cost. cent.er :31 r'88dy 8Y.'; st s from 23 09 :?~i05 to 31 .12 . ~::;999

Note:

Execute the same Program and this time INSERT the error records into Session.

Page 54 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad .

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Input File:

1"j$7IJ!ffl**nt@lM' ""'*«~~_j.;i.i.~f2ff:.p:tfjnY::::~~11{~,;:;,::;,f'··

Eif,:,- ,f:dit FQ.rmat :i_1t.:'W -_ tlelp

1000l OOOl OOOl OOOl

l5736 23446 l7796 98672

23092004 23092005 23092004 23092005

HardwarEd so+rwar-e HardwarE softwarE

Execute the Program :

Output:

Page 55 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 --65976727, Cell No: 99484 44808, 98490 34399, www.emaxtech.com

.,

Session Method

We Never Compromise in Quality, Would You?

PROCESS THE ERROR RECORDS THROUGH THE SESSION MY_SESSI0f4

Process the Session Execute SM35

Select the Session N arne

and Execute.

iSAPUSER ISAPUSER

!s,O,PU'SER 128 !SAPUSER i1

iSAPUSER 125 !SAPUSER 11

is.'.PUSE~ 12?PPUSER .. 10

ISAPUSE~ !25 ISAPUSER 11

1~~~~m·l~t~t~6ri;l~i;::;~:1 i~1~~~~~I~

r'-f) LE.u~w~~·_'_~:.~==~·:;Jj!Cf:~~L:~:~~~!i?:~~~t~{~0J.~ .. _, ... ~:~4~~0;L4:~~lElt: .. "'<:0"-,>,,,-/,0,-; """"""_"""",,,,00=0!i0'

Page 56 of 72

By Ganapati Adirnularn

eMax Technologies, Ameerpet, Hyderabad .

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com.

Session Method

We Never Compromise in Quality, Would You?

Page 57 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Observe the Error LOG

Created at Created by Authori2:ation Locked until Queue ID

09.11 .2003 21 :27:59

Out Of 4 records, One record is successfully created through Call Transaction and all error records Inserted into SESSION.

SAPUSER SP,PU8ER

031109212759346400

Transactions

Scr.

Total

incorrect

Processed 0

Deleted

f:-ii~~'~:i~'n':i~To:~m~l~n~~':7-~--'--"-'---'----'" ." " .. - .... -------.--.~ .. m··-l

r .. ···(~~N-¥~l· r-tY_SESSlON

,Ii, ~~::::: :~ ~~; ~~; ::03

Created by SP,PUSER

Authorization SP,PUSER

Locked untn .

i Queue ID 03110921275934640001 I

L.__ ------"

Transactions

Screens

Page 58 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com·

Session Method

We Never Compromise in Quality, Would You?

Check wheather the Cost Center 98672 is really created or Not? Execute KS03 (Cost Center Dis la ) for 98672.

1~'?::~Y="::::;:_;f~_:.r::.:Z_<~~~<':::.rE:;L_«? '0::;5;';_~ ~ ;:: JL..:~N:::: 0 v ~ ~;:r~~ ~v,~ v~ ~ • ~';:>"B1

~,_ -:!:;:o'St (:Cr)t~r:~ ~ EditS-.-~oti::j:"v_~E~'S;:'- E!.wir~;:'H\nwn1 S:istem E!.elP h v

Soth. v are Centre Sivv Expense.s

J\'lR."'.~;;DHU

7" Services

C1_010 Corporate

Working with Table Control

Table Control is used to Observe the Screen from KNAI-NAMEI KNAI-SORTL

KNAlKNAI KNAI KNAI-SP

t multiple records.

Creation without Table Control.

Description Name Search key Street

City Country

. Language

Page 59 of72

By Ganapati Adimulam

eM ax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Screen with Table Ctrl For Customer Bank Details:

KNBK-BANKS(Ol) Bank Country Key

KNBK-BANKL(Ol) Bank Key

KNBK-BANKN(Ol) Bank Account

Observer (01) for each filed, This is to Identify the Row from the Table Control and for the 2nd row it is (02) etc.

Note: Here in the table control.field names depends on the no of Bank details for each customer, i.e the row no in each field name is Dynamic.

Processing Logic to .build the field names in the table Control.

*IS INCEMENTED BY 1 EACH TIME FOR ALL RECO V INDEX = SY-TABIX. "LOOP COUNTER

Result of CONCATENATE Is KNNK-BANKS(OI) for 151 record KNNK-BANKS(02) for 2nd record

Etc ..

DATA: V _INDEX(2) TYPE N.

DATA V FNAM LIKE BDCDATA-FNAM. LOOP AT IT BANKS INTO WA BANKS.

- -

*FORBANKS

CONCATENATE 'KNBK-BANKS(' V_INDEX ')' INTO

V FNAM.

WA_BDCDATA-FNAM = V _FNAM.

WA BDCDATA-FVAL = WA BANKS-BANKS.

- -

APPEND WA BDCDATA TO IT BDCDATA.

- -

*NOTE : REPEAT THE SAME PROCEDURE FOR ALL FIELDS ENDLOOP.

Page 60 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 --65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Input File:

1.,w'~·J ...... ttt""B4t-iii4*"·5&·P· %7 ~A@f#,&'&f&\'£:3UBW>'i)l%/::S:Kllitt'fMGi??<~~r:s';, "0 -5;'--" • __ L:z.l~

E.Ue ,Edle _ Fc_~m~c _' ~Ie"" t::lelp

lO-;2:L8 7 9;-reT-:-fresh:-rel~A;Tiee-rpet--;--HvD--:-I N , EN-----·-------~-----;;j 20,2:L879,DE,20050000,O:L:L22334 20,2:L879,DE,23022200,:L122334455 20,2:L879,DE,23984899,2233445566

I

LJ

ata.

The file contains both Customer Master General D In each record, the first two characters are to id~

i.e 10 for Customer Master General and .

20 for Customer Bank Details.

Identification 10(Header)

Search Key

ReLFresh

Field Position

Description

Example

1

2

- Customer No 21169

4

ReI

Street

Ameerpet

5

City

HYD

6

Country Key

IN

7

8

Language Ke

EN

Customer Master Bank-Details :

Field SAP Field Name Length Description Example
Position
1 ID 2 Identification 20(Bank
Details)
2 KUNNR 10 Customer No 21169
,..., BANKS 3 Bank Country DE
.J
Key
4 BANKL 15 Bank Key 50013050
5 BANKN 18 Bank 123456789
Account No Page 61 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Note: This File structure is helpful to declare the corresponding Internal table and also to SPLIT the file according to the file structure.

Execute the Program: ZDEMO_BDC_USING_TABC_IN_XDOI.

REPORT ZDEMO BDC USING TABC IN XDOl .

IT BDCDATA LIKE TABLE OF BDCDATA, WA BDCDATA LIKE BDCDATA.

DATA : IT BDCMSGCOLL LIKE TABLE OF BDCMSGCOLL, WA BDCMSGCOLL LIKE BDCMSGCOLL.

DATA

DATA: BEGIN OF WA_FILE, TEXT(150) TYPE C, END OF WA FILE.

DATA IT FILE LIKE TABLE OF WA FILE.

DATA : BEGIN OF WA_KNA1,
KUNNR TYPE KUNNR, "CUSTOMER
NAMEl TYPE NAME 1 , "NAME
SORTL TYPE SORTL, "SEARCH
STAAS TYPE STAAS, "STREET
ORTOl TYPE ORT01, "CITY
LANDl TYPE LAND1, "COUNTRY
SPAAS TYPE SPAAS, "LANGU
END OF WA KNA1. DATA IT KNAl LIKE TABLE OF WAKNA1.

DATA : BEGIN OF WA_KNBK,

KUNNR TYPE KUNNR,

BANKS LIKE KNBK-BANKS, "BANK COUNTRY BANKL LIKE KNBK-BANKL, "BANK KEY BANKN LIKEKNBK-BANKN, "ACCNO

WA KNBK.

TABLE OF WA KNBK. TYPE N. DCDATA-FNAM.

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

*

START-OF-SELECTION.

*

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

START-OF-SELECTION. *UPLOAD

CALL FUNCTION 'GUI UPLOAD' EXPORTING

FILENAME TABLES

DATA TAB

'C:\XDOl KNBK.TXT'

IT FILE.

*SPILT THE FILE ITAB AND MOVE TO CORRESPONDING ITABS.

LOOP AT IT FILE INTO WA FILE.

IF WA FILE+0(2) = '10'.

Page 62 ofn

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -fJ5976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

SPLIT WA_FILE AT ','

INTO V 10

WA KNAl-KUNNR WA KNAl-NAMEl WA KNAl-SORTL WA KNAl-STRAS WA KNAl-ORTOl WA KNAl-LANDl WA KNAl-SPRAS

APPEND WA KNAI TO IT KNAI.

ELSEIF WA_FILE+O(2) = '20'.

SPLIT WA FILE AT ','

INTO V 10

WA KNBK-KUNNR WA KNBK-BANKS WA KNBK-BANKL WA KNBK-BANKN.

APPEND WA KNBK TO IT KNBK.

ENDIF.

ENDLOOP.

*CURSOR
PERFORM

*OK CODE FOR NEXT
PERFORM FILL FIELD DETAILS
PERFORM FILL FIELD DETAILS
PERFORM FILL FIELD DETAILS
PERFORM FILL FIELD DETAILS
PERFORM FILL FIELD DETAILS
PERFORM FILL FIELD DETAILS
PERFORM FILL FIELD DETAILS SING 'BDC OKCODE' '/00'

HANGING IT BDCDATA.

PERFORM FILL FIELD DETAI

~:

*KUNNR RF02D-KUNNR PERFORM FILL FIELD

KNAl-KUNNR

*KTOKD PERFORM

USING 'SAPMF02D' 'OlIO' 'X' CHANGING IT BDCDATA.

USING 'BDC CURSOR' 'KNAl-SPRAS' CHANGING IT BDCDATA.

USING 'BDC OKCODE' '=VW' CHANGING IT BDCDATA.

USING 'KNAl-NAMEl' WA KNAI-NAMEl CHANGING IT BDCDATA.

USING 'KNAl-SORTL' WA KNAl-SORTL CHANGING IT BDCDATA.

USING 'KNAl-ORTOl' WA KNAl-ORTOl CHANGING IT BDCDATA.

USING 'KNAl-STRAS' WA KNAl-STRAS CHANGING IT BDCDATA.

USING 'KNAl-LANDl' WA KNAl-LANDl CHANGING IT BDCDATA.

USING 'KNAl-SPRAS' WA KNAl-SPRAS CHANGING IT BDCDATA.

*2ND SCREEN DETAILS

Page 63 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40-65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You1

PERFORM FILL SCREEN DETAILS USING 'SAPMF02D' '0120' 'X' CHANGING IT BDCDATA. *CURSOR

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR' 'KNA1-LIFNR' CHANGING IT BDCDATA.

*OK CODE

FOR NEXT

PERFORM FILL FIELD DETAILS USING 'BDC OKCODE' '=VW' CHANGING IT BDCDATA. *NEXT SCREEN

PERFORM FILL SCREEN DETAILS USING 'SAPMF02D' '0125' 'X' CHANGING IT BDCDATA. *CURSOR

PERFORM FILL FIELD DETAILS USING 'BDC CURSOR 'JiKNA1-NIELS' CHANGING IT BDCDA~A.

")'''''-';,,-'

*OK CODE

FOR NEXT

CHAN

/', .

PERFORM FILL FIELD DETAILS

CHANGING I

*TABLE CTRL SCREEN

PERFORM FILL SCREEN DETAILS

*OK CODE FOR SAVE

PERFORM FILL FIELD DETAILS USI

V COUNTER = O. *Handling Table Control

LOOP AT IT KNBK INTO WA KNBK WHERE KUNNR V COUNTER = V COUNTER + 1.

~'Bl\NKS : COUNTRY KEY

CONCATENATE 'KNBK-BANKS(' V_COUNTER ')' INTO V FNAM. PERFORM FILL FIELD DETAILS USING V FNAM WA KNBK-BANKS

- -

CHANGING IT BDCDATA.

WA KNA1-KUNNR.

*

'KNBK-BANKL(' V_COUNTER ')' INTO V_FNAM.

FIELD DETAILS USING V FNAM WA KNBK-BANKL CHANGING IT BDCDATA.

* KNBK-BANKN

CONCATENATE 'KNBK-BANKN(' V_COUNTER ')' INTO V_FNAM. PERFORM FILL FIELD DETAILS USING V FNAM WA KNBK-BANKN

CHANGING IT BDCDATA.

ENDLOOP.

CALL TRANSACTION 'XD01' USING IT BDCDATA MODE 'A' UPDATE'S' MESSAGES INTO IT BDCMSGCOLL.

REFRESH IT BDCDATA.

ENDLOOP.

Page 64 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

*&--------------------------------------------------------------------*

*& Form FILL SCREEN DETAILS

*&--------------------------------------------------------------------*

* text

*----------------------------------------------------------------

------*

* -->P PROGRAM text

* -->P DYNPRO text

* -->P DYNBEGIN text

* <--P IT BDCDATA text

*---------------------------------------------------------------------*

FORM FILL SCREEN DETAILS USING

FP PROGRAM LIKE BDCDATA-PROGRAM FP DYNPRO LIKE BDCDATA-DYNPRO FP DYNBEGIN LIKE BDCDATA-

DYNBEGIN

CHANGING FP IT BDCDATA LIKE IT BDCDATA.

CLEAR WA BDCDATA. WA BDCDATA-PROGRAM WA BDCDATA-DYNPRO WA BDCDATA-DYNBEGIN = FP APPEND WA BDCDATA TO

ENDFORM.

*&--------------------------------------------------------------------*

*& Form FILL FIELD DETAILS

*&--------------------------------------------------------------------*

* text

*----------------------------------------------------------------

*

*

*

text

*---

FORM

FP FNAM FP FVAL

CHANGING FP IT BDCDATA LIKE IT BDCDATA.

USING

CLEAR WA BDCDATA.

WA BDCDATA-FNAM = FP FNAM. WA BDCDATA-FVAL = FP FVAL.

APPEND WA BDCDATA TO FP IT BDCDATA.ENDFORM. " FILL FIELD DETAILS

Page 65 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Name rer.rreen

Street Cily District

,A,ln8f:HPet HYD

P.O. Box Postal code

PO IloxPCode Region

Telex number Fax: number Teletex number

Next Screen:

Page 66 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

c·:] Equalizatn tax :::J Natural person [] Tax on slsrpur.

VATreg.no. Jurisdict. code

Location no. 2

Check digit

:, '.'_"; -,;,_,,~ _, ',',::' . ',",:, :0,'_'_,,:';

. 'C8eyfigLires~~)'~~'~-'_-~'--->_"

, Annual sales Employees FLyear variant

CU: OK-Code Ind ~

moo-so 9 CQue I

Add.lno.coue s

in

1n

',L.§_~!2:.~e_r~~~~~j~~~.)~' .

Legal status

Page 67 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

i\ D.o, T,O, : IT _BDCD,', T.~ LIKE BBLE OF 80GDI, T I"

'I; I'I,~_BOGOATA LIKE BOGDRTA.

Ii DATA: IT_BDCHSGCOLL LIKE TABLE OF BDCHSGCOLL,

'ii HP,_8DGHSGGOLL LIKE BDCI·ISGCOLL.

iii

Ii DATA: BEGIN OF ~IA_FILE, Ii TEXT (150) TYPE C,

END OF 14,~ FILE.

I[ DATA IT FILE LIKE TABLE OF foIA FILE.

II:.!. DATA : ~EGIN OF foIA_KNA1, _

I'.' KlINNR TYPE KlINNR, "CUSTO!'IER

Ii NM'IEI TYPE NM'1El, "NM-lE

••• 11 •..•. ; SORTL TYPE SORTL, "SEARCH TER!'1

STRAS TYPE STRAS, "STREET

Ii ORTOI TYPE ORT01, "CITY

Ii UNDI TYPE UN01, "COUNTRY SPRAS TYPE SPRAS, "LANGU

END OF foIA_KNA 1 .

Session Method

We Never Compromise in Quality, Would You?

Observe the Customer 21169 has been Created.

.r

Page 68 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +9140 -fJ5976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Testing:

Execute XD03 to display the above Customer.

r~ .;~-- -~;:~ v v :; ---- - v--- - - - "1~;W:"~~

-:- Q~stQ~~t"~tijC§Q~f::CEEt~.-;~-E!l~rOfj~ant":~~s1ern "J:ieIP_ ~ ~: "~_ " -,,--.zi', l_~ SAB

Page 69 of72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Session Method

We Never Compromise in Quality, Would You?

Recording Details of the above transaction:

Page 70 of 72

By Ganapati Adimulam

eMax Technologies, Ameerpet, Hyderabad

Ph No: +91 40 -65976727, Cell No: 9948444808,9849034399, www.emaxtech.com

Sign up to vote on this title
UsefulNot useful