Question About BDC Program

What is bdc_okcode?

It is the user command that was executed.   eg. '/00'  means Enter command.
The user command can varies during a bdc program.  Therefore, we need to used tcode shdb to check what it actually contains.

What is the function key values of BDC_OKCODE  ie '/00' what this is for?
How will we handle the errors in call transaction method?

'/00' is generally the BDC_OKCODE for the ENTER key.
You don't need to know the list of the BDC_OKCODE s.
You go to the transaction SHDB.
You can execute any transaction here.
Then you can replay the execution of the trasaction afterwards.
Select 'display all screens' mode.
BDC_OKCODEs for each one functions you use is displayed on the screen.

Now, regarding the error handling in call transaction.
The BDCMSGCOLL does not have the messages text. It has only the message type, number and message parameters.
You have to read the message text.  (recall that the database table T100 stores all the messages.)
There are more than one method of doing this.

Following is the psuedocode for one of the methods.

LOOP for the internal table IT1 which has data value from flat file.

call transcation using....
if SY-SUBRC <> 0.

Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL.
(also use the condition T100-SPRAS  =  SY-LANGU (the log on language. This is because you need only the message texts in English if the user is logged in English language)

IF message type is E , then, transfer the contents of this particular error record to file x. (TRANSFER......)
( Ignore all other messages. Only consider type 'E' messages. Ignore other types of messages.)

(You can also store the message text from T100 and the error record in another internal table IT2)
.....
....
ENDLOOP.

Please note that the client might ask you for a file of records which could not be uploaded.
Give him the file created in the above psuedocode. (most often you will have to do this).

Otherwise just display the error messages and the error records in the internal table IT2 in the form of a list.
Thats it.

Alternatively,

Instead of
" Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL."
you can use the function module
WRITE_MESSAGES to read the messages.
Please refer to the function module for the list of parameters.

Also refer FORMAT_MESSAGES function module.

As, I said, there are more than one method of doing this.

ABAP Tips by: Satheesh, Jinna

1) How to handle error in bdc call transaction method...without using  structure BDCMSGCOLL.

Use Std Function module 'FORMAT_MESSAGE'

2) How to load images from application server in bdc

Solution: I don't think so.

3) How to insert data in table control through bdc ....problem is every system displays different no of rows in the table control when you enter  the application....for ex .. purchase order, pur req, bom....

Solution: Use CALL TRANSACTION 'ME21N'  OPTIONS FROM w_ctu_params.( type CTU_PARAMS)

This structure contains the follwing.

DISMODE :  Display mode (like the MODE addition)
UPDMODE:  Update mode (like the UPDATE addition)
CATTMODE: CATT mode (controls a CATT)
     CATT mode can have the following values:
            ' ' No CATT active
            'N' CATT without single-screen control
            'A' CATT with single-screen control

DEFSIZE : Use default window size (Here we are handling those transaction by giving default window size)
RACOMMIT: Do not end transaction at COMMIT WORK
NOBINPT  : No batch input mode (that is, SY-BINPT = SPACE)
NOBIEND : No batch input mode after the end of BDC data.

The components DEFSIZE , RACOMMIT, NOBINPT, and NOBIEND always take the following values:
'X' Yes

4) Can you give me one example where we should use only bdc call transaction method:

Solution:  With CALL TRANSACTION USING, the system processes the data more quickly than with batch input sessions. Unlike batch input sessions, CALL TRANSACTION USING does not automatically support interactive correction or logging functions

5) In the reports when you press f4 to get list is it possible to pass default value in that value...i.e suppose i have created select option on company code when the user press f4 automatically he should get the default value.

Solution: Ya, It is possible.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BUKRS.

    P_BUKRS-LOW  =  ‘2000’.

With Compliment by: Venkat .O.

I  want to learn BDC ....how should I go about it so that I make it my strong area......please help.

BDC is Batch Data Communication where data is transferred from legacy system to SAP system. Different methods of BDC are

1. Call Transaction Method.
2. Session Method
3. Direct Input method.

In all the above methods you have to prepare a flat file containing the data in the required format to be uploaded to the SAP system. You need to call the function ' UPLOAD' to do this. Then the contents of the flat file have to copied to your internal table and then u need to call the transaction through which you want to update the database. You internal table should also have the information relating to the structure BDCDATA which is having the details like the module pool program name, screen no. The basic concept of updating the database is same in all the 3 methods but only the method differs.

In session method after the data transfer program is coded, in order to process that particular session you have to go to TC: SM 35 to process the session.

Direct input method have some standard programs that have to executed.....

Well, to be strong you got to try it out.......and check if it works!!!

Smitha

Q: Our ABAP program is working properly in Foreground. Can I schedule it for background processing on the weekend?

A: SAP standard program RSBDCSUB helps you to schedule the job. Create a variant for RSBDCSUB with the BDC session name.

Q: How can we send a mail to the user intimating him that his report/BDC is completed in background?

A: You can use FUNCTION RS_SEND_MAIL_FOR_SPOOLLIST

If UNIX is being used, you may send a report to any internet mail with the following:

REPORT ZSNDMAIL.
DATA: COMND (200) type c.
DATA: RESULT (200) type c occurs 100 with header line.
PARAMETERS: FILE (60) type c lower case default '/sapdata/sd_outbound/testmail.dat'.
PARAMETERS: SUBJECT (60) type c lower case. 
PARAMETERS: EMAIL (60) type c lower case.
INITIALIZATION. 
TRANSLATE EMAIL TO LOWER CASE.
START-OF-SELECTION. 
TRANSLATE EMAIL TO LOWER CASE. 
CONCATENATE 'cat' FILE '| elm -s "' subject '"' email into comnd seperated by space. 
CALL 'SYSTEM' ID 'COMMAND' FIELD comnd 'TAB' FIELD UNIX_RESULTS-*SYS*. 
Loop at Results. 
write: /1 results. 
endloop 
end-of-selection.
Content Author: Shivanand Patlolla

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

BDC Tips and Tricks 
BDC Programming Tips

ABAP Programming Tips
ABAP Forum for Discussion and Samples Program Codes for Abapers

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.