cancel
Showing results for 
Search instead for 
Did you mean: 

RV_MESSAGES_GET inside MM07MFB9_BUCHEN_AUSFUEHREN and XNAST assignment

Shizofrenik
Explorer
0 Kudos
160

Hi, experts.
Why does 'RV_MESSAGES_GET' initialize XNAST table.
Before calling xnast nad ynast tables are emty and at once it i start to execite this fm xnast is filling with data
Why it's happerning?

  CALL FUNCTION 'RV_MESSAGES_GET'
    EXPORTING
      msg_kappl     = 'ME'
    TABLES
      tab_xnast     = xnast
      tab_ynast     = ynast
    EXCEPTIONS
      error_message = 4.
  IF NOT sy-subrc IS INITIAL.
    MESSAGE ID sy-msgid TYPE a NUMBER sy-msgno WITH
               sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

 

Accepted Solutions (0)

Answers (2)

Answers (2)

RaymondGiuseppi
Active Contributor
0 Kudos

Basically, these tables are export parameters and not changing parameters. As any good programmer should do, they are initialised and populated in this GET data FM.

(The reason why TABLES parameters are considered obsolete)

DominikTylczyn
SAP Champion
SAP Champion
0 Kudos

Hello @Shizofrenik 

That is how RV_MESSAGES_GET is implemented. It initializes both TAB_XNAST and TAB_YNAST at the very beginning:

FUNCTION RV_MESSAGES_GET.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(MSG_KAPPL) LIKE  NAST-KAPPL DEFAULT SPACE
*"     VALUE(MSG_OBJKY_FROM) LIKE  NAST-OBJKY DEFAULT ' '
*"     VALUE(MSG_OBJKY_TO) LIKE  NAST-OBJKY DEFAULT ' '
*"  TABLES
*"      TAB_XNAST STRUCTURE  VNAST
*"      TAB_YNAST STRUCTURE  NAST
*"----------------------------------------------------------------------

  REFRESH: tab_xnast,
           tab_ynast.

Best regards

Dominik Tylczynski

Shizofrenik
Explorer
0 Kudos

Tab_xnast is empty when 'RV_MESSAGES_GET' start to execute, and xnast is filling at once it start

Shizofrenik_0-1745394319761.png

 

DominikTylczyn
SAP Champion
SAP Champion

Hello @Shizofrenik 

What you see is a case of Variable shadowing - XNAST defined in your program that calls RV_MESSAGE_GET is not the same as XNAST defined globally in the V61B function group. RV_MESSAGE_GET is defined in V61B, so all global variables of the function group are visible in all its functions. See SAP Help Validity and Visibility

Best regards

Dominik Tylczynski