Report on sales order on hold
hello sdn friends,
how to develop an report to display to open sales orders on hold.
i dont have any idea about this,please help regarding this.
Hi,
Check the program
TABLES:vbak,
vbap,
tvko,
tvak,
mara,
tvtw,
kna1,
vbpa.
TYPE-POOLS : slis.
GLOBAL TYPES
naming convention: "TY_name"
TYPES : BEGIN OF ty_vbak ,
vbeln TYPE vbak-vbeln ,
auart TYPE vbak-auart , " DRFK904686
vkorg TYPE vbak-vkorg ,
vtweg TYPE vbak-vtweg ,
vkgrp TYPE vbak-vkgrp ,
bstnk TYPE vbak-bstnk , "DRFK904686(+)
kunrsl TYPE vbak-kunnr ,
END OF ty_vbak .
TYPES: BEGIN OF ty_vbap ,
vbeln TYPE vbap-vbeln ,
posnr TYPE vbap-posnr ,
matnr TYPE vbap-matnr ,
matkl TYPE vbap-matkl ,
kwmeng TYPE vbap-kwmeng,
vrkme TYPE vbap-vrkme , "order unit
zmeng TYPE vbap-zmeng ,
zieme TYPE vbap-zieme , "order unit
netpr TYPE vbap-netpr , "price
netwr TYPE vbap-netwr , "DRFK904686(+)
END OF ty_vbap .
TYPES:BEGIN OF ty_vbuk ,
vbeln TYPE vbuk-vbeln,
Start of addition DRFK904686
lfstk TYPE statv ,
lfgsk TYPE statv ,
fkstk TYPE statv ,
End of addition DRFK904686
END OF ty_vbuk .
TYPES:BEGIN OF ty_vbpa ,
vbeln TYPE vbpa-vbeln,
kunrsh TYPE kunnr ,
END OF ty_vbpa .
TYPES:BEGIN OF ty_makt ,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
TYPES:BEGIN OF ty_t023t,
matkl TYPE matkl,
wgbez TYPE wgbez,
END OF ty_t023t.
TYPES:BEGIN OF ty_kna1 ,
kunnr TYPE kunnr ,
name1 TYPE name1_gp,
END OF ty_kna1.
TYPES:BEGIN OF ty_final ,
vbeln TYPE vbak-vbeln ,
auart TYPE vbak-auart ,
vkorg TYPE vbak-vkorg ,
vtweg TYPE vbak-vtweg ,
vkgrp TYPE vbak-vkgrp ,
bstnk TYPE vbak-bstnk , "PO Number; DRFK904686(+)
kunrsl TYPE vbak-kunnr ,
name1 TYPE name1_gp ,
matnr TYPE vbap-matnr ,
maktx TYPE maktx ,
matkl TYPE vbap-matkl ,
wgbez TYPE wgbez ,
kwmeng TYPE vbap-kwmeng ,
vrkme TYPE vbap-vrkme , "order unit
zmenge TYPE vbap-kwmeng ,
netpr TYPE vbap-netpr , " price "vv
netwr TYPE vbap-netwr ,
zmein TYPE vbap-meins ,
kunrsh TYPE kunnr ,
name2 TYPE name1_gp ,
Start of addition DRFK904686
lfstk TYPE statv ,
lfgsk TYPE statv ,
fkstk TYPE statv ,
End of addition DRFK904686
END OF ty_final .
GLOBAL CONSTANTS
naming convention: "c_name"
CONSTANTS: c_sh TYPE vbpa-parvw VALUE 'WE' ,
c_formname_top_of_page TYPE slis_formname VALUE 'F_DISPLAY_TOP_OF_PAGE',
c_en(2) TYPE c VALUE 'EN' ,
c_a TYPE char1 VALUE 'A' .
GLOBAL ELEMENTARY VARIABLES
naming convention: "w_name"
DATA :w_list_top_of_page TYPE slis_t_listheader,
w_kwmeng TYPE vbap-kwmeng ,
w_meins TYPE t006-msehi ,
w_zmein TYPE t006-msehi ,
w_repid TYPE sy-repid ,
w_zmenge TYPE vbap-kwmeng ,
w_events TYPE slis_t_event ,
w_datum TYPE sy-datum ,
w_umrez1 TYPE marm-umrez ,
w_umren1 TYPE marm-umren ,
w_umrez2 TYPE marm-umrez ,
w_umren2 TYPE marm-umren ,
w_text(25) TYPE c .
GLOBAL STRUCTURES
naming convention: "st_name"
DATA:st_vbak TYPE ty_vbak ,
st_vbap TYPE ty_vbap ,
st_vbpa TYPE ty_vbpa ,
st_makt TYPE ty_makt ,
st_t023t TYPE ty_t023t ,
st_knasl TYPE ty_kna1 ,
st_knash TYPE ty_kna1 ,
st_vbuk TYPE ty_vbuk ,
st_final TYPE ty_final .
DATA:st_fieldcat TYPE slis_fieldcat_alv ,
st_layout TYPE slis_layout_alv .
GLOBAL INTERNAL TABLES
naming convention: "i_name"
DATA:i_vbak TYPE TABLE OF ty_vbak ,
i_vbap TYPE TABLE OF ty_vbap ,
i_vbuk TYPE TABLE OF ty_vbuk ,
i_vbpa TYPE TABLE OF ty_vbpa ,
i_makt TYPE TABLE OF ty_makt ,
i_t023t TYPE TABLE OF ty_t023t ,
i_knasl TYPE TABLE OF ty_kna1 ,
i_knash TYPE TABLE OF ty_kna1 ,
i_final TYPE TABLE OF ty_final .
DATA:i_fieldcat TYPE slis_t_fieldcat_alv ,
i_variant TYPE disvariant .
DEFINE m_fieldcat.
add 1 to st_fieldcat-col_pos.
st_fieldcat-fieldname = &1.
st_fieldcat-ref_tabname = &2.
st_fieldcat-seltext_s = &3.
st_fieldcat-seltext_l = &4.
st_fieldcat-datatype = &5.
append st_fieldcat to i_fieldcat.
END-OF-DEFINITION.
PARAMETERS & SELECT-OPTIONS
aming convention: "p_name" & "s_name"
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*SELECT-OPTIONS : s_vkorg FOR vbak-vkorg OBLIGATORY,
s_vtweg FOR vbak-vtweg OBLIGATORY,
s_kunrsl FOR vbak-kunnr ,
s_kunrsh FOR vbpa-kunnr ,
s_matnr FOR vbap-matnr ,
s_auart for vbak-auart . "DRFK904686
s_datum FOR sy-datum OBLIGATORY DEFAULT sy-datum."DRFK904686
SELECT-OPTIONS : s_vkorg FOR tvko-vkorg OBLIGATORY,
s_vtweg FOR tvtw-vtweg OBLIGATORY,
s_kunrsl FOR kna1-kunnr ,
s_kunrsh FOR kna1-kunnr ,
s_matnr FOR mara-matnr ,
s_auart FOR tvak-auart . "DRFK904686
PARAMETERS: p_meins TYPE vbap-meins.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-006 FOR FIELD p_var.
PARAMETERS: p_var TYPE disvariant-variant.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b5.
INITIALIZATION
INITIALIZATION.
Report id assigned to Global variable
w_repid = sy-repid.
EVENTS TABLE BUILD
PERFORM f_eventtab_build USING w_events[].
Processing of listheader
PERFORM f_comment_build USING w_list_top_of_page[].
CLEAR i_variant.
i_variant-report = sy-repid.
Read default display variant (description only, w/o field catalog)
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = c_a
CHANGING
cs_variant = i_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc EQ 0.
p_var = i_variant-variant.
ENDIF.
Start of addition DRFK904686
AT SELECTION-SCREEN ON s_vkorg
Sales Organisation
AT SELECTION-SCREEN ON s_vkorg.
PERFORM f_validate_vkorg.
AT SELECTION-SCREEN ON s_vtweg
Distribution Channel
AT SELECTION-SCREEN ON s_vtweg.
PERFORM f_validate_vtweg.
AT SELECTION-SCREEN ON s_kunrsl
Sold-to-party
AT SELECTION-SCREEN ON s_kunrsl.
IF NOT s_kunrsl[] IS INITIAL.
PERFORM f_validate_cust.
ENDIF.
AT SELECTION-SCREEN ON s_kunrsh
Ship-to-party
AT SELECTION-SCREEN ON s_kunrsh.
IF NOT s_kunrsh[] IS INITIAL.
PERFORM f_validate_shipto.
ENDIF.
AT SELECTION-SCREEN ON s_matnr
Material Number
AT SELECTION-SCREEN ON s_matnr.
IF NOT s_matnr[] IS INITIAL.
PERFORM f_validate_matnr.
ENDIF.
AT SELECTION-SCREEN ON s_auart
Order Type
AT SELECTION-SCREEN ON s_auart.
IF NOT s_auart[] IS INITIAL.
PERFORM f_validate_auart.
ENDIF.
End of addition DRFK904686
AT SELECTION-SCREEN ON VALUE-REQUEST
F4 for Layout Variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
PERFORM f_get_alv_variant CHANGING p_var.
AT SELECTION-SCREEN ON
Validate Layout Variant
AT SELECTION-SCREEN ON p_var.
IF NOT p_var IS INITIAL.
PERFORM f_check_alv_variant USING p_var.
ENDIF.
START-OF-SELECTION
START-OF-SELECTION.
begin of changes DRFK904686
PERFORM f_fetch_vbuk.
PERFORM f_fetch_vbak.
*perform to fetch the data from vbuk.
*perform to fetch the data from vbak.
PERFORM f_fetch_vbak.
*perform to fetch the data from vbuk.
PERFORM f_fetch_vbuk.
end of changes DRFK904686
*perform to fetch the data from vbpa.
PERFORM f_fetch_vbpa.
*perform to fetch the data from vbap.
PERFORM f_fetch_vbap.
*perform to fetch the material description.
PERFORM f_fetch_makt.
*perform to fetch the material group description.
PERFORM f_fetch_t023t.
*perform to fetch the customer name
PERFORM f_fetch_knasl.
*perform to fetch the customer name
PERFORM f_fetch_knash.
*perofrm to move the data into final table
PERFORM f_move_final.
Finding no of entries in Internal Table
IF LINES( i_final ) EQ 0.
MESSAGE s000 WITH 'No documents found for the selection criteria'(019).
EXIT.
ENDIF.
*perform for fieldcatalog building
PERFORM f_build_fieldcat.
*perform to display the list
PERFORM f_list_dispaly.
*& Form f_validate_vkorg
text
-->P_S_VKORG text
FORM f_validate_vkorg.
SELECT vkorg
FROM tvko
UP TO 1 ROWS
INTO tvko-vkorg
WHERE vkorg IN s_vkorg.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'Sales Organization is invalid'(033).
ENDIF.
ENDFORM. " f_validate_vkorg
*& Form f_validate_vtweg
text : This form is used to validate the Distribution Channel
FORM f_validate_vtweg.
SELECT vtweg
FROM tvtw
UP TO 1 ROWS
INTO tvtw-vtweg
WHERE vtweg IN s_vtweg.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'Distribution Channel is invalid'(032).
ENDIF.
ENDFORM. " f_validate_vtweg
*& Form f_validate_cust
text: This form is used to validate the Sold-to party .
FORM f_validate_cust.
SELECT kunnr
FROM kna1
UP TO 1 ROWS
INTO kna1-kunnr
WHERE kunnr IN s_kunrsl.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'Customer is invalid'(034).
ENDIF.
ENDFORM. " f_validate_cust
*& Form f_validate_shipto
text: This form is used to validate the Ship-to party .
FORM f_validate_shipto.
SELECT kunnr
FROM kna1
UP TO 1 ROWS
INTO kna1-kunnr
WHERE kunnr IN s_kunrsh.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'Ship-to party is invalid'(035).
ENDIF.
ENDFORM. " f_validate_shipto
*& Form f_validate_matnr
text: This form is used to validate material.
FORM f_validate_matnr .
SELECT matnr
FROM mara
UP TO 1 ROWS
INTO mara-matnr
WHERE matnr IN s_matnr.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'Material is invalid'(036).
ENDIF.
ENDFORM. " f_validate_matnr
*& Form f_validate_auart
text: This form is used to validate Order Type
FORM f_validate_auart .
SELECT auart
FROM tvak
UP TO 1 ROWS
INTO tvak-auart
WHERE auart IN s_auart.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'Order Type is invalid'(037).
ENDIF.
ENDFORM. " f_validate_auart
*& Form sub_get_alv_variant
To display variant selection dialog box
FORM f_get_alv_variant CHANGING p_layvar TYPE disvariant-variant.
CLEAR i_variant.
DATA lw_exit(1) TYPE c.
i_variant-report = sy-repid.
i_variant-username = sy-uname.
Display variant selection dialog box
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = i_variant
i_save = c_a
IMPORTING
e_exit = lw_exit
es_variant = i_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
IF lw_exit IS INITIAL.
p_layvar = i_variant-variant.
ENDIF.
ELSE.
MESSAGE i000 WITH 'No display variants found'(007).
ENDIF.
ENDFORM. " sub_get_alv_variant
*& Form sub_check_alv_variant
to check whether a display variant exists
FORM f_check_alv_variant USING p_layvar TYPE disvariant-variant.
CLEAR i_variant.
i_variant-report = sy-repid.
i_variant-username = sy-uname.
IF p_layvar NE space.
MOVE p_layvar TO i_variant-variant.
Checks whether a display variant exists
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = c_a
CHANGING
cs_variant = i_variant.
ENDIF.
ENDFORM. "f_check_alv_variant
" sub_check_alv_variant
*& Form f_fetch_vbak
from to fetch sales org, dis chanel,sales group sold to party from vbak
FORM f_fetch_vbak .
*{ begin of change DRFK904686
IF i_vbuk IS NOT INITIAL.
SELECT vbeln
auart
vkorg
vtweg
vkgrp
bstnk
kunnr
FROM vbak
INTO TABLE i_vbak
FOR ALL ENTRIES IN i_vbuk
WHERE vbeln EQ i_vbuk-vbeln
AND auart IN s_auart
AND vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND kunnr IN s_kunrsl .
end of change DRFK904686 }
IF sy-subrc EQ 0.
SORT i_vbak BY vbeln.
ELSE.
MESSAGE s000 WITH 'No documents found for the selection criteria'(019).
EXIT.
ENDIF.
ENDIF.
ENDFORM. " f_fetch_vbak
*& Form f_fetch_vbuk
from to fetch open sales doc from vbuk
FORM f_fetch_vbuk .
IF i_vbak IS NOT INITIAL.
SELECT vbeln
FROM vbuk
INTO TABLE i_vbuk
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln
AND ( lfstk NE 'C'
OR fkstk NE 'C' ) .
SELECT vbeln
lfstk
lfgsk
fkstk FROM vbuk
INTO TABLE i_vbuk
WHERE ( ( lfstk EQ 'A'
OR lfstk EQ 'B')
OR ( fkstk EQ 'A'
OR fkstk EQ 'B' ) ) .
ENDIF.
ENDFORM. " f_fetch_vbuk
*& Form f_fetch_vbpa
from to fetch ship to party from vbpa
FORM f_fetch_vbpa .
IF i_vbak IS NOT INITIAL.
SELECT vbeln
kunnr
FROM vbpa
INTO TABLE i_vbpa
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln
AND kunnr IN s_kunrsh
AND parvw EQ c_sh.
ENDIF.
ENDFORM. " f_fetch_vbpa
*& Form f_fetch_vbap
from to fetch sales doc, mat no, mat group,order UOM from vbap
FORM f_fetch_vbap .
IF i_vbpa IS NOT INITIAL.
SELECT vbeln
posnr
matnr
matkl
kwmeng
vrkme
zmeng
zieme
netwr
netpr
FROM vbap
INTO TABLE i_vbap
FOR ALL ENTRIES IN i_vbpa
WHERE vbeln EQ i_vbpa-vbeln
AND matnr IN s_matnr.
ENDIF.
ENDFORM. " f_fetch_vbap
*& Form f_fetch_makt
form to fetch the material description
FORM f_fetch_makt .
IF i_vbap IS NOT INITIAL.
SELECT
matnr
maktx
FROM makt
INTO TABLE i_makt
FOR ALL ENTRIES IN i_vbap
WHERE matnr EQ i_vbap-matnr
AND spras EQ c_en.
ENDIF.
ENDFORM. " f_fetch_makt
*& Form f_fetch_t023t
form to fetch the material group description
FORM f_fetch_t023t .
IF i_vbap IS NOT INITIAL.
SELECT
matkl
wgbez
FROM t023t
INTO TABLE i_t023t
FOR ALL ENTRIES IN i_vbap
WHERE spras EQ c_en
AND matkl EQ i_vbap-matkl.
ENDIF.
ENDFORM. " f_fetch_t023t
*& Form f_fetch_kna1
form to fetch the sold to customer name
FORM f_fetch_knasl .
IF i_vbak IS NOT INITIAL.
SELECT
kunnr
name1
FROM kna1
INTO TABLE i_knasl
FOR ALL ENTRIES IN i_vbak
WHERE kunnr EQ i_vbak-kunrsl.
ENDIF.
ENDFORM. " f_fetch_kna1
*& Form f_fetch_knash
form to fetch the ship to customer name
FORM f_fetch_knash .
IF i_vbpa IS NOT INITIAL.
SELECT
kunnr
name1
FROM kna1
INTO TABLE i_knash
FOR ALL ENTRIES IN i_vbpa
WHERE kunnr EQ i_vbpa-kunrsh.
ENDIF.
ENDFORM. " f_fetch_knash
*& Form f_move_final
form for moving all the fields into the final internal table for
*dispalying the final output.
FORM f_move_final .
SORT : i_vbak BY vbeln,
i_vbpa BY vbeln,
i_makt BY matnr,
i_t023t BY matkl,
i_knasl BY kunnr,
i_vbuk BY vbeln,
i_knash BY kunnr.
*looping at i_vbap and moving mat no,mat group,quantity and
*UOM into final table.
LOOP AT i_vbap INTO st_vbap.
IF st_vbap-kwmeng IS INITIAL.
st_vbap-kwmeng = st_vbap-zmeng.
st_vbap-vrkme = st_vbap-zieme.
ENDIF.
MOVE: st_vbap-matnr TO st_final-matnr,
st_vbap-matkl TO st_final-matkl,
st_vbap-kwmeng TO st_final-kwmeng,
st_vbap-netwr TO st_final-netwr,
st_vbap-vrkme TO st_final-vrkme.
IF p_meins IS INITIAL.
MOVE:st_vbap-vrkme TO st_final-zmein ,
st_vbap-kwmeng TO st_final-zmenge.
ELSE.
CLEAR : w_kwmeng,
w_meins,
w_zmein.
*Order Quantity
w_kwmeng = st_vbap-kwmeng.
*Order Unit
w_meins = st_vbap-vrkme.
*Report Unit
w_zmein = p_meins.
CLEAR : w_umrez1,
w_umren1,
w_umrez2,
w_umren2.
SELECT SINGLE umrez
umren
INTO (w_umrez1,
w_umren1)
FROM marm
WHERE matnr EQ st_vbap-matnr
AND meinh EQ w_meins.
SELECT SINGLE umrez
umren
INTO (w_umrez2,
w_umren2)
FROM marm
WHERE matnr EQ st_vbap-matnr
AND meinh EQ w_zmein.
IF w_umrez1 IS NOT INITIAL AND w_umren2 IS NOT INITIAL.
w_zmenge = w_kwmeng * ( w_umren1 / w_umrez1 ) * ( w_umrez2 / w_umren2 ).
update new report unit and quantity
MOVE p_meins TO st_final-zmein.
MOVE w_zmenge TO st_final-zmenge.
ELSE.
if failed to convert update report unit and quantity with order values
MOVE st_vbap-vrkme TO st_final-zmein.
MOVE st_vbap-kwmeng TO st_final-zmenge.
ENDIF.
ENDIF.
Start of changes DRFK904686
To get the delivery, overall and billing status
CLEAR st_vbuk.
READ TABLE i_vbuk INTO st_vbuk
WITH KEY vbeln = st_vbap-vbeln
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE : st_vbuk-lfstk TO st_final-lfstk,
st_vbuk-lfgsk TO st_final-lfgsk,
st_vbuk-fkstk TO st_final-fkstk.
ENDIF.
End of changes DRFK904686
*reading i_vbak and moving sales doc,sales org,dist chanel,
*sales group,and sold to party into the final internal table
CLEAR st_vbak.
READ TABLE i_vbak
INTO st_vbak
WITH KEY vbeln = st_vbap-vbeln
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE: st_vbak-vbeln TO st_final-vbeln ,
st_vbak-vkorg TO st_final-vkorg ,
st_vbak-vtweg TO st_final-vtweg ,
st_vbak-vkgrp TO st_final-vkgrp ,
st_vbak-auart TO st_final-auart ,
st_vbak-bstnk TO st_final-bstnk , "DRFK904686(+)
st_vbak-kunrsl TO st_final-kunrsl.
ENDIF.
*reading i_vbpa and moving ship to party to the final internal table
CLEAR st_vbpa.
READ TABLE i_vbpa
INTO st_vbpa
WITH KEY vbeln = st_vbap-vbeln
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE st_vbpa-kunrsh TO st_final-kunrsh.
ENDIF.
*reading i_makt and moving material description to the final table
CLEAR st_makt.
READ TABLE i_makt
INTO st_makt
WITH KEY matnr = st_vbap-matnr
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE st_makt-maktx TO st_final-maktx.
ENDIF.
*reading i_t023t
CLEAR st_t023t.
READ TABLE i_t023t
INTO st_t023t
WITH KEY matkl = st_vbap-matkl
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE st_t023t-wgbez TO st_final-wgbez.
ENDIF.
*READINGI_KNASL
CLEAR st_knasl.
READ TABLE i_knasl
INTO st_knasl
WITH KEY kunnr = st_final-kunrsl
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE st_knasl-name1 TO st_final-name1.
ENDIF.
*READINGI_KNASH
CLEAR st_knash.
READ TABLE i_knash
INTO st_knash
WITH KEY kunnr = st_final-kunrsh
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE st_knash-name1 TO st_final-name2.
ENDIF.
APPEND st_final TO i_final.
CLEAR st_final.
ENDLOOP.
ENDFORM. " f_move_final
*& Form f_build_fieldcat
form for building the field catalog
FORM f_build_fieldcat .
m_fieldcat 'VKORG' 'VBAK' 'Sales Organisation'(004) 'Sales Organisation'(004) ' '.
m_fieldcat 'VTWEG' 'VBAK' 'Distribution Channel'(005) 'Distribution Channel'(005) ' '.
m_fieldcat 'VKGRP' 'VBAK' 'Sales Group'(008) 'Sales Group'(008) ' '.
m_fieldcat 'VBELN' 'VBAK' 'Sales Document'(009) 'Sales Document'(009) ' '.
m_fieldcat 'AUART' 'VBAK' 'Order Type'(026) 'Order Type'(026) ' '.
m_fieldcat 'BSTNK' 'VBAK' 'PO number'(031) 'PO number'(031) ' '.
m_fieldcat 'KUNRSL' 'VBAK' 'Sold to Party'(010) 'Sold to Party'(010) ' '.
m_fieldcat 'NAME1' 'KNA1' 'Name Sold to'(020) 'Name Sold to'(020) ' '.
m_fieldcat 'KUNRSH' 'VBPA' 'Ship to Party'(011) 'Ship to Party'(011) ' '.
m_fieldcat 'NAME2' 'KNA1' 'Name Ship to'(022) 'Name Ship to'(022) ' '.
m_fieldcat 'KWMENG' 'VBAP' 'Order Quantity'(012) 'Order Quantity'(012) 'QUAN '(014).
m_fieldcat 'VRKME' 'VBAP' 'Order UOM'(017) 'Order UOM'(017) ' '.
m_fieldcat 'ZMENGE' 'VBAP' 'Report Quantity'(013) 'Report Quantity'(013) 'QUAN '(014).
m_fieldcat 'ZMEIN' 'VBAP' 'Report UOM'(018) 'Report UOM'(018) ' '.
m_fieldcat 'NETWR' 'VBAP' 'Net value'(030) 'Net value'(030) ' '.
m_fieldcat 'MATKL' 'VBAP' 'Material Group Description'(023) 'Material Group Description'(023) ' '. "DRFK904686(-)
m_fieldcat 'WGBEZ' 'T023T' 'Material Group'(015) 'Material Group'(015) ' '. "DRFK904686(-)
m_fieldcat 'MATKL' 'VBAP' 'Material Group'(015) 'Material Group'(015) ' '. "DRFK904686(+)
m_fieldcat 'WGBEZ' 'T023T' 'Material Group Description'(023) 'Material Group Description'(023) ' '. "DRFK904686(+)
m_fieldcat 'MATNR' 'VBAP' 'Material Number'(016) 'Material Number'(016) ' '.
m_fieldcat 'MAKTX' 'MAKT' 'Materia Description'(024) 'Material Description'(025) ' '.
Begin of addition DRFK904686
m_fieldcat 'LFSTK' 'VBUK' 'Delivery status'(027) 'Delivery status'(027) 'DelStat' .
m_fieldcat 'LFGSK' 'VBUK' 'Overall delivery status'(028) 'Overall delivery status'(028) ' '.
m_fieldcat 'FKSTK' 'VBUK' 'Billing status'(029) 'Billing status'(029) ' '.
End of addition DRFK904686
ENDFORM. " f_build_fieldcat
*& Form f_list_dispaly
form for displaying the final output in the Alv grid
FORM f_list_dispaly .
st_layout-cell_merge = 'X'.
st_layout-colwidth_optimize = 'X'.
To display the required data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = w_repid
is_layout = st_layout
it_fieldcat = i_fieldcat[]
i_save = 'A'
is_variant = i_variant
it_events = w_events[]
TABLES
t_outtab = i_final.
ENDFORM. " f_list_dispaly
" f_EVENTTAB_BUILD
FORM F_DISPLAY_TOP_OF_PAGE *
*form for providing the report heading *
event TOP_OF_PAGE *
FORM f_display_top_of_page. "#EC CALLED
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = w_list_top_of_page.
ENDFORM. "DISPLAY_TOP_OF_PAGE
*& Form f_EVENTTAB_BUILD
Ereignistabelle Bilden
EVENTS TABLE BUILD
-->U_ER_EVENTS[] text
FORM f_eventtab_build USING p_u_er_events TYPE slis_t_event.
FIELD-SYMBOLS: <fs_event> TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_u_er_events.
READ TABLE p_u_er_events WITH KEY name = slis_ev_top_of_page
ASSIGNING <fs_event>.
IF sy-subrc = 0.
<fs_event>-form = c_formname_top_of_page.
ENDIF.
ENDFORM. " f_EVENTTAB_BUILD
*& Form F_COMMENT_BUILD
Bearbeitung des Listenkopfes
Processing of listheader
-->U_ER_LIST_TOP_OF_PAGE[] text
FORM f_comment_build USING u_er_list_top_of_page TYPE slis_t_listheader.
DATA: lw_line TYPE slis_listheader.
Type H
CLEAR lw_line.
lw_line-typ = 'H'.
Daily Historical Volume
lw_line-info = text-003.
APPEND lw_line TO u_er_list_top_of_page.
Type S
CLEAR lw_line.
lw_line-typ = 'S'.
Run Date - Sy-datum
WRITE sy-datum TO w_datum MM/DD/YY .
CONCATENATE text-021 w_datum INTO w_text.
lw_line-info = w_text.
APPEND lw_line TO u_er_list_top_of_page.
ENDFORM. " COMMENT_BUILD
Reward the points for useful answers.
Similar Messages
-
Report on Sales Orders Cancelled
Dear Experts,
I have the following TWO Requirements.
1) How to cancel Sales Orders.
2) How to Generate a Report on Sales Orders Cancelled during a given time. The details required in the Report are:
Orders cancelled by an User, Depot and by the Region.
Creation date of sale order.
Cancellation date.
Kindly give us your Detailed & Valuable solutions to proceed.
Regards
HariHi Lakshmipathi,
I have been going through various Threads Posted in the Forum.
In One of your Replies to a Question Posted "Re: Deletion indicator of sales order" the Solution given is "Execute TCode AUT10."
When I had tried with the Transaction Code AUT10 on the SAP System, No Data is populated on the Screen. Any settings to be done on the System.
You can suggest a possible solution to the Issue posted by me.
Regards
hari -
How to create a daily report for sales order
hi
how to create a daily report for sales order. what fields it must consists of. what are the tables it need?Hi
You have to use the sales order tables VBAK,VBAP and VBEP
So keep date field on selection screen
and treat this date as Order creation data audat field in VBAK.
based on this fetch the data from VBAK and VBAP with the following fields like
VBELN, KUNNR,NETWR,POSNR, MATNR,ARKTX,KWMENG,WAERS etc and display in the report
<b>Reward points for useful Answers</b>
Regards
Anji -
Report for Sales orders with the consumed credit limit value
Dear Gurus,
In my company, the credit check is at sales order level. We want a report which shows up the credit value consumed from the credit master by Sales order.
Going into the details, Say Credit limt is setup for a customer at Credit master for 10000 $.
I want a report showing Sales order 59235 has consumed 500 $, Sales order 59277 has consumed 1500 $, Sales order 59333 has consumed 2500 $.
Is their a report in standard SAP for the above functionality. If not, any ideas of how to achieve it?
Thank you for your responses.
Regards,Hi,
Try the following transaction codes
S_ALR_87012218
FDK43
F.31
But if you want to a report like what you explained in thread i think in standard not available we need to develop a customized one.
Regards -
Report on sales order material
Hi
i am working in implementation project first time.We are implementing sd module in bi. We are working on the infocube 0sd_c03.I have to develop the reports on "*sales order material". As i am new kindly explain me what is procedure step by step
TusharHi Tushar,
1.Execute T-code RSA1, Under menu options on LHS, goto Metadata Repository.
You will find 2 windows adjacent to eachother.
Under "SAP Business Information Warehouse" window, Click on "Local Objects" under Heading Business Content.
After Selecting that, you will find a huge list of all the objects on RHS window such as KPI's,Infoarea,Application, info object catalog etc..
Click on "Infocube". (note:System may take time to display all list of cubes.)
You will find a list of all infocubes which are ready to use (out-of-the-box) from Business content.
Search for your cube ,use CTRL+F /Find option (give Sales cube or 0SD_C03 in search).
Click on the cube Sales cube :0SD_C03.
Now you will find all the details about this cube. Each and every data objects are dispayed.
Goto reports section, you will find a huge list of reports already built on your sales cube. There you will find the report 0sd_c03_Q0012.
If you need to know which key figs/characteristics/variables used in this query, then just click on that query, it will take you to a new screen displaying details about that query.
Once you gather all the details, then after Gap analysis, if you feel that, yes the standard out of the box report matches your requirement or it almost meets the requirement and if you need to do slight enhancements then you can go ahead in instaling this report and save a lot of time instead of starting from scratch.
To install this report, pre-requisites are- you should haveinstalled your cube, underlying DSO, transformation, all keyfigs, all chars, data source etc.
and then use T-code RSORBCT/you can use BI Content menu on LHS in RSA1 screen to install this report.
If pre-requisites are pending, you need to install all the objects first, you can use RSORBCT to install your cubes.
2. It is advisable to search the query you need in the business content, if the query matches the requirement, you save a lot of time in developing the query. If you didnt find the suiatable query in Busines content, then you need to develop it from scratch.
3)
so when we run the query in bex query designer on cube 0sd_c03 by using 0sd_c03_Q0012 then what are things we have to take care. In rows and columns which chartersitic and key figures we have to put?
I hope the query 0sd_c03_Q0012 "sales order material" may meet your requirements. If its not then try to get what is missing in this. If you need to enhance by adding any new objects, then first install this query from Business content, and then modify this query as per your need. and then activate and it will be ready to use.
You can install any object as many times as possible from business content, its just the same as copy and paste.
So only business content can help you on first phase regarding your requirement, because SAP has developed these reports at standard level used world wide thoughout industry.
Hope this clears your queries.
Regards
Jeeth
Edited by: Jeeth_P on Feb 3, 2012 9:25 AM -
Report of sales orders with several schedules lines
Hi all,
I try to develop a report for sales orders and delivery info. I need sales order quantity, delivery quantity and the quantity in the scheduled line. But I faced with the problem of several scheduled lines.
I could not find the relation between delivery information and the scheduled lines of sales order.
Any function module or other way to find out a delivery belongs to which cheduled line of the sales order ?
Thanks,
UtkuSolved problem
-
Report of sales orders with several scheduled lines
Hi all,
I try to develop a report for sales orders and delivery info. I need sales order quantity, delivery quantity and the quantity in the scheduled line. But I faced with the problem of several scheduled lines.
I could not find the relation between delivery information and the scheduled lines of sales order.
Any function module or other way to find out a delivery belongs to which scheduled line of the sales order ?
Thanks,
Utkupost this in ABAP forum for quicker response.
Regards
Raja -
How to put sales order on hold
HI sap minds ,
help me how can i put a sales order on hold , through va01 .Add delivery block and/or billing block.
-
Track/report delayed sales order
Dear Experts,
Do you have a simple solution to track/report delayed sales order with reason code? (I'd like to see delays in days and a reason code in a list.) Is there anyone who generate this KPI from SAP?
Thanks in advance,Dear Roland
Besides going down order by order, if you want to see the changes made to sale orders in bulk, I dont think there is a standard TCode available.
As you would be aware, for sales documents, the change object is VERKBELEG and you have to develop a report considering tables VBAK and VBAP. Of course, you are aware, changed history are recorded in CDHDR and CDPOS but both will eat your time.
May be you can check this link and develop a zee report accordingly.
[Sales Order Changed History Display |http://www.sap-img.com/ab024.htm]
thanks
G. Lakshmipathi -
hi ,
developed a report(alv list) to search application database for open sales orders. the inputs are sales organization, sold to party, material number,customer purchase order number,sales order craetion date.Hi,
sales organization, sold to party, material number,customer purchase order number,sales order craetion date.
to get the open sales order, that is the DElivery for sales order is not created.
u can check the status of sales order in the tables VBUK /VBUP.
In VBUK , check one filed(iam not sure at this movement) , if the field value is C, then that particular order is closed, if not C(i.e A (no delivery)or B(some part of items are deliverd) ) . From this u can display Open Sales Orders.
Revert Back if any issues,
Reward with points if helpful.
Regards,
Naveen -
Report for sales orders with abnormal discounts
Hi
We have a discount condition type say ZDIS with 10% which is not changeable manually in sales order..But incase if the user has changed the condition master to 12% and created the sales order with 12%disc...Hence i need a report, the list of sales orders with the abnormal discounts..(the sales orders with the discount value more or less than 10%)..
How do i get this report..Kindly provide me the table names&logic ...
Reg
JJWe have a discount condition type say ZDIS with 10% which is not changeable manually in sales order..But incase if the user has changed the condition master to 12% and created the sales order with 12%disc...Hence i need a report, the list of sales orders with the abnormal discounts..(the sales orders with the discount value more or less than 10%)..
How do i get this report..Kindly provide me the table names&logic ...
Select KNUMH where KONP-KSCHL EQ ZDIS ( Condition record number)
Select KONV-KNUMV Where KONV-KNUMH EQ KONP-KNUMH
Select VBAK-KNUMV where VBAK-KNUMV EQ KONV-KNUMV
Then with the help of ABAPER hard code the condition amount (KBERT>10%)
Regards
Rohit -
ECC report for sales order status from order entry to Invoice (OTC rpt)
Dear All.
Looking to see if there's a standard report or transaction that we can use to review sales order line item status.
VA05 provides a good view from sales, and VL06O provides a good view from LE, and VF05 provides a good view from billing.
But there is there something that would list sales orders and show related quantity, open, delivered, billed all in one report?
Many thanks!Thank you Shiva.
That's what we were thinking as well. Just wanted to make sure we didn't miss something in case SAP provided a template or customizable program for this.
Thanks -
Abap Report including sales orders and delivery data.
Hi Experts,
I Want to develop a new abap report which would contain the data for sales orders and delivery.
I want to fetch all the sales orders based on the ship date (LIKP-WADAT_IST) of the delievry.
Could anyone please let me know how to fetch teh data or is their any function module which would help me to solve my problem.
<Removed by moderator>
Thanks,
Komal.
Moderator message : Spec dumping not allowed. Thread locked.
Edited by: Vinod Kumar on Aug 10, 2011 1:25 PMpost this in ABAP forum for quicker response.
Regards
Raja -
Purchase items report for sales orders - very important
Hi Folks,
Could you please guide me on how to create a report of "items purchased" for a particular "sales order". if i am able to include various fields of items purchased, like....quantity, item description, vendor name, item price, etc., it will be very useful.
This report is required for a client, who assembles machines in a "make to order" scenario, and most of the BOM child items are "purchase items".Hello Krishna,
Few things to note:
Is the PO created from the SO. Is YES, then you could use the base document ref at the POR1 table.
OR
Are the BOM components defined with a default vendor in the Item Master and if YES are the components always purchased from the same vendor.
I am trying to see how to establish the relationship of the items between the PO and SO.
Please give me the details and I could guide you further
Thanks
Suda -
I need to create a report for all sales order that have line items with a Material Tax Class '2' - One time exemption. Tax will require a report that identifies/displays all line items with Tax Classification = '2'.
Report layout specifics:
Bill-To
Ship-To
Order No.
Tax classification
Internal Item Notice Text.
For bill-to, ship-to, order no are all fields of structure KOMK, but I need to know which table it comes from so I retrieve the data by a select statement to display this. Can anyone guide me on this ? Thanks in advance !!!
NimeshI dont know where that tab is either. I will have to find out and let you know. For now I just left it out and I have written the following code - please let me know if this looks right according to the requirement.
REPORT ZMAT_TAX_REPORT .
TABLES: VBAK, VBPA, VBAP, MLAN, KOMK.
DATA: begin of jtab occurs 0,
kunnr like vbak-kunnr,
vbeln like vbak-vbeln,
parvw like vbpa-parvw,
end of jtab,
wa_vbak like vbak occurs 0 with header line,
wa_vbpa like vbpa occurs 0 with header line,
wa_vbap like vbap occurs 0 with header line.
PARAMETERS: TAXM1 like MLAN-TAXM1 default '2'.
select single taxm1 from vbap into vbap-taxm1 where TAXM1 = MLAN-TAXM1.
if sy-subrc eq 0.
if vbap-taxm1 = '2'.
select single * from vbak into wa_vbak
where kunnr = komk-kunre.
select single * from vbpa into wa_vbpa
where parvw = komk-kunwe.
select single * from vbap into wa_vbap
where taxm1 = mlan-taxm1.
move wa_vbak-kunnr to jtab-kunnr.
move wa_vbak-vbeln to jtab-vbeln.
move wa_vbpa-parvw to jtab-parvw.
endif.
if sy-subrc eq 0.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Bill-To',
21 sy-vline,
3 'Ship-To',
21 sy-vline,
4 'Order No.',
21 sy-vline.
write:/(95) sy-uline.
loop at jtab.
write:/1 sy-vline,
2 jtab-kunnr,
21 sy-vline,
3 jtab-parvw,
21 sy-vline,
4 jtab-vbeln,
21 sy-vline,
95 sy-vline.
endloop.
endif.
endif.
endif.
Maybe you are looking for
-
How to Change Default Iview Properties for Role Upload?
Hello, We have many roles to upload from R/3 ABAp system to NW2004s EP. We use the Role Upload tool in the Portal to achieve this. It works fine, the roles are created in the portal and can be assigned to users. The fall back is that we have to modif
-
Free iBook won't load or delete
Problem on iPad 2, iOS 8 Months ago there was a free textbook by E. O Wilson-Life on Earth volume 1. I tried to download it on my iPad and it would never load. It just sits there greyed out in the grid view and in the list view it has a stop button t
-
When browsing my artists in iTunes, why is there multiple Various Artists?
I am in the process of organizing my iTunes, and came across a problem. Under the artists tab of iTunes 11 I have two different options for my Various Artists (i.e. Soundracks and complilations). I tried to see if there was a difference in any of the
-
How to use external monitor with laptop closed
My external monitor goes to sleep when i close the Macbook Air lid. How do i stop that from happening?
-
[SOLVED] Dependency tracking
Hello, I had some updates available yesterdays, among others: - libgadu, - mplayer, - gnutls. I didn't want to restart machine right away, so I upgraded only libgadu and mplayer. Then, when trying to start mplayer or kadu (which uses libgadu) a got a