‎2007 Sep 28 6:29 PM
hi,
my data declarations and code is as follows:
types:ty_bapi_return LIKE bapiret2.
data: t_return TYPE STANDARD TABLE OF ty_bapi_return,
wa_return TYPE ty_bapi_return.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_bapi_hdr
TABLES
accountgl = t_accountgl
currencyamount = t_currencyamount
return = t_return.
READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
MOVE: wa_return-type TO wa_msg_table-type,
wa_return-message TO wa_msg_table-message,
wa_return-message_v2 TO wa_msg_table-message_v2,
wa_bkpf-belnr TO wa_msg_table-belnr,
wa_bkpf-gjahr TO wa_msg_table-gjahr,
wa_bkpf-bukrs TO wa_msg_table-bukrs.
APPEND wa_msg_table TO t_msg_table.
CLEAR wa_msg_table.
CONTINUE.
ELSEIF wa_return-type = 'S'.
call bapi_transaction_commit
CLEAR wa_commit_return1.
REFRESH t_commit_return1.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = t_commit_return1.
Now when i debug and see wa_return , i cant find any values in wa_return.but the table t_return has 2 rows with type 'S'.can anyone tell me what the problem is..thank you.
regards,
Challa.
‎2007 Sep 28 6:32 PM
READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
If you reading the table looking for TYPE "E"...And the table only got 2 rows with TYPE "S"...You will get a line into WA_RETURN...
If you want records in WA_RETURN, you should write this...
READ TABLE t_return INTO wa_return WITH KEY type = 'S'.
"E" stands for error...If your BAPI have been well performed...You're not going to get any errors -;)
Greetings,
Blag.
‎2007 Sep 28 6:32 PM
READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
If you reading the table looking for TYPE "E"...And the table only got 2 rows with TYPE "S"...You will get a line into WA_RETURN...
If you want records in WA_RETURN, you should write this...
READ TABLE t_return INTO wa_return WITH KEY type = 'S'.
"E" stands for error...If your BAPI have been well performed...You're not going to get any errors -;)
Greetings,
Blag.
‎2007 Sep 28 6:33 PM
thats perfectly right because yor are checking KEY TYPE = 'E' and t_return has value 'S', o the condition fails and return no records in wa_return.
Regards,
Amit
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 28 6:37 PM
READ doesn't work that way. When you:
READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
It will only return the first occurrence that exactly matches the key(s) you specify. If none match, you will get nothing even though other records are in the table.
You probably want to use a LOOP to read all records.
Rob