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-Call Transaction

Former Member
0 Likes
972

hi

i am using call transaction as Mode 'N' to create Inbound Delivery when PO get Created. every thing is fine. since i am using Mode 'N' to create Inbound Delivery i can see last inbound delivery number in status message not each and every inbound delivery number.

my requirement is, i need to update each inbound delivery number which is create in Mode 'N' to my custom number.

give me some suggestion to catch the each inbound delivery number.

Thanks,

Regards,

Saran.

hi

i am using call transaction as Mode 'N' to create Inbound Delivery when PO get Created. every thing is fine. since i am using Mode 'N' to create Inbound Delivery i can see last inbound delivery number in status message not each and every inbound delivery number.

my requirement is, i need to update each inbound delivery number which is create in Mode 'N' to my custom number.

give me some suggestion to catch the each inbound delivery number.

Thanks,

Regards,

Saran.

6 REPLIES 6
Read only

Former Member
0 Likes
934

I think you are calling call trans. in the loop and after the loop you checking for the message, If you want each and every call you should check messages after every call and put it a internal table and check after endloop.

Cheers,

Satya

Read only

Former Member
0 Likes
934

How are doing the call transaction? If you add the option "MESSAGES INTO messtab", all the messages are captured into this internal table for each call of the transaction and you can read it and do whatever you want to. The concept is something like this

loop at yourdata.

refresh bdcdata internal table.

prepare call transaction data.

refresh the message table.

call the transaction using bdcdata messages into messtab.

read messtab for messages and move them into another table for reporting.

endloop.

Srinivas

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
934

You should be using the MESSAGES into ITAB extension of CALL TRANSACTION. This will have your success messages in it. The inbound delivery number should be in the first "varible" field. What I usually do is find out exactly what message class/number is used, then read the message table for that message and get the number from the variable 1 field.

call transaction 'VA01' using bdcdata
                              mode 'N'
                              messages into itab.
if sy-subrc  = 0.
read table itab with key msgid = <the message class>
                         msgnr = <the message number>.
if sy-subrc = 0.
my_order_number = itab-msvar1.
endif.

endif.

I don't remember the exact fields names of the message itab off the top of my head, but you get the idea. Check the F1 help on CALL TRANSACTION.

Regards,

Rich Heilman

Read only

0 Likes
934

I have check the field names and modified accordingly.

Again, this is an example of a sales order creation, same thing applies to creating delivery note



<b>DATA: itab LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.</b>


call transaction 'VA01' using bdcdata
                              mode 'N'
                              messages into itab.
if sy-subrc  = 0.
read table itab with key msgid = <the message class>
                         msgnr = <the message number>.
if sy-subrc = 0.
my_order_number = <b>itab-MSGV1.</b>
endif.

endif.

Regards,

Rich Heilman

Read only

ananjun1
Explorer
0 Likes
934

Hi,

You could trap messages issued by the Call Transaction program with the option MESSAGES within the CALL TRANSACTION statement.

For trapping these messages you need to store them first in an internal table. Look at the sample code snippet below:

(I have stripped sample code considerably to show what you need)


DATA : t_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.

  CALL TRANSACTION '<DELIVERYTRANSACTION>' USING t_bdctab
                          mode 'N'
                          MESSAGES INTO t_bdcmsgcoll.

  DESCRIBE TABLE t_bdcmsgcoll LINES g_lines.
  READ TABLE t_bdcmsgcoll INDEX g_lines.

  IF t_bdcmsgcoll-msgtyp = 'S' AND
     t_bdcmsgcoll-msgid = <Msg id> AND
     t_bdcmsgcoll-msgnr = <Msg number>.
* Trap your Call Transaction messages
    t_success-deliverynumber = t_bdcmsgcoll-msgv1.
* You can format the message returned by call transaction using function 'FORMAT_MESSAGE' which will return g_mesg
    t_success-message = g_mesg.
    APPEND t_success.
    CLEAR  t_success.
  ELSE.
* If there an Error-Do this..
    READ TABLE t_bdcmsgcoll WITH KEY msgtyp = 'E'.
    IF sy-subrc = 0.
* Format your message using FORMAT_MESSAGE
     CLEAR g_mesg.
     t_error-msg   = g_mesg_incl.
     APPEND t_error.
     CLEAR  t_error.
   ENDIF.
 ENDIF.

* Clear for next run
  CLEAR: t_bdcmsgcoll,
         t_bdctab.
  REFRESH: t_bdcmsgcoll[],
           t_bdctab[].

t_success above has your inbound delivery numbers which you can use for further processing or reporting. Msg Id, Msg number is the message id and number of the message you get when you create an inbound delivery for that transaction.

Hope that this is what you wanted.

Thanks,

Anand

Message was edited by: Anand Nanjundaiah

Read only

Former Member
0 Likes
934

Please close the post if answered.

Thanks,

Srinivas