on 09-10-2007 5:07 AM
hi experts,
I am doing credit / debit form now my requirement is
According to BELNR , GJAHR,BUKRS i want to find credit amount for this selection cretiria.
so i want to add all the lines of amount filed for a particular BELNR and display it as single line.
so i am getting data from print program like this
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 2.
PARAMETERS: p_belnr LIKE bkpf-belnr OBLIGATORY,
p_bukrs LIKE bkpf-bukrs OBLIGATORY,
p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b0.
SELECT SINGLE *
FROM bkpf
INTO i_bkpf
WHERE belnr = p_belnr
AND ( blart = 'DG' OR blart = 'ZG' )
AND bukrs = p_bukrs
AND gjahr = p_gjahr.
IF sy-subrc = 0.
SELECT *
FROM bseg
INTO table it_bseg
WHERE belnr = i_bkpf-belnr .
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_CREDIT_DEBIT' " p_name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = v_form_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION v_form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
i_bkpf = i_bkpf
i_bseg = i_bseg
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
so my I_BSEG containing all line items of particular BELNR . with the field SHKZG iam getting only credit line items .
now i want to do is add all credited amount and display like this in a table.
-
against ref# (BSEG-REBZG) ! details (BSEG-SGTXT)! amount
-
124569 10%discount 950.00(total amount ie sum of all lines amount for a BELNR)
10.00(total tax amt ie sum of all lines of tax amount for a BELNR)
-
960.00
-
Hi,
pl try this one.
Try this one.
Types: begin of ty_bseg,
BELNR type ..
GJAHR type
BUKRS type
sHKZG type .
SGTXT type ..
End of ty_bseg.
Populate i_bseg.
Take it i_bseg1 type ty_bseg1
Take wa , wa1, a2 type i_bseg
Sort i_bseg by belnr gjahr bukrs shkzg.
Loop at i_bseg into wa.
Wa1 = wa.
At new shkzg.
Sum.
Wa-sgtxt = wa1-sgtxt.
Append wa to i_bseg1.
Endat.
Endloop.
Pass i_bseg1 in place of i_bseg.
with thanks,
sanjukta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sateesh ,
Try using the <b>collect</b> command if it is possible to use it , please see the help of the command for more info.
If that is not possible then you will have to loop and find the sum and then pass the data to your form.
Regadrs
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi arun,
i used collect in smartform my procedure is like this .
i am getting data into i_BSEG because i declared like this in TABLES parameter
i created a loop .
in that i mentioned like I_BSEG into WA_BSEG.
then i created a program lines here i mentioned like this.
COLLECT WA_BSEG INTO IT_BSEG.
but because of BUZEI "Number of Line Item Within Accounting Document .it is not same it is varying for every credited time that means for every line of BELNR. thats why it is not adding it is just appending .
so pls tell me any other chance to find sum .
because i want to sum up all credted amount and display it in single line
ie first column REBZG "Number of the Invoice the Transaction Belongs to(against ref) i want to display once .
And Second column SGTXT "item text(details) for amount once and for tax amount once
And Third column Amount first line consists total amount & second line consists total for tax amount
regards,
satheesh.
satheesh.br@gmail.com
any doubts chat me regarding this post.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.