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: 

Dynamic assignment of variable

DominikKraemer
Active Participant
0 Kudos

Hello,

I am currently investigating a dump which was occuring in our productive system in one of our BTE's while doing rebates with T-Code VBOF:

The current ABAP program "SAPLV60A" had to be terminated because it has

come across a statement that unfortunately cannot be executed.

   27   ASSIGN ('(SAPMV60A)XVBRK') TO <ls_vbrk>.

   28   IF sy-subrc NE 0.

>>>>>     ASSIGN ('(SAPLV60A)XVBRK') TO <ls_vbrk>. " Invoice creation in BG

   30     IF sy-subrc NE 0.

   31       RETURN.

   32     ENDIF.

Anyone got an idea on why we are receiving a dump saying "Field symbol has not yet been assigned."?

I was expecting in case the assignment was not working correctly that sy-subrc would be set to 4 as it is happening in line 27.

Regards,

Dominik

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
  • SAPLV60A is not active but was active (look in the "List of ABAP programs affected") and so XVBRK is no longer active (I suppose some FM of the group was called) -> Note that the documentation of this statement syntax mentions a "For internal use only,"
  • SAPMV60A wasn't active, so no problem arose.

Regards,
Raymond

14 REPLIES 14

Former Member
0 Kudos

Hi

Yes it should work as you says:

I've tried your code and it works as you expect....which is your basis release?

Can you post the dump?

Max

0 Kudos

Hello,

The code is executed succesfully via VF01 in foreground or also during invoice creation in background. This however as it seems that the variable XVBRK is correctly filled.

During rebate changes with T-Code VBOF the above dump occures. However I cannot find SAPMV60A nor SAPLV60A in the call stack.

Dump is partially attached.

Temporary workaround for the moment is to check the call stack prior to the ASSIGN and in case both programs are not in the stack to ignore the statements completly. However I am still wondering why the first assign works as expected and the second returns a dump.

Basis release: SAP_BASIS 700 0025 SAPKB70025

Regards,

Dominik

0 Kudos

I would like to read full dump

Anyway I've tried to run that code in a program where the both main programs (SAPMV60A and SAPLV60A) are not loaded in call stack

Any dump occurs.....so it's strange

Max

0 Kudos

Attached the full dump. Hope it helps.

0 Kudos

Hi Dominik,

I have read your whole dump.

Instead of line:-

<ls_vbrk> TYPE vbrkvb,

try use

<ls_vbrk> LIKE vbrkvb,

Hope it helps.

Thanks & Regards,

Swati

0 Kudos

Hello Swati,

I have tried as per your suggestion but am still receiving the same dump.

Even if I change the field-symbol to type any the dump continues.

Regards,

Dominik

0 Kudos

Hi Dominik,

Try the below code:-

I_TABLE   TYPE STANDARD TABLE OF vbrkvb,

<ls_vbrk>  LIKE LINE OF I_TABLE

Thanks & Regards,

Swati

raymond_giuseppi
Active Contributor
0 Kudos
  • SAPLV60A is not active but was active (look in the "List of ABAP programs affected") and so XVBRK is no longer active (I suppose some FM of the group was called) -> Note that the documentation of this statement syntax mentions a "For internal use only,"
  • SAPMV60A wasn't active, so no problem arose.

Regards,
Raymond

0 Kudos

Hello Raymond,

actually you are somewhat right. I've also seen SAPLV60A however a call to FM 'SYSTEM_CALLSTACK' from within VBOF returns me the following:

1 SAPLY_QTC_TRANSMIT_DATA LY_QTC_TRANSMIT_DATAU03 29 FUNCTION Y_QTC_844_TRANSMIT_INV_DATA

2 SAPLBFFM LBFFMU37 52 FUNCTION OPEN_FI_PERFORM_00001050_E

3 SAPLFACI LFACIF57 381 FORM FI_DOCUMENT_POST

4 SAPLFACI LFACIU05 25 FUNCTION FI_DOCUMENT_POST

5 SAPLRWCL LRWCLF01 608 FORM DOCUMENT_POST

6 SAPLRWCL LRWCLU02 42 FUNCTION AC_DOCUMENT_POST

7 SDBONT06 SDBONT06 1323 FORM BONUS_FI_POST

8 SDBONT06 SDBONT06 722 FORM FAKTUREN_ABARBEITEN

9 SDBONT06 SDBONT06 343 EVENT START-OF-SELECTION

However from VF01 I see the following:

1 SAPLY_QTC_TRANSMIT_DATA LY_QTC_TRANSMIT_DATAU03 29 FUNCTION Y_QTC_844_TRANSMIT_INV_DATA

2 SAPLBFFM LBFFMU37 52 FUNCTION OPEN_FI_PERFORM_00001050_E

3 SAPLFACI LFACIF57 381 FORM FI_DOCUMENT_POST

4 SAPLFACI LFACIU05 25 FUNCTION FI_DOCUMENT_POST

5 SAPLRWCL LRWCLF01 608 FORM DOCUMENT_POST

6 SAPLRWCL LRWCLU02 42 FUNCTION AC_DOCUMENT_POST

7 SAPLV60A J3GD_SAPLV60A=================E 149 FUNCTION RV_INVOICE_DOCUMENT_ADD

8 SAPMV60A /NFM/SD_SAPMV60A==============E 2 FORM BELEG_SICHERN

9 SAPLV00F LV00FF0F 90 FORM FCODE_BEARBEITEN

10 SAPLV00F LV00FU02 44 FUNCTION SCREEN_SEQUENCE_CONTROL

11 SAPMV60A MV60AF0F_FCODE_BEARBEITEN 154 FORM FCODE_BEARBEITEN

12 SAPMV60A MV60AI0F_FCODE_BEARBEITEN 8 MODULE (PAI) FCODE_BEARBEITEN

So I guess I will continue with the check to the CallStack to see if I can go ahead with my assign or not.

Long story short:

CALL FUNCTION 'SYSTEM_CALLSTACK'

-> IF SAPMV60A or SAPLV60A is found in the stack, go ahead and try the assign, else skip completly.

Regards,

Dominik

0 Kudos

But in a FM like RV_INVOICE_DOCUMENT_ADD, XVBRK is a parameter of the FM and not a data defined in the global area (TOP) if the main program (SAPLV60A) so cannot be assigned from another program, only "global data object" of the program are allowed. (Here XVBRK is defined in include VBRKDATA at start of program SDBONT06 so an assignment in this program should not dump)

Regards,

Raymond

former_member195402
Active Contributor
0 Kudos

Hi,

XVBRK is not globally defined in SAPLV60A, it is only an interface parameter of some function modules and only known there.

If you need to access it, you have to define a globally defined internal table of same structure, which you can fill fill thru enhancement or userexit.

Then you can access this new table with ASSIGN.

Gruß

Klaus

0 Kudos

I agree with Klaus, you could try to use some FM in a Billing Exit/BAdI to store data in global area of a function group, oe export it to memory. Then in your BTE, you could try to get this data back with a FM reading in global data or from memory, if not found then you could  access information from database


For User-exits for Billing, read Billing → , Working with User Exits and User-defined Enhancements of the Billing Interface or System ModificationsUser ExitsUser Exits For Billing and User Exits For General Billing Interface.


Else you should be required to identify the main program whereXVBRK[] is defined, e.g. SAPMV60A (VF01, etc.) or SDBONT06 (VBOF),  SAPLVBRK (BAPI), etc.


Regards,

Raymond

0 Kudos

Hi Raymond,

thanks for your input. As of now this is the way I am going forward, checking the call stack and go ahead with the ASSIGN to the corresponding program.

I need to consider this as a lessons learned to not do an assign without making sure that the variable was previously available.

Regards,

Dominik

Former Member
0 Kudos

A suggestion

If I understand what you need to do:

You have developed a BTE triggered while FI document is beeing posted ....I've had a problem like yours, so I've developed the following code for a fm for BTE 1050


DATA: MY_BSEG TYPE BSEG_T WITH HEADER LINE.

   LOOP AT T_BKPF.

     CLEAR MY_BSEG[].

     CLEAR MY_BSEG.

     LOOP AT T_BSEG INTO MY_BSEG

       WHERE BUKRS = T_BKPF-BUKRS

         AND BELNR = T_BKPF-BELNR

         AND GJAHR = T_BKPF-GJAHR.

       APPEND MY_BSEG.

     ENDLOOP.

     CALL FUNCTION 'Z_ACM_COMMISSION_CREATE_OPEN'

       EXPORTING

         I_BKPF        = T_BKPF

         I_BSEG        = MY_BSEG[]

         I_UPDATE_TASK = 'X'.

   ENDLOOP.

My fm Z_ACM_COMMISSION_CREATE_OPEN belongs to a function group where I've defined other fms in order to get all data from billing, those fms are placed in the user-exit of the bill, like, for example, the user-exit of interface SD-FI

So it doesn't need to use field-symbol

Max