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: 

submit and return

Former Member
0 Kudos
702

Hi All,

I am using submit and return to call a transaction by passing select-options. It is calling the transaction with the passed values. My problem is if i am using back button (F3) then it is going to selection screen of the called transaction. I want to go back to the last screen not to selection screen. Please help me.

Thanks & Regards,

praveena.

7 REPLIES 7

sreeramkumar_madisetty
Active Contributor
0 Kudos
184

Hi

Can you attach the code so that we can know where control is going wrongly.

regards,

kumar

Former Member
0 Kudos
184

as per my knowledge submit and return will come back to the cursor position from where it has been triggered....Just paste the code and we can let u know...

Former Member
0 Kudos
184

Hi All,

I attached my code but its very lengthy. In PERFORM listausgabe_bestand.

i am calling the transactionand that perform is in User-command. Please help me.

Thanking you,

praveena.

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

  • REPORT RM07MBST (Transaktionscode MB5L) *

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

  • Bestandswertliste: Saldendarstellung *

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

  • November 2005 MS "n897018

  • When you are selecting previous period/year and then go "n897018

  • from MB5L to MMBE, a message appears, that says, that "n897018

  • MMBE shows actual inventory "n897018

  • May 2005 TW "843776

  • color in detail view could be switched off to avoid "843776

  • runtime error "843776

  • July 2004 MM "n760405

  • Total valuated stock at sales price for pervious period "n760405

  • and previous year filled incorretly "n760405

  • March 2004 MM

  • field vbeln filled incorretly "n711749

  • June 2003 MM "n631251

  • improve handling when G/L account is missing "n631251

  • Sept 2002 MM "n555246

  • log function tax auditor "n555246

  • June 6th, 2002 MM "n525339

  • MB5L : jump to detail list incorrect when cursor is not "n525339

  • on a line with a stock account "n525339

  • no more use of include RM07MSQL "n525339

  • check entry for valuation area improved "n525339

  • Feb. 28th 2002 MM "n497391

  • MB5L : consider valuated subcontractor stocks "n497391

  • warning M7 375 after selections for material "n497391

  • extend field definition of sum fields "n497391

  • no details possible for function sums only "n497391

  • MB5L : consider special periods "n460469

  • separate time depending authorization for tax auditor "n486477

*----


*

  • process material short text as a hidden field "n407181

*----


*

INCLUDE: rm07mbsd, " reportspezifische Datendefinitionen

mm07mabc, " Variablen zum Zeichensatz

rm07musr, " Tastenbelegungen und Transkationen

rm07mend. " Anforderungsbild und Enderoutine

  • Start of addition by os0800

TABLES: s031,

mkpf.

DATA: g_invgrp(3) TYPE c, " Inventory group

g_singrp(6) TYPE c, " Sub Inventory group

g_dingrp(9) TYPE c. " Detail Inventory Group

DATA: v_year TYPE t009b-bdatj, " Posting date YYYY

v_year1 TYPE t009b-bdatj, " Posting date YYYY

v_period TYPE t009b-poper, " Posting period

v_period1 TYPE t009b-poper, " Posting period

v_first_date TYPE sy-datum,

v_last_date TYPE sy-datum,

v_first_date1 TYPE sy-datum,

v_last_date1 TYPE sy-datum.

  • End of addition by os0800

INCLUDE: zrm07mbsp1, " reporteigene Parameter "os0800

rm07alvi. " ALV functions

  • improve handling when G/L account is missing "n631251

  • define working table g_t_err_acc for the errors "n631251

TYPES: BEGIN OF stype_err_acc, "n631251

bukrs LIKE t001-bukrs, "n631251

konts LIKE t030-konts, "n631251

matnr LIKE mbew-matnr, "n631251

bwkey LIKE mbew-bwkey, "n631251

bwtar LIKE mbew-bwtar, "n631251

flag(01) TYPE c, "n631251

END OF stype_err_acc, "n631251

"n631251

stab_err_acc TYPE STANDARD TABLE OF "n631251

stype_err_acc "n631251

WITH DEFAULT KEY. "n631251

"n631251

DATA : g_s_err_acc TYPE stype_err_acc, "n631251

g_t_err_acc TYPE stab_err_acc. "n631251

  • separate time depending authorization for tax auditor "n486477

  • define working areas for time depending authority check "n486477

DATA : g_f_budat LIKE bsim-budat, "n486477

g_f_budat_work LIKE bsim-budat. "n486477

"n486477

TYPES : BEGIN OF stype_bukrs, "n486477

bukrs LIKE t001-bukrs, "n486477

END OF stype_bukrs, "n486477

"n486477

stab_bukrs TYPE STANDARD TABLE OF "n486477

stype_bukrs WITH DEFAULT KEY. "n486477

"n486477

DATA : g_t_bukrs TYPE stab_bukrs, "n486477

g_s_bukrs TYPE stype_bukrs. "n486477

"n486477

TYPES : BEGIN OF stype_t001k, "n486477

bwkey LIKE t001k-bwkey, "n486477

bukrs LIKE t001-bukrs, "n486477

END OF stype_t001k. "n486477

"n486477

DATA : g_s_t001k TYPE stype_t001k, "n486477

g_t_t001k TYPE stype_t001k OCCURS 0. "n486477

"n486477

DATA : g_flag_tpcuser(01) TYPE c, "n486477

  • 1 = carry out the special checks for this user "n486477

g_f_repid TYPE progname. "n486477

                                                • HAUPTPROGRAMM *********************************

*----


F4-Hilfe für Reportvariante -


*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR alv_def.

PERFORM alv_f4.

*----


Prüfung der eingegebenen Selektionsparameter, -


*

*----


Berechtigungsprüfung -


*

AT SELECTION-SCREEN.

PERFORM alv_check.

PERFORM eingaben_pruefen.

PERFORM berechtigung_pruefen.

  • Start of addition by by os0800 ******

  • to check whether user entered value or not

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'MD1'.

screen-invisible = '1' .

screen-active = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

  • End of addition by os0800 *****

  • check whether the function module is available "n555246

CALL FUNCTION 'FUNCTION_EXISTS' "n555246

EXPORTING "n555246

funcname = 'FI_CHECK_DATE' "n555246

EXCEPTIONS "n555246

function_not_exist = 1 "n555246

OTHERS = 2. "n555246

"n555246

IF sy-subrc IS INITIAL. "n555246

  • separate time depending authorization for tax auditor "n486477

  • check, whether the user is a tax auditor "n486477

MOVE sy-repid TO g_f_repid. "n486477

"n486477

CALL FUNCTION 'FI_CHECK_DATE' "#EC EXISTS "n555246

EXPORTING "n486477

i_bukrs = space "n486477

i_user = sy-uname "n486477

i_program = g_f_repid "n486477

IMPORTING "n486477

e_return = g_flag_tpcuser "n486477

EXCEPTIONS "n486477

no_authority_prog = 1 "n486477

no_authority_date = 2 "n486477

wrong_parameter = 3 "n486477

OTHERS = 4. "n486477

"n486477

CASE sy-subrc. "n486477

WHEN 0. "n486477

  • what kind of user : g_flag_tpcuser = 1 tax auditor "n486477

  • g_flag_tpcuser = 4 other other "n486477

IF g_flag_tpcuser = '1'. "n486477

  • clear header line of select-option table BUKRS "n486477

CLEAR bukrs. "n486477

"n486477

  • second step : user is an auditor -> check periods "n486477

PERFORM tpc_check_period_for_all_cc."n486477

ENDIF. "n486477

"n486477

WHEN 1. "n486477

  • user is tax auditor, but program is not allowed "n486477

MESSAGE e001(ca_check_date) WITH g_f_repid. "n486477

WHEN OTHERS. "n486477

  • other error "n486477

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

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

ENDCASE. "n486477

ENDIF. "n555246

*----


Initialisierung -


*

INITIALIZATION.

PERFORM initialisierung.

*----


Datenselektion -


*

START-OF-SELECTION.

PERFORM get_dates. "os0800.

PERFORM organisation.

PERFORM datenselektion.

*----


Datenausgabe----


*

END-OF-SELECTION.

IF summen IS INITIAL.

IF NOT pruef IS INITIAL.

PERFORM erweiterte_pruefung.

ENDIF.

PERFORM selektion_bearbeiten.

DESCRIBE TABLE bestand LINES index_z.

IF NOT index_z IS INITIAL.

  • process log function if the user is a tax auditor "n555246

  • and the database selection was successful "n555246

IF g_flag_tpcuser = '1'. "n555246

PERFORM tpc_write_log. "n555246

ENDIF. "n555246

IF alv_colourize_fields = 'X'. "843776

PERFORM selektion_ergaenzen.

ELSE. "843776

LOOP AT bestand. "843776

READ TABLE organ WITH KEY bwkey = bestand-bwkey. "843776

MOVE organ-bukrs TO bestand-bukrs. "843776

MOVE organ-waers TO bestand-waers. "843776

MODIFY bestand TRANSPORTING bukrs waers. "843776

ENDLOOP. "843776

ENDIF. "843776

PERFORM feldkatalog_bestand USING fieldcat_b[].

IF NOT pruef IS INITIAL.

PERFORM feldkatalog_pruefung USING fieldcat_p[].

ENDIF.

PERFORM summen_bilden.

PERFORM feldkatalog_saldo USING fieldcat_s[].

PERFORM listausgabe_saldo.

ELSE.

IF NOT negativ IS INITIAL.

MESSAGE s827.

  • Es sind keine negativen Bestände vorhanden

PERFORM anforderungsbild.

ELSE.

MESSAGE s843.

  • Zu den vorgegebenen Daten ist kein Bestand vorhanden

PERFORM anforderungsbild.

ENDIF.

ENDIF.

ELSEIF NOT summen IS INITIAL.

LOOP AT xmbew.

IF NOT keinzel IS INITIAL OR xmbew-bwtty IS INITIAL.

CHECK xmbew-bwtar IS INITIAL.

ELSEIF keinzel IS INITIAL AND NOT xmbew-bwtty IS INITIAL.

CHECK NOT xmbew-bwtar IS INITIAL.

ENDIF.

ON CHANGE OF xmbew-bklas OR xmbew-bwkey.

rc = 0.

PERFORM sachkonto.

ENDON.

CHECK rc = 0.

MOVE-CORRESPONDING xmbew TO bestand.

MOVE xkonto TO bestand-konts.

READ TABLE organ WITH KEY mandt = sy-mandt

bwkey = xmbew-bwkey BINARY SEARCH.

MOVE organ-bukrs TO bestand-bukrs.

MOVE organ-butxt TO bestand-butxt.

MOVE organ-waers TO bestand-waers.

READ TABLE it030 WITH KEY konts = bestand-konts.

MOVE it030-txt50 TO bestand-txt50.

APPEND bestand.

ENDLOOP.

DESCRIBE TABLE bestand LINES index_z.

IF NOT index_z IS INITIAL.

  • process log function if the user is a tax auditor "n555246

  • and the database selection was successful "n555246

IF g_flag_tpcuser = '1'. "n555246

PERFORM tpc_write_log. "n555246

ENDIF. "n555246

PERFORM summen_bilden.

PERFORM feldkatalog_saldo USING fieldcat_s[].

PERFORM listausgabe_saldo.

ELSE.

MESSAGE s843.

  • Zu den vorgegebenen Daten ist kein Bestand vorhanden

PERFORM anforderungsbild.

ENDIF.

ENDIF.

                                              • Ende HAUPTPROGRAMM *****************************

                                                    • FORMROUTINEN ********************************

*----


*

  • FORM SACHKONTO *

*----


*

  • Ermitteln Sachkonto und Sachkontentext *

*----


*

FORM sachkonto.

CLEAR: organ, it030.

READ TABLE organ WITH KEY bwkey = xmbew-bwkey.

x030_key-mandt = sy-mandt.

x030_key-ktopl = organ-ktopl.

x030_key-ktosl = 'BSX'.

x030_key-bwmod = organ-bwmod.

x030_key-bklas = xmbew-bklas. "note 358829

IF organ-xbkla IS INITIAL. "note 358829

CLEAR x030_key-bklas. "note 358829

ENDIF. "note 358829

READ TABLE it030 WITH KEY x030_key.

xkonto = it030-konts.

IF NOT sy-subrc IS INITIAL.

rc = 4.

ENDIF.

ENDFORM. "sachkonto

*----


*

  • FORM PERIODE *

*----


*

  • Bestimmung der Buchungsperiode *

*----


*

FORM periode.

CLEAR bermon. REFRESH bermon.

IF NOT aksaldo IS INITIAL.

MOVE organ-vmmon TO xmonat.

MOVE organ-vmmon TO xbuper(2).

MOVE '/' TO xbuper+2(1).

MOVE organ-vmgja TO xbuper+3(4).

MOVE 'I' TO bermon-sign.

MOVE 'BT' TO bermon-option.

MOVE '01' TO bermon-low.

MOVE '16' TO bermon-high.

APPEND bermon.

ELSEIF NOT vmsaldo IS INITIAL.

MOVE organ-vmmon TO xmonat. " modified by os0800

MOVE organ-vmmon TO xbuper(2). " modified by os0800

MOVE '/' TO xbuper+2(1).

MOVE organ-vmgja TO xbuper+3(4).

MOVE 'I' TO bermon-sign.

MOVE 'BT' TO bermon-option.

MOVE '01' TO bermon-low.

  • if the previous period is in the previous year "n460469

  • consider the FI special periods 13 - 16, too "n460469

IF organ-vmmon = organ-vjmon AND "n460469

organ-vmgja = organ-vjgja. "n460469

MOVE '16' TO bermon-high. "n460469

ELSE. "n460469

MOVE organ-vmmon TO bermon-high. "n460469

ENDIF. "n460469

APPEND bermon.

ELSEIF NOT vjsaldo IS INITIAL.

MOVE organ-vjmon TO xbuper(2).

MOVE '/' TO xbuper+2(1).

MOVE organ-vjgja TO xbuper+3(4).

MOVE 'I' TO bermon-sign.

MOVE 'BT' TO bermon-option.

MOVE '01' TO bermon-low.

  • consider the FI special periods 13 - 16, too "n460469

bermon-high = '16'. "n460469

APPEND bermon.

ENDIF.

ENDFORM. " PERIODE

*&----


*

*& Form EINGABEN_PRUEFEN

*&----


*

  • text

*----


*

FORM eingaben_pruefen.

  • this check delivered wrong results when "n525339

  • valuation level is company code "n525339

IF NOT bwkey[] IS INITIAL. "n525339

SELECT * FROM t001w WHERE bwkey IN bwkey. "n525339

EXIT. "n525339

ENDSELECT. "n525339

"n525339

IF NOT sy-subrc IS INITIAL.

MESSAGE e884.

  • Bewertungskreis nicht vorhanden

ENDIF.

ENDIF.

IF NOT bwtar-low IS INITIAL OR NOT bwtar-high IS INITIAL.

SELECT SINGLE * FROM t149d WHERE bwtar IN bwtar.

IF NOT sy-subrc IS INITIAL.

  • error fixed ( reported by the extended syntax check ) "n486477

MESSAGE e885 WITH bwtar-low. "n486477

  • Bewertungsart & nicht vorhanden

ENDIF.

ENDIF.

IF NOT pruef IS INITIAL AND NOT bwtar IS INITIAL.

MESSAGE w288.

  • Bewertungsart wird zurückgesetzt.

CLEAR bwtar.

REFRESH bwtar. "357162

ENDIF.

  • send warning M7 375 after selections for material, etc. "n497391

REFRESH : g_t_listheader.

CLEAR : g_s_listheader, g_flag_warning_m7375. "n497391

"n497391

IF NOT matnr[] IS INITIAL. "n497391

MOVE x TO g_flag_warning_m7375. "n497391

SET CURSOR FIELD 'MATNR-LOW'. "n497391

"n497391

ELSEIF NOT bwkey[] IS INITIAL. "n497391

MOVE x TO g_flag_warning_m7375. "n497391

SET CURSOR FIELD 'BWKEY-LOW'. "n497391

"n497391

ELSEIF NOT bwtar[] IS INITIAL. "n497391

MOVE x TO g_flag_warning_m7375. "n497391

SET CURSOR FIELD 'BWTAR-LOW'. "n497391

"n497391

ELSEIF NOT bklas[] IS INITIAL. "n497391

MOVE x TO g_flag_warning_m7375. "n497391

SET CURSOR FIELD 'BKLAS-LOW'. "n497391

"n497391

ELSEIF NOT negativ IS INITIAL. "n497391

MOVE x TO g_flag_warning_m7375. "n497391

SET CURSOR FIELD 'NEGATIV'. "n497391

ENDIF. "n497391

"n497391

IF g_flag_warning_m7375 = x. "n497391

MOVE : h TO g_s_listheader-typ, "n497391

  • Durch Eingrenzungen kann der Saldenabgleich fehlerhaft... "n497391

  • Due to material selection, results may be incorrect "n497391

text-101 TO g_s_listheader-info. "n497391

APPEND g_s_listheader TO g_t_listheader. "n497391

"n497391

  • this warning can be surpressed "n497391

CALL FUNCTION 'MB_CHECK_T160M' "n497391

EXPORTING "n497391

i_msgnr = '375' "n497391

IMPORTING "n497391

rc = g_retcode. "n497391

"n497391

IF g_retcode <> 0. "n497391

  • Selections for this field will deliver wrong results "n497391

  • message w375. "n497391"0S0800

ENDIF. "n497391

ENDIF. "n497391

ENDFORM. " EINGABEN_PRUEFEN

*&----


*

*& Form BERECHTIGUNG_PRUEFEN

*&----


*

  • text

*----


*

FORM berechtigung_pruefen.

AUTHORITY-CHECK OBJECT 'M_MATE_WRK'

ID 'ACTVT' FIELD actvt03

ID 'WERKS' DUMMY.

IF NOT sy-subrc IS INITIAL.

*------ SIE HABEN KEINE BERECHTIGUNG FÜR DIESES WERK

MESSAGE e120 WITH bwkey.

ENDIF.

ENDFORM. " BERECHTIGUNG_PRUEFEN

*&----


*

*& Form INITIALISIERUNG

*&----


*

  • text

*----


*

FORM initialisierung.

PERFORM alv_init.

titel = '100'.

SET TITLEBAR titel.

ENDFORM. " INITIALISIERUNG

*&----


*

*& Form DATENSELEKTION

*&----


*

  • Die Materialbewertungssätze werden gelesen. *

*----


*

FORM datenselektion.

  • extend field definition of sum fields "n497391

DATA: sum(10) TYPE p DECIMALS 2. "n497391

IF NOT skont IS INITIAL.

IF NOT aksaldo IS INITIAL.

IF NOT summen IS INITIAL.

LOOP AT organ.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM mbew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja BETWEEN v_year AND v_year1 " os0800

AND lfmon BETWEEN v_period AND v_period1 " os0800

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM ebew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM qbew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

  • consider valuated subcontractor stocks from OBEW "n497391

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum. "n497391

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) "n497391

FROM obew "n497391

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum) "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bklas IN ibklas "n497391

AND bwtar IN bwtar "n497391

GROUP BY bwkey bklas bwtty bwtar. "n497391

CHECK NOT sum IS INITIAL. "n497391

MOVE f_bwkey TO xmbew-bwkey. "n497391

MOVE f_bklas TO xmbew-bklas. "n497391

MOVE f_bwtty TO xmbew-bwtty. "n497391

MOVE f_bwtar TO xmbew-bwtar. "n497391

MOVE sum TO xmbew-salk3. "n497391

COLLECT xmbew. "n497391

ENDSELECT. "n497391

ENDLOOP.

ELSEIF summen IS INITIAL.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lvorm lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty pstat vksal eklas qklas

FROM mbew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja BETWEEN v_year AND v_year1 " os0800

AND lfmon BETWEEN v_period AND v_period1. " os0800

APPEND xmbew.

ENDSELECT.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty vksal sobkz vbeln posnr

FROM ebew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja BETWEEN v_year AND v_year1 " os0800

AND lfmon BETWEEN v_period AND v_period1. " os0800

xmbew-no_sum = 'X'.

APPEND xmbew.

ENDSELECT.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty vksal sobkz pspnr

FROM qbew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja BETWEEN v_year AND v_year1 " os0800

AND lfmon BETWEEN v_period AND v_period1. " os0800

xmbew-no_sum = 'X'.

APPEND xmbew.

ENDSELECT.

  • consider valuated subcontractor stocks from OBEW "n497391

CLEAR xmbew. "n497391

SELECT mandt matnr bwkey bwtar lbkum salk3 "n497391

vprsv verpr stprs peinh bklas salkv "n497391

lfgja lfmon bwtty vksal sobkz lifnr "n497391

FROM obew INTO CORRESPONDING FIELDS OF xmbew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bklas IN ibklas "n497391

AND bwtar IN bwtar

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja BETWEEN v_year AND v_year1 " os0800

AND lfmon BETWEEN v_period AND v_period1. " os0800

xmbew-no_sum = 'X'. "n497391

APPEND xmbew. "n497391

ENDSELECT. "n497391

ENDIF.

ELSEIF NOT vmsaldo IS INITIAL.

SELECT * FROM mbew INTO CORRESPONDING FIELDS OF TABLE imbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR imbew_ext. REFRESH imbew_ext. "n760405

CALL FUNCTION 'MBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = 'X'

xvjah = ' '

TABLES

mbew_tab = imbew "n760405

mbew_ext_tab = imbew_ext. "n760405

SORT imbew_ext BY matnr bwkey bwtar. "n760405

LOOP AT imbew.

  • Test der Bewertungsklasse erst aus MBEWH hier möglich,

  • da in MBEW möglicherweise veraltet.

CHECK imbew-vmbkl IN ibklas. "207501

MOVE-CORRESPONDING imbew TO xmbew.

xmbew-lbkum = imbew-vmkum.

xmbew-salk3 = imbew-vmsal.

xmbew-vprsv = imbew-vmvpr.

xmbew-verpr = imbew-vmver.

xmbew-stprs = imbew-vmstp.

xmbew-peinh = imbew-vmpei.

xmbew-bklas = imbew-vmbkl.

xmbew-salkv = imbew-vmsav.

READ TABLE imbew_ext WITH KEY matnr = imbew-matnr "n760405

bwkey = imbew-bwkey "n760405

bwtar = imbew-bwtar "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = imbew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR imbew. REFRESH imbew. FREE imbew.

CLEAR xmbew. "n711749

SELECT * FROM ebew INTO CORRESPONDING FIELDS OF TABLE iebew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iebew_ext. REFRESH iebew_ext. "n760405

CALL FUNCTION 'EBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = 'X'

xvjah = ' '

TABLES

ebew_tab = iebew "n760405

ebew_ext_tab = iebew_ext. "n760405

SORT iebew_ext BY matnr bwkey bwtar sobkz vbeln posnr."n760405

LOOP AT iebew.

CHECK iebew-vmbkl IN ibklas. "207501

MOVE-CORRESPONDING iebew TO xmbew.

xmbew-lbkum = iebew-vmkum.

xmbew-salk3 = iebew-vmsal.

xmbew-vprsv = iebew-vmvpr.

xmbew-verpr = iebew-vmver.

xmbew-stprs = iebew-vmstp.

xmbew-peinh = iebew-vmpei.

xmbew-bklas = iebew-vmbkl.

xmbew-salkv = iebew-vmsav.

xmbew-no_sum = 'X'.

READ TABLE iebew_ext WITH KEY matnr = iebew-matnr "n760405

bwkey = iebew-bwkey "n760405

bwtar = iebew-bwtar "n760405

sobkz = iebew-sobkz "n760405

vbeln = iebew-vbeln "n760405

posnr = iebew-posnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iebew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iebew. REFRESH iebew. FREE iebew.

CLEAR xmbew. "n711749

SELECT * FROM qbew INTO CORRESPONDING FIELDS OF TABLE iqbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iqbew_ext. REFRESH iqbew_ext. "n760405

CALL FUNCTION 'QBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = 'X'

xvjah = ' '

TABLES

qbew_tab = iqbew "n760405

qbew_ext_tab = iqbew_ext. "n760405

SORT iqbew_ext BY matnr bwkey bwtar sobkz pspnr. "n760405

LOOP AT iqbew.

CHECK iqbew-vmbkl IN ibklas. "207501

MOVE-CORRESPONDING iqbew TO xmbew.

xmbew-lbkum = iqbew-vmkum.

xmbew-salk3 = iqbew-vmsal.

xmbew-vprsv = iqbew-vmvpr.

xmbew-verpr = iqbew-vmver.

xmbew-stprs = iqbew-vmstp.

xmbew-peinh = iqbew-vmpei.

xmbew-bklas = iqbew-vmbkl.

xmbew-salkv = iqbew-vmsav.

xmbew-no_sum = 'X'.

READ TABLE iqbew_ext WITH KEY matnr = iqbew-matnr "n760405

bwkey = iqbew-bwkey "n760405

bwtar = iqbew-bwtar "n760405

sobkz = iqbew-sobkz "n760405

pspnr = iqbew-pspnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iqbew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iqbew. REFRESH iqbew. FREE iqbew.

CLEAR xmbew. "n711749

  • consider valuated subcontractor stocks from OBEW "n497391

SELECT * FROM obew "n497391

INTO CORRESPONDING FIELDS OF TABLE iobew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bwtar IN bwtar. "n497391

CLEAR iobew_ext. REFRESH iobew_ext. "n760405

CALL FUNCTION 'OBEW_EXTEND' "n497391

EXPORTING "n497391

kzrfb = 'X' "n497391

maxtz = ' ' "n497391

xvper = 'X' "n497391

xvjah = ' ' "n497391

TABLES "n497391

obew_tab = iobew "n760405

obew_ext_tab = iobew_ext. "n760405

SORT iobew_ext BY matnr bwkey bwtar sobkz lifnr. "n760405

LOOP AT iobew. "n497391

CHECK iobew-vmbkl IN ibklas. "n497391

MOVE-CORRESPONDING iobew TO xmbew. "n497391

xmbew-lbkum = iobew-vmkum. "n497391

xmbew-salk3 = iobew-vmsal. "n497391

xmbew-vprsv = iobew-vmvpr. "n497391

xmbew-verpr = iobew-vmver. "n497391

xmbew-stprs = iobew-vmstp. "n497391

xmbew-peinh = iobew-vmpei. "n497391

xmbew-bklas = iobew-vmbkl. "n497391

xmbew-salkv = iobew-vmsav. "n497391

xmbew-no_sum = 'X'. "n497391

READ TABLE iobew_ext WITH KEY matnr = iobew-matnr "n760405

bwkey = iobew-bwkey "n760405

bwtar = iobew-bwtar "n760405

sobkz = iobew-sobkz "n760405

lifnr = iobew-lifnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iobew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew. "n497391

ENDLOOP. "n497391

CLEAR iobew. REFRESH iobew. FREE iobew. "n497391

CLEAR xmbew. "n711749

ELSEIF NOT vjsaldo IS INITIAL.

SELECT * FROM mbew INTO CORRESPONDING FIELDS OF TABLE imbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR imbew_ext. REFRESH imbew_ext. "n760405

CALL FUNCTION 'MBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = ' '

xvjah = 'X'

TABLES

mbew_tab = imbew "n760405

mbew_ext_tab = imbew_ext. "n760405

SORT imbew_ext BY matnr bwkey bwtar. "n760405

LOOP AT imbew.

CHECK imbew-vjbkl IN ibklas. "207501

MOVE-CORRESPONDING imbew TO xmbew.

xmbew-lbkum = imbew-vjkum.

xmbew-salk3 = imbew-vjsal.

xmbew-vprsv = imbew-vjvpr.

xmbew-verpr = imbew-vjver.

xmbew-stprs = imbew-vjstp.

xmbew-peinh = imbew-vjpei.

xmbew-bklas = imbew-vjbkl.

xmbew-salkv = imbew-vjsav.

READ TABLE imbew_ext WITH KEY matnr = imbew-matnr "n760405

bwkey = imbew-bwkey "n760405

bwtar = imbew-bwtar "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = imbew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR imbew. REFRESH imbew. FREE imbew.

CLEAR xmbew. "n711749

SELECT * FROM ebew INTO CORRESPONDING FIELDS OF TABLE iebew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iebew_ext. REFRESH iebew_ext. "n760405

CALL FUNCTION 'EBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = ' '

xvjah = 'X'

TABLES

ebew_tab = iebew "n760405

ebew_ext_tab = iebew_ext. "n760405

SORT iebew_ext BY matnr bwkey bwtar sobkz vbeln posnr."n760405

LOOP AT iebew.

CHECK iebew-vjbkl IN ibklas. "207501

MOVE-CORRESPONDING iebew TO xmbew.

xmbew-lbkum = iebew-vjkum.

xmbew-salk3 = iebew-vjsal.

xmbew-vprsv = iebew-vjvpr.

xmbew-verpr = iebew-vjver.

xmbew-stprs = iebew-vjstp.

xmbew-peinh = iebew-vjpei.

xmbew-bklas = iebew-vjbkl.

xmbew-salkv = iebew-vjsav.

xmbew-no_sum = 'X'.

READ TABLE iebew_ext WITH KEY matnr = iebew-matnr "n760405

bwkey = iebew-bwkey "n760405

bwtar = iebew-bwtar "n760405

sobkz = iebew-sobkz "n760405

vbeln = iebew-vbeln "n760405

posnr = iebew-posnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iebew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iebew. REFRESH iebew. FREE iebew.

CLEAR xmbew. "n711749

SELECT * FROM qbew INTO CORRESPONDING FIELDS OF TABLE iqbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iqbew_ext. REFRESH iqbew_ext. "n760405

CALL FUNCTION 'QBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = ' '

xvjah = 'X'

TABLES

qbew_tab = iqbew "n760405

qbew_ext_tab = iqbew_ext. "n760405

SORT iqbew_ext BY matnr bwkey bwtar sobkz pspnr. "n760405

LOOP AT iqbew.

CHECK iqbew-vjbkl IN ibklas. "207501

MOVE-CORRESPONDING iqbew TO xmbew.

xmbew-lbkum = iqbew-vjkum.

xmbew-salk3 = iqbew-vjsal.

xmbew-vprsv = iqbew-vjvpr.

xmbew-verpr = iqbew-vjver.

xmbew-stprs = iqbew-vjstp.

xmbew-peinh = iqbew-vjpei.

xmbew-bklas = iqbew-vjbkl.

xmbew-salkv = iqbew-vjsav.

xmbew-no_sum = 'X'.

READ TABLE iqbew_ext WITH KEY matnr = iqbew-matnr "n760405

bwkey = iqbew-bwkey "n760405

bwtar = iqbew-bwtar "n760405

sobkz = iqbew-sobkz "n760405

pspnr = iqbew-pspnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iqbew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iqbew. REFRESH iqbew. FREE iqbew.

CLEAR xmbew. "n711749

  • consider valuated subcontractor stocks from OBEW "n497391

SELECT * FROM obew "n497391

INTO CORRESPONDING FIELDS OF TABLE iobew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bwtar IN bwtar. "n497391

CLEAR iobew_ext. REFRESH iobew_ext. "n760405

CALL FUNCTION 'OBEW_EXTEND' "n497391

EXPORTING "n497391

kzrfb = 'X' "n497391

maxtz = ' ' "n497391

xvper = ' ' "n497391

xvjah = 'X' "n497391

TABLES "n497391

obew_tab = iobew "n760405

obew_ext_tab = iobew_ext. "n760405

SORT iobew_ext BY matnr bwkey bwtar sobkz lifnr. "n760405

LOOP AT iobew. "n497391

CHECK iobew-vjbkl IN ibklas. "n497391

MOVE-CORRESPONDING iobew TO xmbew. "n497391

xmbew-lbkum = iobew-vjkum. "n497391

xmbew-salk3 = iobew-vjsal. "n497391

xmbew-vprsv = iobew-vjvpr. "n497391

xmbew-verpr = iobew-vjver. "n497391

xmbew-stprs = iobew-vjstp. "n497391

xmbew-peinh = iobew-vjpei. "n497391

xmbew-bklas = iobew-vjbkl. "n497391

xmbew-salkv = iobew-vjsav. "n497391

xmbew-no_sum = 'X'. "n497391

READ TABLE iobew_ext WITH KEY matnr = iobew-matnr "n760405

bwkey = iobew-bwkey "n760405

bwtar = iobew-bwtar "n760405

sobkz = iobew-sobkz "n760405

lifnr = iobew-lifnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iobew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew. "n497391

ENDLOOP. "n497391

CLEAR iobew. REFRESH iobew. FREE iobew. "n497391

CLEAR xmbew. "n711749

ENDIF.

ELSEIF skont IS INITIAL.

IF NOT aksaldo IS INITIAL.

IF NOT summen IS INITIAL.

LOOP AT organ.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM mbew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN bklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

CHECK NOT f_bklas IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas SUM( salk3 ) FROM ebew

INTO (f_bwkey, f_bklas, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN bklas

AND bwtar IN bwtar GROUP BY bwkey bklas.

CHECK NOT sum IS INITIAL.

CHECK NOT f_bklas IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM qbew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN bklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

CHECK NOT f_bklas IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

  • consider valuated subcontractor stocks from OBEW "n497391

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum. "n497391

"n497391

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) "n497391

FROM obew "n497391

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum) "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bklas IN bklas "n497391

AND bwtar IN bwtar "n497391

GROUP BY bwkey bklas bwtty bwtar. "n497391

CHECK NOT sum IS INITIAL. "n497391

CHECK NOT f_bklas IS INITIAL. "n497391

MOVE f_bwkey TO xmbew-bwkey. "n497391

MOVE f_bklas TO xmbew-bklas. "n497391

MOVE f_bwtty TO xmbew-bwtty. "n497391

MOVE f_bwtar TO xmbew-bwtar. "n497391

MOVE sum TO xmbew-salk3. "n497391

COLLECT xmbew. "n497391

ENDSELECT. "n497391

ENDLOOP.

ELSEIF summen IS INITIAL.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lvorm lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty pstat vksal eklas qklas

FROM mbew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar

AND bklas IN bklas

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja between v_year and v_year1 " os0800

AND lfmon between v_period and v_period1." os0800

CHECK NOT xmbew-bklas IS INITIAL.

APPEND xmbew.

ENDSELECT.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty vksal sobkz vbeln posnr

FROM ebew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar

AND bklas IN bklas

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja between v_year and v_year1 " os0800

AND lfmon between v_period and v_period1. " os0800

CHECK NOT xmbew-bklas IS INITIAL.

xmbew-no_sum = 'X'.

APPEND xmbew.

ENDSELECT.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty vksal sobkz pspnr

FROM qbew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar

AND bklas IN bklas

AND lfgja = v_year "os0800

AND lfmon = v_period "os0800

AND lfgja between v_year and v_year1 " os0800

AND lfmon between v_period and v_period1. "os0800

CHECK NOT xmbew-bklas IS INITIAL.

xmbew-no_sum = 'X'.

APPEND xmbew.

ENDSELECT.

  • consider valuated subcontractor stocks from OBEW "n497391

CLEAR xmbew. "n497391

SELECT mandt matnr bwkey bwtar lbkum salk3 "n497391

vprsv verpr stprs peinh bklas salkv "n497391

lfgja lfmon bwtty vksal sobkz lifnr "n497391

FROM obew INTO CORRESPONDING FIELDS OF xmbew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bwtar IN bwtar "n497391

AND bklas IN bklas

AND lfgja = v_year " os0800

AND lfmon = v_period " os0800

AND lfgja between v_year and v_year1 " os0800

AND lfmon between v_period and v_period1. "os0800

CHECK NOT xmbew-bklas IS INITIAL. "n497391

xmbew-no_sum = 'X'. "n497391

APPEND xmbew. "n497391

ENDSELECT. "n497391

ENDIF.

ELSEIF NOT vmsaldo IS INITIAL.

SELECT * FROM mbew INTO CORRESPONDING FIELDS OF TABLE imbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR imbew_ext. REFRESH imbew_ext. "n760405

CALL FUNCTION 'MBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = 'X'

xvjah = ' '

TABLES

mbew_tab = imbew "n760405

mbew_ext_tab = imbew_ext. "n760405

SORT imbew_ext BY matnr bwkey bwtar. "n760405

LOOP AT imbew.

CHECK NOT imbew-vmbkl IS INITIAL.

CHECK imbew-vmbkl IN bklas. "207501

MOVE-CORRESPONDING imbew TO xmbew.

xmbew-lbkum = imbew-vmkum.

xmbew-salk3 = imbew-vmsal.

xmbew-vprsv = imbew-vmvpr.

xmbew-verpr = imbew-vmver.

xmbew-stprs = imbew-vmstp.

xmbew-peinh = imbew-vmpei.

xmbew-bklas = imbew-vmbkl.

xmbew-salkv = imbew-vmsav.

READ TABLE imbew_ext WITH KEY matnr = imbew-matnr "n760405

bwkey = imbew-bwkey "n760405

bwtar = imbew-bwtar "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = imbew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR imbew. REFRESH imbew. FREE imbew.

CLEAR xmbew. "n711749

SELECT * FROM ebew INTO CORRESPONDING FIELDS OF TABLE iebew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iebew_ext. REFRESH iebew_ext. "n760405

CALL FUNCTION 'EBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = 'X'

xvjah = ' '

TABLES

ebew_tab = iebew "n760405

ebew_ext_tab = iebew_ext. "n760405

SORT iebew_ext BY matnr bwkey bwtar sobkz vbeln posnr."n760405

LOOP AT iebew.

CHECK NOT iebew-bklas IS INITIAL.

CHECK iebew-vmbkl IN bklas. "207501

MOVE-CORRESPONDING iebew TO xmbew.

xmbew-lbkum = iebew-vmkum.

xmbew-salk3 = iebew-vmsal.

xmbew-vprsv = iebew-vmvpr.

xmbew-verpr = iebew-vmver.

xmbew-stprs = iebew-vmstp.

xmbew-peinh = iebew-vmpei.

xmbew-bklas = iebew-vmbkl.

xmbew-salkv = iebew-vmsav.

xmbew-no_sum = 'X'.

READ TABLE iebew_ext WITH KEY matnr = iebew-matnr "n760405

bwkey = iebew-bwkey "n760405

bwtar = iebew-bwtar "n760405

sobkz = iebew-sobkz "n760405

vbeln = iebew-vbeln "n760405

posnr = iebew-posnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iebew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iebew. REFRESH iebew. FREE iebew.

CLEAR xmbew. "n711749

SELECT * FROM qbew INTO CORRESPONDING FIELDS OF TABLE iqbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iqbew_ext. REFRESH iqbew_ext. "n760405

CALL FUNCTION 'QBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = 'X'

xvjah = ' '

TABLES

qbew_tab = iqbew "n760405

qbew_ext_tab = iqbew_ext. "n760405

SORT iqbew_ext BY matnr bwkey bwtar sobkz pspnr. "n760405

LOOP AT iqbew.

CHECK NOT iqbew-bklas IS INITIAL.

CHECK iqbew-vmbkl IN bklas. "207501

MOVE-CORRESPONDING iqbew TO xmbew.

xmbew-lbkum = iqbew-vmkum.

xmbew-salk3 = iqbew-vmsal.

xmbew-vprsv = iqbew-vmvpr.

xmbew-verpr = iqbew-vmver.

xmbew-stprs = iqbew-vmstp.

xmbew-peinh = iqbew-vmpei.

xmbew-bklas = iqbew-vmbkl.

xmbew-salkv = iqbew-vmsav.

xmbew-no_sum = 'X'.

READ TABLE iqbew_ext WITH KEY matnr = iqbew-matnr "n760405

bwkey = iqbew-bwkey "n760405

bwtar = iqbew-bwtar "n760405

sobkz = iqbew-sobkz "n760405

pspnr = iqbew-pspnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iqbew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iqbew. REFRESH iqbew. FREE iqbew.

CLEAR xmbew. "n711749

  • consider valuated subcontractor stocks from OBEW "n497391

SELECT * FROM obew "n497391

INTO CORRESPONDING FIELDS OF TABLE iobew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bwtar IN bwtar. "n497391

CLEAR iobew_ext. REFRESH iobew_ext. "n760405

CALL FUNCTION 'OBEW_EXTEND' "n497391

EXPORTING "n497391

kzrfb = 'X' "n497391

maxtz = ' ' "n497391

xvper = 'X' "n497391

xvjah = ' ' "n497391

TABLES "n497391

obew_tab = iobew "n760405

obew_ext_tab = iobew_ext. "n760405

SORT iobew_ext BY matnr bwkey bwtar sobkz lifnr. "n760405

LOOP AT iobew. "n497391

CHECK NOT iobew-bklas IS INITIAL. "n497391

CHECK iobew-vmbkl IN bklas. "n497391

MOVE-CORRESPONDING iobew TO xmbew. "n497391

xmbew-lbkum = iobew-vmkum. "n497391

xmbew-salk3 = iobew-vmsal. "n497391

xmbew-vprsv = iobew-vmvpr. "n497391

xmbew-verpr = iobew-vmver. "n497391

xmbew-stprs = iobew-vmstp. "n497391

xmbew-peinh = iobew-vmpei. "n497391

xmbew-bklas = iobew-vmbkl. "n497391

xmbew-salkv = iobew-vmsav. "n497391

xmbew-no_sum = 'X'. "n497391

READ TABLE iobew_ext WITH KEY matnr = iobew-matnr "n760405

bwkey = iobew-bwkey "n760405

bwtar = iobew-bwtar "n760405

sobkz = iobew-sobkz "n760405

lifnr = iobew-lifnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iobew_ext-vmvks. "n760405

ENDIF. "n760405

APPEND xmbew. "n497391

ENDLOOP. "n497391

CLEAR iobew. REFRESH iobew. FREE iobew. "n497391

CLEAR xmbew. "n711749

ELSEIF NOT vjsaldo IS INITIAL.

SELECT * FROM mbew INTO CORRESPONDING FIELDS OF TABLE imbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR imbew_ext. REFRESH imbew_ext. "n760405

CALL FUNCTION 'MBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = ' '

xvjah = 'X'

TABLES

mbew_tab = imbew "n760405

mbew_ext_tab = imbew_ext. "n760405

SORT imbew_ext BY matnr bwkey bwtar. "n760405

LOOP AT imbew.

CHECK NOT imbew-bklas IS INITIAL.

CHECK imbew-vjbkl IN bklas. "207501

MOVE-CORRESPONDING imbew TO xmbew.

xmbew-lbkum = imbew-vjkum.

xmbew-salk3 = imbew-vjsal.

xmbew-vprsv = imbew-vjvpr.

xmbew-verpr = imbew-vjver.

xmbew-stprs = imbew-vjstp.

xmbew-peinh = imbew-vjpei.

xmbew-bklas = imbew-vjbkl.

xmbew-salkv = imbew-vjsav.

READ TABLE imbew_ext WITH KEY matnr = imbew-matnr "n760405

bwkey = imbew-bwkey "n760405

bwtar = imbew-bwtar "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = imbew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR imbew. REFRESH imbew. FREE imbew.

CLEAR xmbew. "n711749

SELECT * FROM ebew INTO CORRESPONDING FIELDS OF TABLE iebew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iebew_ext. REFRESH iebew_ext. "n760405

CALL FUNCTION 'EBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = ' '

xvjah = 'X'

TABLES

ebew_tab = iebew "n760405

ebew_ext_tab = iebew_ext. "n760405

SORT iebew_ext BY matnr bwkey bwtar sobkz vbeln posnr."n760405

LOOP AT iebew.

CHECK NOT iebew-bklas IS INITIAL.

CHECK iebew-vjbkl IN bklas. "207501

MOVE-CORRESPONDING iebew TO xmbew.

xmbew-lbkum = iebew-vjkum.

xmbew-salk3 = iebew-vjsal.

xmbew-vprsv = iebew-vjvpr.

xmbew-verpr = iebew-vjver.

xmbew-stprs = iebew-vjstp.

xmbew-peinh = iebew-vjpei.

xmbew-bklas = iebew-vjbkl.

xmbew-salkv = iebew-vjsav.

xmbew-no_sum = 'X'.

READ TABLE iebew_ext WITH KEY matnr = iebew-matnr "n760405

bwkey = iebew-bwkey "n760405

bwtar = iebew-bwtar "n760405

sobkz = iebew-sobkz "n760405

vbeln = iebew-vbeln "n760405

posnr = iebew-posnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iebew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iebew. REFRESH iebew. FREE iebew.

CLEAR xmbew. "n711749

SELECT * FROM qbew INTO CORRESPONDING FIELDS OF TABLE iqbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bwtar IN bwtar.

CLEAR iqbew_ext. REFRESH iqbew_ext. "n760405

CALL FUNCTION 'QBEW_EXTEND'

EXPORTING

kzrfb = 'X'

maxtz = ' '

xvper = ' '

xvjah = 'X'

TABLES

qbew_tab = iqbew "n760405

qbew_ext_tab = iqbew_ext. "n760405

SORT iqbew_ext BY matnr bwkey bwtar sobkz pspnr. "n760405

LOOP AT iqbew.

CHECK NOT iqbew-bklas IS INITIAL.

CHECK iqbew-vjbkl IN bklas. "207501

MOVE-CORRESPONDING iqbew TO xmbew.

xmbew-lbkum = iqbew-vjkum.

xmbew-salk3 = iqbew-vjsal.

xmbew-vprsv = iqbew-vjvpr.

xmbew-verpr = iqbew-vjver.

xmbew-stprs = iqbew-vjstp.

xmbew-peinh = iqbew-vjpei.

xmbew-bklas = iqbew-vjbkl.

xmbew-salkv = iqbew-vjsav.

xmbew-no_sum = 'X'.

READ TABLE iqbew_ext WITH KEY matnr = iqbew-matnr "n760405

bwkey = iqbew-bwkey "n760405

bwtar = iqbew-bwtar "n760405

sobkz = iqbew-sobkz "n760405

pspnr = iqbew-pspnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iqbew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew.

ENDLOOP.

CLEAR iqbew. REFRESH iqbew. FREE iqbew.

CLEAR xmbew. "n711749

  • consider valuated subcontractor stocks from OBEW "n497391

SELECT * FROM obew "n497391

INTO CORRESPONDING FIELDS OF TABLE iobew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bwtar IN bwtar. "n497391

CLEAR iobew_ext. REFRESH iobew_ext. "n760405

CALL FUNCTION 'OBEW_EXTEND' "n497391

EXPORTING "n497391

kzrfb = 'X' "n497391

maxtz = ' ' "n497391

xvper = ' ' "n497391

xvjah = 'X' "n497391

TABLES "n497391

obew_tab = iobew "n760405

obew_ext_tab = iobew_ext. "n760405

SORT iobew_ext BY matnr bwkey bwtar sobkz lifnr. "n760405

LOOP AT iobew. "n497391

CHECK NOT iobew-bklas IS INITIAL. "n497391

CHECK iobew-vjbkl IN bklas. "n497391

MOVE-CORRESPONDING iobew TO xmbew. "n497391

xmbew-lbkum = iobew-vjkum. "n497391

xmbew-salk3 = iobew-vjsal. "n497391

xmbew-vprsv = iobew-vjvpr. "n497391

xmbew-verpr = iobew-vjver. "n497391

xmbew-stprs = iobew-vjstp. "n497391

xmbew-peinh = iobew-vjpei. "n497391

xmbew-bklas = iobew-vjbkl. "n497391

xmbew-salkv = iobew-vjsav. "n497391

xmbew-no_sum = 'X'. "n497391

READ TABLE iobew_ext WITH KEY matnr = iobew-matnr "n760405

bwkey = iobew-bwkey "n760405

bwtar = iobew-bwtar "n760405

sobkz = iobew-sobkz "n760405

lifnr = iobew-lifnr "n760405

BINARY SEARCH. "n760405

IF sy-subrc = 0. "n760405

xmbew-vksal = iobew_ext-vjvks. "n760405

ENDIF. "n760405

APPEND xmbew. "n497391

ENDLOOP. "n497391

CLEAR iobew. REFRESH iobew. FREE iobew. "n497391

CLEAR xmbew. "n711749

ENDIF.

ENDIF.

READ TABLE xmbew INDEX 1.

IF NOT sy-subrc IS INITIAL.

MESSAGE s289.

  • Kein Material in Selektion vorhanden

PERFORM anforderungsbild.

ENDIF.

  • Lesen des Materialstammes:

LOOP AT xmbew.

MOVE xmbew-matnr TO material-matnr.

COLLECT material.

ENDLOOP.

  • For every material we need the material master MARA. If the

  • logon language is present in MAKT, we also need the text.

  • INNER JOIN or OUTER JOIN cannot be used because the language-condition

  • canot be handled in one statement.

SELECT matnr mtart lvorm meins "353378

INTO CORRESPONDING FIELDS OF TABLE xmarav "353378

FROM mara "353378

FOR ALL ENTRIES IN material "353378

WHERE matnr = material-matnr. "353378

  • This is the ONE AND ONLY sort for XMARAV!!!

SORT xmarav BY matnr. "353378

  • Texts, as far as available. SELECT is buffered by the interface.

SELECT matnr maktx "353378

INTO (makt-matnr,makt-maktx) "353378

FROM makt "353378

FOR ALL ENTRIES IN material "353378

WHERE matnr = material-matnr "353378

AND spras = sy-langu. "353378

READ TABLE xmarav WITH KEY matnr = makt-matnr BINARY SEARCH."353378

IF sy-subrc IS INITIAL. "487464

xmarav-maktx = makt-maktx. "353378

MODIFY xmarav INDEX sy-tabix. "353378

ENDIF. "487464

ENDSELECT. "353378

CLEAR: t001-bukrs, matnr, saknr.

ENDFORM. " DATENSELEKTION

*&----


*

*& Form FELDKATALOG_BESTAND

*&----


*

  • text

*----


*

  • -->P_FIELDCAT[] text *

*----


*

FORM feldkatalog_bestand USING p_fieldcat TYPE slis_t_fieldcat_alv.

DATA: fieldcat TYPE slis_fieldcat_alv.

  • Positionsfelder:

CLEAR fieldcat.

fieldcat-fieldname = 'BUPER'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-key = 'X'.

fieldcat-key_sel = 'X'.

fieldcat-col_pos = '1'.

fieldcat-no_out = 'X'.

fieldcat-seltext_s = text-070.

fieldcat-seltext_m = text-070.

fieldcat-seltext_l = text-070.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BUKRS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'T001'.

fieldcat-key = 'X'.

fieldcat-col_pos = '2'.

fieldcat-key_sel = 'X'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'KONTS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'T030'.

fieldcat-key = 'X'.

fieldcat-col_pos = '3'.

fieldcat-key_sel = 'X'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BWKEY'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-col_pos = '4'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MATNR'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-col_pos = '5'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MAKTX'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MAKT'.

fieldcat-col_pos = '6'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BWTAR'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'LVORM'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'EMBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'LBKUM'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-col_pos = '7'.

fieldcat-qfieldname = 'MEINS'.

fieldcat-do_sum = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SALK3'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-col_pos = '9'.

fieldcat-cfieldname = 'WAERS'.

fieldcat-do_sum = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MEINS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MARA'.

fieldcat-col_pos = '8'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAERS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'T001'.

fieldcat-col_pos = '10'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'VKSAL'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

fieldcat-do_sum = 'X'.

fieldcat-cfieldname = 'WAERS'. "note 305809

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SOBKZ'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'EBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'VBELN'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'EBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'POSNR'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'EBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'PSPNR'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'QBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

  • process the vendor number of subcontractor as a hidden "n497391

  • field "n497391

CLEAR fieldcat. "n497391

fieldcat-fieldname = 'LIFNR'. "n497391

fieldcat-tabname = 'DETAIL'. "n497391

fieldcat-ref_tabname = 'OBEW'. "n497391

fieldcat-no_out = 'X'. "n497391

APPEND fieldcat TO p_fieldcat. "n497391

CLEAR fieldcat.

fieldcat-fieldname = 'VPRSV'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'VERPR'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

fieldcat-cfieldname = 'WAERS'. "note 305809

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'STPRS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

fieldcat-cfieldname = 'WAERS'. "note 305809

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'PEINH'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BKLAS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'EKLAS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'QKLAS'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SALKV'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

fieldcat-cfieldname = 'WAERS'. "note 305809

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BWTTY'. "

fieldcat-tabname = 'DETAIL'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

ENDFORM. " FELDKATALOG_BESTAND

*&----


*

*& Form LISTAUSGABE_BESTAND

*&----


*

  • text

*----


*

FORM listausgabe_bestand.

      • mofication done by os0800

SUBMIT z21597r_ccna_inv_balance

WITH werks IN bwkey

WITH matnr IN matnr

WITH datum IN s_budat

WITH s_ingrp IN s_ingrp

WITH s_sigrp IN s_sigrp

WITH s_dtgrp IN s_dtgrp

AND return.

  • DATA: ls_variant LIKE disvariant.

  • DATA: ls_layout TYPE slis_layout_alv. "843776

  • CLEAR ls_variant.

  • ls_variant-report = alv_repid.

  • ls_variant-handle = 'MATS'.

*

  • ls_layout = alv_layout. "843776

  • IF alv_colourize_fields = 'X'. "843776

  • ls_layout-coltab_fieldname = 'FARBE'. "843776

  • ENDIF. "843776

  • ls_layout-f2code = '9MAT'. "843776

*

  • CALL FUNCTION alv_detail_func

  • EXPORTING

  • i_callback_program = alv_repid

  • i_callback_pf_status_set = 'STATUS_B'

  • i_callback_user_command = 'USER_COMMAND'

  • is_layout = ls_layout "843776

  • it_fieldcat = fieldcat_b[]

  • i_default = 'X'

  • i_save = 'A'

  • is_variant = ls_variant

  • is_print = alv_print

  • TABLES

  • t_outtab = detail.

*****end of modification by os0800

ENDFORM. " LISTAUSGABE_BESTAND

*&----


*

*& Form SELEKTION_ERGAENZEN

*&----


*

  • text

*----


*

FORM selektion_ergaenzen.

*----


Saldenausgabe am Ende Sachkonto -


*

LOOP AT bestand.

READ TABLE organ WITH KEY bwkey = bestand-bwkey.

MOVE organ-bukrs TO bestand-bukrs.

MOVE organ-waers TO bestand-waers.

  • Farbinformation:

CLEAR color.

REFRESH color.

IF bestand-lbkum >= 0.

color-fieldname = 'LBKUM'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'MEINS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF bestand-lbkum < 0.

color-fieldname = 'LBKUM'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'MEINS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF bestand-salk3 >= 0.

color-fieldname = 'SALK3'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF bestand-salk3 < 0.

color-fieldname = 'SALK3'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF bestand-vmkum >= 0.

color-fieldname = 'VMKUM'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'MEINS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF bestand-vmkum < 0.

color-fieldname = 'VMKUM'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'MEINS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF bestand-vmsal >= 0.

color-fieldname = 'VMSAL'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF bestand-vmsal < 0.

color-fieldname = 'VMSAL'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF bestand-vjkum >= 0.

color-fieldname = 'VJKUM'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'MEINS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF bestand-vjkum < 0.

color-fieldname = 'VJKUM'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'MEINS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF bestand-vjsal >= 0.

color-fieldname = 'VJSAL'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF bestand-vjsal < 0.

color-fieldname = 'VJSAL'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

bestand-farbe = color[].

MODIFY bestand TRANSPORTING bukrs waers farbe. "843776

ENDLOOP.

ENDFORM. " SELEKTION_ERGAENZEN

*&----


*

*& Form ORGANISATION

*&----


*

  • Einlesen der Tabellen T001, T001K, T030, T030R *

*----


*

FORM organisation.

SELECT DISTINCT t001~mandt t001~bukrs t001~butxt t001~waers t001~ktopl

t001k~bwkey t001k~bwmod t001k~xvkbw

INTO CORRESPONDING FIELDS OF TABLE organ

FROM t001 INNER JOIN t001k

ON t001~mandt = t001k~mandt AND

t001~bukrs = t001k~bukrs

WHERE t001k~bukrs IN bukrs

AND t001k~bwkey IN bwkey.

SORT organ.

  • Buchungsperioden (aktuelle und Vorperioden) werden aus MARV gelesen,

  • in die Organisationsatabelle ORGAN gestellt und von dort in die

  • Ausgabetabellen SALDO und HEADER übertragen

LOOP AT organ.

ON CHANGE OF organ-bukrs.

CLEAR rc_marv.

CALL FUNCTION 'MARV_SINGLE_READ'

EXPORTING

bukrs = organ-bukrs

IMPORTING

wmarv = marv

EXCEPTIONS

not_found = 1

wrong_call = 2

OTHERS = 3.

rc_marv = sy-subrc.

ENDON.

IF rc_marv IS INITIAL.

  • start of change by os0800.

MOVE-CORRESPONDING marv TO organ.

organ-vmgja = v_year.

organ-vmmon = v_period.

MODIFY organ TRANSPORTING vmgja vmmon.

MODIFY organ.

  • end of change by os0800.

ELSE.

DELETE organ.

ENDIF.

ENDLOOP.

  • If already here not more entries in ORGAN (wrong CC or combination)

  • leave. The rest of this report is not designed to recognize this

  • and totally fails with SELECT ... FOR ALL ENTRIES IN ORGAN.

IF organ[] IS INITIAL. "357162

MESSAGE s843. "357162

PERFORM anforderungsbild. "357162

ENDIF. "357162

  • 'inner join' ist nur für transparente Tabellen, jedoch nicht für

  • Pooltabellen möglich.

SELECT * FROM t030r

FOR ALL ENTRIES IN organ WHERE ktopl EQ organ-ktopl

AND ktosl EQ 'BSX'.

IF t030r-xbkla IS INITIAL.

CLEAR bklas. REFRESH bklas.

ENDIF.

SELECT * FROM t030 WHERE ktopl EQ t030r-ktopl

AND ktosl EQ 'BSX'

AND bklas IN bklas

AND konts IN skont.

  • Stimmt die automatische Kontenfindung für die Bestandsbuchung

  • mit den zulässigen Customizing-Einstellungen (vergleiche mit

  • Include DFKB1INT) überein (keine Kontomodifikation und keine

  • voneinander abweichende Soll- und Habenkonten erlaubt)?

IF NOT t030-komok IS INITIAL OR "note209823

t030-konts NE t030-konth. "note209823

MOVE t030-ktopl TO message_text.

WRITE 'BSX' TO message_text+10.

WRITE t030-konts TO message_text+20.

CONDENSE message_text.

MESSAGE s147(m8) WITH message_text.

  • Kontenfindung für den Eintrag & nicht möglich

PERFORM anforderungsbild.

ENDIF.

ON CHANGE OF t030-ktopl OR t030-konts.

SELECT SINGLE * FROM skat WHERE spras = sy-langu

AND ktopl = t030-ktopl

AND saknr = t030-konts.

ENDON.

MOVE-CORRESPONDING t030 TO it030.

MOVE-CORRESPONDING skat TO it030.

MOVE-CORRESPONDING t030r TO it030.

APPEND it030.

ENDSELECT.

  • Bewertungsmodifikation eingeschaltet?

IF t030r-xbwmo IS INITIAL. "note 358829

LOOP AT organ WHERE ktopl EQ t030r-ktopl "note 358829

AND bwmod NE space. "note 358829

CLEAR organ-bwmod. "note 358829

MODIFY organ. "note 358829

ENDLOOP. "note 358829

ENDIF. "note 358829

LOOP AT organ WHERE ktopl EQ t030r-ktopl. "note 358829

organ-xbkla = t030r-xbkla. "note 358829

MODIFY organ. "note 358829

ENDLOOP. "note 358829

ENDSELECT.

SORT it030 BY bklas.

IF NOT skont IS INITIAL.

DESCRIBE TABLE it030 LINES index_z.

IF index_z IS INITIAL.

MESSAGE s055 WITH skont bukrs.

  • Das Sachkonto & ist im Buchungskreis & nicht vorhanden

PERFORM anforderungsbild.

ENDIF.

LOOP AT it030.

ON CHANGE OF it030-bklas.

CHECK it030-bklas IN bklas.

MOVE 'I' TO ibklas-sign.

MOVE 'EQ' TO ibklas-option.

MOVE it030-bklas TO ibklas-low.

APPEND ibklas.

ENDON.

ENDLOOP.

DESCRIBE TABLE ibklas LINES index_z.

IF index_z IS INITIAL.

MESSAGE s843.

  • Zu den vorgegebenen Daten ist kein Bestand vorhanden

PERFORM anforderungsbild.

ENDIF.

ENDIF.

SORT it030.

ENDFORM. " ORGANISATION

*&----


*

*& Form STATUS_S

*&----


*

FORM status_s USING extab TYPE slis_t_extab.

IF pruef IS INITIAL.

  • SET PF-STATUS 'STANDARD' EXCLUDING extab. "OS0800

SET PF-STATUS 'INV_STANDARD' EXCLUDING extab. "OS0800

ELSEIF NOT pruef IS INITIAL.

  • SET PF-STATUS 'ERWPRUEF' EXCLUDING extab."OS0800

SET PF-STATUS 'INV_ERWPRUEF' EXCLUDING extab. "OS0800

ENDIF.

ENDFORM. " STATUS_S

*&----


*

*& Form STATUS_B

*&----


*

FORM status_b USING extab TYPE slis_t_extab.

SET PF-STATUS 'BESTAND' EXCLUDING extab.

ENDFORM. " STATUS_B

*&----


*

*& Form SELEKTION_BEARBEITEN

*&----


*

  • text

*----


*

FORM selektion_bearbeiten.

SORT xmbew BY bwkey bklas.

LOOP AT xmbew.

  • Wertartikel: Verkaufswerte anzeigen

READ TABLE organ WITH KEY mandt = sy-mandt

bwkey = xmbew-bwkey BINARY SEARCH.

IF NOT organ-xvkbw IS INITIAL.

  • Verkaufspreisbewertung ist in diesem Bewertungskreis aktiv geschaltet.

  • Es muß geprüft werden, ob es sich um einen Wertartikel handelt.

MOVE c_ja TO xmbew-xvkbw.

READ TABLE xmarav "353378

WITH KEY matnr = xmbew-matnr BINARY SEARCH."353378

  • Die Materialart des Artikels wird gelesen:

SELECT SINGLE * FROM t134m WHERE bwkey = xmbew-bwkey

AND mtart = xmarav-mtart.

IF sy-subrc IS INITIAL.

IF t134m-wertu = c_ja AND t134m-mengu = c_nein.

  • Es handelt sich um einen Wertartikel

MOVE c_ja TO xmbew-ke_xwart.

ELSE.

  • Es handelt sich nicht um einen Wertartikel

MOVE c_nein TO xmbew-ke_xwart.

ENDIF.

ELSE.

  • Materialart nicht gefunden.

  • error fixed ( reported by extended syntax check ) "n486477

MESSAGE s001 "n486477

WITH 'T134M' xmbew-bwkey xmarav-mtart ' '. "n486477

ENDIF.

ELSE.

MOVE c_nein TO xmbew-ke_xwart.

MOVE c_nein TO xmbew-xvkbw.

ENDIF.

IF NOT negativ IS INITIAL.

IF xmbew-ke_xwart IS INITIAL.

IF xmbew-lbkum GE cnull. "Negative Bestände

DELETE xmbew. "Loeschen von positiven Best.

CHECK xmbew-lbkum LT cnull.

ENDIF.

ELSEIF NOT xmbew-ke_xwart IS INITIAL. "Verkaufswerte

IF xmbew-vksal GE cnull.

DELETE xmbew.

CHECK xmbew-vksal LT cnull.

ENDIF.

ENDIF.

ENDIF.

IF nullb = ' '. "keine Materialien mit

IF xmbew-ke_xwart IS INITIAL. "Nullbestand

IF xmbew-lbkum = null.

DELETE xmbew.

CHECK xmbew-lbkum NE null.

ENDIF.

ELSEIF NOT xmbew-ke_xwart IS INITIAL.

IF xmbew-vksal = null.

DELETE xmbew.

CHECK xmbew-vksal NE null.

ENDIF.

ENDIF.

ENDIF.

ON CHANGE OF xmbew-bklas OR xmbew-bwkey.

rc = 0.

PERFORM sachkonto.

ENDON.

IF rc NE 0.

DELETE xmbew.

CHECK rc = 0.

ENDIF.

MOVE xkonto TO xmbew-xkonto.

MOVE organ-bukrs TO xmbew-bukrs.

MOVE organ-butxt TO xmbew-butxt.

MODIFY xmbew.

ENDLOOP.

SORT xmbew BY matnr bwkey bwtar.

CLEAR gebew.

LOOP AT xmbew.

IF NOT keinzel IS INITIAL OR xmbew-bwtty IS INITIAL.

CHECK xmbew-bwtar IS INITIAL.

ELSEIF keinzel IS INITIAL AND NOT xmbew-bwtty IS INITIAL.

IF pruef IS INITIAL.

CHECK NOT xmbew-bwtar IS INITIAL.

ELSEIF NOT pruef IS INITIAL.

READ TABLE gebew WITH KEY matnr = xmbew-matnr

bwkey = xmbew-bwkey.

IF sy-subrc IS INITIAL.

CLEAR header_change. REFRESH header_change.

objekt = 'MATERIAL'.

objektid = gebew-matnr.

CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

EXPORTING

objectclass = objekt

objectid = objektid

TABLES

i_cdhdr = header_change

EXCEPTIONS

no_position_found = 1

OTHERS = 2.

IF sy-subrc IS INITIAL.

CLEAR item_change. REFRESH item_change.

LOOP AT header_change.

nummer = header_change-changenr.

tabname = 'MBEW'.

tabkey(3) = sy-mandt.

tabkey+3(18) = gebew-matnr.

tabkey+21(4) = gebew-bwkey.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

EXPORTING

changenumber = nummer

tablename = tabname

tablekey = tabkey

  • importing

  • header = icdpos

TABLES

editpos = item_change

EXCEPTIONS

no_position_found = 1

OTHERS = 2.

LOOP AT item_change.

CHECK item_change-fname EQ 'BWTTY'

AND item_change-f_old EQ space

AND item_change-f_new NE space.

xsumme = 'X'.

CLEAR item_change.

ENDLOOP.

ENDLOOP.

ENDIF.

ENDIF.

IF xsumme IS INITIAL.

CHECK NOT xmbew-bwtar IS INITIAL.

ELSEIF NOT xsumme IS INITIAL.

CHECK xmbew-bwtar IS INITIAL.

ENDIF.

ENDIF.

ENDIF.

MOVE-CORRESPONDING xmbew TO bestand.

MOVE xmbew-xkonto TO bestand-konts.

READ TABLE it030 WITH KEY konts = bestand-konts.

MOVE it030-txt50 TO bestand-txt50.

READ TABLE xmarav WITH KEY matnr = xmbew-matnr BINARY SEARCH.

MOVE xmarav-meins TO bestand-meins.

MOVE xmarav-maktx TO bestand-maktx.

MOVE xmarav-lvorm TO bestand-lvorx.

APPEND bestand.

ENDLOOP.

ENDFORM. " SELEKTION_BEARBEITEN

*&----


*

*& Form USER_COMMAND *

*&----


*

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • no details possible for function sums only "n497391

IF NOT summen IS INITIAL. "n497391

  • This function is not possible "n497391

MESSAGE e127(00). "n497391

ENDIF. "n497391

      • PERFORM listausgabe_bestand.

CASE r_ucomm.

WHEN '9BST'.

ucomm = sy-ucomm.

CLEAR detail. REFRESH detail.

READ TABLE saldo INDEX rs_selfield-tabindex.

  • the cursor must be on a line with a stock account "n525339

IF sy-subrc IS INITIAL AND "n525339

rs_selfield-tabname = 'SALDO'. "n525339

LOOP AT bestand WHERE bukrs = saldo-bukrs

AND konts = saldo-konto.

MOVE-CORRESPONDING bestand TO detail.

  • The posting period is determined per account when creating

  • SALDO. The entry in BESTAND is therefore emtpy.

detail-buper = saldo-buper. "211416

APPEND detail.

ENDLOOP.

SORT detail BY bwkey matnr.

PERFORM listausgabe_bestand.

ELSE.

MESSAGE e847 WITH text-041.

  • Bitte Cursor auf & positionieren

  • Text-041: gültiges Sachkonto

ENDIF.

CLEAR saldo.

CLEAR r_ucomm.

      • WHEN '9MAT'.

        • If the previous period or the previous year has been "n897018

        • selected, send an information message when the "n897018

        • transaction "MMBE - Stock * overview" is called because "n897018

        • this transaction only shows the current stock. "n897018

      • IF vmsaldo = 'X' OR vjsaldo = 'X'. "n897018

      • MESSAGE i895 WITH text-t04. "n897018

      • ENDIF. "n897018

***

      • READ TABLE detail INDEX rs_selfield-tabindex.

      • IF sy-subrc IS INITIAL.

      • DATA: l_lgort LIKE mseg-lgort,

      • l_charg LIKE mseg-charg.

      • CLEAR: l_lgort, l_charg.

      • SET PARAMETER ID 'MAT' FIELD detail-matnr.

      • SET PARAMETER ID 'WRK' FIELD detail-bwkey.

      • SET PARAMETER ID 'LAG' FIELD l_lgort.

      • SET PARAMETER ID 'CHA' FIELD l_charg.

      • CALL TRANSACTION 'MMBE' AND SKIP FIRST SCREEN.

      • ELSE.

      • MESSAGE s219.

        • Bitte positionieren Sie den Cursor auf das gewünschte Material

      • ENDIF.

      • CLEAR detail-matnr.

      • CLEAR detail-bwkey.

      • CLEAR r_ucomm.

***

      • WHEN '9EWP'.

      • PERFORM listausgabe_pruefung.

      • CLEAR r_ucomm.

ENDCASE.

ENDFORM. " USER_COMMAND

*&----


*

*& Form SUMMEN_BILDEN

*&----


*

  • Summen pro Buchungskreis und Sachkonto

*----


*

FORM summen_bilden.

SORT bestand BY bukrs konts.

LOOP AT bestand.

saldo-mabtr = saldo-mabtr + bestand-salk3.

MOVE bestand-bukrs TO saldo-bukrs.

MOVE bestand-butxt TO saldo-butxt.

MOVE bestand-konts TO saldo-konto.

MOVE bestand-txt50 TO saldo-txt50.

MOVE bestand-waers TO saldo-waers.

MOVE bestand-waers TO saldo-waer1.

MOVE bestand-waers TO saldo-waer2.

  • fill working area for possible error case "n631251

IF g_s_err_acc-flag IS INITIAL. "n631251

IF NOT bestand-salk3 IS INITIAL. "n631251

  • take the first material with a value of this "n631251

  • group ( account ) as an example "n631251

MOVE-CORRESPONDING bestand "n631251

TO g_s_err_acc. "n631251

MOVE x TO g_s_err_acc-flag. "n631251

ENDIF. "n631251

ENDIF. "n631251

AT END OF konts.

CALL FUNCTION 'FOR_ALL_SKC1A'

EXPORTING

xbukrs = bestand-bukrs

xsaknr = bestand-konts

TABLES

xskc1a = intab

EXCEPTIONS

key_incomplete = 01

not_authorized = 02

not_found = 03.

IF sy-subrc = 02.

MESSAGE s460(f5) WITH bestand-bukrs. "note 427068

  • Sie haben keine Berechtigung für Buchungskreis & "note 427068

  • message s120 with bestand-konts.

PERFORM anforderungsbild.

ELSEIF sy-subrc = 03 AND NOT saldo-mabtr IS INITIAL.

  • account not found but there are values "n631251

  • improve handling when G/L account is missing "n631251

  • save the data in working table g_t_err_acc "n631251

APPEND g_s_err_acc TO g_t_err_acc. "n631251

ENDIF.

ON CHANGE OF bestand-bukrs.

READ TABLE organ WITH KEY bukrs = bestand-bukrs.

PERFORM periode.

ENDON.

LOOP AT intab.

CHECK intab-gjahr = xbuper+3(4).

ADD intab-um01h THEN intab-um02h UNTIL intab-um16h

GIVING haben ACCORDING TO bermon.

ADD intab-um01s THEN intab-um02s UNTIL intab-um16s

GIVING soll ACCORDING TO bermon.

saldo-skbtr = saldo-skbtr + intab-umsav + soll - haben.

ENDLOOP.

CLEAR intab. REFRESH intab.

  • move xsaldo to saldo-vmsal.

saldo-diff = saldo-skbtr - saldo-mabtr.

saldo-buper = xbuper.

APPEND saldo.

CLEAR saldo.

  • delete working area for possible errors "n631251

CLEAR g_s_err_acc. "n631251

ENDAT.

ENDLOOP.

LOOP AT saldo.

  • Farbinformation:

CLEAR color.

REFRESH color.

IF saldo-mabtr >= 0.

color-fieldname = 'MABTR'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF saldo-mabtr < 0.

color-fieldname = 'MABTR'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAERS'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF saldo-skbtr >= 0.

color-fieldname = 'SKBTR'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAER1'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF saldo-skbtr < 0.

color-fieldname = 'SKBTR'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAER1'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

IF saldo-diff = 0.

color-fieldname = 'DIFF'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAER2'.

color-color-col = '5'.

color-color-int = '0'.

APPEND color.

ELSEIF saldo-diff <> 0.

color-fieldname = 'DIFF'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

color-fieldname = 'WAER2'.

color-color-col = '6'.

color-color-int = '0'.

APPEND color.

ENDIF.

saldo-farbe = color[].

MODIFY saldo.

ENDLOOP.

ENDFORM. " SUMMEN_BILDEN

*&----


*

*& Form FELDKATALOG_SALDO

*&----


*

  • text

*----


*

  • -->P_FIELDCAT[] text *

*----


*

FORM feldkatalog_saldo USING p_fieldcat TYPE slis_t_fieldcat_alv.

DATA: fieldcat TYPE slis_fieldcat_alv.

  • Kopffelder:

CLEAR fieldcat.

fieldcat-fieldname = 'BUPER'. "

fieldcat-tabname = 'HEADER'.

fieldcat-key = 'X'.

fieldcat-seltext_s = text-070.

fieldcat-seltext_m = text-070.

fieldcat-seltext_l = text-070.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BUKRS'. "

fieldcat-tabname = 'HEADER'.

fieldcat-ref_tabname = 'T001'.

fieldcat-key = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BUTXT'. "

fieldcat-tabname = 'HEADER'.

fieldcat-ref_tabname = 'T001'.

fieldcat-key = 'X'.

fieldcat-key_sel = 'X'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

  • Positionsfelder:

CLEAR fieldcat.

fieldcat-fieldname = 'KONTO'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_fieldname = 'KONTS'.

fieldcat-ref_tabname = 'T030'.

fieldcat-key = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'TXT50'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 'SKAT'.

fieldcat-key = 'X'.

fieldcat-key_sel = 'X'.

fieldcat-no_out = 'X'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MABTR'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_fieldname = 'SALK3'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-cfieldname = 'WAERS'.

fieldcat-do_sum = 'X'.

fieldcat-seltext_s = text-080.

fieldcat-seltext_m = text-080.

fieldcat-seltext_l = text-080.

fieldcat-reptext_ddic = text-080. "433493

  • extend field definition of sum fields "n497391

fieldcat-outputlen = 21. "n497391

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAERS'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 'T001'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SKBTR'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_fieldname = 'SALK3'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-cfieldname = 'WAER1'.

fieldcat-do_sum = 'X'.

fieldcat-seltext_s = text-083.

fieldcat-seltext_m = text-083.

fieldcat-seltext_l = text-083.

fieldcat-reptext_ddic = text-083. "433493

  • extend field definition of sum fields "n497391

fieldcat-outputlen = 21. "n497391

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAER1'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_fieldname = 'WAERS'.

fieldcat-ref_tabname = 'T001'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'DIFF'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_fieldname = 'SALK3'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-cfieldname = 'WAER2'.

fieldcat-do_sum = 'X'.

fieldcat-seltext_s = text-086.

fieldcat-seltext_m = text-086.

fieldcat-seltext_l = text-086.

fieldcat-reptext_ddic = text-086. "433493

  • extend field definition of sum fields "n497391

fieldcat-outputlen = 21. "n497391

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAER2'. "

fieldcat-tabname = 'SALDO'.

fieldcat-ref_fieldname = 'WAERS'.

fieldcat-ref_tabname = 'T001'.

APPEND fieldcat TO p_fieldcat.

  • note 136652

DATA: noout.

IF matlines IS INITIAL.

noout = 'X'.

ELSE.

CLEAR noout.

ENDIF.

CLEAR fieldcat.

fieldcat-fieldname = 'BWKEY'.

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = noout.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MATNR'.

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = noout.

APPEND fieldcat TO p_fieldcat.

  • material short text always hidden "n407181

CLEAR fieldcat. "n407181

fieldcat-fieldname = 'MAKTX'. "n407181

fieldcat-tabname = 'SALDO'. "n407181

fieldcat-ref_tabname = 'MAKT'. "n407181

fieldcat-no_out = 'X'. "n407181

APPEND fieldcat TO p_fieldcat. "n407181

CLEAR fieldcat.

fieldcat-fieldname = 'LBKUM'.

fieldcat-tabname = 'SALDO'.

fieldcat-qfieldname = 'MEINS'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-no_out = noout.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MEINS'.

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 'MARA'.

fieldcat-no_out = noout.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SALK3'.

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-cfieldname = 'WAERS1'.

fieldcat-no_out = noout.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAERS1'.

fieldcat-tabname = 'SALDO'.

fieldcat-ref_tabname = 't001'.

fieldcat-ref_fieldname = 'WAERS'.

fieldcat-no_out = noout.

APPEND fieldcat TO p_fieldcat.

  • note 136652

ENDFORM. " FELDKATALOG_SALDO

*&----


*

*& Form LISTAUSGABE_SALDO

*&----


*

  • text

*----


*

FORM listausgabe_saldo.

SORT saldo BY bukrs konto.

LOOP AT saldo.

ON CHANGE OF saldo-bukrs.

MOVE saldo-buper TO header-buper.

MOVE saldo-bukrs TO header-bukrs.

MOVE saldo-butxt TO header-butxt.

APPEND header.

ENDON.

ENDLOOP.

alv_keyinfo-header01 = 'BUKRS'.

alv_keyinfo-item01 = 'BUKRS'.

alv_keyinfo-item02 = 'KONTO1'.

  • note 136652

IF NOT matlines IS INITIAL.

DATA: BEGIN OF saldo1 OCCURS 0.

INCLUDE STRUCTURE saldo.

DATA: END OF saldo1.

alv_keyinfo-header01 = 'BUKRS'.

alv_keyinfo-item01 = 'BUKRS1'.

alv_keyinfo-item02 = 'KONTO1'.

alv_keyinfo-item03 = 'BWKEY'.

alv_keyinfo-item04 = 'MATNR'.

saldo1[] = saldo[].

REFRESH saldo.

SORT saldo1 BY bukrs konto.

SORT bestand BY bukrs konts matnr.

LOOP AT saldo1.

saldo = saldo1.

saldo-bukrs1 = saldo-bukrs.

saldo-konto1 = saldo-konto.

APPEND saldo.

LOOP AT bestand WHERE bukrs = saldo1-bukrs

AND konts = saldo1-konto.

CLEAR saldo.

saldo-bukrs1 = bestand-bukrs.

saldo-konto1 = bestand-konts.

saldo-bwkey = bestand-bwkey.

saldo-matnr = bestand-matnr.

  • copy the material short text "n407181

MOVE bestand-maktx TO saldo-maktx. "n407181

saldo-lbkum = bestand-lbkum.

saldo-meins = bestand-meins.

saldo-salk3 = bestand-salk3.

saldo-waers1 = bestand-waers.

APPEND saldo.

ENDLOOP.

ENDLOOP.

ENDIF.

  • note 136652

layout = alv_layout.

layout-coltab_fieldname = 'FARBE'.

layout-f2code = '9BST'.

  • assign a form routine for the process time top-of-page "n497391

MOVE : 'TOP_OF_PAGE' TO g_s_event-name, "n497391

'F1000_TOP_OF_PAGE' TO g_s_event-form. "n497391

APPEND g_s_event TO g_t_event. "n497391

  • assign form routine for the output of account errors "n631251

MOVE : 'END_OF_LIST' TO g_s_event-name, "n631251

'F1100_END_OF_LIST' TO g_s_event-form. "n631251

APPEND g_s_event TO g_t_event. "n631251

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = alv_repid

i_callback_pf_status_set = 'STATUS_S'

i_callback_user_command = 'USER_COMMAND'

is_layout = layout

it_fieldcat = fieldcat_s[]

it_events = g_t_event[] "n497391

i_default = 'X'

i_save = 'A'

is_variant = alv_variant

i_tabname_header = 'HEADER'

i_tabname_item = 'SALDO'

is_keyinfo = alv_keyinfo

is_print = alv_print

TABLES

t_outtab_header = header

t_outtab_item = saldo.

ENDFORM. " LISTAUSGABE_SALDO

*&----


*

*& Form ERWEITERTE_PRUEFUNG

*&----


*

  • Erweiterte Prüfung bei getrennter Bewertung

*----


*

FORM erweiterte_pruefung.

SORT xmbew BY matnr bwkey bwtar.

LOOP AT xmbew.

IF NOT xmbew-bwtty IS INITIAL AND xmbew-no_sum IS INITIAL.

IF xmbew-bwtar IS INITIAL.

gebew-summe_wert = xmbew-salk3.

gebew-summe_bestand = xmbew-lbkum.

ELSEIF NOT xmbew-bwtar IS INITIAL.

gebew-einzel_wert = gebew-einzel_wert + xmbew-salk3.

gebew-einzel_bestand = gebew-einzel_bestand + xmbew-lbkum.

ENDIF.

ENDIF.

AT END OF bwkey.

IF gebew-summe_wert NE gebew-einzel_wert OR

gebew-summe_bestand NE gebew-einzel_bestand.

MOVE-CORRESPONDING xmbew TO gebew.

READ TABLE organ WITH KEY bwkey = xmbew-bwkey.

MOVE organ-waers TO gebew-waers.

MOVE organ-waers TO gebew-waer1.

READ TABLE xmarav WITH KEY matnr = xmbew-matnr BINARY SEARCH.

  • copy the material short text if the entry exists "n407181

IF sy-subrc IS INITIAL. "n407181

MOVE xmarav-maktx TO gebew-maktx. "n407181

MOVE xmarav-meins TO gebew-meins. "n407181

MOVE xmarav-meins TO gebew-mein1. "n407181

ENDIF. "n407181

APPEND gebew.

ENDIF.

CLEAR gebew.

ENDAT.

ENDLOOP.

SORT gebew.

ENDFORM. " ERWEITERTE_PRUEFUNG

*&----


*

*& Form LISTAUSGABE_PRUEFUNG

*&----


*

  • text

*----


*

FORM listausgabe_pruefung.

layout = alv_layout.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = alv_repid

i_callback_pf_status_set = 'STATUS_P'

i_callback_user_command = 'USER_COMMAND'

is_layout = layout

it_fieldcat = fieldcat_p[]

is_print = alv_print

TABLES

t_outtab = gebew.

ENDFORM. " LISTAUSGABE_PRUEFUNG

*&----


*

*& Form FELDKATALOG_PRUEFUNG

*&----


*

  • text

*----


*

  • -->P_FIELDCAT_P[] text *

*----


*

FORM feldkatalog_pruefung USING p_fieldcat TYPE slis_t_fieldcat_alv.

DATA: fieldcat TYPE slis_fieldcat_alv.

  • Positionsfelder:

CLEAR fieldcat.

fieldcat-fieldname = 'MATNR'. "

fieldcat-tabname = 'GEBEW'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-key = 'X'.

fieldcat-col_pos = '1'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'BWKEY'. "

fieldcat-tabname = 'GEBEW'.

fieldcat-ref_tabname = 'MBEW'.

fieldcat-key = 'X'.

fieldcat-col_pos = '2'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'EINZEL_WERT'. "

fieldcat-tabname = 'GEBEW'.

fieldcat-col_pos = '3'.

fieldcat-outputlen = '11'.

fieldcat-cfieldname = 'WAERS'.

fieldcat-seltext_s = text-088.

fieldcat-seltext_m = text-089.

fieldcat-seltext_l = text-090.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAERS'.

fieldcat-tabname = 'GEBEW'.

fieldcat-ref_tabname = 'T001'.

fieldcat-col_pos = '4'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SUMME_WERT'. "

fieldcat-tabname = 'GEBEW'.

fieldcat-col_pos = '5'.

fieldcat-outputlen = '11'.

fieldcat-cfieldname = 'WAER1'.

fieldcat-seltext_s = text-091.

fieldcat-seltext_m = text-092.

fieldcat-seltext_l = text-093.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'WAER1'.

fieldcat-tabname = 'GEBEW'.

fieldcat-ref_fieldname = 'WAERS'.

fieldcat-ref_tabname = 'T001'.

fieldcat-col_pos = '6'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'EINZEL_BESTAND'. "

fieldcat-tabname = 'GEBEW'.

fieldcat-col_pos = '7'.

fieldcat-outputlen = '11'.

fieldcat-qfieldname = 'MEINS'.

fieldcat-seltext_s = text-094.

fieldcat-seltext_m = text-095.

fieldcat-seltext_l = text-096.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MEINS'.

fieldcat-tabname = 'GEBEW'.

fieldcat-ref_tabname = 'MARA'.

fieldcat-col_pos = '8'.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'SUMME_BESTAND'. "

fieldcat-tabname = 'GEBEW'.

fieldcat-col_pos = '9'.

fieldcat-outputlen = '11'.

fieldcat-qfieldname = 'MEIN1'.

fieldcat-seltext_s = text-097.

fieldcat-seltext_m = text-098.

fieldcat-seltext_l = text-099.

APPEND fieldcat TO p_fieldcat.

CLEAR fieldcat.

fieldcat-fieldname = 'MEIN1'.

fieldcat-tabname = 'GEBEW'.

fieldcat-ref_fieldname = 'MEINS'.

fieldcat-ref_tabname = 'MARA'.

fieldcat-col_pos = '10'.

APPEND fieldcat TO p_fieldcat.

  • material short text always hidden "n407181

CLEAR fieldcat. "n407181

fieldcat-fieldname = 'MAKTX'. "n407181

fieldcat-tabname = 'GEBEW'. "n407181

fieldcat-ref_tabname = 'MAKT'. "n407181

fieldcat-col_pos = '11'. "n407181

fieldcat-no_out = 'X'. "n407181

APPEND fieldcat TO p_fieldcat. "n407181

ENDFORM. " FELDKATALOG_PRUEFUNG

*&----


*

*& Form STATUS_P

*&----


*

FORM status_p USING extab TYPE slis_t_extab.

SET PF-STATUS 'PRUEFPROT' EXCLUDING extab.

ENDFORM. " STATUS_P

*----

-


"n497391

"n497391

*&----


*

*& Form f1000_top_of_page

*&----


*

  • text

*----


*

FORM f1000_top_of_page. "n497391

"n497391

  • print warning at the top of the page "n497391

CHECK : g_flag_warning_m7375 = 'X'. "n497391

"n497391

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' "n497391

EXPORTING "n497391

it_list_commentary = g_t_listheader[]. "n497391

"n497391

ENDFORM. "f1000_top_of_page "n497391

"n497391

*----

-


"n497391

*----

-


"n486477

  • tpc_check_period_for_all_CC "n486477

*----

-


"n486477

"n486477

  • special time depending authorization for auditor "n486477

"n486477

*&----


*

*& Form tpc_check_period_for_all_CC

*&----


*

  • text

*----


*

FORM tpc_check_period_for_all_cc. "n486477

"n486477

DATA : l_f_buper LIKE bbseg-abper, "n486477

l_s_marv LIKE marv. "n486477

"n486477

  • clear working aeras and ranges "n486477

CLEAR : g_s_bukrs, g_s_t001k. "n486477

REFRESH : g_t_bukrs, g_t_t001k. "n486477

"n486477

IF bwkey[] IS INITIAL. "n486477

  • no restrictions for valuation : "n486477

  • get all matching company codes from table T001 "n486477

SELECT bukrs FROM t001 "n486477

INTO CORRESPONDING FIELDS OF TABLE g_t_bukrs "n486477

WHERE bukrs IN bukrs. "n486477

"n486477

IF sy-subrc <> 0. "n486477

SET CURSOR FIELD 'BUKRS-LOW'. "n486477

  • Company code does not exist "n486477

MESSAGE e282. "n486477

ENDIF. "n486477

ELSE. "n486477

  • select all matching valuation areas and look for the "n486477

  • corresponding company codes "n486477

SELECT bukrs FROM t001k "n486477

INTO CORRESPONDING FIELDS OF TABLE g_t_bukrs "n486477

WHERE bwkey IN bwkey "n486477

AND bukrs IN bukrs. "n486477

"n486477

IF sy-subrc IS INITIAL. "n486477

SORT g_t_bukrs BY bukrs. "n486477

DELETE ADJACENT DUPLICATES FROM g_t_bukrs. "n486477

ELSE. "n486477

SET CURSOR FIELD 'BWKEY-LOW'. "n486477

MESSAGE e884. "Valuation area does not exist "n486477

ENDIF. "n486477

ENDIF. "n486477

"n486477

  • check the selected company codes and the dates "n486477

LOOP AT g_t_bukrs INTO g_s_bukrs. "n486477

"n486477

  • read the matching MARV entry for this company code "n486477

CALL FUNCTION 'MARV_SINGLE_READ' "n486477

EXPORTING "n486477

bukrs = g_s_bukrs-bukrs "n486477

IMPORTING "n486477

wmarv = l_s_marv "n486477

EXCEPTIONS "n486477

not_found = 1 "n486477

wrong_call = 2 "n486477

OTHERS = 3. "n486477

"n486477

IF sy-subrc <> 0. "n486477

  • material control record missing in company code & "n486477

SET CURSOR FIELD 'BUKRS-LOW'. "n486477

MESSAGE e176 WITH g_s_bukrs-bukrs. "n486477

ENDIF. "n486477

"n486477

  • get the posting period for the authority check "n486477

  • depending on the selected period "n486477

  • Begin of change by os0800

    • IF NOT aksaldo IS INITIAL. "n486477

      • current period "n486477

    • MOVE : l_s_marv-lfmon TO l_f_buper+5(2), "n486477

    • '/' TO l_f_buper+4(1), "n486477

    • l_s_marv-lfgja TO l_f_buper+0(4). "n486477

"n486477

    • ELSEIF NOT vmsaldo IS INITIAL. "n486477

    • previous period "n486477

  • MOVE : l_s_marv-vmmon TO l_f_buper+5(2), "n486477

  • '/' TO l_f_buper+4(1), "n486477

  • l_s_marv-vmgja TO l_f_buper+0(4). "n486477

  • "n486477

  • ELSEIF NOT vjsaldo IS INITIAL. "n486477

    • previous year "n486477

  • MOVE : l_s_marv-vjmon TO l_f_buper+5(2), "n486477

  • '/' TO l_f_buper+4(1), "n486477

  • l_s_marv-vjgja TO l_f_buper+0(4). "n486477

  • ENDIF. "n486477 **********end of change by os0800

  • End of change by os0800

  • check the authorization for date and company code "n486477

CALL FUNCTION 'FI_CHECK_DATE' "n486477

EXPORTING "n486477

i_bukrs = g_s_bukrs-bukrs "n486477

i_user = sy-uname "n486477

i_program = g_f_repid "n486477

i_from_per = l_f_buper "n486477

EXCEPTIONS "n486477

no_authority_prog = 1 "n486477

no_authority_date = 2 "n486477

wrong_parameter = 3 "n486477

OTHERS = 4. "n486477

"n486477

CASE sy-subrc. "n486477

WHEN 0. "n486477

  • authorization ok --> take this company code "n486477

"n486477

WHEN 2. "n486477

  • send 2 messages to show the company code "n486477

SET CURSOR FIELD 'BUKRS-LOW'. "n486477

  • no display authorization for company code & "n486477

MESSAGE i113(fg) WITH g_s_bukrs-bukrs. "n486477

"n486477

SET CURSOR FIELD 'BWKEY-LOW'. "n486477

  • Keine Berechtigung zur Anzeige von Daten aus ... "n486477

MESSAGE e002(ca_check_date). "n486477

"n486477

WHEN OTHERS. "n486477

  • an error occurred "n486477

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

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

ENDCASE. "n486477

ENDLOOP. "n486477

"n486477

FREE : g_t_bukrs, g_t_t001k. "n486477

"n486477

ENDFORM. "tpc_check_period_for_all_CC "n486477

"n486477

*----

-


"n486477

  • tpc_write_log "n555246

*----

-


"n555246

"n555246

*&----


*

*& Form tpc_write_log

*&----


*

  • text

*----


*

FORM tpc_write_log. "n555246

"n555246

  • check whether the function module is available "n555246

CALL FUNCTION 'FUNCTION_EXISTS' "n555246

EXPORTING "n555246

funcname = 'CA_WRITE_LOG' "n555246

EXCEPTIONS "n555246

function_not_exist = 1 "n555246

OTHERS = 2. "n555246

"n555246

CHECK : sy-subrc IS INITIAL. "n555246

"n555246

  • write the entries of the selection screen into log file "n555246

CALL FUNCTION 'CA_WRITE_LOG' "#EC EXISTS "n555246

EXPORTING "n555246

i_program = g_f_repid "n555246

EXCEPTIONS "n555246

write_error = 1 "n555246

OTHERS = 2. "n555246

"n555246

IF sy-subrc IS INITIAL. "n555246

COMMIT WORK. "n555246

ELSE. "n555246

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

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

ENDIF. "n555246

"n555246

ENDFORM. "tpc_write_log "n555246

"n555246

*----

-


"n555246

*----

-


"n631251

  • f1100_end_of_list "n631251

*----

-


"n631251

"n631251

*&----


*

*& Form f1100_end_of_list

*&----


*

  • text

*----


*

FORM f1100_end_of_list. "n631251

"n631251

  • print the detected errors with missing stock accounts "n631251

  • and one material as an example "n631251

"n631251

  • go on when missing accounts detected "n631251

CHECK NOT g_t_err_acc[] IS INITIAL. "n631251

DATA : l_text(255) TYPE c. "n631251

"n631251

FORMAT COLOR COL_NEGATIVE. "print in red color "n631251

"n631251

LOOP AT g_t_err_acc INTO g_s_err_acc. "n631251

SKIP 1. "n631251

"n631251

  • complete message FH 005 with account and company code "n631251

  • Account &1 does not exist in company code &2 "n631251

MESSAGE i005(fh) "n631251

WITH g_s_err_acc-konts g_s_err_acc-bukrs "n631251

INTO l_text. "n631251

WRITE : /1 l_text. "n631251

"n631251

  • print a line with a material number as example "n631251

CONCATENATE "n631251

text-001 "G/L accnt is missing for val. segment "n631251

g_s_err_acc-matnr "n631251

g_s_err_acc-bwkey "n631251

g_s_err_acc-bwtar "n631251

INTO l_text SEPARATED BY space. "n631251

CONDENSE l_text. "n631251

WRITE : /1 l_text. "n631251

ENDLOOP. "n631251

"n631251

FORMAT RESET. "n631251

"n631251

ENDFORM. "f1100_end_of_list "n631251

"n631251

  • Start of change by os0800

*&----


*

*& Form get_dates

*&----


*

  • used to calculate first day and last day of the given period *

*----


*

FORM get_dates .

v_year = sl_spbup-low+0(4).

v_period = sl_spbup-low+4(2).

v_year1 = sl_spbup-high+0(4).

v_period1 = sl_spbup-high+4(2).

CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = v_year

  • I_MONMIT = 00

i_periv = 'KO'

i_poper = v_period

IMPORTING

e_date = v_first_date

  • EXCEPTIONS

  • INPUT_FALSE = 1

  • T009_NOTFOUND = 2

  • T009B_NOTFOUND = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

IF sl_spbup-high IS INITIAL .

CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = v_year

  • I_MONMIT = 00

i_periv = 'KO'

i_poper = v_period

IMPORTING

e_date = v_last_date

  • EXCEPTIONS

  • INPUT_FALSE = 1

  • T009_NOTFOUND = 2

  • T009B_NOTFOUND = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

s_budat-sign = 'I'.

s_budat-option = 'BT'.

s_budat-low = v_first_date.

s_budat-high = v_last_date.

APPEND s_budat.

CLEAR s_budat.

ELSEIF sl_spbup-high IS NOT INITIAL .

CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'

EXPORTING

i_gjahr = v_year1

  • I_MONMIT = 00

i_periv = 'KO'

i_poper = v_period1

IMPORTING

e_date = v_last_date1

  • EXCEPTIONS

  • INPUT_FALSE = 1

  • T009_NOTFOUND = 2

  • T009B_NOTFOUND = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

s_budat-sign = 'I'.

s_budat-option = 'BT'.

s_budat-low = v_first_date.

s_budat-high = v_last_date1.

APPEND s_budat.

CLEAR s_budat.

ENDIF.

ENDFORM. " get_dates

  • End of chnage by os0800.

Former Member
0 Kudos
184

Hi All,

I will explain my problem clearly now. I am calling a transaction suppose t1 thru submit and return where as t1 is calling another transaction suppose t2 with submit and return. Now After executing my program i am getting t1 then t2 screens.When i am executing F3 from t2 it is getting the screen of t1 and there again ifu choose F3 then it is calling the selection screen of t1. I think this is because of using submit and return in t1 .Am I thinking in the right way. If so what is the solution for not getting the selection screen of t1.Please help me

Thanks &Regards ,

praveena.

0 Kudos
184

Hi Sri Praveena,

If you call T2 from T1 using statement Submit T2 and return, then you will automatically get display list of T1 when u press F3 button.

If you want that T1 should not get displayed again, dont use AND RETURN. Just SUBMIT T2 from T1.

Regards,

Navin

Former Member
0 Kudos
184

Hi All,

I am calling a transaction suppose t1 thru submit and return where as t1 is calling another transaction suppose t2 with submit and return. Now After executing my program i am getting t1 then t2 screens.When i am executing F3 from t2 it is getting the screen of t1 and there again ifu choose F3 then it is calling the selection screen of t1. I think this is because of using submit and return in t1 .Am I thinking in the right way. If so what is the solution for not getting the selection screen of t1.Please help me

Thanks &Regards ,

praveena.