‎2006 May 17 6:05 AM
Hi,
I am creating a vendor from a legacy file using a function
IDOC_INPUT_CREDITOR.
it is working fine if i use only one segment (E1LFA1M).
But in my case i also have to save data into one field in
table LFB1 for which i have to fill one more segment
(E1LFB1M).
Now when i fill both the segments, i am unable to create
vendor.
Below is a sample code, please revert ASAP :
REPORT zvr001_vendor_create.
types ------------
DATA l_input_method TYPE bdwfap_par-inputmethd.
DATA l_header_data TYPE bapi_incinv_create_header.
DATA l_return TYPE bapiret2.
DATA wa_lfa1 TYPE lfa1.
DATA wa_bseg TYPE bseg.
DATA wa_bkpf TYPE bkpf.
DATA l_update TYPE bdwfap_par-updatetask.
internal tables --------------
control records
DATA: it_cntrl TYPE TABLE OF edidc,
wa_cntrl LIKE LINE OF it_cntrl.
data records
DATA: it_data TYPE TABLE OF edidd,
wa_data LIKE LINE OF it_data,
wa_e1lfa1m LIKE e1lfa1m,
wa_e1lfb1m LIKE e1lfb1m.
status records
DATA: it_status TYPE TABLE OF bdidocstat,
wa_status LIKE LINE OF it_status.
return variables
DATA: it_ret TYPE TABLE OF bdwfretvar,
wa_ret LIKE LINE OF it_ret.
serialization
DATA: it_serial TYPE TABLE OF bdi_ser,
wa_serial LIKE LINE OF it_serial.
fill internal tables ( hardcoded for test purpose )
1. control records
wa_cntrl-doctyp = 'CREMAS03'.
wa_cntrl-mestyp = 'CREMAS'.
wa_cntrl-idoctp = 'CREMAS03'.
APPEND wa_cntrl TO it_cntrl.
2. data records
wa_data-segnam = 'E1LFA1M'.
wa_e1lfa1m-lifnr = 'A007'.
wa_e1lfa1m-ktokk = 'AMVG'.
wa_e1lfa1m-name1 = 'name'.
wa_e1lfa1m-stras = 'address1'.
wa_e1lfa1m-ort02 = 'address2'.
wa_e1lfa1m-ort01 = 'city'.
wa_e1lfa1m-regio = 'pstlz'.
wa_e1lfa1m-pstlz = '122200'.
wa_e1lfa1m-land1 = 'IN'.
wa_data-sdata = wa_e1lfa1m.
APPEND wa_data TO it_data.
CLEAR wa_data.
wa_data-segnam = 'E1LFB1M'.
wa_e1lfb1m-lifnr = 'A007'.
wa_e1lfb1m-bukrs = '1000'.
wa_e1lfb1m-tlfns = 'Text001'.
wa_data-sdata = wa_e1lfb1m.
APPEND wa_data TO it_data.
CLEAR wa_data.
------------------------
create vendor
CALL FUNCTION 'IDOC_INPUT_CREDITOR'
EXPORTING
input_method = 'N'
mass_processing = ' '
PI_XK99_USED = ' '
IMPORTING
WORKFLOW_RESULT =
APPLICATION_VARIABLE =
in_update_task = 'X'
CALL_TRANSACTION_DONE =
TABLES
idoc_contrl = it_cntrl
idoc_data = it_data
idoc_status = it_status
return_variables = it_ret
serialization_info = it_serial
EXCEPTIONS
wrong_function_called = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
gaurav
‎2006 May 17 6:31 AM
uncomment the message statement following the fm call and see what the message is... it may give you a clue.
‎2006 May 17 6:53 AM
Hi,
sy-subrc is 0.
error details/success details will come in table
return_variables.
the mess is
ERROR_IDOC and 000000000000.
gaurav
‎2006 May 17 7:01 AM
‎2006 May 17 7:06 AM
hi,
ya, it contains two fields viz. WF_PARAM and DOC_NUMBER.
Under WF_PARAM the value is Error_IDOCS and
Under DOC_NUMBER the value is 0000000000000000.
‎2006 May 17 7:09 AM
do the sy-msg fields contain something even though sy-subrc is 0?
‎2006 May 17 7:25 AM
ya
sy-msgid contains 00
SY-MSGTY contains E
SY-MSGNO contains 055
it says : Make entry in all required fields.
But i have already made entries in req fields.
‎2006 May 17 7:35 AM
maybe the bapi does a call transaction somewhere....set a breakpoint on call transaction and give it another go..if you can change the mode to 'a' you might be able to find the offending field.
Try include LKD02F01.
...
CALL TRANSACTION BLF00-TCODE USING FT
MODE CALL_TRANSACTION_MODE
UPDATE C_UPDATE_SYNC
MESSAGES INTO T_BDCMSGCOLL.
‎2006 May 17 8:15 AM
Thank u for the suggestion. i did run the function in
'A' mode and came to know that there were few fields
which were required.
Thanks again. My querry is solved.
‎2007 Feb 26 6:28 AM
Hi Guys,
i was just creating a vendor for my own use. while creating vendor using transaction xk01 the account group field is creating problems. Can you please give me an example of step by step creation of a vendor using xk01.