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: 

How to log error and successfull messages in BDC Session Method.

Former Member
0 Kudos

Hi all,

I have developed a BDC for creating BOMs. I used session method for this. How can i capture error and successful messages and i want show this messages as output of the program.i know how to capture error and successful messages using call transaction method.but i want to know that how i will capture these messages using BDC session method.

Thanks & Regards,

Reddy.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I hope u already know that BDC session is an offline method, so when u run a program to create a session it is not run..so it will not be possible to get the errors there and then..

hence when u process it in SM35 you can view the erros in the error log.

may be u can schelude the session with immidiate effect but u can only get if the session completed or has errors.

santhosh

5 REPLIES 5

Former Member
0 Kudos

Hi,

I hope u already know that BDC session is an offline method, so when u run a program to create a session it is not run..so it will not be possible to get the errors there and then..

hence when u process it in SM35 you can view the erros in the error log.

may be u can schelude the session with immidiate effect but u can only get if the session completed or has errors.

santhosh

Former Member
0 Kudos

hi,

using session method we can create a session through a program and process them on-line or in the background.this generally creates a session. then you can go to the transaction sm35p and get the log of the session.

but you cant get this with in your program.

plz let me know if you need further details.

Former Member
0 Kudos

Hi Reddy,

<b>Session Method</b>:

When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.

However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.

If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.

Hope this resolves your query.

Reward all the helpful answers.

Regards

Former Member
0 Kudos

Hi Reddy's

Go through this program and do it ur self it is very easy and better.

Creation of Material BOM using BAPI_MATERIAL_BOM_GROUP_CREATE

Creation of Simple BOM Using BAPI_MATERIAL_BOM_GROUP_CREATE:

Program:

REPORT ZSM_CREATE_SIMPLEBOM.

  • This code will create a material BoM for the material

  • MAINMATERIAL with the components COMPON1 and COMPON2.

  • Data Declaration

DATA:

it_bomgroup LIKE bapi1080_bgr_c OCCURS 0 WITH HEADER LINE,

it_variants LIKE bapi1080_bom_c OCCURS 0 WITH HEADER LINE,

it_items LIKE bapi1080_itm_c OCCURS 0 WITH HEADER LINE,

it_matrel LIKE bapi1080_mbm_c OCCURS 0 WITH HEADER LINE,

it_itemas LIKE bapi1080_rel_itm_bom_c OCCURS 0 WITH HEADER LINE,

it_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

  • Fill the data

  • Material BoM Group Header Data

CLEAR it_bomgroup.

it_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.

it_bomgroup-object_type = 'BGR'.

it_bomgroup-object_id = 'SIMPLE1'.

it_bomgroup-bom_usage = '5'. " YOU COULD CHANGE THE BOM USAGE TO YOUR

NEEDS

it_bomgroup-ltxt_lang = sy-langu.

it_bomgroup-technical_type = ' '.

it_bomgroup-bom_text = 'Simple BoM - FM'.

APPEND it_bomgroup.

  • Header Details of the different variants

CLEAR it_variants.

it_variants-bom_group_identification = 'BAPI_SMP_COL1'.

it_variants-object_type = 'BOM'.

it_variants-object_id = 'SIMPLE1'.

it_variants-alternative_bom = '01'.

it_variants-bom_status = '01'.

it_variants-base_qty = '1.000'.

it_variants-valid_from_date = sy-datum.

it_variants-function = 'NEW'.

APPEND it_variants.

  • Details of the items of the variants

CLEAR it_items.

it_items-bom_group_identification = 'BAPI_SMP_COL1'.

it_items-object_type = 'ITM'.

it_items-object_id = 'SIMPLE1'.

it_items-item_no = '0010'.

it_items-item_cat = 'L'.

it_items-component = 'COMPON1'.

it_items-comp_qty = '2'.

it_items-valid_from_date = sy-datum.

APPEND it_items.

CLEAR it_items.

it_items-bom_group_identification = 'BAPI_SMP_COL1'.

it_items-object_type = 'ITM'.

it_items-object_id = 'SIMPLE1'.

it_items-item_no = '0020'.

it_items-item_cat = 'L'.

it_items-component = 'COMPON2'.

it_items-comp_qty = '3'.

it_items-valid_from_date = sy-datum.

APPEND it_items.

  • Details of the materials of the different variants

CLEAR it_matrel.

it_matrel-bom_group_identification = 'BAPI_SMP_COL1'.

it_matrel-material = 'MAINMATERIAL'.

it_matrel-bom_usage = '5'.

it_matrel-alternative_bom = '01'.

APPEND it_matrel.

  • Linking items to the corresponding variants

CLEAR it_itemas.

it_itemas-bom_group_identification = 'BAPI_SMP_COL1'.

it_itemas-sub_object_type = 'ITM'.

it_itemas-sub_object_id = 'SIMPLE1'.

it_itemas-super_object_type = 'BOM'.

it_itemas-super_object_id = 'SIMPLE1'.

it_itemas-valid_from_date = sy-datum.

it_itemas-function = 'NEW'.

APPEND it_itemas.

  • Create variants

CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'

EXPORTING

all_error = 'X'

TABLES

bomgroup = it_bomgroup

variants = it_variants

items = it_items

materialrelations = it_matrel

itemassignments = it_itemas

return = it_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

LOOP AT it_return.

WRITE:/ it_return-type, it_return-id, it_return-number,

it_return-message.

ENDLOOP.

Rewords some points if it is useful.

Rgds,

P.Nag

Former Member
0 Kudos

Thank you for all of your suggestions.

Thanks&Regards,

chandra.