Application Development 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: 

BDC

Former Member
0 Kudos

Hi All,

PLease help me to resolve the below issue.

Problem Faced

I am working on BDC using call transaction method.

This works fine when all records in the input file are current

but if one of the record contains invalid input, the transaction

fails without processing the remaining records.

My requirement is

If any invalid records are encountered, the error log of the record should be

stored and remaining records should be processed

Further details are

Session Mode : Background &

Update Mode : Local.

Actually this BDC is called within a SAP-RFC, which is triggered by an Excel Macro.

9 REPLIES 9

Vinod_Chandran
Active Contributor
0 Kudos

Try this.

CALL TRANSACTION tcode USING BDCDATA MODE 'N'

MESSAGES INTO ITAB.

Former Member
0 Kudos

Declare a messtab

DATA: i_bdcdata TYPE STANDARD TABLE OF bdcdata,

  • Internal table to hold BDC messages

<b> i_messtab TYPE STANDARD TABLE OF bdcmsgcoll</b>

  • Work area to hold bdcdata value

DATA: w_bdcdata TYPE bdcdata,

  • Work area to hold BDC messages

w_messtab TYPE bdcmsgcoll.

CONSTANTS : c_e type bdcmsgcoll-msgtyp value 'E', "E

c_a type bdcmsgcoll-msgtyp value 'A', "A

nodata type c value '/'. "/

<b>perform f1000_bdc_mm03 using lv_matnr lv_werks.</b>

FORM f1000_bdc_mm03 USING P_LV_MATNR

P_LV_WERKS.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

p_lv_matnr.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(15)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(15)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0080'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-WERKS'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-WERKS'

p_lv_werks.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'=ZU01'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_dynpro using 'SAPLMGMM' '4300'.

perform bdc_field using 'BDC_OKCODE'

'=ZU08'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_dynpro using 'SAPLMGMM' '4110'.

perform bdc_field using 'BDC_OKCODE'

'=GESV'.

*perform bdc_field using 'BDC_CURSOR'

  • 'RMMG1-MATNR'.

<b>call transaction c_transaction_call_MM03 using i_bdcdata MODE 'N'MESSAGES INTO i_messtab.</b>

Similarly u can try for ur code, the messages will egt captured in i_messtab.

Hope this helps.

Thanks & Regards,

Judith.

Former Member
0 Kudos

The program already has this statement.

This is the call transaction code

call transaction 'FB01' using bdcdata

mode c_mode

update 'L'

messages into messtab. "// Returned

LOOP AT messtab. " WHERE msgtyp EQ 'E' .

SELECT SINGLE * FROM t100 INTO WA_T100

WHERE sprsl = messtab-msgspra

AND arbgb = messtab- msgid

AND msgnr = messtab-msgnr.

IF sy-subrc = 0.

l_mstring = WA_T100-text.

IF l_mstring CS '&1'.

REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.

REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.

REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.

REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.

ELSE.

REPLACE '&' WITH messtab-msgv1 INTO l_mstring.

REPLACE '&' WITH messtab-msgv2 INTO l_mstring.

REPLACE '&' WITH messtab-msgv3 INTO l_mstring.

REPLACE '&' WITH messtab-msgv4 INTO l_mstring.

ENDIF.

CONDENSE l_mstring.

  • Create name for session

clear l_message.

move: l_mstring to l_message.

condense l_message.

move l_message to errorrec-message.

ENDIF.

ENDLOOP.

I just wanted to know when this messtab value is to be passed to the external system (VB Macro), so that all the error logs are displayed.

0 Kudos

Please let me know how are you calling this BDC from RFC?

0 Kudos

move l_message to errorrec-message.

U have to write it inorder to display the output.

former_member214131
Active Contributor
0 Kudos

Hello,

I would suggest that you process the BDC by a Session which will fulfill your reqmt.

FMs to create a a Session:

BDC_OPEN_GROUP

BDC_CLOSE_GROUP

if you want to process the session immediately get the session ID from BDC_OPEN_GROUP and submit the Prg.: RSBDCBTC_NEW. This will process the session immediately.

Hope this helps you.

Best Regards, Murugesh AS

<b>Post your existing code plz.</b>

Message was edited by: Murugesh Arcot

Former Member
0 Kudos

Friends, sorry for the delayed reply.

Let me explain the scenario in more detailed manner.

-> The BDC, calls the transaction FB01

-> The input file contains

header data &

many item details for this header data.

Once on excecuting the above BDC,

The header data is first posted & then all the

item data pertaining to this header gets posted. If all the item details are

correct, a document number is generated. If anyone of them fails, the document number will not

be generated.

My current scenario

a. If any one of my item data is wrong, the other item records are not processed.

But as we know even if some records in a file are incorrect, the remaining records will be processed!

Actually my work now is enhancement related & I have not created the above BDC.

So could anyone of you specify which portion of code in BDC makes all records to be processed excluding the incorrect

records (or) is the scenario specify to the TCODE : FB01.

Please help to resolve the above problem.

0 Kudos

Hi,

1) why don't you use a bapi,

e.g. BAPI_ACC_DOCUMENT_POST ?

-> here you get all errors in a table BAPIRET2

2) i don't understand your explanation of headers and items. you post, ...The header data is first posted ..

-> you can only post a complete document not header data

regards Andreas

0 Kudos

Usha,

If i understand correctly what you are thinking is not possible, Let me explain this.

In your case you have one header data and multiple line items, which means its for a single FI document.

A document can post only if there are no errors in that LUW. If there is error with in any line item of that document everything has to roll back !

The situation would have been different in case you <u><b>had</b></u> multiple documents with single line item, in this case you can skip the err'd one and go to the next document bcuz they all are in different LUW.

I dont know if anyone has a better answer to this...

Ravi