2007 Sep 20 10:51 PM
Hi, im not an ABAP developer, and i dont have to who ask...
I know that the problem is when i multiply KONV-KWERT * 100.
but i dont konw how to solve this... please..someone.
REPORT Z_GESTION_CONDIC.
type-pools: slis.
DATA: BEGIN OF i_full,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr,
knumv TYPE vbak-knumv,
name1 type kna1-name1,"nombre cLiente
ernam type vbak-ernam,"nombre usuario creador
erdat type vbak-erdat,"fechade creacion
vdatu type vbak-vdatu,"fecha preferente entrega
auart type vbak-auart,"clase de documento
pstyv type vbap-pstyv,"tipo de posicion
netwr type vbap-netwr,"valor neto de la posicion
matnr type vbap-matnr,"codigo de material
arktx type vbap-arktx,"descripcion del material
kwmeng type vbap-kwmeng,"cantidad de pedido
vrkme type vbap-vrkme,"unidad de medidad de venta
kschl type konv-kschl,"clase de condicion
kwert type konv-kwert,
kposn type konv-kposn,"posicion del Doc. de ventas.
kunnr type kna1-kunnr,"ni idea.
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
spart type vbak-spart,
waers TYPE konv-waers,
END OF i_full.
DATA: it_join LIKE TABLE OF i_full,
LI_join LIKE LINE OF it_join.
DATA: BEGIN OF i_kondition,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
knumv TYPE vbak-knumv,
name1 type kna1-name1,"nombre cLiente
ernam type vbak-ernam,"nombre usuario creador
erdat type vbak-erdat,"fechade creacion
vdatu type vbak-vdatu,"fecha preferente entrega
auart type vbak-auart,"clase de documento
pstyv type vbap-pstyv,"tipo de posicion
netwr type vbap-netwr,"valor neto de la posicion
matnr type vbap-matnr,"codigo de material
arktx type vbap-arktx,"descripcion del material
kwmeng type vbap-kwmeng,"cantidad de pedido
vrkme type vbap-vrkme,"unidad de medidad de venta
kschl type konv-kschl,"clase de condicion
kwert type konv-kwert,
kposn type konv-kposn,"posicion del Doc. de ventas.
kunnr type kna1-kunnr,"ni idea.
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
spart type vbak-spart,
waers TYPE konv-waers,
END OF i_kondition.
DATA: it_kondition LIKE TABLE OF i_kondition,
it_konv LIKE TABLE OF i_kondition,
it_final LIKE TABLE OF i_kondition,
LI_konv LIKE LINE OF it_kondition.
Heading of the report.
data: t_heading type slis_t_listheader.
**=======================================================================
Selection screen
**=======================================================================
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_vbeln for LI_join-vbeln, "Documento de ventas
s_posnr for LI_join-posnr, "Posicion del doc de ventas
s_auart for LI_join-auart, "clase de doc.
s_vkorg for LI_join-vkorg, "org. de ventas
s_vtweg for LI_join-vtweg, "Canal
s_spart for LI_join-spart, "sector
s_pstyv for LI_join-pstyv, "tipo de posicion
s_kschl for LI_join-kschl, "clase de condicion
S_kunnr for LI_join-kunnr. "Nº de cliente 1
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM kondition_lesen.
PERFORM build_alv using it_kondition t_heading.
*----
*
FORM kondition_lesen *
*----
*
FORM kondition_lesen.
SELECT vbak~vbeln vbak~ernam vbak~erdat vbak~vdatu vbak~auart vbak~knumv
vbap~posnr vbap~pstyv vbap~netwr vbap~matnr vbap~arktx vbap~kwmeng vbap~vrkme
kna1~name1 kna1~kunnr
FROM vbak
inner join vbap as vbap on vbak~vbeln = vbap~vbeln
inner join kna1 as kna1 on kna1~kunnr = vbak~kunnr
INTO CORRESPONDING FIELDS OF TABLE it_join
WHERE vbak~vbeln in s_vbeln
AND vbak~auart in s_auart
AND vbak~vkorg in s_vkorg
AND vbak~vtweg in s_vtweg
AND vbak~spart in s_spart
AND vbap~posnr in s_posnr
AND vbap~pstyv in s_pstyv
AND kna1~kunnr in s_kunnr.
LOOP AT it_join INTO LI_join.
SELECT knumv kposn kschl kbetr waers kwert
FROM konv
INTO CORRESPONDING FIELDS OF TABLE it_konv
WHERE knumv EQ LI_join-knumv
AND kposn EQ LI_join-posnr.
LOOP AT it_konv INTO LI_konv.
if LI_konv-kwert <> '0'.
LI_konv-vbeln = LI_join-vbeln.
LI_konv-name1 = LI_join-name1.
LI_konv-ernam = LI_join-ernam.
LI_konv-erdat = LI_join-erdat.
LI_konv-vdatu = LI_join-vdatu.
LI_konv-auart = LI_join-auart.
LI_konv-posnr = LI_join-posnr.
LI_konv-pstyv = LI_join-pstyv.
LI_konv-netwr = LI_join-netwr.
LI_konv-matnr = LI_join-matnr.
LI_konv-arktx = LI_join-arktx.
LI_konv-kwmeng = LI_join-kwmeng.
LI_konv-vrkme = LI_join-vrkme.
LI_konv-kschl = LI_konv-kschl.
LI_konv-kwert = LI_konv-kwert * 100. "HERE IS THE PROBLEM!!
APPEND LI_konv TO it_final.
endif.
ENDLOOP.
ENDLOOP.
ENDFORM. "kondition_lesen
*&----
*
*& Form build_alv
*&----
*
Builds and display the ALV Grid.
*----
*
form build_alv using it_kondition
t_heading type slis_t_listheader.
ALV required data objects.
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_sort type slis_t_sortinfo_alv.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
Field Catalog
perform set_fieldcat2 using:
1 'VBELN' 'VBELN' 'VBAK' space space space space space space space space space space space space t_fieldcat ,
2 'NAME1' 'NAME1' 'KNA1' space space space space space space space space space space space space t_fieldcat ,
3 'ERNAM' 'ERNAM' 'VBAK' space space space space space space space space space space space space t_fieldcat ,
4 'ERDAT' 'ERDAT' 'VBAK' space space space space space space space space space space space space t_fieldcat ,
5 'VDATU' 'VDATU' 'VBAK' space space space space space space space space space space space space t_fieldcat ,
6 'AUART' 'AUART' 'VBAK' space space space space space space space space space space space space t_fieldcat ,
7 'POSNR' 'POSNR' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
8 'PSTYV' 'PSTYV' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
9 'NETWR' 'NETWR' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
10 'MATNR' 'MATNR' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
11 'ARKT' 'ARKT' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
12 'KWMENG' 'KWMENG' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
13 'VRKME' 'VRKME' 'VBAP' space space space space space space space space space space space space t_fieldcat ,
14 'KSCHL' 'KSCHL' 'KONV' space space space space space space space space space space space space t_fieldcat ,
15 'KWERT' 'KWERT' 'KONV' space space space space space space space space space space space space t_fieldcat .
Top of page heading
perform set_top_page_heading using t_heading t_event.
Events
perform set_events using t_event.
GUI Status
w_status = ''.
w_repid = sy-repid.
Title
w_title = <<If you want to set a title for
the ALV, please, uncomment and edit this line>>.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " build_alv.
*&----
*
*& Form set_top_page_heading
*&----
*
Creates the report headings.
*----
*
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = ''(001).
append x_heading to t_heading.
Program name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Program: '.
x_heading-info = sy-repid.
append x_heading to t_heading.
User who is running the report
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'User: '.
x_heading-info = sy-uname.
append x_heading to t_heading.
Date of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Date: '.
write sy-datum to x_heading-info.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'Time: '.
write sy-uzeit to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform. "set_top_page_heading
*&----
*
*& Form set_events
*&----
*
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
*----
*
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
**
Example
-------
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
**
endform. "set_events
*&----
*
*& Form set_order
*&----
*
Adds an entry to the order table.
*----
*
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-up = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*&----
*
*& Form set_fieldcat2
*&----
*
Adds an entry to the field catalog.
p_colpos: Column position.
p_fieldname: Field of internal table which is being described by
* this record of the field catalog.
p_ref_fieldname: (Optional) Table field / data element which
* describes the properties of the field.
* If this field is not given, it is copied from
* the fieldname.
p_ref_tabname: (Optional) Table which holds the field referenced
* by <<p_ref_fieldname>>.
If this is not given, the parameter
<<p_ref_fieldname>> references a data element.
p_outputlen: (Optional) Column width.
p_noout: (Optional) If set to 'X', states that the field is not
* showed initially. If so, the field has to be
included in the report at runtime using the display
options.
p_seltext_m: (Optional) Medium label to be used as column header.
p_seltext_l: (Optional) Long label to be used as column header.
p_seltext_s: (Optional) Small label to be used as column header.
p_reptext_ddic: (Optional) Extra small (heading) label to be
* used as column header.
p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
or REPTEXT_DDIC as text for column header.
p_hotspot: (Optional) If set to 'X', this field will be used
* as a hotspot area for cursor, alolowing the user
* to click on the field.
p_showasicon: (Optional) If set to 'X', this field will be shown
as an icon and the contents of the field will set
* which icon to show.
p_checkbox: (Optional) If set to 'X', this field will be shown
as a checkbox.
p_edit: (Optional) If set to 'X', this field will be editable.
p_dosum: (Optional) If set to 'X', this field will be summed
(aggregation function) according to the grouping set
by the order functions.
t_fieldcat: Table which contains the whole fieldcat.
*----
*
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given
is a data element.
If p_ref_tabname is given, the ref_fieldname given is a
field of a table.
In case ref_fieldname is not given,
it is copied from the fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF NOT p_edit IS INITIAL.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*&----
*
*& Form top_of_page
*&----
*
Called on top_of_page ALV event.
Prints the heading.
*----
*
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = <<If you want to set a logo, please,
uncomment and edit this line>>
it_list_commentary = t_heading.
endform. " alv_top_of_page
*&----
*
*& Form user_command
*&----
*
Called on user_command ALV event.
Executes custom commands.
*----
*
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
**
Example Code
*
Executes a command considering the sy-ucomm.
CASE r_ucomm.
WHEN '&IC1'.
Set your "double click action" response here.
Example code: Create and display a status message.
DATA: w_msg TYPE string,
w_row(4) TYPE n.
w_row = rs_selfield-tabindex.
CONCATENATE 'Casilla seleccionada: ' w_row
'Campo:' rs_selfield-fieldname
'Valor:' rs_selfield-value
INTO w_msg SEPARATED BY space.
MESSAGE w_msg TYPE 'S'.
ENDCASE.
*
End of example code.
**
endform. "user_command
2007 Sep 20 10:56 PM
2007 Sep 20 10:55 PM
2007 Sep 20 10:56 PM
2007 Sep 20 10:59 PM
This is the analisis of SAP.
analisis.errores
An exception occurred. This exception is dealt with in more detail b
. The exception, which is assigned to the class 'CX_SY_ARITHMETIC_OV
was neither
caught nor passed along using a RAISING clause, in the procedure
"KONDITION_LESEN" "(FORM)"
.
Since the caller of the procedure could not have expected this excep
to occur, the running program was terminated.
The reason for the exception is:
An overflow has been determined in the current arithmetical operatio
containing operands of type P. Possible causes include:
1. The results field of type P is to small and the result does not
into it.
places.
2. The result or partial result has more than 31 decimal places.
***********************************
I never use the RISING CLAUSE....
maybe i have some definition on aritmethic functions?..
2007 Sep 20 11:05 PM
Felipe,
do small change in the code like this and check....
kwert(40) type c,
or something like this...
kwert(42) type p decimals 2,
chage these variables in the internal table declarations....
or I donno what type of values u r passing into this variable... and what u r expecting the out put
kwert(n) type p decimals m,
pass n and m values based on the values ur passing and the decimals u r expecting ....
and check the code once again....
2007 Sep 20 11:06 PM