cancel
Showing results for 
Search instead for 
Did you mean: 

How to append new data in start routine or update routine?

Former Member
0 Kudos

Dears,

I wanna to switch the COPA data from row to column. That is, one record from COPA may be converted into tens of records. I'm going to try this process in start routine or update routine. Just wanna check if routine can append records? If yes, how to handle it. Thanks for your suggestions.

Best regards,

Gerald

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

this is quite easy by implementing a return table routine; I've done exactly the same: converting COPA value fields into records based on cost elements/accounts.

let us know should you neeed more details....

Olivier.

Former Member
0 Kudos

Great Olivier,

I tried it some times, but failed.

Could you please forward me the details?

So far, I'm going to switch COPA data from row to column based on profit center, just like

Original data like:

Profit Center....G_QVV001,G_AVV002....

0000003100.....100 ,150

The result I'm expecting

Profit Center....Key Figure Type, Amount

0000003100....VV001 ,100

0000003100....VV002 ,150

B.R

Gerald

Former Member
0 Kudos

Hi,

Start Routine:


"declaration
DATA:  BEGIN OF ls_fact,
        FIELDNAME LIKE DD03L-FIELDNAME,
       END OF ls_fact.
TYPES: ly_fact LIKE ls_fact.
DATA:  lt_fact TYPE SORTED TABLE OF ly_fact WITH UNIQUE KEY FIELDNAME.

"code
"we need to get the value field list in an itab
"here I take from the source of my data (an ICube)
SELECT FIELDNAME INTO CORRESPONDING FIELDS OF TABLE lt_fact
FROM DD03L
WHERE TABNAME = '/BIC/FZICFC_C12'
  AND AS4LOCAL = 'A'
  AND FIELDNAME LIKE '%VV%'.

Your amount result table routine (replace -/BIC/ZPER_AMNT by your keyfig and replace -/BIC/ZVFIELD by your target IObj name where you will store the VV name)


FIELD-SYMBOLS: <lf_vfield_value>.
DATA:          lv_vfieldnm(50) TYPE C.

RESULT_TABLE = ICUBE_VALUES.

RESULT_TABLE-CURRENCY = COMM_STRUCTURE-CURRENCY.

LOOP AT lt_fact INTO ls_fact.
  CONCATENATE 'COMM_STRUCTURE-' ls_fact-FIELDNAME INTO lv_vfieldnm.
  ASSIGN (lv_vfieldnm) TO  <lf_vfield_value>.
  IF <lf_vfield_value> IS NOT INITIAL.

*** Key Fig Result
    MOVE <lf_vfield_value> TO RESULT_TABLE-/BIC/ZPER_AMNT.

*** Characteristics
*   Value Field
    RESULT_TABLE-/BIC/ZVFIELD   =  ls_fact-FIELDNAME+3.

    APPEND RESULT_TABLE.
  ENDIF.
ENDLOOP.

hope this helps...

Olivier.

Message was edited by:

Olivier Cora

Former Member
0 Kudos

Hi Olivier,

Seems not working.

Former Member
0 Kudos

Hi Olivier,

Done, Thank you very much. Hope you got the score I committed.

B.R

Gerald

Former Member
0 Kudos

Hi Gerald He,

did you make it work finally? Does this meet with your requirement?

Olivier.

Former Member
0 Kudos

Hi Olivier,

Thanks. Yer. You helped,man.Thumbs up.

B.R

Gerald

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Geralg

/You can do it in

1. Start routine

2. update routine

3. Return table ( see if your requirement suits to this)

Thanks

Tripple k

Former Member
0 Kudos

yes.. this is possible..

you have to declare a work area like

DATA : wa_temp TYPE data_package_structure.

populate wa_temp and

APPEND wa_temp TO DATA_PACKAGE.