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: 

hi abaper expert

Former Member
0 Kudos

hello

i hv a problem .in transaction fk10n.i hv been copy its program.i hv to add one more field as a plant code .and the data should be fatch depend on plant code.because plant code may be vary.

code is

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

report RFARBALANCE message-id FDBL.

...tables.............................................................

tables: LFC1,

LFC3,

RF42B,

SSCRFIELDS.

...selections.........................................................

select-options: SO_LIFNR for RF42B-LIFNR memory id LIF

matchcode object KRED

visible length 10,

SO_BUKRS for LFC3-BUKRS memory id BUK.

parameters: GP_GJAHR like LFC1-GJAHR memory id GJR,

GP_ITUSR type C no-display.

selection-screen function key 1.

...selection screen for processing of worklists.......................

selection-screen begin of screen 2000.

selection-screen begin of block VENDOR with frame title TEXT-010.

parameters: GP_WLLIF like RF42B-IDNTK.

select-options: SO_WLLIF for LFC1-LIFNR memory id LIF.

selection-screen end of block VENDOR.

selection-screen begin of block COMPANY with frame title TEXT-011.

parameters: GP_WLBUK like RF42B-IDNTB.

select-options: SO_WLBUK for LFC1-BUKRS memory id BUK.

selection-screen end of block COMPANY.

parameters: GP_GJHR2 type GJAHR memory id GJR.

selection-screen function key 2.

selection-screen end of screen 2000.

...internal data specific for g/l accounts............................

constants: GC_LDB type TRDIR-LDBNAME value 'KDF',

GC_CURTYPE like RFPDO2-ALLGCRTP value '10',

GC_KOART type KOART value 'K'.

...internal data common for all account types.........................

include RFBALANCEDATA.

...initialization.....................................................

initialization.

...initialize internal data table.....................................

refresh LT_BALANCE_DATA.

refresh LT_APAR_DATA.

refresh LT_APAR_SPECIAL.

...remove user command for batch and print jobs.......................

perform CHANGE_STATUS.

...set text for additional function keys..............................

SSCRFIELDS-FUNCTXT_01 = TEXT-005.

SSCRFIELDS-FUNCTXT_02 = TEXT-006.

...process user command...............................................

at selection-screen.

case SSCRFIELDS-UCOMM.

...get local range for customer.......................................

when 'ONLI'.

if not GP_WLLIF is initial.

perform GET_RANGE_FROM_WORKLIST tables GT_RANGE

using GP_WLLIF

'LIFNR'.

refresh SO_WLLIF.

loop at GT_RANGE.

move-corresponding GT_RANGE to SO_WLLIF.

append SO_WLLIF.

endloop.

endif.

refresh LR_LIFNR.

append lines of SO_WLLIF to LR_LIFNR.

loop at SO_LIFNR.

LS_LIFNR-SIGN = SO_LIFNR-SIGN.

LS_LIFNR-OPTION = SO_LIFNR-OPTION.

if SO_LIFNR-LOW cn '0123456789'.

LS_LIFNR-LOW = SO_LIFNR-LOW.

else.

LS_LIFNR-LOW = SO_LIFNR-LOW+6.

endif.

if SO_LIFNR-HIGH cn '0123456789'.

LS_LIFNR-HIGH = SO_LIFNR-HIGH.

else.

LS_LIFNR-HIGH = SO_LIFNR-HIGH+6.

endif.

append LS_LIFNR to LR_LIFNR.

endloop.

if LR_LIFNR[] is initial.

clear SSCRFIELDS-UCOMM.

refresh LR_LIFNR.

message E002.

endif.

...get local range for company code...................................

if not GP_WLBUK is initial.

perform GET_RANGE_FROM_WORKLIST tables GT_RANGE

using GP_WLBUK

'BUKRS'.

refresh SO_WLBUK.

loop at GT_RANGE.

move-corresponding GT_RANGE to SO_WLBUK.

append SO_WLBUK.

endloop.

endif.

refresh LR_BUKRS.

append lines of SO_WLBUK to LR_BUKRS.

append lines of SO_BUKRS to LR_BUKRS.

if LR_BUKRS[] is initial.

refresh LR_LIFNR.

refresh LR_BUKRS.

clear SSCRFIELDS-UCOMM.

message E007.

endif.

...get local range for fiscal year....................................

LS_GJAHR-SIGN = 'I'.

LS_GJAHR-OPTION = 'EQ'.

if GP_GJAHR is initial.

LS_GJAHR-LOW = GP_GJHR2.

else.

LS_GJAHR-LOW = GP_GJAHR.

endif.

clear LS_GJAHR-HIGH.

if not LS_GJAHR-LOW is initial.

append LS_GJAHR to LR_GJAHR.

else.

clear SSCRFIELDS-UCOMM.

refresh LR_LIFNR.

refresh LR_BUKRS.

message E008.

endif.

...check existence of accounts given..................................

loop at LR_LIFNR transporting no fields

where OPTION ne 'EQ' or

SIGN ne 'I'.

exit.

endloop.

if SY-SUBRC = 0.

select LIFNR BUKRS LNRZE from LFB1 into table LT_LIFNR

where LIFNR in LR_LIFNR

and BUKRS in LR_BUKRS.

else. "worklist

select LIFNR BUKRS LNRZE from LFB1 into table LT_LIFNR

for all entries in LR_LIFNR

where LIFNR eq LR_LIFNR-LOW

and BUKRS in LR_BUKRS.

endif.

if SY-SUBRC ne 0.

clear SSCRFIELDS-UCOMM.

refresh LR_BUKRS.

refresh LR_LIFNR.

refresh LR_GJAHR.

message E030(MSITEM).

endif.

...check authorizations.............................................

perform CHECK_AUTHORITY_GROUPS

using LR_BUKRS

LR_SAKNR

LR_KUNNR

LR_LIFNR

GC_KOART.

...switch on worklists..............................................

when 'FC01'.

leave to transaction 'FK10NA'.

...switch off worklists.............................................

when 'FC02'.

leave to transaction 'FK10N'.

endcase.

...start-of-selection.................................................

start-of-selection.

...check, if all company codes given use the same fiscal year.........

perform CHECK_FISCAL_YEARS using LR_BUKRS

LD_RC.

if LD_RC ne 0.

message I021.

return.

endif.

...build table with selection criteria..............................

perform BUILD_COSEL tables LT_COSEL

using LR_BUKRS

LR_KUNNR

LR_LIFNR

LR_SAKNR

LR_GJAHR

LR_GSBER

GP_ITUSR

SPACE

GP_WLLIF

SPACE

GP_WLBUK

GC_CURTYPE.

...build table with selections for LDB................................

perform BUILD_RSPARAMS tables LT_COSEL

LT_PARAMS

using GC_LDB.

...build table with callbacks.........................................

perform BUILD_CALLBACK tables LT_CALLBACKS.

...get transaction data...............................................

call function 'LDB_PROCESS'

exporting

LDBNAME = GC_LDB

tables

CALLBACK = LT_CALLBACKS

SELECTIONS = LT_PARAMS

exceptions

LDB_SELECTIONS_NOT_ACCEPTED = 4

others = 1.

if SY-SUBRC eq 4.

message id SY-MSGID type SY-MSGTY number SY-MSGNO

with SY-MSGV1 SY-MSGV2.

endif.

...end-of-selection...................................................

end-of-selection.

...read and process transaction figures.............................

describe table LT_APAR_DATA lines LD_BALANCE_LINES.

perform PROCESS_BALANCE tables LT_BALANCE_DATA

using LT_APAR_DATA

LD_ACCOUNT_CR_FRWD

LD_ACCOUNT_DEBIT

LD_ACCOUNT_CREDIT

LD_ACCOUNT_BALANCE

GP_ITUSR.

...read and process special G/L transaction figures.................

describe table LT_APAR_SPECIAL lines LD_SPECIAL_LINES.

perform PROCESS_SPECIAL_GL tables LT_SPECIAL_GL

using LT_APAR_SPECIAL

LD_ACCOUNT_CR_FRWD

LD_ACCOUNT_DEBIT

LD_ACCOUNT_CREDIT

LD_ACCOUNT_BALANCE

GP_ITUSR.

...check, if any data has been read at all..........................

if LD_BALANCE_LINES = 0 and LD_SPECIAL_LINES = 0.

...if a branch was given: is head office included, too?.............

refresh LT_LNRZE.

insert lines of LT_LIFNR into table LT_LNRZE.

loop at LT_LIFNR where LNRZE ne SPACE.

read table LT_LNRZE with table key

LIFNR = LT_LIFNR-LNRZE

BUKRS = LT_LIFNR-BUKRS

transporting no fields.

if SY-SUBRC ne 0.

message id 'F4' type 'I' number '002' with LT_LIFNR-LIFNR

LT_LIFNR-LNRZE.

return.

endif.

exit.

endloop.

...no branch, but nevertheless no data!............................

message I020 with GP_GJAHR.

if GP_ITUSR is initial.

import LD_RETURN from memory id 'RETURN_FLAG'.

return.

else.

import OLDYEAR to LD_YEAR from memory id 'YEAR'.

if SY-SUBRC eq 0.

read table LR_BUKRS into LS_BUKRS index 1.

read table LR_LIFNR into LS_LIFNR index 1.

submit RFNETBALANCE with PD_GJAHR = LD_YEAR

with PD_BUKRS = LS_BUKRS-LOW

with PD_LIFNR = LS_LIFNR-LOW.

submit RFNETBALANCE with PD_GJAHR = LD_YEAR.

endif.

endif.

endif.

...display data.....................................................

call function 'FDBL_BALANCES_DISPLAY'

exporting

PT_COSEL = LT_COSEL

PD_ITUSR = GP_ITUSR

changing

PT_BALANCE_DATA = LT_BALANCE_DATA

PT_SPECIAL_GL = LT_SPECIAL_GL.

include RFBALANCE.

3 REPLIES 3

Former Member
0 Kudos

Hi,

You've asked this question 6 times - please be patient and don't create multiple similar questions.

Gareth.

0 Kudos

probably he has to write this program 6 times...

0 Kudos

I was going to ask the same question (without the code of course : ) but I see nobody has answered a single question till date.

Anyways, I wanted to call Function Module: FDBL_BALANCES_DISPLAY from a Z Program and wanted to know what all parameters I need to pass.

I'm posting the same as a new thread. If you've got something that can help, please post.

Thank you.

Regards,

Gaurav Brahmbhatt