Application Development 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: 

Call transaction FBV0 uses different screens for same user

former_member185998
Active Participant
0 Kudos

I'm editing two function modules that process parked FI documents by making a call to transaction FBV0. I'm debugging them in the same client, with the same user, with the exact same inputs. Still one uses screen SAPMF05A 1001 while the other uses SAPLF040 0700. I can't see why.

This thread seems related, but I can't see how I could set the screen variant, nor why my user would use different screen variants.

Here's the first case

I'll switch to display mode A to see all screens, then proceed.

and I reach screen

Here's the data from table BDCDATA

SAPMF05V 0100 X
0000 BDC_CURSOR RF05V-BUKRS
0000 RF05V-BUKRS 1000
0000 RF05V-BELNR 5200000001
0000 RF05V-GJAHR 2018
0000 BDC_OKCODE /00
SAPMF05A 1001 X
0000 BDC_OKCODE=BS
SAPMSSY0 0120 X
0000 BDC_OKCODE=F03
SAPMF05A 1001 X
0000 BDC_OKCODE =RW
SAPLSPO1 0200 X
0000 BDC_OKCODE	=YES

Then I'll debug the other function

Switch to display mode A and proceed (same document)

But the screen is SAPLF040

Here's the data from gt_bdcdata - quite the same as in the previous function module.

SAPMF05V 0100 X
0000 BDC_CURSOR RF05V-BUKRS
0000 RF05V-BUKRS 1000
0000 RF05V-BELNR 5200000001
0000 RF05V-GJAHR 2018
0000 BDC_OKCODE /00
SAPMF05A 1001 X
0000 BDC_OKCODE =BS
SAPMSSY00120 X
0000 BDC_OKCODE =F03
SAPMF05A1001 X
0000 BDC_OKCODE =RW
SAPLSPO10200 X
0000 BDC_OKCODE =YES

Why does SAP use different screens in these cases?

6 REPLIES 6

mmcisme1
Active Contributor

OK - so I know very little about FI/CO. Here are somethings to try.

1. Step thru your program as if you are the person do it manually using all transaction codes in the FM.

2. SHDB is always a great option.

My guess is that one of the function modules is running a transaction prior to this one. That transaction effects how the screen flow runs.

Perhaps you could share why there are 2 different FM. What are they doing? Are there any other transactions in them? IF your code isn't too long - copy it here.

0 Kudos

Thanks Michelle!

No, the functions call no other transactions than FBV0. I'll add the coding below.

Some background: the issue that I have is that in the function using SAPLF040 (first listing), the field VBKPF-XSNET poses a problem, while in the other using SAPMF05A (second listing), it doesn't. I've now tested changing so that both functions use SAPMF05A. Now the first function returns the error No batch input data for dynpro SAPLF040 0700, because it still tries to use SAPLF040. In other words, with my recent changes, it doesn't work anymore, but it serves to prove that something determines which screens to use in the transaction. Apparently the BDC table data doesn't, because the table content is identical in these cases. Then what does?

FUNCTION /xxx/iv_check_document.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(IV_COMP) TYPE  BUKRS

*"     REFERENCE(IV_BELNR) TYPE  BELNR_D

*"     REFERENCE(IV_YEAR) TYPE  GJAHR

*"  EXPORTING

*"     REFERENCE(EX_OK) TYPE  BOOLEAN

*"     REFERENCE(EX_TXT) TYPE  NATXT

*"  CHANGING

*"     REFERENCE(MESSTAB) TYPE  TRTY_BDCMSGCOLL

*"----------------------------------------------------------------------

* Check that document given is OK.

* Contents of the code copied from function PRELIMINARY_POSTING_CHECK_ALL

* - that function was displaying result of the check on screen and we don't want it



  DATA: lv_appl_log TYPE  xfeld,

        lv_handle   TYPE  balloghndl,

        lv_prof     TYPE  bal_s_prof,

        lt_bkpf     TYPE  STANDARD TABLE OF vbkpf,

        ls_bkpf     TYPE  vbkpf,

        lt_msg_tab  TYPE  STANDARD TABLE OF msg_tab_line,

        ls_msg      TYPE  msg_tab_line,

        lv_error    TYPE  symsgty VALUE 'E',

        lv_langu    TYPE  spras.



  DATA: it_messtab TYPE STANDARD TABLE OF bdcmsgcoll.

  DATA: wa_messtab TYPE bdcmsgcoll.

  DATA: char_x(1)  TYPE c VALUE 'X'.

  DATA: char_t(1)  TYPE c VALUE 'T'.



  DATA: msg_tab    TYPE STANDARD TABLE OF msg_tab_line WITH HEADER LINE.



  DATA: lv_ctumode TYPE c.

  DATA: lv_cupdate TYPE c.

  DATA: lv_opt     TYPE ctu_params.



  DATA: fvalbukrs         LIKE bdcdata-fval.

  DATA: fvalbelnr         LIKE bdcdata-fval.

  DATA: fvalgjahr         LIKE bdcdata-fval.

  DATA: global_test_flag  TYPE xfeld.



  FIELD-SYMBOLS: <fs_messtab> LIKE bdcmsgcoll.

  DEFINE  convert_message_type.

    IF msg_tab-msgid = &1 AND msg_tab-msgno = &2.

      msg_tab-msgty = &3.

    ENDIF.

  END-OF-DEFINITION.



  CLEAR: messtab.

  lv_langu = sy-langu.

  ex_ok = 'X'.



  ls_bkpf-bukrs = iv_comp.

  ls_bkpf-belnr = iv_belnr.

  ls_bkpf-gjahr = iv_year.

  APPEND ls_bkpf TO lt_bkpf.



  EXPORT global_test_flag FROM char_x TO MEMORY ID 'F040_TEST'.



  CLEAR gt_bdcdata[].



  lv_appl_log = 'X'.

  MOVE iv_comp  TO fvalbukrs.

  MOVE iv_belnr TO fvalbelnr.

  MOVE iv_year  TO fvalgjahr.



  PERFORM bdc_dynpro      USING 'SAPMF05V' '0100'.

  PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05V-BUKRS'.

  PERFORM bdc_field       USING 'RF05V-BUKRS'   fvalbukrs.

  PERFORM bdc_field       USING 'RF05V-BELNR'   fvalbelnr.

  PERFORM bdc_field       USING 'RF05V-GJAHR'   fvalgjahr.



*  PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.

*  PERFORM bdc_dynpro      USING 'SAPLF040' '0700'.

*  PERFORM bdc_field       USING 'BDC_OKCODE'    '=PB'.

*  PERFORM bdc_dynpro      USING 'SAPLF040' '0700'.

*  PERFORM bdc_field       USING 'BDC_OKCODE'   '=RW'.



  PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.

  PERFORM bdc_dynpro      USING 'SAPMF05A' '1001'.

  PERFORM bdc_field       USING 'BDC_OKCODE'    '=BS'.

  PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.

  PERFORM bdc_field       USING 'BDC_OKCODE'    '=F03'.

  PERFORM bdc_dynpro      USING 'SAPMF05A' '1001'.

  PERFORM bdc_field       USING 'BDC_OKCODE'   '=RW'.

  PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.

  PERFORM bdc_field       USING 'BDC_OKCODE'   '=YES'.



  lv_ctumode = 'N'.

  lv_cupdate = 'L'.

  lv_opt-nobinpt = ' '.

  lv_opt-dismode = 'N'.

* begin CER-715 1.3.2018 make sure we calculate taxes from gross amounts

  DATA: rfopt2     TYPE rfopt2, ct_options TYPE ctu_params.

  GET PARAMETER ID 'FO2' FIELD rfopt2.

  CLEAR rfopt2-xsnet.

  SET PARAMETER ID 'FO2' FIELD rfopt2.



  CALL TRANSACTION 'FBV0' USING  gt_bdcdata

                          MODE   lv_ctumode

                          UPDATE lv_cupdate

                     MESSAGES INTO it_messtab.

* end CER-715

( omitted code for processing and analysing messages from this listing)

    FREE MEMORY ID 'F040_TEST'.



ENDFUNCTION.

Then the second function

FUNCTION /xxx/iv_check_posting.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(I_BUKRS) TYPE  BUKRS

*"     REFERENCE(I_BELNR) TYPE  BELNR_D

*"     REFERENCE(I_GJAHR) TYPE  GJAHR

*"  EXPORTING

*"     REFERENCE(E_BELNR) TYPE  BELNR_D

*"     REFERENCE(E_GJAHR) TYPE  GJAHR

*"     REFERENCE(E_BUDAT_NEW) TYPE  BUDAT

*"     REFERENCE(E_TAX_FAIL) TYPE  XFELD

*"  TABLES

*"      T_MSG_TAB STRUCTURE  MSG_TAB_LINE

*"----------------------------------------------------------------------

  DATA: char_x(1) TYPE c VALUE 'X',

        char_l(1) TYPE c VALUE 'L',

        char_n(1) TYPE c VALUE 'N',

        char_t(1) TYPE c VALUE 'T'.

  DATA: ymesstab TYPE TABLE OF bdcmsgcoll.

  FIELD-SYMBOLS: <fs_messtab> LIKE bdcmsgcoll.

  DATA: fvalbukrs LIKE bdcdata-fval.

  DATA: fvalbelnr LIKE bdcdata-fval.

  DATA: fvalgjahr LIKE bdcdata-fval.

  DATA:  global_test_flag TYPE xfeld.

  DATA: ld_tfill      LIKE sy-tfill,

        ld_loop_count TYPE i,

        ld_text(10)   TYPE c,

        lv_langu      TYPE spras,

        lv_bdcfail    TYPE xfeld,

        lv_vbsegs     TYPE vbsegs.





  DATA lv_budat_current TYPE budat.

  DATA lv_budat_new TYPE budat.

  DATA lv_msg100(100) TYPE c.

  DATA lv_error TYPE boolean.

  DATA lv_belnr_new TYPE belnr_d.

  DATA lv_gjahr_new TYPE gjahr.

  DATA lv_count TYPE i.

  DATA lv_vbkpf TYPE vbkpf.

  DATA lv_tax_codes TYPE /xxx/paramvalue.

  DATA lv_tax_sel TYPE selopt.

  DATA lv_tax_seltab TYPE TABLE OF selopt.



  DATA: lv_subrc TYPE sy-subrc VALUE 0,

        lv_gjahr TYPE gjahr,

        lv_monat TYPE monat,

        lv_frpe1 TYPE t001b-frpe1.



  DEFINE  convert_message_type.

    IF msg_tab-msgid = &1 AND msg_tab-msgno = &2.

      msg_tab-msgty = &3.

    ENDIF.

  END-OF-DEFINITION.



  e_belnr = i_belnr.

  e_gjahr = i_gjahr.



  lv_langu = sy-langu.



  SELECT SINGLE budat INTO lv_budat_current

      FROM bkpf WHERE bukrs = i_bukrs

                  AND belnr = i_belnr

                  AND gjahr = i_gjahr.
  IF i_belnr <> e_belnr OR i_gjahr <> e_gjahr OR NOT lv_budat_new IS INITIAL.

    DO 10 TIMES.

      WAIT UP TO 1 SECONDS.

      SELECT SINGLE * FROM vbkpf INTO lv_vbkpf

        WHERE bukrs = i_bukrs AND

              belnr = e_belnr AND

              gjahr = e_gjahr AND

              budat = lv_budat_new.

      IF sy-subrc = 0.

        EXIT.

      ELSE.

        CONTINUE.

      ENDIF.

    ENDDO.



  ENDIF.



*old_percent = 0.



  REFRESH t_msg_tab.





  REFRESH t_msg_tab.



  MOVE i_bukrs TO fvalbukrs.

  MOVE i_belnr TO fvalbelnr.

  MOVE i_gjahr TO fvalgjahr.

  PERFORM bdc_nodata1 USING '/'.

  PERFORM bdc_dynpro      USING 'SAPMF05V' '0100'.

  PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05V-BUKRS'.

  PERFORM bdc_field       USING 'RF05V-BUKRS'   fvalbukrs.

  PERFORM bdc_field       USING 'RF05V-BELNR'   fvalbelnr.

  PERFORM bdc_field       USING 'RF05V-GJAHR'   fvalgjahr.

  PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.

  PERFORM bdc_dynpro      USING 'SAPMF05A' '1001'.

  PERFORM bdc_field       USING 'BDC_OKCODE'    '=BS'.

  PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.

  PERFORM bdc_field       USING 'BDC_OKCODE'    '=F03'.

  PERFORM bdc_dynpro      USING 'SAPMF05A' '1001'.

  PERFORM bdc_field       USING 'BDC_OKCODE'   '=RW'.

  PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.

  PERFORM bdc_field       USING 'BDC_OKCODE'   '=YES'.

* begin CER-715 1.3.2018 make sure we calculate taxes from gross amounts

  DATA: rfopt2 TYPE rfopt2.

  GET PARAMETER ID 'FO2' FIELD rfopt2.

  CLEAR rfopt2-xsnet.

  SET PARAMETER ID 'FO2' FIELD rfopt2.

* end CER-715



  REFRESH ymesstab.

  PERFORM bdc_transaction TABLES ymesstab[]

  USING                         'FBV0'



ENDFUNCTION.<br>

mmcisme1
Active Contributor

Try setting a break-point and looking at rftopt2.

You can also try searching google with:


fbv0 No batch input data for dynpro SAPLF040 0700

It does come up with a list. I'm not sure if any of it will help you.

https://lmgtfy.com/

😄

I didn't find the cause and ran out of time, so I edited the surrounding code so that I can use the function module that works everywhere and did some regression testing. Seems to work. Don't know the reason why there were two different function modules that apparently do the same thing.

mmcisme1
Active Contributor
0 Kudos

Perfect!!! If all else fails.

Yes, just looking at it the code looked the same to me.. Nice job finding a work around!

Michelle

chaouki_akir
Contributor

One of your function module is changing a standard memory id "F040_TEST". This is the reason why screen SAPMF05A 1001 can be displayed instead SAPLF040 0700:

  EXPORT global_test_flag FROM char_x TO MEMORY ID 'F040_TEST'.

Depending the value of the memory id "F040_TEST" and of BKPF-TCODE, then the code of transaction FBV0 will display screen

SAPMF05A 1001 instead screen SAPLF040 0700.

The related SAP standard code of transaction FBV0 is there (routine beleg_anzeigen of SAPMF05V):

  • if bkpf-tcode= FB50 and memory id "F040_TEST" is set to X then transaction FV50 will be called and screen SAPMF05A 1001 will be displayed.

In, your test case, what is the value of bkpf-tcode for your document 1000/5200000001/2018 ?