Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BDC

Former Member
0 Likes
998

how to create a log file in session method for further processing

10 REPLIES 10
Read only

Former Member
0 Likes
971

i think a log file will b created by the system itself

Read only

alex_m
Active Contributor
0 Likes
971

Log details will be created by system in session method, that is one of the advandage compare to call transaction.

Read only

Former Member
0 Likes
971

i got an error while processing the session

i got an error in the line item like 'order 111 does not exist'.

then

accno for that line item and this message should be stored in the file

like this whenever error occurs for the line items it should store it

Read only

Former Member
0 Likes
971

Hi Rushi,

As per your requirement, when we need to store the message in the file , we can do this way in Explicit error handling using Call Transaction method.

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

Read only

Former Member
0 Likes
971

i need it in session method only.. after the updation i need to c the log file n recorrect it later... i need log file in text file..

Read only

Former Member
0 Likes
971

Hi Rushi,

You can view hte error log in SM35, and from there itself you can modify the error records. So what is the need to create a file for it explicitly.

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

Read only

Former Member
0 Likes
971

its my requriement..

Read only

Former Member
0 Likes
971

Hi Rushi,

In Session Method, the error log is created automatically whenever we process the session in SM35, whenever there is error in the flat file and Internal table mapping.

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

Read only

Former Member
0 Likes
971

Hi

In session methos the log file is created by the system itself.

Regards

Nilesh

Read only

Former Member
0 Likes
971

Hi Rushi,

Go through thid info.

this will be usefull to u

Steps for submitting data for Batch Processing

1. Analyze the transactions for which a BDC program.

The user has to determine the sequence of screens in the transactions and the information about all the fields in every screen. To do this the user must run the transaction .

Then select System ? Status. This will give the screen number and the module pool associated with this screen of the transaction. These two are the most important fields that the user would need in order to write the BDC program.

2. Use transaction SE38 to write the BDC program. This ABAP/4 program should reads the external data that is to be entered in the SAP System and stores the data in a "batch-input session." A session stores the actions that are required to enter data using normal SAP transactions. This is done by basically using three functions:

BDC_OPEN_GROUP

BDC_INSERT

BDC_CLOSE_GROUP.

3. To create a batch input session, use the function BDC_OPEN_GROUP. This function has the following 5 parameters :

a. CLIENT which is by default set to SY_MANDT. It is the client in which the session is to be processed.

b. GROUP which is the name of the BDC session. This parameter is important because it is with this name that the user will recognize the BDC session in the batch input queue. Using this name process the BDC session.

c. USER which is usually set to SY-UNAME. It is the user name for starting the session in background.

d. KEEP indicates whether the session should be kept or deleted after processing. If ‘ ‘ then the session is deleted. If ‘X’ then the session is retained even after it is successfully processed without any errors.

e. HOLDDATE Lock date. The session is locked and may not be processed until after the date that is specified. Default: No lock date, session can be processed immediately. A lock date is optional.

4. Populate the bdcdata table .

The user may define the table as follows:

DATA: BEGIN OF BDCDATA OCCURS 0.

INCLUDE STRUCTURE BDCDATA.

DATA: END OF BDCDATA.

This bdcdata structure has the following fields:

• PROGRAM

Name of the program.

• DYNPRO

Number of the screen. Set this field only in the first record for the screen.

• DYNBEGIN

Indicates the first record for the screen. Set this field to X only in the first record for the screen. (Reset to ' ' (blank) for all other records.)

• FNAM

Name of a field in the screen. The FNAM field is not case-sensitive.

• FVAL

Value for the field named in FNAM.

5. The next step is to submit the BDC session. Use the BDC_INSERT function module to add a transaction to a batch input session. Specify the transaction that is to be started in the call to BDC_INSERT.

BDC_INSERT takes the following parameters:

• TCODE

The code of the transaction that is to be run. TCODE is an EXPORTING parameter in the function module.

• DYNPROTAB

The BDCDATA structure that contains the data that is to be processed by the transaction. DYNPROTAB is a tables parameter in the function module.

6. The final step is to close the BDC session. Use the BDC_CLOSE_GROUP function module to close a session. Once a session is closed, it can be processed.

7. Running this program will create a batch input session by the name that is specified in the GROUP parameter in the BDC_CREATE_GROUP function call.

8. Transaction SM35 can be used to process the submitted session. This transaction can be used to check the status of all BDC sessions.

2.2. Summary: Creating Batch Input Session:

• Open Batch Input group

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = GROUP

USER = USER

KEEP = KEEP.

• Fill in the Data for Transaction in an internal table 'BDCDATA'

FORM INSERT_SCREEN USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

FORM INSERT_FIELD USING FNAM FVAL.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDFORM.

• Insert Transacton

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ME21'

TABLES

DYNPROTAB = BDCDATA.

• Close Batch Input group

CALL FUNCTION 'BDC_CLOSE_GROUP'.

Finally to process Batch Input Session, first execute the BDC ABAP. This will create

a BDC session. Run transaction 'SM35' & processes the BDC session.

Some useful URLs

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

http://www.sap-img.com/abap/learning-bdc-programming.htm

http://www.guidancetech.com/people/holland/sap/abap/zzsni001.htm

********Rewards some pints,

Rgds,

P.Naganjana Reddy