2009 Oct 26 10:09 AM
Hello,
How do you recover a key that was generated during a call transaction. Specifically, I ran IW31 via call transaction (as opposed to batch input). After the execution I tried to get the generated work order number using GET PARAMETER ID 'ANR'. I got a return code of 4. It seems that GET PARAMETER ID is not the correct way to get the generated key. HOW then?
Thanks in advance.
mki
2009 Oct 26 10:45 AM
hi ,
CALL TRANSACTION XXXX
USING BDCDATA
MESSAGES INTO MESSTAB
MODE N.
Here you will get all the messages. Then do like this,
go to debugging mode there you will find message id and message number for successful message and error messages.
take that sucessful message and message id and do like this
READ TABLE MESSATAB INTO WA_MESSTAB WITH KEY MSGID = 'message id' MSGNR = 'message no'.
Then Document Number = WA_MESSTAB-MSGV1.
I Hope it will work.
Regards
Rami Reddy
hi ,
CALL TRANSACTION XXXX
USING BDCDATA
MESSAGES INTO MESSTAB
MODE N.
Here you will get all the messages. Then do like this,
go to debugging mode there you will find message id and message number for successful message and error messages.
take that sucessful message and message id and do like this
READ TABLE MESSATAB INTO WA_MESSTAB WITH KEY MSGID = 'message id' MSGNR = 'message no'.
Then Document Number = WA_MESSTAB-MSGV1.
I Hope it will work.
Regards
Rami Reddy
2009 Oct 26 10:11 AM
Hi,
Did you use SET PARAMTER ID before using CALL TRANSACTION ?
Regards,
Tarun
2009 Oct 26 10:18 AM
why dont u collect the BDC message after call transaction....
it will contain the document no. genrated.
please try....
2009 Oct 26 10:19 AM
2009 Oct 26 10:24 AM
Hi,
Collect the messages from the BDC and find out the success message class and number being used. You should be able to get the number in one of the variables.
Thanks
Saachin
2009 Oct 26 10:33 AM
HI ,
When u call the transaction at that time u can colllect the message into an internal table and then u will get the work order number
in internal table.
first u declare internal table
data: itab type standard table of BDCMSGCOLL .
call transaction " Trans name "
MESSAGES INTO itab
Thanks
shambhu
2009 Oct 26 10:33 AM
Hi,
In this with the CALL TRANSACTION statement,
you can include BDCMSGCOLL Structure also like:
data itab like bdcmsgcoll.
*.CALL TRANSACTION (Tcode Name).. { {[MODE mode] [UPDATE upd]}
| [OPTIONS FROM opt] }
[MESSAGES INTO itab] ... .*
if sy-subrc = 0.
* use FORMAT_MESSAGE to read the complete description of message
* based on the message-id (msgid) and message-number(msgnr)
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = messtab-msgid
lang = sy-langu
no = messtab-msgnr
* v1 = messtab-msgv1
* v2 = messtab-msgv2 "In one of these variables your work order will get captured
* v3 = messtab-msgv3
* v4 = messtab-msgv4
IMPORTING
msg = wa_message-msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MOVE w_aufnr TO wa_message-aufnr.
APPEND wa_message TO it_message. "Final Internal table
ELSE.
MOVE w_aufnr TO wa_message-aufnr.
APPEND wa_message TO it_message.
ENDIF.
endif.
Hope it helps
Regards
Mansi
2009 Oct 26 10:36 AM
Hi,
Please use MESSTAB internal table for call transaction. You will get the document number as the last line of the internal table.
Use below code -
CALL TRANSACTION XXXX
USING BDCDATA
MESSAGES INTO MESSTAB
MODE N.
This is the correct way getting document data. If the transaction fails you will get the error message/warning messages into this table as well.
Try it,
Thanks,
Vivekanand
2009 Oct 26 10:45 AM
hi ,
CALL TRANSACTION XXXX
USING BDCDATA
MESSAGES INTO MESSTAB
MODE N.
Here you will get all the messages. Then do like this,
go to debugging mode there you will find message id and message number for successful message and error messages.
take that sucessful message and message id and do like this
READ TABLE MESSATAB INTO WA_MESSTAB WITH KEY MSGID = 'message id' MSGNR = 'message no'.
Then Document Number = WA_MESSTAB-MSGV1.
I Hope it will work.
Regards
Rami Reddy
2009 Oct 26 10:51 AM
Thanks to all who responded. They are all very helpful answers. I hope I didn't miss awarding points to anyone. I don't know if all the points are awarded after I clicked on 1 that solved the problem. There were several !!
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |