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

Getting Material Doc number from BDC

Former Member
0 Likes
3,331

Hi ,

Iam updating the materail using MSCN tcode in BDC.

When the material is updated successfully through BDC.

I have to capture the Material document number of that particular material.

Please suggest me how to get the material documnet number of material which is updated through 'BDC'.

Thnaks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,903

In BDC call transaction use Messages into addition.

else. use FM FORMAT_MESSAGES to get the material number after the sucessful execution of transaction.

Hi ,

Iam updating the materail using MSCN tcode in BDC.

When the material is updated successfully through BDC.

I have to capture the Material document number of that particular material.

Please suggest me how to get the material documnet number of material which is updated through 'BDC'.

Thnaks in advance.

15 REPLIES 15
Read only

Former Member
0 Likes
2,904

In BDC call transaction use Messages into addition.

else. use FM FORMAT_MESSAGES to get the material number after the sucessful execution of transaction.

Read only

Former Member
0 Likes
2,903

Hi Vinay

You may capture the messaggs generated during BDC by adding MESSAGES INTO itab (type msgcoll).

Then you can also use the FM MESSAGE_PREPARE.

Pushpraj

Read only

Former Member
0 Likes
2,903

Hi,

After writing the call transaction,use the FM FORMAT_MESSAGES.

LOOP AT t_msg INTO fs_msg.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = fs_msg-msgid

lang = sy-langu

no = fs_msg-msgnr

v1 = fs_msg-msgv1

v2 = fs_msg-msgv2

v3 = fs_msg-msgv3

v4 = fs_msg-msgv4

IMPORTING

msg = w_message

EXCEPTIONS

not_found = 1

OTHERS = 2.

  • WRITE:

  • / W_message.

ENDLOOP.

Declare the fieldstring fs_msg and table t_msg,then the values will be populated.

Regards,

jaya

Read only

0 Likes
2,903

Thankyou jayapradha,

But in my case when iam using call transaction for MSC2N.

It is not populating any messages.

even though iam getting the sy-subrc value as 0.

Read only

0 Likes
2,903

Hi Vinay,

When you maually post it do you see any message that a material doc XXXXX has been create messages? If yes then check MEssage Table in Call Transaction with type S.

If no then use a select query either after each call transaction or after completing your whole process. The Material Documents are stored in Table MSEG and MKPF.

Thanks,

Prashanth

Read only

0 Likes
2,903

Thankyou prashanth.

I did the same thing.

But can you give me the reason why it is not showing in messages. any idea.

Read only

0 Likes
2,903

can you please show me the select query how we have to write.

here iam using matnr,plant, storagelocation and batch.

using these parametes how we will get the material doc number from MKPF.

Please suggest me prashanth.

Read only

0 Likes
2,903

Hi,

Check in MSEG you have Material, Plant, Storage Location and Batch and along with this you use Sy-uname and Date and also time since there could be many Doc available for Material, plant storage Loc and Batch combination.

The reason why you don't get those details captured could be because Material Document gets created in Background and you don't receive the message for that. This is my guess and could be one of the reasons.

Thanks,

Prashanth.

Read only

Former Member
0 Likes
2,903

Hi Vinay,

You can also use BDCMSGCOLL table and you can cature your messgae.

Here s the logic.

data :

t_msg type standard table of bdcmsgcoll with headerline.

Now you can loop at this table and all youe messages will be catured by the fields MSGV1,MSGV2,MSGV3 and MSGV4.

You ll get it.

Much Regards,

Amuktha.

Read only

0 Likes
2,903

Thankyou amuktha.

Read only

nagarajan_ramudu
Active Participant
0 Likes
2,903

Hi,

I had gone through the transaction MSC2N which is to change the batch and you have written BDC to update the material Batch details.

After the BDC session, you can use BAPI_BATCH_GET_DETAIL to get the status of BDC run (run successfully or not), return table should have zero records for the successful update and PROD_DATE in BATCHATTRIBUTES export table should show the current date.

(another suggestion is use BAPI_BATCH_CHANGE instead of BDC)

Hope this helps.

Thank you.

Nagarajan

Read only

0 Likes
2,903

Nagarajan thakyou for your reply.

But here i have to change the material old status to new status.

I have to change the old status from restricted to Unrestricted and vice versa.

I think this can be possible through BDC.

But when iam changing the status the material status is changing successfully.

But it is not capturing in any messages.

but here when ever the material is updated successfully i need to capture that material documnet number.

Edited by: vinay raj on Feb 12, 2009 3:21 PM

Edited by: vinay raj on Feb 13, 2009 9:26 PM

Read only

0 Likes
2,903

did u see a FM, some thing like material_save_data?

thanq

Read only

Former Member
0 Likes
2,903

Thanks for all your replies.

I got an idea now.

Read only

0 Likes
2,903

Hi Vinay,

Im having exactly the same requirement as what you did last time, not sure whether would you mind to share how did you solve the problem, please?

Many thanks in adv.