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

posting a doc using FMBB

Former Member
0 Likes
3,980

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,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,390

Are you sure the document was pre-posted? What activity type did you use?

Rob

13 REPLIES 13
Read only

Former Member
0 Likes
3,391

Are you sure the document was pre-posted? What activity type did you use?

Rob

Read only

0 Likes
3,390

Yes I can open the document using FMBB and the status of the document says 'Preposted'.

Thanks,

Read only

0 Likes
3,390

And what activity type did you use??

Rob

Read only

0 Likes
3,390

where can I see the activity type?

Read only

0 Likes
3,390

My mistake - it's not imported to the FM.

Can we see your code calling the FM?

Rob

Read only

0 Likes
3,390

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'.

Read only

0 Likes
3,390

You haven't checked the contents of RETURN before doing a COMMIT.

Rob

Read only

0 Likes
3,390

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.

Read only

0 Likes
3,390

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

Read only

0 Likes
3,390

I did and this is what I get in the return table:

1 S BAPI 000 BudgetEntryDocFM **20161000227*** has been created. External reference:

Read only

0 Likes
3,390
  • No error raised in SM13?
  • What is the currrent status of document? (Table FMBH fields DOCSTATE or even REVSTATE.)

Regards,

Raymond

Read only

0 Likes
3,390

HI,

No errors in SM13 and DOCSTATE in FMBH is 2 i.e. PREPOSTED.

Read only

0 Likes
3,390

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