‎2016 Feb 22 8:24 PM
Hi,
I am using FM 'BAPI_0050_CREATE' to prepost a budgeting document and it works fine but now when I go to transaction FMBB to post the same document the 'Post document' icon is greyed out, do you have any idea why is it so?
Thanks,
‎2016 Feb 22 10:26 PM
Are you sure the document was pre-posted? What activity type did you use?
Rob
‎2016 Feb 22 10:26 PM
Are you sure the document was pre-posted? What activity type did you use?
Rob
‎2016 Feb 24 1:16 PM
Yes I can open the document using FMBB and the status of the document says 'Preposted'.
Thanks,
‎2016 Feb 24 5:21 PM
‎2016 Feb 24 5:27 PM
‎2016 Feb 24 5:46 PM
My mistake - it's not imported to the FM.
Can we see your code calling the FM?
Rob
‎2016 Feb 24 6:00 PM
Hi Rob,
here it is:
DATA: item_data TYPE TABLE OF bapi_0050_item,
period_data TYPE TABLE OF bapi_0050_period.
DATA: techorg TYPE buku_techorg,
header_data TYPE bapi_0050_header,
return TYPE TABLE OF bapiret2,
gt_return TYPE TABLE OF bapiret2.
DATA: it_header_data TYPE bapi_0050_header,
it_item_data LIKE LINE OF item_data,
it_period_data LIKE LINE OF period_data,
longtext TYPE TABLE OF bapi_0050_longtext,
wa_longtext LIKE LINE OF longtext.
it_header_data-fm_area = '00'.
it_header_data-version = '000'.
it_header_data-docdate = '20160111'.
it_header_data-doctype = 'BDGT'.
it_header_data-docstate = '2'.
it_header_data-process = 'SUPL'.
MOVE it_header_data TO header_data.
it_item_data-item_num = '000001'.
it_item_data-fisc_year = '2016'.
it_item_data-budcat = '9F'.
it_item_data-budtype = 'DCTR'.
it_item_data-fund = 'D******'.
it_item_data-funds_ctr = '6*********'.
it_item_data-cmmt_item = '8*****'.
it_item_data-func_area = 'X'.
it_item_data-grant_nbr = 'NOT RELEVANT'.
it_item_data-trans_curr = 'USD'.
*it_item_data-total_amount = '1000.0000'.
*it_item_data-distkey = '1'.
it_item_data-valtype = 'B1'.
APPEND it_item_data TO item_data.
it_item_data-item_num = '000002'.
it_item_data-fisc_year = '2016'.
it_item_data-budcat = '9F'.
it_item_data-budtype = 'DCTR'.
it_item_data-fund = 'D******'.
it_item_data-funds_ctr = '6********'.
it_item_data-cmmt_item = '5*****'.
it_item_data-func_area = '5'.
it_item_data-grant_nbr = 'NOT RELEVANT'.
it_item_data-trans_curr = 'USD'.
it_item_data-total_amount = '-1000.0000'.
it_item_data-distkey = '1'.
it_item_data-valtype = 'B1'.
APPEND it_item_data TO item_data.
it_period_data-item_num = '000001'.
it_period_data-budgeting_period = '006'.
it_period_data-period_amount = '100.00'.
APPEND it_period_data TO period_data.
wa_longtext-text_id = 'FMED'.
wa_longtext-text_line = 'this is a test doc'.
APPEND wa_longtext TO longtext.
CALL FUNCTION 'FMKU_0050_CREATE'
EXPORTING
* LANGUAGE =
header_data = header_data
* HEADER_DATA_ADD =
techorg = 'BWB'
testrun = ' '
* IMPORTING
* FMAREA =
* DOCUMENTYEAR =
* DOCUMENTNUMBER =
TABLES
item_data = item_data
* SENDER_ITEM_DATA =
period_data = period_data
* SENDER_PERIOD_DATA =
long_text = longtext
* EXTENSION_IN =
return = return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = '2'.
‎2016 Feb 24 6:47 PM
You haven't checked the contents of RETURN before doing a COMMIT.
Rob
‎2016 Feb 24 8:18 PM
I have done that too but it's not making any difference:
READ TABLE return INTO wa_return WITH KEY type = 'S'
id = 'BAPI'
number = '000'.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = '0'.
ENDIF.
‎2016 Feb 24 9:12 PM
But that still doesn't tell you if there are any errors.
Have you tested this in debugging to see what the contents of RETURN are immediately after the call to the FM?
Rob
‎2016 Feb 24 9:25 PM
I did and this is what I get in the return table:
1 S BAPI 000 BudgetEntryDocFM **20161000227*** has been created. External reference:
‎2016 Feb 25 11:07 AM
‎2016 Feb 25 12:03 PM
HI,
No errors in SM13 and DOCSTATE in FMBH is 2 i.e. PREPOSTED.
‎2016 Feb 25 12:22 PM
its resolved... I was passing the tech org to be BWB but as soon as I changed it to BAPI-ED, it worked fine.
Thanks,
Rajat