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: 

performance issue

Former Member
0 Kudos
181

hi experts,

My object is an ALV interactive report which also involves 2 batch session and 2 call transaction method .program includes 10 secondary lists. Problem is the performance issue. its very slow while testing. please give tips to improve the performance. select statements are everything fine i took according to the db table which i am using. when i did runtime analysis

abap- 66.1%( red colour)

database --- 29.0%( red colour)

R/3---- 4.9%( green colour)

call u plz suggest whether the performance of the program is good. plz suggest me.

Thanks and Regards,

Ramya

2 REPLIES 2

Former Member
0 Kudos
99

hi

Abap is 66% means you need to write your code more accurate.

Do SQL trace and check whether any select statements are taking much time.

If select statements are taking more time then need to cross checks the select statements in program. If require (select data from more tables), user for all entries statement or inner join. Use all key fields in select statement.

If select statements are fine in SQL trace, then check rest of the code in you program. If you are using read statement then use binary search for that. Before reading sort those internal tables. Avoid nested loops. Avoid function modules inside the loop. Avoid select statements inside the loop. Avoid MOVE CORRESPONDING in select statement.

Still it is taking more time just past your code. We can check it.

Reward if it is useful.

Thanks.

Siva kumar

0 Kudos
99

hi siva kumar ,

this is my code

tables: zupi5a,

zfi_restatmt,

zfirestate_log,

t001a,

bgr00, " BTCI Structure.

bbkpf, " Accounting Header.

bbseg, " Acounting Item

bbtax. " Document Taxes (Batch Input Structure).

type-pools slis.

types: begin of ty_data1,

ryear like zupi5a-ryear, "Fiscal year

rbukrs like zupi5a-rbukrs, "Company code

racct like zupi5a-racct, "Account number

rzzps_posid like zupi5a-rzzps_posid, "WBS element

rzzmtit like zupi5a-rzzmtit, "MPM title

rzzmfor like zupi5a-rzzmfor, "MPM format

rzzmatnr like zupi5a-rzzmatnr, "Material number

rzzcou like zupi5a-rzzcou, "Country

rzzfow like zupi5a-rzzfow, "Financial owner

rzzoow like zupi5a-rzzoow, "Operational owner

rzzcon like zupi5a-rzzcon, "Licensee Contract

rzzloc like zupi5a-rzzloc, "Licensor Contract

kostl like zupi5a-kostl, "Cost center

zzfam like zupi5a-zzfam, "Fame Number

zzfor like zupi5a-zzfor, "Format

zzprd like zupi5a-zzprd, "Product Line

zzwin like zupi5a-zzwin, "Window group

zzwig like zupi5a-zzwig, "Window

rtcur like zupi5a-rtcur, "Currency Key

TSL like zupi5a-TSL,

HSL like zupi5a-hSL,

KSL like zupi5a-KSL,

MSL like zupi5a-MSL,

end of ty_data1.

types: begin of ty_data2,

ryear like zupi5a-ryear, "Fiscal year

rbukrs like zupi5a-rbukrs, "Company code

racct like zupi5a-racct, "Account number

rzzps_posid like zupi5a-rzzps_posid, "WBS element

end of ty_data2.

types: begin of ty_final,

ryear like zupi5a-ryear, "Fiscal year

rbukrs like zupi5a-rbukrs, "Company code

racct like zupi5a-racct, "Account number

rzzps_posid like zupi5a-rzzps_posid, "WBS element

rzzmtit like zupi5a-rzzmtit, "MPM title

rzzmfor like zupi5a-rzzmfor, "MPM format

rzzmatnr like zupi5a-rzzmatnr, "Material number

rzzcou like zupi5a-rzzcou, "Country

rzzfow like zupi5a-rzzfow, "Financial owner

rzzoow like zupi5a-rzzoow, "Operational owner

rzzcon like zupi5a-rzzcon, "Licensee Contract

rzzloc like zupi5a-rzzloc, "Licensor Contract

kostl like zupi5a-kostl, "Cost center

rtcur like zupi5a-rtcur, "Currency Key

zzfam like zupi5a-zzfam, "Fame Number

zzfor like zupi5a-zzfor, "Format

zzprd like zupi5a-zzprd, "Product Line

zzwin like zupi5a-zzwin, "Window group

zzwig like zupi5a-zzwig, "Window

tsl like zupi5a-tsl, "Amount Transaction currency

hsl like zupi5a-hsl, "Amount Co. code currency

ksl like zupi5a-ksl, "Amount Group currency

msl like zupi5a-msl, "Quantity

end of ty_final.

types: begin of ty_final1,

ryear like zupi5a-ryear, "Fiscal year

rbukrs like zupi5a-rbukrs, "Company code

racct like zupi5a-racct, "Account number

rzzps_posid like zupi5a-rzzps_posid, "WBS element

end of ty_final1.

types: begin of ty_fidoc,

ryear like zupi5a-ryear, "Fiscal year

rbukrs like zupi5a-rbukrs, "Company code

racct like zupi5a-racct, "Account number

rzzps_posid like zupi5a-rzzps_posid, "WBS element

bschl like bseg-bschl, "Posting key

wrbtr like bseg-wrbtr,

dmbe2 like bseg-dmbe2,

kostl like zupi5a-kostl, "Cost center

rtcur like zupi5a-rtcur, "Currency Key

tsl like zupi5a-tsl, "Amount Transaction currency

hsl like zupi5a-hsl, "Amount Co. code currency

ksl like zupi5a-ksl, "Amount Group currency

msl like zupi5a-msl, "Quantity

end of ty_fidoc.

*----


*

  • Data

*----


*

data:

  • i_data type standard table of ty_data,

i_data type standard table of ty_data1,

i_final type standard table of ty_final,

i_final2 type standard table of ty_final,

  • i_data2 type standard table of ty_data2, **JAGANV

i_data2 type standard table of ty_data1, "**JAGANV

i_final1 type standard table of ty_final1.

data:

wa_data type ty_data1,

wa_final type ty_final,

wa_final2 type ty_final,

wa_data2 type ty_data2,

wa_final1 type ty_final1.

Data : v_lines type i.

data : t_data like zfirestate_log occurs 0 with header line.

************************************************************************

  • Declaration of Structures *

************************************************************************

DATA:

*-- Structure for Field Catalog

fs_fldcat TYPE slis_fieldcat_alv,

*-- Structure for Events

fs_events TYPE slis_alv_event,

*-- Structure for Headings

fs_comments TYPE slis_listheader.

*********************************************************************

  • ALV

*********************************************************************

DATA: i_fieldcat TYPE slis_t_fieldcat_alv,

i_fieldcat1 TYPE slis_t_fieldcat_alv,

i_fieldcat2 TYPE slis_t_fieldcat_alv,

i_events TYPE slis_t_event.

DATA: i_top_of_page TYPE slis_t_listheader,

i_top_of_page2 TYPE slis_t_listheader,

i_top_of_page3 TYPE slis_t_listheader,

i_top_of_page4 TYPE slis_t_listheader,

i_top_of_page5 TYPE slis_t_listheader,

i_top_of_page6 TYPE slis_t_listheader,

i_top_of_page7 TYPE slis_t_listheader,

i_top_of_page8 TYPE slis_t_listheader,

i_top_of_page9 TYPE slis_t_listheader,

i_top_of_page10 TYPE slis_t_listheader,

i_top_of_page11 TYPE slis_t_listheader.

DATA: wa_fieldcat TYPE slis_fieldcat_alv,

wa_fieldcat2 TYPE slis_fieldcat_alv.

DATA:

lf_sp_group TYPE slis_t_sp_group_alv, "Gruppentabelle

l_default(1) TYPE c,

l_exit(1) TYPE c, "Importpara. für F4 FB

l_variant LIKE disvariant,"Variant_init.

l_status TYPE slis_formname VALUE 'STANDARD',

l_user_command TYPE slis_formname VALUE 'USER_COMMAND'.

*----


*

  • Counters

*----


*

data: v_doc_count type i,

  • v_wtgbtr like coep-wtgbtr,

v_wkgbtr like coep-wkgbtr,

v_wogbtr like coep-wogbtr.

DATA: V_PARAMVALUE LIKE ZWFM_CONTROL_TAB-PARAMVALUE.

*data: v_rtcur like t001-waers.

*----


*

  • Constants

*----


*

constants: wa_c_formname_top_of_page TYPE slis_formname

VALUE 'TOP_OF_PAGE',

wa_c_formname_top_of_page2 TYPE slis_formname

VALUE 'TOP_OF_PAGE2',

wa_c_formname_top_of_page3 TYPE slis_formname

VALUE 'TOP_OF_PAGE3',

wa_c_formname_top_of_page4 TYPE slis_formname

VALUE 'TOP_OF_PAGE4',

wa_c_formname_top_of_page5 TYPE slis_formname

VALUE 'TOP_OF_PAGE5',

wa_c_formname_top_of_page6 TYPE slis_formname

VALUE 'TOP_OF_PAGE6',

wa_c_formname_top_of_page7 TYPE slis_formname

VALUE 'TOP_OF_PAGE7',

wa_c_formname_top_of_page8 TYPE slis_formname

VALUE 'TOP_OF_PAGE8',

wa_c_formname_top_of_page9 TYPE slis_formname

VALUE 'TOP_OF_PAGE9',

wa_c_formname_top_of_page10 TYPE slis_formname

VALUE 'TOP_OF_PAGE10',

wa_c_formname_top_of_page11 TYPE slis_formname

VALUE 'TOP_OF_PAGE11',

c_x value 'X',

c_40(2) type c value '40',

c_50(2) type c value '50',

c_s type c value 'S',

c_h type c value 'H',

c_onli(4) type c value 'ONLI',

c_obj_type like bkpf-awtyp value 'IBKPF'.

CONSTANTS : lit_ucomm TYPE slis_formname VALUE 'F1000_USERCOMMAND',

" Form name

lit_val(1) TYPE c VALUE '0', " Variable to store zero

lit_tabname TYPE slis_tabname VALUE 'I_FINAL',

" Output Int. Table Name

lit_left(1) TYPE c VALUE 'L', " Left Justification

lit_centre(1) TYPE c VALUE 'C', " Centered

lit_right(1) TYPE c VALUE 'R', " Right Justification

lit_key(1) TYPE c VALUE 'X', " to assign as Key field

lit_typ_h(1) TYPE c VALUE 'H', " Heading line with Bold

lit_typ_s(1) TYPE c VALUE 'S', " Heading line w/o Bold

lit_x(1) TYPE c VALUE 'X', " Flag

LIT_TABNAME1 TYPE SLIS_TABNAME VALUE 'I_ERR'.

CONSTANTS: c_i VALUE 'I',

c_z VALUE 'Z',

c_y VALUE 'Y',

c_fb01(4) VALUE 'FB01',

c_fbs1(4) VALUE 'FBS1',

c_nodata VALUE '/',

c_amph VALUE '&',

c_plus VALUE '+',

c_comma VALUE ',',

c_period VALUE '.',

c_hyphen VALUE '-',

c_gl VALUE 'G',

c_customer VALUE 'C',

c_vendor VALUE 'V',

c_mask(9) VALUE ',.,..' ,

c_zero VALUE '0'.

*CONSTANTS: c_40(2) TYPE n VALUE '40',

  • c_50(2) TYPE n VALUE '50'.

DATA : ws_flag(1) TYPE c, " Flag

ws_found(1) TYPE c VALUE 'X', " Flag

ws_fieldcat TYPE slis_fieldcat_alv," Work area for fld. catagory

ws_comments TYPE slis_listheader, " Work area for List Heading

ws_tabix LIKE sy-tabix, " Table Index

ws_ind(1) TYPE c, " Flag

ws_trg(1) TYPE c, " Flag

ws_repid LIKE sy-repid, " Program Name

ws_name LIKE trdir-name. " Program Name

DATA : w_num(3) TYPE n,

w_wrbtr LIKE bseg-wrbtr,

  • w_wrbtr type p DECIMALS 2,

w_wrbtr2 LIKE bseg-wrbtr,

w1_dmbe2 like bseg-dmbe2,

w2_dmbe2 like bseg-dmbe2,

w_total_credit LIKE bseg-wrbtr,

w_total_debit LIKE bseg-wrbtr,

w_first(1) TYPE c,

p_var1(3) type c,

p_var2(3) type c,

p_var3(3) type c,

s_var1(3) type c,

s_var2(3) type c,

s_var3(3) type c,

s_var4(3) type c,

s_var5(3) type c,

t_var1(3) type c,

t_var2(3) type c,

t_var3(3) type c.

*&----

-


*Fields Symbols

*&----

-


FIELD-SYMBOLS : .

*----


*

*macros

*----


*

*macro for fieldcatalog

define add_field.

wa_fieldcat-fieldname = &1.

wa_fieldcat-col_pos = &2.

wa_fieldcat-ddictxt = &3.

wa_fieldcat-seltext_l = &3.

wa_fieldcat-seltext_m = &3.

wa_fieldcat-seltext_s = &3.

wa_fieldcat-reptext_ddic = &3.

wa_fieldcat-ddictxt = 'M'.

wa_fieldcat-ref_fieldname = &4.

wa_fieldcat-ref_tabname = &5.

wa_fieldcat-cfieldname = &6.

wa_fieldcat-ctabname = &7.

append wa_fieldcat to i_fieldcat.

add 1 to &2.

end-of-definition.

define add_field2.

wa_fieldcat2-fieldname = &1.

wa_fieldcat2-col_pos = &2.

wa_fieldcat2-ddictxt = &3.

wa_fieldcat2-seltext_l = &3.

wa_fieldcat2-seltext_m = &3.

wa_fieldcat2-seltext_s = &3.

wa_fieldcat2-reptext_ddic = &3.

wa_fieldcat2-ddictxt = 'M'.

wa_fieldcat2-ref_fieldname = &4.

wa_fieldcat2-ref_tabname = &5.

wa_fieldcat2-cfieldname = &6.

wa_fieldcat2-ctabname = &7.

append wa_fieldcat2 to i_fieldcat2.

add 1 to &2.

end-of-definition.

*----


*

  • Selection screen

*----


*

selection-screen begin of block one with frame title text-001.

parameters:

p_rldnr like zupi5a-rldnr obligatory default 'Z5', "Ledger

p_rrcty like zupi5a-rrcty obligatory default '0', "Record type

p_rvers like zupi5a-rvers obligatory default '001', "Version

p_ryear like zupi5a-ryear obligatory. "Fiscal year

select-options:

s_rpmax for zupi5a-poper obligatory no-extension. "Period

parameters:

p_rbukrs like zupi5a-rbukrs obligatory. "Company code

  • p_rtcur like zupi5a-rtcur no-display. "Currency Key

select-options:

s_racct for zupi5a-racct obligatory no-extension, "Account number

s_rbusa for zupi5a-rbusa, "Business area

s_rzzps for zupi5a-rzzps_posid obligatory no intervals, "WBS Element

s_rzmtit for zupi5a-rzzmtit, "MPM title

s_rzmfor for zupi5a-rzzmfor, "MPM format

s_zmatnr for zupi5a-rzzmatnr, "Material number

s_rzzcou for zupi5a-rzzcou, "Country

s_rkunnr for zupi5a-rzzkunnr, "Customer number

s_rzzfow for zupi5a-rzzfow, "Financial owner

s_rzzoow for zupi5a-rzzoow, "Operational owner

s_rzzcon for zupi5a-rzzcon, "Licence contract

s_raufnr for zupi5a-rzzaufnr, "Order number

s_rzzloc for zupi5a-rzzloc, "Licensor contract

s_blart for zupi5a-blart, "Document type

s_zzrrc for zupi5a-zzrrc, "Return reason code

s_zztsc for zupi5a-zztsc, "Type of sales/Sales channel

s_zzfam for zupi5a-zzfam, "Fame number

s_zzfor for zupi5a-zzfor, "Format

s_zzgen for zupi5a-zzgen, "Movie Genre

s_zzprd for zupi5a-zzprd, "Product Line

s_zzfmt for zupi5a-zzfmt, "Price point

s_zzwin for zupi5a-zzwin, "Window group

s_zzwig for zupi5a-zzwig, "Window

s_kostl for zupi5a-kostl. "Cost center

selection-screen end of block one.

*SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE text-t01.

*PARAMETERS:

*SELECTION-SCREEN END OF BLOCK 2.

selection-screen begin of block three with frame title text-t02.

parameters:

p_blart like bkpf-blart , "Doc Type

p_bldat type bkpf-bldat obligatory,

p_budat type bkpf-budat obligatory,

p_monat type bkpf-monat obligatory,

p_gjahr type bkpf-gjahr obligatory,

p_batch LIKE bgr00-group OBLIGATORY,

p_mode LIKE rfpdo-rfbifunct DEFAULT 'B' no-display,

p_filout LIKE rlgrap-filename DEFAULT '/PELINT/fipost' no-display,

p_max(3) TYPE n DEFAULT '900' no-display.

selection-screen end of block three.

*&----

-


  • INITIALIZATION

*&----

-


INITIALIZATION.

CONCATENATE c_z sy-uname INTO p_batch.

perform set_defaults_parms.

  • perform set_defaults_curr.

at selection-screen output.

perform set_screen_attributes.

at selection-screen on s_racct.

perform check_racct.

at selection-screen on s_rzzps.

perform check_rzzps.

at selection-screen.

select from_period to_period from_acct

to_acct ryear rbukrs rzzps_posid

from zfirestate_log

into corresponding fields of table t_data

where ryear eq p_ryear

and rbukrs eq p_rbukrs.

  • and rzzps_posid in s_rzzps.

clear : s_var1,

s_var2,

s_var3,

s_var4,

s_var5.

clear : p_var1,

p_var2,

p_var3,

t_var1,

t_var2,

t_var3.

if not t_data[] is initial.

loop at t_data.

IF p_ryear eq t_data-ryear.

move 'YES' to s_var1.

else.

move 'NO' to s_var1.

ENDIF.

loop at s_rpmax.

if s_rpmax-low LE t_data-from_period.

Move 'YES' to p_var1.

else.

move 'NO' to P_Var1.

endif.

if s_rpmax-low LE t_data-to_period.

Move 'YES' to p_var2.

else.

move 'NO' to P_Var2.

endif.

if s_rpmax-high LT t_data-from_period.

Move 'YES' to p_var3.

else.

move 'NO' to P_Var3.

endif.

if p_var1 ne p_var2

or p_var2 ne p_var3

or p_var1 ne p_var3.

move 'YES' to s_var2.

else.

move 'NO' to s_var2.

endif.

endloop.

IF p_rbukrs eq t_data-rbukrs.

move 'YES' to s_var3.

else.

move 'NO' to s_var3.

ENDIF.

loop at s_racct.

if s_racct-low LE t_data-from_acct.

Move 'YES' to t_var1.

else.

move 'NO' to t_Var1.

endif.

if s_racct-low LE t_data-to_acct.

Move 'YES' to t_var2.

else.

move 'NO' to t_Var2.

endif.

if s_racct-high LT t_data-from_acct.

Move 'YES' to t_var3.

else.

move 'NO' to t_Var3.

endif.

if t_var1 ne t_var2

or t_var2 ne t_var3

or t_var1 ne t_var3.

move 'YES' to s_var4.

else.

move 'NO' to s_var4.

endif.

endloop.

loop at s_rzzps.

IF s_rzzps-low eq t_data-rzzps_posid.

move 'YES' to s_var5.

else.

move 'NO' to s_var5.

ENDIF.

endloop.

if s_var1 eq 'YES'

and s_var2 eq 'YES'

and s_var3 eq 'YES'

and s_var4 eq 'YES'

and s_var5 eq 'YES'.

  • or s_var1 eq s_var4

  • or s_var1 eq s_var5

  • or s_var2 eq s_var4

  • or s_var2 eq s_var5

  • or s_var3 eq s_var5.

message e007.

endif.

endloop.

endif.

*----


*

  • Start of selection

*----


*

start-of-selection.

*Select the data from UPI5T table based on the selection screen

perform get_data.

perform get_data1.

  • perform ckeck_data.

*Populate the final internal table

perform populate_final_table.

perform populate_final1_table.

end-of-selection.

if not i_final[] is initial.

*build field catalog

perform build_catalog.

perform build_header_comment using i_top_of_page[] 1.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page.

perform alv_gui_status using i_events.

perform alv_call_back using i_events.

perform show_output.

else.

  • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

*&----


*

*& Form check_racct

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM check_racct.

if s_racct-low LT 40000000 or s_racct-low GT 79999999

or s_racct-high GT 79999999.

message e000.

endif.

ENDFORM. " check_racct

*&----


*

*& Form get_data

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM get_data.

  • Select the data from zupi5a table based on the selection screen

  • select ryear rbukrs racct rzzps_posid rzzmtit

  • rzzmfor rzzmatnr rzzcou rzzfow rzzoow rzzcon

  • rzzloc kostl

  • zzfam zzfor zzprd zzwin zzwig

  • rtcur

  • tsl01 tsl02

  • tsl03 tsl04 tsl05 tsl06 tsl07 tsl08 tsl09 tsl10 tsl11

  • tsl12 tsl13 tsl14 tsl15 tsl16

  • hsl01 hsl02 hsl03 hsl04

  • hsl05 hsl06 hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13

  • hsl14 hsl15 hsl16

  • ksl01 ksl02 ksl03 ksl04 ksl05 ksl06

  • ksl07 ksl08 ksl09 ksl10 ksl11 ksl12 ksl13 ksl14 ksl15

  • ksl16 msl01 msl02 msl03 msl04 msl05 msl06 msl07 msl08

  • msl09 msl10 msl11 msl12 msl13 msl14 msl15 msl16

  • from zupi5a

  • into table i_data

  • where rldnr = p_rldnr

  • and rrcty = p_rrcty

  • and rvers = p_rvers

  • and ryear = p_ryear

  • and rtcur = p_rtcur

    • and rpmax in s_rpmax

  • and POPER in s_rpmax

  • and rbukrs = p_rbukrs

  • and racct in s_racct

  • and rbusa in s_rbusa

  • and rzzps_posid in s_rzzps

  • and rzzmtit in s_rzmtit

  • and rzzmfor in s_rzmfor

  • and rzzmatnr in s_zmatnr

  • and rzzcou in s_rzzcou

  • and rzzkunnr in s_rkunnr

  • and rzzfow in s_rzzfow

  • and rzzoow in s_rzzoow

  • and rzzcon in s_rzzcon

  • and rzzaufnr in s_raufnr

  • and rzzcon in s_rzzloc

  • and blart in s_blart

  • and zzrrc in s_zzrrc

  • and zztsc in s_zztsc

  • and zzfam in s_zzfam

  • and zzfor in s_zzfor

  • and zzgen in s_zzgen

  • and zzprd in s_zzprd

  • and zzfmt in s_zzfmt

  • and zzwin in s_zzwin

  • and zzwig in s_zzwig

  • and kostl in s_kostl.

select ryear rbukrs racct rzzps_posid rzzmtit

rzzmfor rzzmatnr rzzcou rzzfow rzzoow rzzcon

rzzloc kostl

zzfam zzfor zzprd zzwin zzwig

rtcur

TSL HSL KSL MSL

from zupi5a

into table i_data bypassing buffer

where rldnr = p_rldnr

and rrcty = p_rrcty

and rvers = p_rvers

and ryear = p_ryear

  • and rtcur = p_rtcur

  • and rpmax in s_rpmax

and POPER in s_rpmax

and rbukrs = p_rbukrs

and racct in s_racct

and rbusa in s_rbusa

and rzzps_posid in s_rzzps

and rzzmtit in s_rzmtit

and rzzmfor in s_rzmfor

and rzzmatnr in s_zmatnr

and rzzcou in s_rzzcou

and rzzkunnr in s_rkunnr

and rzzfow in s_rzzfow

and rzzoow in s_rzzoow

and rzzcon in s_rzzcon

and rzzaufnr in s_raufnr

and rzzcon in s_rzzloc

and blart in s_blart

and zzrrc in s_zzrrc

and zztsc in s_zztsc

and zzfam in s_zzfam

and zzfor in s_zzfor

and zzgen in s_zzgen

and zzprd in s_zzprd

and zzfmt in s_zzfmt

and zzwin in s_zzwin

and zzwig in s_zzwig

and kostl in s_kostl.

if sy-subrc NE 0.

message i001.

endif.

ENDFORM. " get_data

*&----


*

*& Form populate_final_table

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM populate_final_table.

loop at i_data into wa_data.

wa_final-ryear = wa_data-ryear.

wa_final-rbukrs = wa_data-rbukrs.

wa_final-racct = wa_data-racct.

wa_final-rzzps_posid = wa_data-rzzps_posid.

wa_final-rzzmtit = wa_data-rzzmtit.

wa_final-rzzmfor = wa_data-rzzmfor.

wa_final-rzzmatnr = wa_data-rzzmatnr.

wa_final-rzzcou = wa_data-rzzcou.

wa_final-rzzfow = wa_data-rzzfow.

wa_final-rzzoow = wa_data-rzzoow.

wa_final-rzzcon = wa_data-rzzcon.

wa_final-rzzloc = wa_data-rzzloc.

wa_final-kostl = wa_data-kostl.

wa_final-zzfam = wa_data-zzfam.

wa_final-zzfor = wa_data-zzfor.

wa_final-zzprd = wa_data-zzprd.

wa_final-zzwin = wa_data-zzwin.

wa_final-zzwig = wa_data-zzwig.

wa_final-rtcur = wa_data-rtcur.

  • wa_final-tsl = wa_data-tsl01 + wa_data-tsl02 + wa_data-tsl03

*+

  • wa_data-tsl04 + wa_data-tsl05 + wa_data-tsl06

*+

  • wa_data-tsl07 + wa_data-tsl08 + wa_data-tsl09

*+

  • wa_data-tsl10 + wa_data-tsl11 + wa_data-tsl12

*+

  • wa_data-tsl13 + wa_data-tsl14 + wa_data-tsl15

*+

  • wa_data-tsl16.

  • wa_final-hsl = wa_data-hsl01 + wa_data-hsl02 + wa_data-hsl03

*+

  • wa_data-hsl04 + wa_data-hsl05 + wa_data-hsl06

*+

  • wa_data-hsl07 + wa_data-hsl08 + wa_data-hsl09

*+

  • wa_data-hsl10 + wa_data-hsl11 + wa_data-hsl12

*+

  • wa_data-hsl13 + wa_data-hsl14 + wa_data-hsl15

*+

  • wa_data-hsl16.

*

  • wa_final-ksl = wa_data-ksl01 + wa_data-ksl02 + wa_data-ksl03

*+

  • wa_data-ksl04 + wa_data-ksl05 + wa_data-ksl06

*+

  • wa_data-ksl07 + wa_data-ksl08 + wa_data-ksl09

*+

  • wa_data-ksl10 + wa_data-ksl11 + wa_data-ksl12

*+

  • wa_data-ksl13 + wa_data-ksl14 + wa_data-ksl15

*+

  • wa_data-ksl16.

*

  • wa_final-msl = wa_data-msl01 + wa_data-msl02 + wa_data-msl03

*+

  • wa_data-msl04 + wa_data-msl05 + wa_data-msl06

*+

  • wa_data-msl07 + wa_data-msl08 + wa_data-msl09

*+

  • wa_data-msl10 + wa_data-msl11 + wa_data-msl12

*+

  • wa_data-msl13 + wa_data-msl14 + wa_data-msl15

*+

  • wa_data-msl16.

wa_final-tsl = wa_data-tsl.

wa_final-hsl = wa_data-hsl.

wa_final-ksl = wa_data-ksl.

wa_final-mSL = wa_data-mSL.

append wa_final to i_final.

clear : wa_final-ryear,

wa_final-rbukrs, wa_final-racct,

wa_final-rzzps_posid, wa_final-rzzmtit, wa_final-rzzmfor,

wa_final-rzzmatnr, wa_final-rzzcou,

wa_final-rzzfow, wa_final-rzzoow, wa_final-rzzcon,

wa_final-rzzloc,

wa_final-kostl,

wa_final-zzfam,

wa_final-zzfor,

wa_final-zzprd, wa_final-zzwin,

wa_final-zzwig,

wa_final-rtcur,

wa_final-tsl,

wa_final-hsl, wa_final-ksl, wa_final-msl.

endloop.

ENDFORM. " populate_final_table

*&----


*

*& Form build_catalog

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM build_catalog.

data: l_pos type i.

l_pos = 1.

add_field 'RYEAR' l_pos 'Fiscal Year'(002) 'RYEAR' 'zupi5a' '' ''.

add_field 'RBUKRS' l_pos 'Company Code'(003) 'RBUKRS' 'zupi5a' '' ''.

add_field 'RACCT' l_pos 'Account Number'(004) 'RACCT' 'zupi5a' '' ''.

add_field 'RZZPS_POSID' l_pos 'WBS Element'(005) 'RZZPS_POSID'

'ZUPI5T' '' ''.

add_field 'RZZMTIT' l_pos 'MPM title'(006) 'RZZMTIT' 'zupi5a' '' ''.

add_field 'RZZMFOR' l_pos 'MPM Format'(007) 'RZZMFOR' 'zupi5a' '' ''.

add_field 'RZZMATNR' l_pos 'Material'(008) 'RZZMATNR' 'zupi5a' '' ''.

add_field 'RZZCOU' l_pos 'Country'(009) 'RZZCOU' 'zupi5a' '' ''.

add_field 'RZZFOW' l_pos 'Financial owner'(010) 'RZZFOW' 'zupi5a' ''

''.

add_field 'RZZOOW' l_pos 'Operational owner'(011) 'RZZOOW' 'zupi5a' ''

''.

add_field 'RZZCON' l_pos 'Licensee Contract'(012) 'RZZCON' 'zupi5a' ''

''.

add_field 'RZZLOC' l_pos 'Licensor Contract'(013) 'RZZLOC' 'zupi5a' ''

''.

add_field 'KOSTL' l_pos 'Cost Center'(014) 'KOSTL' 'zupi5a' '' ''.

add_field 'ZZFAM' l_pos 'Fame Number'(015) 'ZZFAM' 'zupi5a' '' ''.

add_field 'ZZFOR' l_pos 'Format'(016) 'ZZFOR' 'zupi5a' '' ''.

add_field 'ZZPRD' l_pos 'Product Line'(017) 'ZZPRD' 'zupi5a' '' ''.

add_field 'ZZWIN' l_pos 'Window Group'(018) 'ZZWIN' 'zupi5a' '' ''.

add_field 'ZZWIG' l_pos 'Window'(019) 'ZZWIG' 'zupi5a' '' ''.

  • add_field 'RTCUR' l_pos 'Currency'(020) 'RTCUR' 'zupi5a' '' ''.

  • add_field 'TSL' l_pos 'Amt. Transactn curr.'(021) '' '' '' ''.

add_field 'HSL' l_pos 'Amt. Co. Cd. currency'(022) '' '' '' ''.

add_field 'KSL' l_pos 'Amt. Group currency'(023) '' '' '' ''.

add_field 'MSL' l_pos 'Quantity'(024) '' '' '' ''.

ENDFORM. " build_catalog

*&----


*

*& Form show_output

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

ws_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

i_callback_user_command = 'USER_COMMAND'

i_callback_top_of_page = 'TOP_OF_PAGE'

i_save = 'X'

it_fieldcat = i_fieldcat[]

it_events = i_events[]

TABLES

t_outtab = i_final.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output

*----


*

  • FORM TOP_OF_PAGE *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page[].

ENDFORM. " TOP_OF_PAGE

*&----


*

*& Form alv_gui_status

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status USING P_I_EVENTS type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status

*&----


*

*& Form PF_STATUS_SET

*&----


*

  • text

*----


*

form pf_status_set using t_extab.

set pf-status 'ZFI_RESTMT'.

endform. " PF_STATUS_SET

*&----


*

*& Form alv_call_back

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back USING P_I_EVENTS type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back

*&----


*

*& Form USER_COMMAND

*&----


*

  • text

*----


*

form user_command using ucomm like sy-ucomm

selfield type slis_selfield.

case ucomm.

when 'SUMZ'.

perform summarize_final_table.

endcase.

endform. " USER_COMMAND

*&----


*

*& Form SUMMARIZE_AND_PRODUCE_FINAL_TA

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM summarize_final_table.

  • Copy the final table to another internal table and summarize.

*i_final2[] = i_final[].

sort i_final by rzzps_posid.

clear wa_final.

clear i_final2[].

loop at i_final into wa_final.

collect wa_final into i_final2.

clear wa_final.

endloop.

if not i_final2[] is initial.

perform build_header_comment using i_top_of_page2[] 2.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page2 .

perform alv_gui_status1 using i_events.

perform alv_call_back1 using i_events.

perform show_output_rep.

else.

  • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

ENDFORM. " summarize_final_table

*&----


*

*& Form show_output_rep

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_rep.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

ws_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

  • I_STRUCTURE_NAME = itab4

  • i_callback_pf_status_set = 'ZSS_CO' "STANDASPL

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE2'

*

  • i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat[]

it_events = i_events[]

TABLES

t_outtab = i_final2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_rep

*&----


*

*& Form alv_gui_status1

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status1 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET1' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status1

*&----


*

*& Form PF_STATUS_SET1

*&----


*

  • text

*----


*

form pf_status_set1 using t_extab.

set pf-status 'ZFI_RESTMT1'.

endform. " PF_STATUS_SET1

*&----


*

*& Form alv_call_back1

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back1 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND1' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back1

*&----


*

*& Form USER_COMMAND

*&----


*

  • text

*----


*

form user_command1 using ucomm like sy-ucomm

selfield type slis_selfield.

case ucomm.

when 'LOCK'.

export i_final2 to memory id 'table'.

export p_rbukrs to memory id 'BUKRSID'.

submit zfi_lock_wbs_elements and return.

commit work.

message i002.

if not i_final2[] is initial.

perform build_header_comment using i_top_of_page3[] 3.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page3 .

perform alv_gui_status2 using i_events.

perform alv_call_back2 using i_events.

perform show_output_rep3.

else.

MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

endcase.

endform. " USER_COMMAND1

*&----


*

*& Form simulate_and_display_fi_entry

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM simulate_and_display_fi_entry.

data: i_final3 type standard table of ty_fidoc,

v_final2 type ty_final.

data: v_account like zfi_acct_assign-hkont.

data: wa_final3 type ty_fidoc.

data: v_balance_t like zupi5a-tsl,

v_balance_c like zupi5a-hsl,

v_balance_g like zupi5a-ksl.

data: v_rtcur like zupi5a-rtcur.

data: v_cnt type i value 0,

v_cnt1 type i value 0,

n type i.

clear: wa_final3,

v_balance_t,

v_balance_c,

v_balance_g.

sort i_final2 by rtcur.

describe table i_final2 lines n.

delete i_final2 where hsl = 0.

delete i_final2 where hsl < 0 and ksl > '-0.01'.

delete i_final2 where hsl > '-0.01' and ksl < '0.01'.

loop at i_final2 into wa_final2.

v_cnt = sy-tabix + 1.

v_cnt1 = v_cnt1 + 1.

clear wa_final3.

clear v_final2.

v_final2 = wa_final2.

wa_final3-ryear = wa_final2-ryear.

wa_final3-rbukrs = wa_final2-rbukrs.

wa_final3-racct = wa_final2-racct.

wa_final3-rzzps_posid = wa_final2-rzzps_posid.

wa_final3-kostl = wa_final2-kostl.

wa_final3-rtcur = wa_final2-rtcur.

wa_final3-tsl = ( wa_final2-tsl ) * -1. "changes

wa_final3-hsl = ( wa_final2-hsl ) * -1.

wa_final3-ksl = ( wa_final2-ksl ) * -1.

wa_final3-msl = ( wa_final2-msl ) * -1. "changes

  • if ( wa_final2-tsl GT 0 ). "changes

if ( wa_final3-tsl GT 0 ).

wa_final3-bschl = '40'.

else.

wa_final3-bschl = '50'.

endif.

v_balance_t = v_balance_t + wa_final3-tsl. "changes

v_balance_c = v_balance_c + wa_final3-hsl.

v_balance_g = v_balance_g + wa_final3-ksl. "changes

append wa_final3 to i_final3.

endloop.

wa_final3-ryear = wa_final2-ryear.

wa_final3-rbukrs = wa_final2-rbukrs.

  • To read the GL account from the ZFI_ACCT_ASSIGN table for the

  • balancing entry

SELECT single hkont

INTO v_account

FROM zfi_acct_assign

WHERE bukrs EQ p_rbukrs.

if sy-subrc EQ 0.

wa_final3-racct = v_account.

endif.

clear wa_final3-rzzps_posid.

clear wa_final3-kostl.

clear wa_final3-msl.

  • To balance the FI entry add the balancing entry.

if ( v_balance_t GT 0 ).

v_balance_t = ( v_balance_t * -1 ).

v_balance_c = ( v_balance_c * -1 ).

v_balance_g = ( v_balance_g * -1 ).

wa_final3-tsl = v_balance_t.

wa_final3-hsl = v_balance_c.

wa_final3-ksl = v_balance_g.

wa_final3-bschl = '50'.

else.

v_balance_t = ( v_balance_t * -1 ).

v_balance_c = ( v_balance_c * -1 ).

v_balance_g = ( v_balance_g * -1 ).

wa_final3-tsl = v_balance_t.

wa_final3-hsl = v_balance_c.

wa_final3-ksl = v_balance_g.

wa_final3-bschl = '40'.

endif.

wa_final3-rtcur = wa_final2-rtcur.

append wa_final3 to i_final3.

clear wa_final3.

if not i_final3[] is initial.

perform build_catalog2.

perform build_header_comment using i_top_of_page6[] 6.

perform alv_eventtab_build USING i_events wa_c_formname_top_of_page6.

export i_final3 to memory id 'table1'.

perform alv_gui_status5 using i_events.

perform alv_call_back5 using i_events.

perform show_output_fidoc.

endif.

ENDFORM. " simulate_and_display_fi_entry

*&----


*

*& Form build_catalog2

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM build_catalog2.

data: l_pos type i.

clear i_fieldcat2.

l_pos = 1.

add_field2 'RYEAR' l_pos 'Fiscal Year'(002) 'RYEAR' 'zupi5a' '' ''.

add_field2 'RBUKRS' l_pos 'Company Code'(003) 'RBUKRS' 'zupi5a' '' ''.

add_field2 'RACCT' l_pos 'Account Number'(004) 'RACCT' 'zupi5a' '' ''.

add_field2 'RZZPS_POSID' l_pos 'WBS Element'(005) 'RZZPS_POSID'

'zupi5a' '' ''.

add_field2 'KOSTL' l_pos 'Cost Center'(027) 'KOSTL' 'zupi5a' '' ''.

  • add_field2 'RTCUR' l_pos 'Currency'(020) 'RTCUR' 'zupi5a' '' ''.

  • add_field2 'TSL' l_pos 'Amt. Transactn curr.'(021) '' '' '' ''.

add_field2 'HSL' l_pos 'Amt. Co. Cd. currency'(022) '' '' '' ''.

add_field2 'KSL' l_pos 'Amt. Group currency'(023) '' '' '' ''.

add_field2 'BSCHL' l_pos 'Posting Key'(025) 'BSCHL' 'BSEG' '' ''.

add_field2 'MSL' l_pos 'Quantity'(026) '' '' '' ''.

ENDFORM. " build_catalog2

*&----


*

*& Form show_output_fidoc

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_fidoc.

types: begin of ty_fidoc,

ryear like zupi5a-ryear, "Fiscal year

rbukrs like zupi5a-rbukrs, "Company code

racct like zupi5a-racct, "Account number

rzzps_posid like zupi5a-rzzps_posid, "WBS element

bschl like bseg-bschl, "Posting key

wrbtr like bseg-wrbtr,

dmbe2 like bseg-dmbe2,

  • rzzmtit like zupi5a-rzzmtit, "MPM title

  • rzzmfor like zupi5a-rzzmfor, "MPM format

  • rzzmatnr like zupi5a-rzzmatnr, "Material number

  • rzzcou like zupi5a-rzzcou, "Country

  • rzzfow like zupi5a-rzzfow, "Financial owner

  • rzzoow like zupi5a-rzzoow, "Operational owner

  • rzzcon like zupi5a-rzzcon, "Licensee Contract

  • rzzloc like zupi5a-rzzloc, "Licensor Contract

  • kostl like zupi5a-kostl, "Cost center

  • zzfam like zupi5a-zzfam, "Fame Number

  • zzfor like zupi5a-zzfor, "Format

  • zzprd like zupi5a-zzprd, "Product Line

  • zzwin like zupi5a-zzwin, "Window group

  • zzwig like zupi5a-zzwig, "Window

kostl like zupi5a-kostl, "Cost center

rtcur like zupi5a-rtcur, "Currency Key

tsl like zupi5a-tsl, "Amount Transaction currency

hsl like zupi5a-hsl, "Amount Co. code currency

ksl like zupi5a-ksl, "Amount Group currency

msl like zupi5a-msl, "Quantity

end of ty_fidoc.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

data: j_final3 type standard table of ty_fidoc.

ws_repid = sy-repid.

import i_final3 to j_final3 from memory id 'table1'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat2[]

it_events = i_events[]

TABLES

t_outtab = j_final3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_fidoc

*&----


*

*& Form alv_gui_status2

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status2 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET2' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status2

*&----


*

*& Form PF_STATUS_SET2

*&----


*

  • text

*----


*

form pf_status_set2 using t_extab.

set pf-status 'ZFI_RESTMT2'.

endform. " PF_STATUS_SET2

*&----


*

*& Form alv_call_back2

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back2 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND2' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back2

*&----


*

*& Form USER_COMMAND2

*&----


*

  • text

*----


*

form user_command2 using ucomm like sy-ucomm

selfield type slis_selfield.

data: j_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

case ucomm.

when 'CZFI'.

export i_final2 to memory id 'table'.

    • submit zfi_lock_wbs_elements and return.

    • commit work.

import i_final3 to j_final3 from memory id 'table1'.

  • submit z_change_fi_sl and return.

  • commit work.

CALL FUNCTION 'COPF_CALL_TRANSACTION'

EXPORTING

TCODE = 'SM30'

NEW_SESSION = 'X'.

when 'SKIP'.

perform display_secondary_list_3.

  • if not i_final2[] is initial.

  • perform build_header_comment using i_top_of_page4[] 4.

  • perform alv_eventtab_build USING i_events

  • wa_c_formname_top_of_page4 .

  • perform alv_gui_status3 using i_events.

  • perform alv_call_back3 using i_events.

  • perform show_output_rep3.

  • else.

    • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

  • STOP.

  • endif.

endcase.

endform. " USER_COMMAND2

*&----


*

*& Form build_header_comment

*&----


*

  • text

*----


*

  • -->P_I_TOP_OF_PAGE[] text

*----


*

FORM build_header_comment USING p_i_top_of_page TYPE

slis_t_listheader n.

DATA: ws_line TYPE slis_listheader.

case n.

when 1.

clear ws_line.

ws_line-typ = 'H'.

ws_line-key = 'REPORT NAME'.

ws_line-info = 'STEPS TO EXECUTE'.

APPEND ws_line to p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 1 :'.

ws_line-info = 'SUMMARIZE'.

APPEND ws_line to p_i_top_of_page.

when 2.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 2 :'.

ws_line-info = 'LOCK WBS'.

APPEND ws_line to p_i_top_of_page.

when 3.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 3 :'.

ws_line-info = 'CHANGE WBS ELEMENTS IN ZFI_SL'.

APPEND ws_line to p_i_top_of_page.

when 4.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 4 :'.

ws_line-info = 'CHANGE PROFIT CENTER'.

APPEND ws_line to p_i_top_of_page.

when 5.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 5 :'.

ws_line-info = 'SIMULATE FI ENTRY'.

APPEND ws_line to p_i_top_of_page.

when 6.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 6 :'.

ws_line-info = 'FI ENTRY PART 1 CREATE BATCH SESSION'.

APPEND ws_line to p_i_top_of_page.

when 7.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 7 :'.

ws_line-info = 'RESTORE ZFI_SL TABLE'.

APPEND ws_line to p_i_top_of_page.

when 8.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 8 :'.

ws_line-info = 'RESTORE PROFIT CENTER'.

APPEND ws_line to p_i_top_of_page.

when 9.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 9 :'.

ws_line-info = 'SIMULATE FI ENTRY - PART 2'.

APPEND ws_line to p_i_top_of_page.

when 10.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'Step 10 :'.

ws_line-info = 'FI ENTRY - PART 2 CREATE BATCH SESSION'.

APPEND ws_line to p_i_top_of_page.

when 11.

clear p_i_top_of_page.

clear ws_line.

ws_line-typ = 'S'.

ws_line-key = 'STEP 11 :'.

ws_line-info = 'UNLOCK WBS ELEMENTS'.

APPEND ws_line to p_i_top_of_page.

endcase.

ENDFORM. " build_header_comment

*----


*

  • FORM TOP_OF_PAGE2 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE2.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page2[].

ENDFORM. " TOP_OF_PAGE2

*&----


*

*& Form alv_eventtab_build

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

  • -->P_WA_C_FORMNAME_TOP_OF_PAGE text

*----


*

FORM alv_eventtab_build USING p_i_events TYPE slis_t_event

p_wa_c_formname_top_of_page.

data: ls_event type slis_alv_event, idx like sy-tabix.

call function 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = p_i_events.

read table p_i_events with key name = slis_ev_top_of_page

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move p_wa_c_formname_top_of_page to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_eventtab_build

*----


*

  • FORM TOP_OF_PAGE2 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE3.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page3[].

ENDFORM. " TOP_OF_PAGE3

*&----


*

*& Form show_output_rep3

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_rep3.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

ws_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

  • I_STRUCTURE_NAME = itab4

  • i_callback_pf_status_set = 'ZSS_CO' "STANDASPL

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE3'

*

  • i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat[]

it_events = i_events[]

TABLES

t_outtab = i_final2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_rep3

*&----


*

*& Form alv_gui_status3

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status3 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET3' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status3

*&----


*

*& Form PF_STATUS_SET3

*&----


*

  • text

*----


*

form pf_status_set3 using t_extab.

set pf-status 'ZFI_RESTMT3'.

endform. " PF_STATUS_SET3

*&----


*

*& Form alv_call_back3

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back3 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND3' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back3

*&----


*

*& Form USER_COMMAND3

*&----


*

  • text

*----


*

form user_command3 using ucomm like sy-ucomm

selfield type slis_selfield.

data: j_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

case ucomm.

when 'CPCV'.

CALL FUNCTION 'COPF_CALL_TRANSACTION'

EXPORTING

TCODE = 'CJ12'

NEW_SESSION = 'X'.

when 'SKIP'.

perform display_secondary_list_4.

endcase.

endform. " USER_COMMAND3

*----


*

  • FORM TOP_OF_PAGE4 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE4.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page4[].

ENDFORM. " TOP_OF_PAGE4

*&----


*

*& Form show_output_rep4

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_rep4.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

ws_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

  • I_STRUCTURE_NAME = itab4

  • i_callback_pf_status_set = 'ZSS_CO' "STANDASPL

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE4'

*

  • i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat[]

it_events = i_events[]

TABLES

t_outtab = i_final2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_rep4

*&----


*

*& Form display_secondary_list_3

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM display_secondary_list_3.

if not i_final2[] is initial.

perform build_header_comment using i_top_of_page4[] 4.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page4 .

perform alv_gui_status3 using i_events.

perform alv_call_back3 using i_events.

perform show_output_rep3.

else.

  • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

ENDFORM. " display_secondary_list_3

*----


*

  • FORM TOP_OF_PAGE5 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE5.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page5[].

ENDFORM. " TOP_OF_PAGE5

*&----


*

*& Form alv_gui_status4

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status4 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET4' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status4

*&----


*

*& Form PF_STATUS_SET4

*&----


*

  • text

*----


*

form pf_status_set4 using t_extab.

set pf-status 'ZFI_RESTMT4'.

endform. " PF_STATUS_SET4

*&----


*

*& Form alv_call_back4

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back4 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND4' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back4

*&----


*

*& Form USER_COMMAND4

*&----


*

  • text

*----


*

form user_command4 using ucomm like sy-ucomm

selfield type slis_selfield.

data: j_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

case ucomm.

when 'SIMU'.

perform simulate_and_display_fi_entry.

  • message i605.

endcase.

endform. " USER_COMMAND4

*&----


*

*& Form show_output_rep5

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_rep5.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

ws_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

  • I_STRUCTURE_NAME = itab4

  • i_callback_pf_status_set = 'ZSS_CO' "STANDASPL

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE5'

*

  • i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat[]

it_events = i_events[]

TABLES

t_outtab = i_final2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_rep5

*&----


*

*& Form display_secondary_list_4

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM display_secondary_list_4.

if not i_final2[] is initial.

perform build_header_comment using i_top_of_page5[] 5.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page5 .

perform alv_gui_status4 using i_events.

perform alv_call_back4 using i_events.

perform show_output_rep5.

else.

  • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

ENDFORM. " display_secondary_list_4

*&----


*

*& Form alv_gui_status5

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status5 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET5' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status5

*&----


*

*& Form PF_STATUS_SET5

*&----


*

  • text

*----


*

form pf_status_set5 using t_extab.

set pf-status 'ZFI_RESTMT5'.

endform. " PF_STATUS_SET5

*&----


*

*& Form alv_call_back5

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back5 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND5' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back5

*&----


*

*& Form USER_COMMAND5

*&----


*

  • text

*----


*

form user_command5 using ucomm like sy-ucomm

selfield type slis_selfield.

data: k_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

data: v_range(2),

v_NewBatch(10) type c.

CONSTANTS : c_range_obj(10) value 'ZFIRESTATE'.

.

case ucomm.

when 'CRBS'. "Create a Session to be processed Via

"SM35

  • Create a new batch ID every time the program is called.

SELECT SINGLE nrnr

INTO v_range

FROM zfi_bukrs_range

WHERE bukrs = p_rbukrs.

if sy-subrc EQ 0.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = v_range

object = c_range_obj

IMPORTING

number = v_NewBatch

EXCEPTIONS

INTERVAL_NOT_FOUND = 1

NUMBER_RANGE_NOT_INTERN = 2

OBJECT_NOT_FOUND = 3

QUANTITY_IS_0 = 4

QUANTITY_IS_NOT_1 = 5

INTERVAL_OVERFLOW = 6

BUFFER_OVERFLOW = 7

OTHERS = 8.

endif.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

condense v_NewBatch.

ENDIF.

EXPORT v_NewBatch TO MEMORY ID 'bid'.

  • Populate the entries into Zfi_restatmt table.

loop at i_final2 into wa_final2.

perform update_ref_table.

endloop.

commit work.

  • Populate the entries into zfirestate_log.

loop at i_final1 into wa_final1.

perform update_ref_table1.

endloop.

commit work.

*

import i_final3 to k_final3 from memory id 'table1'.

  • Delete all the entries whose transaction currency is 0.00

  • delete k_final3 where tsl EQ 0.

perform create_session using k_final3.

message i010.

if not k_final3[] is initial.

perform build_catalog2.

perform build_header_comment using i_top_of_page7[] 7.

perform alv_eventtab_build

USING i_events wa_c_formname_top_of_page7.

export k_final3 to memory id 'table2'.

perform alv_gui_status6 using i_events.

perform alv_call_back6 using i_events.

perform show_output_fidoc1.

endif.

  • message i605.

endcase.

endform. " USER_COMMAND5

*----


*

  • FORM TOP_OF_PAGE2 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE6.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page6[].

ENDFORM. " TOP_OF_PAGE6

*&----


*

*& Form create_session

*&----


*

  • text

*----


*

  • -->P_I_FINAL3 text

*----


*

FORM create_session USING P_I_FINAL3.

data : l_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

data : flag type c,

flag1 type c,

v_NewBatch(12) type c.

l_final3 = p_i_final3.

  • Amounts converted to positive values since BDC accepts only positive

  • values

loop at l_final3 into wa_final3.

clear flag.

IF ( wa_final3-tsl LT 0 ).

wa_final3-tsl = wa_final3-tsl * -1.

flag = 'X'.

ENDIF.

IF ( wa_final3-hsl LT 0 ).

wa_final3-hsl = wa_final3-hsl * -1.

flag = 'X'.

ENDIF.

IF ( wa_final3-ksl LT 0 ).

wa_final3-ksl = wa_final3-ksl * -1.

flag = 'X'.

ENDIF.

IF ( wa_final3-msl LT 0 ).

wa_final3-msl = wa_final3-msl * -1.

flag = 'X'.

ENDIF.

IF flag EQ 'X'.

  • MODIFY TABLE l_final3 from wa_final3

  • TRANSPORTING tsl hsl ksl msl.

MODIFY l_final3 from wa_final3 index sy-tabix

TRANSPORTING tsl hsl ksl msl.

ENDIF.

endloop.

  • Open the temp file to be used by BTCI

perform open_fileout.

PERFORM f_fill_bgr00.

read table l_final3 into wa_final3 index 1.

if sy-subrc EQ 0.

PERFORM f_fill_bbkpf using wa_final3.

endif.

PERFORM f_fill_bbseg using l_final3.

CLOSE DATASET p_filout.

  • clear flag1.

*

  • PERFORM check_if_batch_processed changing flag1.

*

  • IMPORT v_NewBatch FROM MEMORY ID 'bid'.

  • if flag1 = 'X'.

  • message E006 with v_NewBatch.

  • else.

PERFORM f_btci.

  • endif.

ENDFORM. " create_session

*&----


*

*& Form f_fill_bgr00

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_fill_bgr00.

*TABLE 1:BGR00

*Fill BGROO

bgr00-stype = c_zero.

bgr00-group = p_batch.

bgr00-mandt = sy-mandt.

bgr00-usnam = sy-uname.

bgr00-start = space.

bgr00-xkeep = c_x.

bgr00-nodata = c_nodata.

TRANSFER bgr00 TO p_filout.

ENDFORM. " f_fill_bgr00

*&----


*

*& Form open_fileout

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM open_fileout.

  • open the temporary file to be used by RFBIBL00.

open dataset p_filout for output in text mode.

ENDFORM. " open_fileout

*&----


*

*& Form f_fill_bbkpf

*&----


*

  • text

*----


*

  • -->P_WA_FINAL3 text

*----


*

FORM f_fill_bbkpf USING P_WA_FINAL3 type ty_fidoc.

data: v_date(8) type c,

v_NewBatch(12) type c,

v_BatchId(12) type c,

v_BatchId1(12) type c.

CLEAR w_first.

data p_rtcur type waers.

  • statics n type n value 0.

*

  • n = n + 1.

statics n type n.

if sy-pfkey+10(1) = 5.

n = 1.

elseif sy-pfkey+10(1) = 9.

n = 2.

endif.

  • n = 2 * n - 1.

  • GET PARAMETER ID 'bid' FIELD v_NewBatch.

IMPORT v_NewBatch FROM MEMORY ID 'bid'.

concatenate n v_NewBatch into v_NewBatch.

move v_NewBatch to v_BatchId.

  • move v_NewBatch to v_BatchId1."for function module

  • SET PARAMETER ID 'bid1' FIELD v_BatchId1. "for function module

EXPORT v_BatchId to MEMORY ID 'newbid'.

*Initialise header structure BKPF with NODATA /

PERFORM initialization USING bbkpf.

bbkpf-stype = 1.

bbkpf-tcode = c_fb01.

perform reformat_date using p_bldat

changing v_date.

MOVE v_date TO bbkpf-bldat.

MOVE p_blart TO bbkpf-blart.

MOVE p_wa_final3-rbukrs TO bbkpf-bukrs.

clear v_date.

perform reformat_date using p_budat

changing v_date.

MOVE v_date TO bbkpf-budat.

if not bbkpf-bukrs is initial.

select single waers

from t001 into p_rtcur

where bukrs eq bbkpf-bukrs.

if not p_rtcur is initial.

MOVE p_rtcur TO bbkpf-waers.

endif.

endif.

  • MOVE p_wa_final3-rtcur TO bbkpf-waers.

  • MOVE 'Short text' TO bbkpf-bktxt.

MOVE v_NewBatch TO bbkpf-bktxt.

MOVE p_monat TO bbkpf-monat.

if v_NewBatch(1) eq '1'.

move'1' to bbkpf-xblnr.

else.

move '2' to bbkpf-xblnr.

endif.

TRANSFER bbkpf TO p_filout.

ENDFORM. " f_fill_bbkpf

*&----


*

*& Form initialization

*&----


*

  • text

*----


*

  • -->P_BBKPF text

*----


*

FORM initialization USING P_BBKPF.

DATA: l_champs TYPE i.

MOVE 0 TO l_champs.

DO.

ADD 1 TO l_champs.

ASSIGN COMPONENT l_champs OF STRUCTURE p_bbkpf TO .

ENDDO.

ENDFORM. " initialization

*&----


*

*& Form set_defaults_parms

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM set_defaults_parms.

select single paramvalue into v_paramvalue from zwfm_control_tab

where progid = sy-repid

and proginst = '001'

and paramname = 'BLART'

and paraminst = '001'

and active = 'X'.

if sy-subrc = 0.

p_blart = v_paramvalue.

endif.

clear v_paramvalue.

ENDFORM. " set_defaults_parms

*&----


*

*& Form set_screen_attributes

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM set_screen_attributes.

loop at screen.

case screen-name.

when 'P_RLDNR'.

screen-input = 0.

when 'P_RRCTY'.

screen-input = 0.

when 'P_RVERS'.

screen-input = 0.

when 'P_BLART'.

screen-input = 0.

endcase.

modify screen.

endloop.

ENDFORM. " set_screen_attributes

*&----


*

*& Form f_fill_bbseg

*&----


*

  • text

*----


*

  • -->P_L_FINAL3 text

*----


*

FORM f_fill_bbseg USING P_L_FINAL3.

DATA: wa_bbseg type ty_fidoc,

m_final3 type standard table of ty_fidoc.

data: v_rtcur like t001-waers.

m_final3 = p_l_final3.

select single waers

into v_rtcur from t001

where bukrs = p_rbukrs.

LOOP AT m_final3 into wa_bbseg.

*Initialise item structure BBSEG with NODATA /

PERFORM initialization USING bbseg.

bbseg-stype = '2'.

bbseg-tbnam = 'BBSEG'.

bbseg-newbs = wa_bbseg-bschl.

bbseg-newko = wa_bbseg-racct.

IF wa_bbseg-hsl NE space.

WRITE wa_bbseg-hsl to bbseg-wrbtr CURRENCY wa_bbseg-rtcur.

ENDIF.

  • IF wa_bbseg-ksl NE space.

  • WRITE wa_bbseg-ksl to bbseg-dmbe2 CURRENCY 'USD'.

  • ENDIF.

IF wa_bbseg-ksl NE space and v_rtcur NE 'USD'.

WRITE wa_bbseg-ksl to bbseg-dmbe2 CURRENCY 'USD'.

ENDIF.

IF wa_bbseg-kostl NE space.

MOVE wa_bbseg-kostl TO bbseg-kostl.

ENDIF.

SET PARAMETER ID 'CURID' FIELD wa_bbseg-rtcur.

MOVE 'test' TO bbseg-sgtxt.

IF wa_bbseg-rzzps_posid NE space.

MOVE wa_bbseg-rzzps_posid TO bbseg-projk.

ENDIF.

MOVE wa_bbseg-msl TO bbseg-menge.

MOVE 'EA' TO bbseg-meins.

TRANSFER bbseg TO p_filout.

w_num = w_num + 1.

IF wa_bbseg-bschl EQ c_40.

    • w_wrbtr = w_wrbtr .

    • w_wrbtr = w_wrbtr + wa_bbseg-bschl.

w_wrbtr = w_wrbtr + wa_bbseg-hsl.

w1_dmbe2 = w1_dmbe2 + wa_bbseg-ksl.

ELSEIF wa_bbseg-bschl EQ c_50.

    • w_wrbtr = w_wrbtr - wa_bbseg-bschl.

w_wrbtr = w_wrbtr - wa_bbseg-hsl.

w1_dmbe2 = w1_dmbe2 - wa_bbseg-ksl.

ENDIF.

  • IF wa_bbseg-bschl EQ c_40.

    • w1_dmbe2 = w1_dmbe2 + wa_bbseg-dmbe2.

    • ELSE.

    • w1_dmbe2 = w1_dmbe2 - wa_bbseg-dmbe2.

    • ENDIF.

**

  • w1_dmbe2 = wa_bbseg-dmbe2.

  • ELSE.

  • w1_dmbe2 = -1 * wa_bbseg-dmbe2.

  • ENDIF.

IF w_num > p_max.

PERFORM f_end_bal_entry.

PERFORM f_fill_bbkpf using wa_bbseg.

PERFORM f_start_bal_entry.

MOVE 'X' TO w_first.

w_num = 0.

ENDIF.

ENDLOOP.

ENDFORM. " f_fill_bbseg

*&----


*

*& Form f_decimals

*&----


*

  • text

*----


*

  • -->P_WA_BBSEG_MSL text

*----


*

FORM f_decimals CHANGING P_WA_BBSEG_MSL.

ENDFORM. " f_decimals

*&----


*

*& Form f_end_bal_entry

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_end_bal_entry.

DATA: v_currkey type ty_fidoc-rtcur,

v_offsetacct like zfi_offset_acct-offacct.

data: v_rtcur like t001-waers.

select single waers

into v_rtcur from t001

where bukrs = p_rbukrs.

PERFORM initialization USING bbseg.

bbseg-stype = '2'.

bbseg-tbnam = 'BBSEG'.

IF w_wrbtr > 0.

bbseg-newbs = c_50.

ELSE.

bbseg-newbs = c_40.

ENDIF.

IF w_wrbtr < 0.

w_wrbtr2 = w_wrbtr * -1.

  • w2_dmbe2 = w1_dmbe2 * -1.

ELSE.

w_wrbtr2 = w_wrbtr.

  • w2_dmbe2 = w1_dmbe2.

ENDIF.

  • IF w1_dmbe2 > 0.

  • bbseg-newbs = c_50.

  • ELSE.

  • bbseg-newbs = c_40.

  • ENDIF.

*

IF w1_dmbe2 < 0.

w2_dmbe2 = w1_dmbe2 * -1.

ELSE.

w2_dmbe2 = w1_dmbe2.

ENDIF.

GET PARAMETER ID 'CURID' FIELD v_currkey.

WRITE w_wrbtr2 TO bbseg-wrbtr CURRENCY v_currkey.

IF w2_dmbe2 NE space and v_rtcur NE 'USD'.

WRITE w2_dmbe2 TO bbseg-dmbe2 CURRENCY 'USD'.

endif.

SELECT single offacct

INTO v_offsetacct

FROM zfi_offset_acct

WHERE bukrs EQ p_rbukrs.

bbseg-newko = v_offsetacct.

bbseg-sgtxt = 'OFFSET LINE'.

TRANSFER bbseg TO p_filout.

ENDFORM. " f_end_bal_entry

*&----


*

*& Form f_start_bal_entry

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_start_bal_entry.

DATA: v_currkey type ty_fidoc-rtcur,

v_offsetacct like zfi_offset_acct-offacct.

data: v_rtcur like t001-waers.

select single waers

into v_rtcur from t001

where bukrs = p_rbukrs.

PERFORM initialization USING bbseg.

bbseg-stype = '2'.

bbseg-tbnam = 'BBSEG'.

IF w_wrbtr > 0.

bbseg-newbs = c_40.

ELSE.

bbseg-newbs = c_50.

ENDIF.

IF w_wrbtr < 0.

w_wrbtr2 = w_wrbtr * -1.

  • w2_dmbe2 = w1_dmbe2 * -1.

ELSE.

w_wrbtr2 = w_wrbtr.

ENDIF.

  • IF w1_dmbe2 > 0.

  • bbseg-newbs = c_40.

  • ELSE.

  • bbseg-newbs = c_50.

  • ENDIF.

*

IF w1_dmbe2 < 0.

w2_dmbe2 = w1_dmbe2 * -1.

ELSE.

w2_dmbe2 = w1_dmbe2.

ENDIF.

GET PARAMETER ID 'CURID' FIELD v_currkey.

WRITE w_wrbtr2 TO bbseg-wrbtr CURRENCY v_currkey.

IF w2_dmbe2 NE space and v_rtcur NE 'USD'.

WRITE w2_dmbe2 TO bbseg-dmbe2 CURRENCY 'USD'.

endif.

SELECT single offacct

INTO v_offsetacct

FROM zfi_offset_acct

WHERE bukrs EQ p_rbukrs.

bbseg-newko = v_offsetacct.

bbseg-sgtxt = 'OFFSET LINE'.

TRANSFER bbseg TO p_filout.

ENDFORM. " f_start_bal_entry

*&----


*

*& Form f_btci

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM f_btci.

*submit SAP BDC create program for execution via SM35

SUBMIT rfbibl00 AND RETURN USER sy-uname

WITH ds_name EQ p_filout

WITH fl_check EQ ' '

WITH startdate EQ sy-datum

WITH callmode EQ p_mode

WITH max_comm EQ '1000'

WITH pa_xprot EQ c_x

WITH xinf EQ c_x.

  • WITH xlog = c_x.

ENDFORM. " f_btci

*&----


*

*& Form reformat_date

*&----


*

  • text

*----


*

  • <--P_P_BLDAT text

*----


*

FORM reformat_date USING P_DAT

CHANGING v_dat.

DATA : l_date(8) type c.

*yyyymmdd

CONCATENATE p_dat6(2) p_dat4(2) p_dat(4) into

l_date.

CONDENSE l_date NO-GAPS.

MOVE l_date TO v_dat.

ENDFORM. " reformat_date

*&----


*

*& Form display_secondary_list_5

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM display_secondary_list_5.

ENDFORM. " display_secondary_list_5

*&----


*

*& Form alv_gui_status6

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status6 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET6' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status6

*&----


*

*& Form PF_STATUS_SET5

*&----


*

  • text

*----


*

form pf_status_set6 using t_extab.

set pf-status 'ZFI_RESTMT6'.

endform. " PF_STATUS_SET6

*&----


*

*& Form alv_call_back6

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back6 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND6' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back6

*&----


*

*& Form USER_COMMAND6

*&----


*

  • text

*----


*

form user_command6 using ucomm like sy-ucomm

selfield type slis_selfield.

data: k_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

data: v_NewBatch(12) type c,

flag1 type c.

case ucomm.

when 'RZFI'. "Restore ZFI_SL table

clear flag1.

PERFORM check_if_batch_processed changing flag1.

IMPORT v_NewBatch FROM MEMORY ID 'bid'.

if flag1 = 'X'.

message E006 with v_NewBatch.

else.

CALL FUNCTION 'COPF_CALL_TRANSACTION'

EXPORTING

TCODE = 'SM30'

NEW_SESSION = 'X'.

  • message i605.

endif.

when 'SKIP'.

clear flag1.

PERFORM check_if_batch_processed changing flag1.

IMPORT v_NewBatch FROM MEMORY ID 'bid'.

if flag1 = 'X'.

message E006 with v_NewBatch.

else.

perform display_secondary_list_7.

endif.

endcase.

endform. " USER_COMMAND6

*----


*

  • FORM TOP_OF_PAGE7 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE7.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page7[].

ENDFORM. " TOP_OF_PAGE7

*&----


*

*& Form show_output_fidoc1

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_fidoc1.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

data: j_final3 type standard table of ty_fidoc.

ws_repid = sy-repid.

import k_final3 to j_final3 from memory id 'table2'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat2[]

it_events = i_events[]

TABLES

t_outtab = j_final3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_fidoc1

*&----


*

*& Form display_secondary_list_7

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM display_secondary_list_7.

data: m_final3 type standard table of ty_fidoc.

import k_final3 to m_final3 from memory id 'table2'.

if not m_final3[] is initial.

perform build_header_comment using i_top_of_page8[] 8.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page8 .

perform alv_gui_status7 using i_events.

perform alv_call_back7 using i_events.

perform show_output_fidoc2.

else.

  • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

ENDFORM. " display_secondary_list_7

*&----


*

*& Form alv_gui_status7

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status7 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET7' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status7

*&----


*

*& Form PF_STATUS_SET7

*&----


*

  • text

*----


*

form pf_status_set7 using t_extab.

set pf-status 'ZFI_RESTMT7'.

endform. " PF_STATUS_SET7

*&----


*

*& Form alv_call_back7

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back7 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND7' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back7

*&----


*

*& Form USER_COMMAND7

*&----


*

  • text

*----


*

form user_command7 using ucomm like sy-ucomm

selfield type slis_selfield.

data: k_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

case ucomm.

when 'RPCV'. "Restore profit center value

CALL FUNCTION 'COPF_CALL_TRANSACTION'

EXPORTING

TCODE = 'CJ12'

NEW_SESSION = 'X'.

  • message i605.

when 'SKIP'.

perform display_secondary_list_8.

endcase.

endform. " USER_COMMAND6

*----


*

  • FORM TOP_OF_PAGE8 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE8.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page8[].

ENDFORM. " TOP_OF_PAGE8

*&----


*

*& Form show_output_fidoc2

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_fidoc2.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

data: j_final3 type standard table of ty_fidoc.

ws_repid = sy-repid.

import k_final3 to j_final3 from memory id 'table2'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat2[]

it_events = i_events[]

TABLES

t_outtab = j_final3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_fidoc2

*&----


*

*& Form display_secondary_list_8

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM display_secondary_list_8.

data: n_final3 type standard table of ty_fidoc.

import k_final3 to n_final3 from memory id 'table2'.

if not n_final3[] is initial.

perform build_header_comment using i_top_of_page9[] 9.

perform alv_eventtab_build USING i_events

wa_c_formname_top_of_page9 .

perform alv_gui_status8 using i_events.

perform alv_call_back8 using i_events.

perform show_output_fidoc2.

else.

  • MESSAGE I001. "NO DATA FOUND FOR THE SELECTION

STOP.

endif.

ENDFORM. " display_secondary_list_8

*&----


*

*& Form alv_gui_status8

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status8 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET8' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status8

*&----


*

*& Form PF_STATUS_SET8

*&----


*

  • text

*----


*

form pf_status_set8 using t_extab.

set pf-status 'ZFI_RESTMT8'.

endform. " PF_STATUS_SET8

*&----


*

*& Form alv_call_back8

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back8 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND8' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back8

*&----


*

*& Form USER_COMMAND8

*&----


*

  • text

*----


*

form user_command8 using ucomm like sy-ucomm

selfield type slis_selfield.

data: k_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

case ucomm.

when 'RSFI'. "Simulate FI entry - part 2

perform simulate_and_display_fi_entry2.

  • message i605.

endcase.

endform. " USER_COMMAND8

*----


*

  • FORM TOP_OF_PAGE9 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE9.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page9[].

ENDFORM. " TOP_OF_PAGE9

*&----


*

*& Form simulate_and_display_fi_entry2

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM simulate_and_display_fi_entry2.

data: o_final3 type standard table of ty_fidoc,

p_final3 type standard table of ty_fidoc.

data: wa_final3 type ty_fidoc,

wa1_final3 type ty_fidoc.

import k_final3 to o_final3 from memory id 'table2'.

loop at o_final3 into wa_final3.

clear wa1_final3.

wa1_final3-ryear = wa_final3-ryear.

wa1_final3-rbukrs = wa_final3-rbukrs.

wa1_final3-racct = wa_final3-racct.

wa1_final3-rzzps_posid = wa_final3-rzzps_posid.

wa1_final3-kostl = wa_final3-kostl.

wa1_final3-rtcur = wa_final3-rtcur.

wa1_final3-tsl = ( wa_final3-tsl ) * -1.

wa1_final3-hsl = ( wa_final3-hsl ) * -1.

wa1_final3-ksl = ( wa_final3-ksl ) * -1.

wa1_final3-msl = ( wa_final3-msl ) * -1.

IF ( wa_final3-bschl EQ '40' ).

wa1_final3-bschl = '50'.

ELSEIF ( wa_final3-bschl EQ '50' ).

wa1_final3-bschl = '40'.

ENDIF.

append wa1_final3 to p_final3.

endloop.

if not p_final3[] is initial.

perform build_catalog2.

perform build_header_comment using i_top_of_page10[] 10.

perform alv_eventtab_build USING i_events wa_c_formname_top_of_page10.

export p_final3 to memory id 'table3'.

perform alv_gui_status9 using i_events.

perform alv_call_back9 using i_events.

perform show_output_fidoc3.

endif.

ENDFORM. " simulate_and_display_fi_entry2

*&----


*

*& Form alv_gui_status9

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status9 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET9' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status9

*&----


*

*& Form PF_STATUS_SET8

*&----


*

  • text

*----


*

form pf_status_set9 using t_extab.

set pf-status 'ZFI_RESTMT9'.

endform. " PF_STATUS_SET8

*&----


*

*& Form alv_call_back9

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back9 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND9' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back9

*&----


*

*& Form USER_COMMAND9

*&----


*

  • text

*----


*

form user_command9 using ucomm like sy-ucomm

selfield type slis_selfield.

data: r_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

case ucomm.

when 'CRBS2'. "Create Batch session - part 2

import p_final3 to r_final3 from memory id 'table3'.

clear w_num.

perform create_session using r_final3.

message i010.

if not r_final3[] is initial.

perform build_catalog2.

perform build_header_comment using i_top_of_page11[] 11.

perform alv_eventtab_build

USING i_events wa_c_formname_top_of_page11.

export r_final3 to memory id 'table4'.

perform alv_gui_status10 using i_events.

perform alv_call_back10 using i_events.

perform show_output_fidoc3.

endif.

endcase.

endform. " USER_COMMAND8

*----


*

  • FORM TOP_OF_PAGE10 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE10.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page10[].

ENDFORM. " TOP_OF_PAGE10

*&----


*

*& Form show_output_fidoc3

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM show_output_fidoc3.

DATA: ws_repid LIKE sy-repid.

DATA: ws_filter TYPE slis_t_filter_alv.

data: q_final3 type standard table of ty_fidoc.

ws_repid = sy-repid.

import p_final3 to q_final3 from memory id 'table3'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_repid

i_callback_user_command = 'USER_COMMAND'

i_save = 'X'

it_fieldcat = i_fieldcat2[]

it_events = i_events[]

TABLES

t_outtab = q_final3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " show_output_fidoc3

*&----


*

*& Form alv_gui_status10

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_gui_status10 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'PF_STATUS_SET'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'PF_STATUS_SET10' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_gui_status10

*&----


*

*& Form PF_STATUS_SET10

*&----


*

  • text

*----


*

form pf_status_set10 using t_extab.

set pf-status 'ZFI_RESTMT10'.

endform. " PF_STATUS_SET10

*&----


*

*& Form alv_call_back10

*&----


*

  • text

*----


*

  • -->P_I_EVENTS text

*----


*

FORM alv_call_back10 USING p_i_events type slis_t_event.

data: ls_event type slis_alv_event,

idx like sy-tabix.

read table p_i_events with key name = 'USER_COMMAND'

into ls_event.

idx = sy-tabix.

if sy-subrc = 0.

move 'USER_COMMAND10' to ls_event-form.

modify p_i_events from ls_event index idx transporting form.

endif.

ENDFORM. " alv_call_back10

*&----


*

*& Form USER_COMMAND10

*&----


*

  • text

*----


*

form user_command10 using ucomm like sy-ucomm

selfield type slis_selfield.

data: k_final3 type standard table of ty_fidoc,

wa_final3 type ty_fidoc.

data: v_NewBatch(12) type c,

flag2 type c.

case ucomm.

when 'UWBS'. "Unlock WBS elements

clear flag2.

perform check_if_batch2_processed changing flag2.

IMPORT v_NewBatch FROM MEMORY ID 'bid'.

if flag2 = 'X'.

message E012 with v_NewBatch.

else.

submit zfi_unlock_wbs_elements and return.

commit work.

message i003.

message a004.

endif.

endcase.

endform. " USER_COMMAND6

*----


*

  • FORM TOP_OF_PAGE11 *

*----


*

  • ........ *

*----


*

FORM TOP_OF_PAGE11.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'BACKGROUND'

IT_LIST_COMMENTARY = i_top_of_page11[].

ENDFORM. " TOP_OF_PAGE11

*&----


*

*& Form update_ref_table

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM update_ref_table.

DATA: v_NewBatch(10) type c.

STATICS v_cnt(5) type n.

clear zfi_restatmt.

  • GET PARAMETER ID 'bid' FIELD v_NewBatch.

IMPORT v_NewBatch FROM MEMORY ID 'bid'.

  • collect wa_final into i_final.

v_cnt = v_cnt + 1.

move wa_final2-ryear to zfi_restatmt-ryear.

move v_cnt to zfi_restatmt-cnt.

move wa_final2-rbukrs to zfi_restatmt-rbukrs.

  • move wa_final-racct to zfi_restatmt-racct.

move wa_final2-rzzps_posid to zfi_restatmt-rzzps_posid.

move wa_final2-rzzmtit to zfi_restatmt-rzzmtit.

move wa_final2-rzzmfor to zfi_restatmt-rzzmfor.

move wa_final2-rzzmatnr to zfi_restatmt-rzzmatnr.

move wa_final2-rzzcou to zfi_restatmt-rzzcou.

move wa_final2-rzzfow to zfi_restatmt-rzzfow.

move wa_final2-rzzoow to zfi_restatmt-rzzoow.

move wa_final2-rzzcon to zfi_restatmt-rzzcon.

move wa_final2-rzzloc to zfi_restatmt-rzzloc.

move wa_final2-kostl to zfi_restatmt-kostl.

move wa_final2-zzfam to zfi_restatmt-zzfam.

move wa_final2-zzfor to zfi_restatmt-zzfor.

move wa_final2-zzprd to zfi_restatmt-zzprd.

move wa_final2-zzwin to zfi_restatmt-zzwin.

move wa_final2-zzwig to zfi_restatmt-zzwig.

move wa_final2-rtcur to zfi_restatmt-rtcur.

*move i_final-runit to zfi_restatmt-runit.

move wa_final2-tsl to zfi_restatmt-tsl.

move wa_final2-hsl to zfi_restatmt-hsl.

move wa_final2-ksl to zfi_restatmt-ksl.

move wa_final2-msl to zfi_restatmt-msl.

move v_NewBatch to zfi_restatmt-batchid.

move s_rpmax-low to zfi_restatmt-from_period.

move s_rpmax-high to zfi_restatmt-to_period.

move s_racct-low to zfi_restatmt-from_acct.

move s_racct-high to zfi_restatmt-to_acct.

insert zfi_restatmt.

clear wa_final2.

ENDFORM. " update_ref_table

**&----

-


**

**& Form check_if_batch_processed

**&----

-


**

    • text

**----

-


**

    • --> p1 text

    • <-- p2 text

**----

-


**

*FORM check_if_batch_processed.

*

*DATA: v_BatchId(12) type c,

  • t_BatchId1(10) type c,

  • t_BatchId2(10) type c.

*

*

  • IMPORT v_BatchId FROM MEMORY ID 'newbid'.

*

  • IF v_BatchId(1) EQ '1'.

  • continue.

  • ELSE.

  • t_BatchId1 = v_BatchId+1(10).

*

  • select single batchid into t_BatchId2

  • from zbatch_log

  • where batchid EQ t_BatchId1.

*

  • if sy-subrc EQ 0.

  • continue.

  • else.

*

  • endif.

*

  • ENDIF.

*

*ENDFORM. " check_if_batch_processed

*&----

-


*

*& Form check_if_batch_processed

*&----

-


*

  • text

*----

-


*

  • <--P_FLAG text

*----

-


FORM check_if_batch_processed CHANGING P_FLAG.

DATA: v_BatchId(12) type c,

t_BatchId1(12) type c,

t_BatchId2(12) type c.

IMPORT v_BatchId FROM MEMORY ID 'newbid'.

IF v_BatchId(1) EQ '1'.

  • exit.

  • ELSE.

t_BatchId1 = v_BatchId+1(10).

select single batchid into t_BatchId2

from zbatch_log

where batchid EQ t_BatchId1.

if sy-subrc EQ 0.

exit.

else.

p_flag = 'X'.

endif.

ENDIF.

ENDFORM. " check_if_batch_processed

**&----

-


**

**& Form set_defaults_curr

**&----

-


**

    • text

**----

-


**

    • --> p1 text

    • <-- p2 text

**----

-


*

*FORM set_defaults_curr.

*

**data: v_rtcur like t001-waers.

*

*select single waers into v_rtcur from t001 where bukrs = p_rbukrs.

*

  • if sy-subrc = 0.

  • p_rtcur = v_rtcur.

  • endif.

*

*clear p_rtcur.

*

*ENDFORM. " set_defaults_curr

*&----


*

*& Form update_ref_table1

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM update_ref_table1.

DATA: v_NewBatch(10) type c.

STATICS v_cnt(5) type n.

clear zfirestate_log.

  • GET PARAMETER ID 'bid' FIELD v_NewBatch.

IMPORT v_NewBatch FROM MEMORY ID 'bid'.

v_cnt = v_cnt + 1.

move v_cnt to zfirestate_log-cnt.

move wa_final1-ryear to zfirestate_log-ryear.

move wa_final1-rbukrs to zfirestate_log-rbukrs.

move wa_final1-rzzps_posid to zfirestate_log-rzzps_posid.

move v_NewBatch to zfirestate_log-batchid.

move s_rpmax-low to zfirestate_log-from_period.

move s_rpmax-high to zfirestate_log-to_period.

move s_racct-low to zfirestate_log-from_acct.

move s_racct-high to zfirestate_log-to_acct.

insert zfirestate_log.

clear wa_final1.

ENDFORM. " update_ref_table1

*&----


*

*& Form populate_final1_table

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM populate_final1_table.

DELETE ADJACENT DUPLICATES FROM i_final1 COMPARING ALL FIELDS.

loop at i_data2 into wa_data2.

wa_final1-ryear = wa_data2-ryear.

wa_final1-rbukrs = wa_data2-rbukrs.

wa_final1-racct = wa_data2-racct.

wa_final1-rzzps_posid = wa_data2-rzzps_posid.

append wa_final1 to i_final1.

clear : wa_final1-ryear,

wa_final1-rbukrs,

wa_final-racct,

wa_final1-rzzps_posid.

endloop.

ENDFORM. " populate_final1_table

*&----


*

*& Form get_data1

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM get_data1.

********JAGANV

*select ryear rbukrs racct rzzps_posid

  • from zupi5a

  • into table i_data2

  • where ryear = p_ryear

  • and POPER in s_rpmax

  • and rbukrs = p_rbukrs

  • and racct in s_racct

  • and rzzps_posid in s_rzzps.

i_data2[] = i_data[].

********JAGANV

sort i_data2 by rzzps_posid.

delete adjacent duplicates from i_data2 comparing rzzps_posid.

ENDFORM. " get_data1

*&----


*

*& Form check_if_batch2_processed

*&----


*

  • text

*----


*

  • <--P_FLAG2 text

*----


*

FORM check_if_batch2_processed CHANGING P_FLAG2.

DATA: v_BatchId(12) type c,

t1_BatchId1(12) type c,

t1_BatchId2(12) type c.

IMPORT v_BatchId FROM MEMORY ID 'newbid'.

IF v_BatchId(1) EQ '2'.

  • exit.

  • ELSE.

t1_BatchId1 = v_BatchId+1(10).

select single batchid1 into t1_BatchId2

from zbatch_log1

where batchid1 EQ t1_BatchId1.

if sy-subrc EQ 0.

exit.

else.

p_flag2 = 'X'.

endif.

ENDIF.

ENDFORM. " check_if_batch2_processed

*&----

-


*

*& Form check_rzzps

*&----

-


*

  • text

*----

-


*

  • --> p1 text

  • <-- p2 text

*----

-


*

FORM check_rzzps.

data v_usr00 like PRPS-USR00.

loop at s_rzzps.

  • If not s_rzzps-low is initial.

if s_rzzps-low+0(1) = 'T'.

Elseif s_rzzps-low+0(1) = 'C'.

Select single usr00 into v_usr00

from PRPS where POSID = s_rzzps-low.

if v_usr00 is initial." and sy-subrc NE 0.

MESSAGE e013 .

endif.

endif.

*endif.

endloop.

ENDFORM. " check_rzzps