SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

Billing Variant - output operands to structure

ricky_shaw
Contributor
0 Kudos

Hello Experts,

I created a custom variant ZVAR1(say) that takes FLAG as input operand and INTEGER type as Output operand.

This output operand holds integer values(for month difference) that is used by next std variant (INFACT08) in the schema.

My custom variant ZVAR1 should NOT write to the install facts. The next variant writesto the installation facts(using MAC_FACTS_WRITE).

What macro should i use here? I tried mac_output_ioper x_op-o1 but its not working.

In the rate config(EA32), i am seeing that my variant gets called first followed by std variant INFACT08. In debug mode inside the std variant INFACT08 code, i am seeing some values filled up in XY_OBJ & X_OP-O1 structures. i am NOT able to see the value of my output operand coming from the previous variant(ZVAR1).

Can someone tell me what is wrong? Thanks Ricky

12 REPLIES 12

Former Member
0 Kudos

Need for info on the import and changing parameters.

Paste the code here if possible.

Regards,

Rakesh..

sapisurdg.wordpress.com

0 Kudos

Hi Rakesh,

The code is like this.

Some parts of the code is commented which shows are my attempts.

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

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(X_RED) TYPE  ISU2A_REDUCED_BILLING_DATA

*"     REFERENCE(X_SS) TYPE  ISU2A_SS

*"     REFERENCE(X_OP) TYPE  ISU2A_VARIANT_PARAMETERS

*"  CHANGING

*"     REFERENCE(XY_OBJ) TYPE  ISU2A_BILLING_DATA

*"     REFERENCE(XY_SOBJ) TYPE  ISU2A_DATA_COLLECTOR

*"  EXCEPTIONS

*"      GENERAL_FAULT

*"      REGULAR_ERROR

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

include ievarbasic. 

include ievarmac . 

include iealinesort_mac .

*--------

*lv_months holds an output value from a std FM:

value-qnt_new = lv_months + 1. 

if lv_months ge 12.   

value-qnt_new = 12.

  endif. 

ab = x_ss-ab. 

bis = x_ss-bis. 

mac_invoice_line co_dltyp01.

* mac_invoice_line_info X_SS-VARCONT1 CO_DLTYP01.

MAC_INVOICE_LINE CO_DLTYP01.

** Write installation facts into current period with proration

*  mac_facts_write x_op-o1-operand x_op-o1-optyp.

*  wzone-z-i_zahl1 = lv_months.

*  wzone-z-ab = x_ss-ab.

*  wzone-z-bis = x_ss-bis.

*  append wzone to izone.

*  out_oper-string1 = lv_months.

*  clear out_ioper. 

out_oper-ab = x_ss-ab.

out_oper-bis = x_ss-bis. 

out_oper-qnt_new = lv_months. ---->this value needs to be passed.

*  append out_oper to out_ioper.

*  clear out_oper. 

mac_output_ioper x_op-o1.

* *  mac_output_ivb x_op-o1.

endfunction.

The value in lv_months is not at all appearing in variant INFACT08.

I am seeing that the AB & BIS values are being passed in xy_obj[] table.

0 Kudos

Hi,

I copied your code and was able to update the facts.( zvariant and then using infact08)

  DATA : lv_months TYPE i.

  lv_months = 1.

  out_oper-ab = x_ss-ab.

  out_oper-bis = x_ss-bis.

  out_oper-qnt_new = lv_months.

  mac_output_ioper x_op-o1.

You can check the screenshots.

Regards,

Rakesh..

sapisurdg.wordpress.com

0 Kudos

Rakesh, Thats sounds to be a good news. But i want this output value(INTEGER) to pass as input parameter to another variant INFACT08. Please define another subsquent std variant INFACT08 in your rate step and mention this INTEGER as import parameter. Can you help me with that?

0 Kudos

Hi,

I already had that in the rate steps , that's how the integer got updated in the installation facts.

Regards,

Rakesh..

sapisurdg.wordpress.com

0 Kudos

Rakesh. Thanks for your attempts. I think i am getting closer. Finally can you see that these integer values are output under Historical facts node as seen in the attached. The values need to be displayed here for different period 1,2,3,...12 under Inetger column.

0 Kudos

Hi,

Yes, They do.

The screenshot of the Installation fact I shared , if I click on the '1' it shows similar entries.

Hope this helps.

Merry Christmas Everyone !!

Cheers,

Rakesh..

sapisurdg.wordpress.com

0 Kudos

Hi Rakesh, Can you please try if it is possible to output multiple values for the INTEGER in place of single values? I think you need to use some structure/int table to accumulate the contents of the  variable lv_months. Also you need to use append it to  structure called ioper I think. out_oper-qnt_new = lv_months. append out_oper to ioper. clear out_oper. mac_output_ioper x_op-o1. I will wait for your response. Thanks

0 Kudos

Hi,

I didn't get your question.

The operand can hold a single value during the variant execution. Its like a variable in the code.

Cheers,

Rakesh..

sapisurdg.wordpress.com

0 Kudos

Rakesh,

What I was asking is you can try appending out_oper to an internal table out_ioper and then use the macro mac_output_ioper x_op-o1.

But you just got it  without using an int table. that's GOOD to see.

lv_months just holds a single value at a time & it passes it to out_oper.

Are the multiple values that we are seeing under integer column is just from out_oper structure?

Thanks Ricky

0 Kudos

Rakesh, Are you maintaining any variant control & parameters for ZINT? Also I need output a line item type for a document. Can you help me with that? I am using mac_output_line co_linty01(holds 01). But its not returning any line item type. Thanks

0 Kudos

Hi,

Nope no variant controls in my example.

Check variant comput12 for the line item thingy for integers.

Hope this helps.

Cheers,

Rakesh..

sapisurdg.wordpress.com