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 programming

Former Member
0 Likes
2,378

Hi,

1). I have created a BDC program for transactio 'S_BCE_68000174' . I have used call transaction method. when I put mode 'A' its working fine table is getting updated. but user has to press enter keys. BUT User doesnt want to press enter key.

CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE 'A' UPDATE 'S'

MESSAGES INTO TMESG.

How can i do this. as i am new in BDC please help me out.

2) User also wants that if any data is not updated in table he should get a email notification. Can this be done because i think that it can be done in workflow only . can the error message be sent through eMail.

Please help me out.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,228

hi,

use following

Replace mode A with N.

CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE 'N' UPDATE 'S'

MESSAGES INTO TMESG.

Regards,

R K

20 REPLIES 20
Read only

Former Member
0 Likes
2,229

hi,

use following

Replace mode A with N.

CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE 'N' UPDATE 'S'

MESSAGES INTO TMESG.

Regards,

R K

Read only

Former Member
0 Likes
2,228

Hi,

PASS MODE 'N'

CALL TRANSACTION c_pa30 USING i_bdc_data MODE p_mode
                                           MESSAGES INTO i_msg_tab.
  IF sy-subrc NE 0.
*   Process as error if message type is E or A. if it is type S, it is
*   only an error if it is 347, 348, 344"No batch input data for screen
    LOOP AT i_msg_tab INTO i_msg_tab_line
                      WHERE msgtyp = c_e OR msgtyp = c_a
            OR ( msgtyp = 'S' AND msgid  = '00' AND msgnr = '347' )
            OR ( msgtyp = 'S' AND msgid  = '00' AND msgnr = '348' )
            OR ( msgtyp = 'S' AND msgid  = '00' AND msgnr = '344' ).
      CALL FUNCTION 'MASS_MESSAGE_GET'
        EXPORTING
          sprsl             = sy-langu
          arbgb             = i_msg_tab_line-msgid
          msgnr             = i_msg_tab_line-msgnr
          msgv1             = i_msg_tab_line-msgv1
          msgv2             = i_msg_tab_line-msgv2
          msgv3             = i_msg_tab_line-msgv3
          msgv4             = i_msg_tab_line-msgv4
        IMPORTING
          msgtext           = l_errormsg
        EXCEPTIONS
          message_not_found = 1
          OTHERS            = 2.
      IF sy-subrc <> 0.                                     "#EC NEEDED
*       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
"  Send Email Functionality
      EXIT.
    ENDLOOP.
  ENDIF.

[Email Logic|http://docs.google.com/Doc?id=dfv2hmgs_0fm22tggx&hl=en]

Read only

prasanth_kasturi
Active Contributor
0 Likes
2,228

Hi,

in Online mode(A) the user must give some action to the screen so as to get the transaction being exectued and there is no other way I think.

So I prefer going to Background Mode.

Put the type as N and not A


CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO TMESG.

And the error messages can be sent using the FM's SO_DOCUMENT_SEND_API1 or SO_NEW_DOCUMENT_SEND_API1

firstly loop through the internal table and find the message with message type as E and u can send those messages with the above FM

please search SDN to get the related code for the FM

regards

Prasanth

Read only

Former Member
0 Likes
2,228

Hi Vikas,

use mode as 'N' Like:

CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE 'N' UPDATE 'S'

MESSAGES INTO TMESG.

then there will be no need to press enter.

For Sending mail you can use FM: 'SO_DOCUMENT_SEND_API1' . see the where used list for the FM for details or you can get in SDN forums.

Read only

0 Likes
2,228

Hi,

even the mode N dint work but when i am doing with mode E its working. is it feasible to use mode 'E' will it have any problem...

Read only

0 Likes
2,228

When u are using Mode 'E' it means you want to display only errors. But anyhow you want to store the errors into the internal table right. then i think its better try using mode 'N' (no screen display) itself.

Regards,

Sakthi.

Read only

Former Member
0 Likes
2,228

Solution for 1.

CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE *'N'* UPDATE 'S'
MESSAGES INTO TMESG.

Solution for 2.collect all the error records in an itab and use this FM SO_NEW_DOCUMENT_SEND_API1 to send mail.Search SDN u will get the sampple code.

Rhea.

Read only

Former Member
0 Likes
2,228

Hi all,

thanks a lot for ur Suggestion.

but when i am changing mode to 'N' its not updating in DATABASE. so i m struck if u can suggess me any way then it ll be more helpful.

solution for my 2nd problem is perfect ..

Vikash

Read only

0 Likes
2,228

hi,

have u wrote commit work after call transaction.

Regards,

R K.

Read only

0 Likes
2,228

Hi,

Use the CALL TRANSACTION's OPTION parameter

The structure is options is of type CTU_PARAMS

and you populate that structure



options-DISMODE = 'N'.
options-UPMODE  = 'S' .      
options-DEFSIZE = 'X'.
options-RACOMMIT = 'X'.


CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA OPTIONS FROM options
MESSAGES INTO TMESG.

Regards

Prasanth

Read only

Former Member
0 Likes
2,228

Do one thing write a SLEEP statement after execution .

Because when ever updateion take place it create a critical section for tht particular table .

so before updation of the table u trace the table which wont work .

Second mailing from the BDC is possible .

Read only

0 Likes
2,228

hey guys its still not working.. i dont knw why in mode A it works but in mode its not working i tried commit and sleep as well.. please help me out..

Read only

0 Likes
2,228

Hi,

What are the messages u r getting in the Message Table of BDC i.e. TMESG......Does prog giving any Error or Warning msg in "N" mode.

Try running this in "E" mode and then see the difference....

Edited by: AJAY TIWARI on Apr 12, 2009 10:40 AM

Read only

Former Member
0 Likes
2,228

its not working in mode N but its working in mode A nd E i want it to work in mode N

Read only

0 Likes
2,228

Hii,

I guess when u run the prog in backgrnd mode, some screen might be goin in error like <field> does not exist in screen <screenno>. run the prog in 'E' mode chk wht all errors comes while running the prg and try to take care of all such errors in the program..

Hope it clears ur doubt.

Regards,

Anil N.

Read only

Former Member
0 Likes
2,228

HI,

It seems you have missed few enter keys while recording i.e. some enter are not recorded and so, please redo recording hitting enter after every screen entered with values.

thans,

kat.

Read only

Former Member
0 Likes
2,228

Hi Vikas,

U problem is quite simple .....

whenrever ur code for BDC recording is writeen ... comment out the following part....

*PERFORM BDC_FIELD TABLES BDCDATA

  • USING 'BDC_OKCODE'

'/00'.

this is the code for the ENTER in the recording ... and '/00'. is the code for ENTER ... keep ur al the code as it is and comment out all the PERFORM STatements of '/00'. .....

and the solution for ur second problem ...is also simple there are lot of FM .. for semding Email.. use it for sending the mail ... instead of Workflow....

regards,

Jay Sawant.

Read only

0 Likes
2,228

Hi Vikas,

I think ur qs is answeered ... so please update the thread as Answered...

Read only

Former Member
0 Likes
2,228

Hey,

You can simply use mode 'N' instead of teh mode 'A' as in the previous case no screens will be displayed for the user to take any aaction, nd in the latter it will work as good as background processing with no user interaction.

as CALL TRANSACTION 'S_BCE_68000174' USING BDCDATA MODE 'N' UPDATE 'S'

MESSAGES INTO TMESG.

Or you can use the mode "E" if you you want to show the error screen in case you encounter any , rest all screens(which work fine) would not be displayed this way.

Hope it helps.

Cheers

Read only

Former Member
0 Likes
2,228

thanks all for helping me out.. thanks a ton..