Logic of determining value for Inventory offsetting line item
Hi,
I want to know the following for the reversal of Process Order for materials for which the price control is 'S'.
How the value for GBB (Inventory offsetting) is determined. I have observed it taking the weighted rate of the (Summation of the Total Actual Cost / Sumation of Actual Qunatity) * Reversal Quantity. The BSX line item is determined by Standard Price * Reversal Quantity
The balance is posted in the Price difference.
I want to know why this difference is determining tge line items.
I have gone thru SAP Note 216080 in this regard but failed to understandard the basic resaon why this is happening.
Regards
Partha
Dear colleague,
you are right
>note 422606:
a) The manufactured material has price control 'S' (Standard price).
Valuation is carried out for goods receipts using the standard
price that is currently valid.
For the reversal of goods receipts, the valuation of the debit of
the order (offsetting entry to stock posting) is carried out
using the price determined from the quotient of value of goods
received and quantity of goods received. That is, all previous
goods receipts are used for the valuation of the reversal of a
goods receipt, but order settlements are not used.
It is the standard system behaviour that the reversal of goods receipt
for production order are not valuated with standard price. All previous
goods receipts are used for the valuation of the reversal of a
goods receipt.
Goods receipts are always reversed with an average of the prices of
all goods receipts in the order history. Therefore price differences
may occur. This behaviour is as well explained in the attached
note 49995 in the reasons and prerequisites step. As well you find
an explanation in note's 422606 symptoms. the system tries to avoid the reversal
with posted values no longer possible.
If this replies your question ,please mark it as answered,
best regards,
maria
Similar Messages
-
How value for Inv Offsetting line item determined for revsesal
Hi,
I want to know the following for the reversal of Process Order for materials for which the price control is 'S'.
How the value for GBB (Inventory offsetting) is determined. I have observed it taking the weighted rate of the (Summation of the Total Actual Cost / Sumation of Actual Qunatity) * Reversal Quantity. The BSX line item is determined by Standard Price * Reversal Quantity
The balance is posted in the Price difference.
I want to know why this difference is determining tge line items.
I have gone thru SAP Note 216080 in this regard but failed to understandard the basic resaon why this is happening.
Regards
ParthaDear colleague,
you are right
>note 422606:
a) The manufactured material has price control 'S' (Standard price).
Valuation is carried out for goods receipts using the standard
price that is currently valid.
For the reversal of goods receipts, the valuation of the debit of
the order (offsetting entry to stock posting) is carried out
using the price determined from the quotient of value of goods
received and quantity of goods received. That is, all previous
goods receipts are used for the valuation of the reversal of a
goods receipt, but order settlements are not used.
It is the standard system behaviour that the reversal of goods receipt
for production order are not valuated with standard price. All previous
goods receipts are used for the valuation of the reversal of a
goods receipt.
Goods receipts are always reversed with an average of the prices of
all goods receipts in the order history. Therefore price differences
may occur. This behaviour is as well explained in the attached
note 49995 in the reasons and prerequisites step. As well you find
an explanation in note's 422606 symptoms. the system tries to avoid the reversal
with posted values no longer possible.
If this replies your question ,please mark it as answered,
best regards,
maria -
How value determined for Inv offsetting line items
Hi,
I want to know the following for the reversal of Process Order for materials for which the price control is 'S'.
How the value for GBB (Inventory offsetting) is determined. I have observed it taking the weighted rate of the (Summation of the Total Actual Cost / Sumation of Actual Qunatity) * Reversal Quantity. The BSX line item is determined by Standard Price * Reversal Quantity
The balance is posted in the Price difference.
I want to know why this difference is determining tge line items.
I have gone thru SAP Note 216080 in this regard but failed to understandard the basic resaon why this is happening.
Regards
ParthaHi,
When you do the reversal of the Production consumption.
There may be two type of consumption for production,the raw matrerial with V price determination & Semi finished goods with the S pricing.
So when you do the reversal entry the Value & Qty update will be happen in the Inventory.
Say when consume the system will capture from GBB with valuation class.the G/L with P&L Account.
When you reverse the same then it will reverse with same G/L & assignment.
There will be 2 entry one is reversal from consumption G/L & post to Price difference,then other document with reverse price difference & post in the inventory account Balance sheet account.
So 2 entry will be entered during reversal.
If there is any difference then the difference amount will posted to price difference account.it will update the inventore also with qty & value.
Regrds,
Raj. -
Could not determine value for variable 0P_FVAEX (or 0P_CTPCA)
I get the below error while accessing a query on the planning Info Cube. I used the SAP Exit variable Most Current Data (Transactional InfoCube) (0S_RQTRA) in the query for the Characteristic - Request ID (0REQUID) to extract the data from the yellow request too.
I do not use the below variables as in the below eror in my query at all. Please assist.
Diagnosis
This error diagnosis is specific only to the variables 0P_FVAEX or 0P_CTPCA !
Termination message BRAIN 632 appears:
Could not determine value for variable 0P_FVAEX (or 0P_CTPCA).
System Response
1. Operation method of SAP-Exit-Variables 0P_FVAEX or 0P_CTPCA
With queries from the CO application, both SAP-Exit-Variables look for an entry for 'controlling area'. With this controlling area from the selection screen, the SAP-Exit-Variables program reads the attributes for InfoObject 0CO_AREA (controlling area).
With queries from the FI application, the SAP Exit Variable 0P_FVAEX looks for an entry for 'company code'. With this company code from the selection screen, the SAP Exit Variables program reads the attributes for InfoObject 0COMP_CODE (Company Code).
0P_FVAEX determines the fiscal year variant (attribute 0FISCVARNT) from the attributes for 0CO_AREA (CO queries) or 0COMP_CODE (FI queries). 0P_CTPCA determines the currency type of the profit center local currency (attribute 0CURTP_PCA) from the attributes for 0CO_AREA.Hello,
you need to take a closer look at your query. Somewhere you used one of the 0P_* exit variables, which work only for controlling related InfoCubes. Use your own variables.
Regards,
Marc
SAP NetWeaver RIG -
Output the requested delivery date for each different line item
Hello Experts
I have program called ZFSFSF(following), in the output Its showing multiple requested delvery dates per line item.
But We need to show the requested delivery date for each different line item.
Any code is highly appreciated. I wud appreacite if you cud bold the added code.
Thanks
SP
TYPE-POOLS: slis.
TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1, bkpf, bsad, bkpf_bsad,
knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
DATA: BEGIN OF i_list OCCURS 0,
vbeln LIKE vbak-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
erdat LIKE vbap-erdat,
mvgr1 LIKE mvke-mvgr1,
wadat_ist LIKE likp-wadat_ist,
days TYPE i,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
kwmeng LIKE vbap-kwmeng," CH01+
lfimg LIKE lips-lfimg," CH01+
pstyv LIKE vbap-pstyv," CH01+
obd LIKE lips-vbeln," CH01+
obd_pos LIKE lips-posnr," CH01+
soldto LIKE vbaK-kunnr," JR+
shipto LIKE vbpa-kunnr," JR+
edatu like vbep-edatu," PR+
END OF i_list.
DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
*ALV Output Header
DATA: gt_list_top_of_page TYPE slis_t_listheader,
prognm LIKE sy-repid,
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
gt_events TYPE slis_t_event,
is_layout TYPE slis_layout_alv,
is_variant LIKE disvariant,
it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER LINE.
DATA: g_repid LIKE sy-repid,
g_count LIKE sy-tabix.
SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-t01.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-t10.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-t11.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(79) text-t12.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF BLOCK block0.
*/ Selection and Input Parameters
SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
s_matnr FOR vbap-matnr," obligatory,
s_mvgr1 FOR mvke-mvgr1,
s_erdat FOR vbap-erdat OBLIGATORY,
s_werks FOR vbap-werks,
s_lgort FOR vbap-lgort,
s_edatu FOR vbep-edatu.
PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
SELECTION-SCREEN SKIP 2.
+EC1
Addition +EC1
+EC1
PARAMETERS: p_vari LIKE disvariant-variant.
+EC1
End Addition +EC1
+EC1
SELECTION-SCREEN END OF BLOCK blocko.
+EC1
Addition +EC1
+EC1
DATA: g_save(1) TYPE c,
g_default(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant,
g_variant LIKE disvariant.
+EC1
End Addition +EC1
+EC1
Initialization fieldcatalog
INITIALIZATION.
PERFORM clear_tables.
g_repid = sy-repid.
PERFORM fieldcat_init USING gt_fieldcat[].
+EC1
Addition +EC1
+EC1
g_save = 'A'.
PERFORM variant_init.
Get default variant
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
AT SELECTION-SCREEN.
PERFORM auth_check. "+ESC
PERFORM pai_of_selection_screen.
+EC1
End Addition +EC1
+EC1
START-OF-SELECTION.
PERFORM get_data.
PERFORM alv.
END-OF-SELECTION.
FORM get_data *
FORM get_data.
*CH01 - Added kwmeng(order qty) to selection, excluded rejects
*JR -added soldto and shipto code
SELECT avbeln aposnr amatnr aerdat awerks algort
akwmeng apstyv bkunnr cedatu
CH01+
INTO
(i_list-vbeln, i_list-posnr, i_list-matnr, i_list-erdat, i_list-werks,
i_list-lgort,
i_list-kwmeng , i_list-pstyv, i_list-soldto,i_list-edatu)
CH01+
FROM vbap AS a INNER JOIN vbak AS b ON avbeln = bvbeln
INNER JOIN vbep AS c ON avbeln = cvbeln
WHERE b~vkorg = p_vkorg
AND a~werks IN s_werks
AND a~lgort IN s_lgort
AND b~auart IN s_auart
AND a~vbeln IN s_vbeln
AND a~erdat IN s_erdat
AND a~abgru = ''" CH01+
AND a~matnr IN s_matnr
AND c~edatu IN s_edatu.
APPEND i_list.
ENDSELECT.
COMMIT WORK AND WAIT.
LOOP AT i_list.
SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
WHERE matnr = i_list-matnr.
MODIFY i_list.
CLEAR: i_list.
ENDLOOP.
COMMIT WORK AND WAIT.
LOOP AT i_list.
IF i_list-mvgr1 IN s_mvgr1.
CONTINUE.
ELSE.
DELETE i_list.
COMMIT WORK AND WAIT.
ENDIF.
ENDLOOP.
CH01 - commented these lines out and redid logic below
LOOP AT i_list.
select single vbeln into lips-vbeln from lips
where vgbel = i_list-vbeln
and vgpos = i_list-posnr.
select single wadat_ist into i_list-wadat_ist from likp
where vbeln = lips-vbeln.
SELECT b~wadat_ist INTO i_list-wadat_ist
FROM lips AS a INNER JOIN
likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
AND a~vgpos = i_list-posnr.
MODIFY i_list.
CLEAR: i_list, lips-vbeln.
ENDSELECT.
ENDLOOP.
CH01 - Changed to select multiple delivery lines & del qty
summing the total deliveries per OBD# and date
LOOP AT i_list.
SELECT avbeln sum( alfimg ) b~wadat_ist
INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
FROM lips AS a INNER JOIN
likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
AND a~vgpos = i_list-posnr
AND a~pstyv = i_list-pstyv
group by avbeln bwadat_ist.
i_list2 = i_list.
APPEND i_list2.
ENDSELECT.
IF sy-subrc <> 0.
i_list2 = i_list.
APPEND i_list2.
ENDIF.
ENDLOOP.
i_list[] = i_list2[].
*End CH01
COMMIT WORK AND WAIT.
LOOP AT i_list.
IF i_list-wadat_ist IS INITIAL.
CONTINUE.
ELSE.
i_list-days = i_list-wadat_ist - i_list-erdat.
ENDIF.
MODIFY i_list.
CLEAR: i_list.
COMMIT WORK AND WAIT.
ENDLOOP.
COMMIT WORK AND WAIT.
LOOP AT i_list.
IF i_list-vbeln IS INITIAL.
DELETE i_list.
ENDIF.
ENDLOOP.
COMMIT WORK AND WAIT.
*JR
LOOP AT i_list.
SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
WHERE vbeln = i_list-vbeln
AND parvw = 'WE'.
MODIFY i_list.
ENDLOOP.
*END JR
gt_outtab[] = i_list[].
COMMIT WORK AND WAIT.
ENDFORM.
FORM alv *
FORM alv.
PERFORM e03_eventtab_build USING gt_events[]. "+EC1
PERFORM e04_comment_build USING gt_list_top_of_page[]. "+EC1
prognm = sy-repid. "+EC1
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_user_command = 'USER_COMMAND'
i_callback_program = g_repid
it_fieldcat = gt_fieldcat[]
it_events = gt_events[] "+ESC
it_sort = it_sort[]
+EC1
Addition +EC1
+EC1
is_variant = g_variant
i_save = g_save
+EC1
End Addition +EC1
+EC1
TABLES
t_outtab = gt_outtab.
COMMIT WORK AND WAIT.
ENDFORM.
FORM fieldcat_init *
--> I_FIELDCAT *
FORM fieldcat_init
USING i_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: pos TYPE i VALUE 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VBELN'.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'POSNR'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MVGR1'.
ls_fieldcat-ref_tabname = 'MVKE'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'LGORT'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ERDAT'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WADAT_IST'.
ls_fieldcat-ref_tabname = 'LIKP'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'DAYS'.
ls_fieldcat-ref_fieldname = 'DAYS'.
ls_fieldcat-seltext_s = '# Of Days'.
ls_fieldcat-seltext_m = '# Of Days'.
ls_fieldcat-seltext_l = '# Of Days'.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
*Begin CH01
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'KWMENG'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-outputlen = 7.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'LFIMG'.
ls_fieldcat-ref_tabname = 'LIPS'.
ls_fieldcat-outputlen = 7.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'OBD'.
ls_fieldcat-seltext_s = 'OBD'.
ls_fieldcat-seltext_m = 'Outbound Del'.
ls_fieldcat-seltext_l = 'Outbound Delivery'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'OBD_POS'.
ls_fieldcat-seltext_s = 'OBD Ln'.
ls_fieldcat-seltext_m = 'Outbound Del Ln'.
ls_fieldcat-seltext_l = 'Outbound Del Line'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
*End CH01
*JR
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SOLDTO'.
ls_fieldcat-ref_tabname = 'VBAP'.
ls_fieldcat-seltext_m = 'Sold To'.
ls_fieldcat-seltext_l = 'Sold To'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SHIPTO'.
ls_fieldcat-ref_tabname = 'VBPA'.
ls_fieldcat-seltext_m = 'Ship To'.
ls_fieldcat-seltext_l = 'Ship To'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
*END JR
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'EDATU'.
ls_fieldcat-ref_tabname = 'VBEP'.
ls_fieldcat-seltext_m = 'Requested Delivery date'.
ls_fieldcat-seltext_l = 'Requested Delivery date'.
ls_fieldcat-outputlen = 20.
APPEND ls_fieldcat TO i_fieldcat.
CLEAR ls_fieldcat.
*FOR ALV SORT & SUBTOTAL
CLEAR it_sort.
it_sort-spos = '0'.
it_sort-fieldname = 'VBELN'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '1'.
it_sort-fieldname = 'POSNR'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '2'.
it_sort-fieldname = 'MATNR'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '3'.
it_sort-fieldname = 'MVGR1'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '4'.
it_sort-fieldname = 'ERDAT'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '5'.
it_sort-fieldname = 'WADAT_IST'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-down = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '6'.
it_sort-fieldname = 'PERNR'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '7'.
it_sort-fieldname = 'VORNA'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '8'.
it_sort-fieldname = 'NACHN'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '9'.
it_sort-fieldname = 'VKGRP'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '10'.
it_sort-fieldname = 'VBELN'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '11'.
it_sort-fieldname = 'ERDAT'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
CLEAR it_sort.
it_sort-spos = '12'.
it_sort-fieldname = 'BEZEI'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
it_sort-subtot = 'X'.
APPEND it_sort.
clear it_sort.
it_sort-spos = '1'.
it_sort-fieldname = 'BELNR'.
it_sort-tabname = 'GT_OUTTAB'.
it_sort-up = 'X'.
append it_sort.
ENDFORM.
+EC1
Addition +EC1
+EC1
*& Form VARIANT_INIT
text
--> p1 text
<-- p2 text
FORM variant_init.
CLEAR g_variant.
g_variant-report = g_repid.
ENDFORM. " VARIANT_INIT
FORM f4_for_variant *
FORM f4_for_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
it_default_fieldcat =
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
ENDFORM.
*& Form PAI_OF_SELECTION_SCREEN
text
FORM pai_of_selection_screen.
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
+EC1
End Addition +EC1
+EC1
FORM e03_eventtab_build *
--> E03_LT_EVENTS *
FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = e03_lt_events.
READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO e03_lt_events.
ENDIF.
ENDFORM.
FORM e04_comment_build *
--> E04_LT_TOP_OF_PAGE *
FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
*Report Title
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-007.
APPEND ls_line TO e04_lt_top_of_page.
**Doc Type Desc.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = text-008.
ls_line-info = p_matnr.
append ls_line to e04_lt_top_of_page.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = text-009.
ls_line-info = p_werks.
append ls_line to e04_lt_top_of_page.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = text-010.
ls_line-info = p_stlan.
append ls_line to e04_lt_top_of_page.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = text-011.
ls_line-info = p_stlal.
append ls_line to e04_lt_top_of_page.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = text-012.
ls_line-info = p_stlal.
append ls_line to e04_lt_top_of_page.
ENDFORM.
FORM top_of_page *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM.
FORM auth_check *
FORM auth_check.
AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
ID 'VKORG' FIELD p_vkorg.
IF sy-subrc NE 0.
MESSAGE e054 WITH p_vkorg.
ENDIF.
ENDFORM. " auth_check
*& Form USER_COMMAND
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
PERFORM display_so_order USING r_ucomm
rs_selfield.
ENDCASE.
ENDFORM.
*& Form display_sales_order
text
-->P_R_UCOMM text
-->P_RS_SELFIELD text
FORM display_so_order USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE rs_selfield-sel_tab_field.
WHEN '1-VBELN'.
SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
WHEN '1-MATNR'.
SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN '1-OBD'.
SET PARAMETER ID 'VL' FIELD rs_selfield-value.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
WHEN OTHERS.
MESSAGE i000(z1) WITH 'Please Click on the Valid Selection'.
EXIT.
ENDCASE.
ENDFORM. " display_sales_order
FORM EDit_table *> TYPE-POOLS: slis.
>
> TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1,
> bkpf, bsad, bkpf_bsad,
> knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
>
> DATA: BEGIN OF i_list OCCURS 0,
> vbeln LIKE vbak-vbeln,
> posnr LIKE vbap-posnr,
<b> etenr like vbep-etenr,</b>
> matnr LIKE vbap-matnr,
> erdat LIKE vbap-erdat,
> mvgr1 LIKE mvke-mvgr1,
> wadat_ist LIKE likp-wadat_ist,
> days TYPE i,
> werks LIKE vbap-werks,
> lgort LIKE vbap-lgort,
> kwmeng LIKE vbap-kwmeng," CH01+
> lfimg LIKE lips-lfimg," CH01+
> pstyv LIKE vbap-pstyv," CH01+
> obd LIKE lips-vbeln," CH01+
> obd_pos LIKE lips-posnr," CH01+
> soldto LIKE vbaK-kunnr," JR+
> shipto LIKE vbpa-kunnr," JR+
> edatu like vbep-edatu," PR+
> END OF i_list.
>
> DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
> i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
>
> DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
>
>
> *ALV Output Header
> DATA: gt_list_top_of_page TYPE slis_t_listheader,
> prognm LIKE sy-repid,
> gc_formname_top_of_page TYPE slis_formname VALUE
> 'TOP_OF_PAGE',
> gt_events TYPE slis_t_event,
> is_layout TYPE slis_layout_alv,
> is_variant LIKE disvariant,
> it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
>
> DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
> DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER
> LINE.
>
> DATA: g_repid LIKE sy-repid,
> g_count LIKE sy-tabix.
>
> SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME
> TITLE text-t01.
>
> SELECTION-SCREEN: BEGIN OF LINE.
> SELECTION-SCREEN COMMENT 1(79) text-t10.
>
> SELECTION-SCREEN: END OF LINE.
>
> SELECTION-SCREEN: BEGIN OF LINE.
> SELECTION-SCREEN COMMENT 1(79) text-t11.
> SELECTION-SCREEN: END OF LINE.
>
> SELECTION-SCREEN: BEGIN OF LINE.
> SELECTION-SCREEN COMMENT 1(79) text-t12.
> SELECTION-SCREEN: END OF LINE.
>
> SELECTION-SCREEN END OF BLOCK block0.
>
> */ Selection and Input Parameters
> SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME
> TITLE text-001.
>
>
>
> SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
> s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
> s_matnr FOR vbap-matnr," obligatory,
> s_mvgr1 FOR mvke-mvgr1,
> s_erdat FOR vbap-erdat OBLIGATORY,
> s_werks FOR vbap-werks,
> s_lgort FOR vbap-lgort,
> s_edatu FOR vbep-edatu.
>
> PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
>
>
>
> SELECTION-SCREEN SKIP 2.
> *----
> -
+EC1
> * Addition +EC1
> *----
> -
+EC1
> PARAMETERS: p_vari LIKE disvariant-variant.
> *----
> -
+EC1
> * End Addition +EC1
> *----
> -
+EC1
> SELECTION-SCREEN END OF BLOCK blocko.
>
> *----
> -
+EC1
> * Addition +EC1
> *----
> -
+EC1
> DATA: g_save(1) TYPE c,
> * g_default(1) TYPE c,
> g_exit(1) TYPE c,
> gx_variant LIKE disvariant,
> g_variant LIKE disvariant.
> *----
> -
+EC1
> * End Addition +EC1
> *----
> -
+EC1
>
> * Initialization fieldcatalog
> INITIALIZATION.
>
> * PERFORM clear_tables.
>
> g_repid = sy-repid.
> PERFORM fieldcat_init USING gt_fieldcat[].
> *----
> -
+EC1
> * Addition +EC1
> *----
> -
+EC1
> g_save = 'A'.
> PERFORM variant_init.
> * Get default variant
> gx_variant = g_variant.
> CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
> EXPORTING
> i_save = g_save
> CHANGING
> cs_variant = gx_variant
> EXCEPTIONS
> not_found = 2.
> IF sy-subrc = 0.
> p_vari = gx_variant-variant.
> ENDIF.
>
> AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
> PERFORM f4_for_variant.
>
> AT SELECTION-SCREEN.
> PERFORM auth_check. "+ESC
> PERFORM pai_of_selection_screen.
>
>
>
> *----
> -
+EC1
> * End Addition +EC1
> *----
> -
+EC1
>
>
> START-OF-SELECTION.
>
> PERFORM get_data.
>
> PERFORM alv.
>
> END-OF-SELECTION.
>
> *----
> -
> * FORM get_data *
> *----
> -
> * ........ *
> *----
> -
> FORM get_data.
> *CH01 - Added kwmeng(order qty) to selection,
> excluded rejects
> *JR -added soldto and shipto code
SELECT a~vbeln a~posnr a~matnr a~erdat a~werks a~lgort
a~kwmeng a~pstyv b~kunnr c~edatu
CH01+
INTO corresponding fields of table i_list
FROM vbap AS a INNER JOIN vbak AS b ON a~vbeln = b~vbeln
INNER JOIN vbep AS c ON a~vbeln = c~vbeln
and a~posnr = c~posnr
WHERE b~vkorg = p_vkorg
AND a~werks IN s_werks
AND a~lgort IN s_lgort
AND b~auart IN s_auart
AND a~vbeln IN s_vbeln
AND a~erdat IN s_erdat
AND a~abgru = ''" CH01+
AND a~matnr IN s_matnr
AND c~edatu IN s_edatu.
> COMMIT WORK AND WAIT.
>
> LOOP AT i_list.
> SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
> WHERE matnr = i_list-matnr.
> MODIFY i_list.
> CLEAR: i_list.
> ENDLOOP.
> COMMIT WORK AND WAIT.
>
> LOOP AT i_list.
> IF i_list-mvgr1 IN s_mvgr1.
> CONTINUE.
> ELSE.
> DELETE i_list.
> COMMIT WORK AND WAIT.
> ENDIF.
> ENDLOOP.
> * CH01 - commented these lines out and redid logic
> below
> * LOOP AT i_list.
> ** select single vbeln into lips-vbeln from lips
> ** where vgbel = i_list-vbeln
> ** and vgpos = i_list-posnr.
> **
> ** select single wadat_ist into i_list-wadat_ist from
> likp
> ** where vbeln = lips-vbeln.
> *
> * SELECT b~wadat_ist INTO i_list-wadat_ist
> * FROM lips AS a INNER JOIN
> * likp AS b ON a~vbeln = b~vbeln WHERE a~vgbel =
> i_list-vbeln
> * AND a~vgpos = i_list-posnr.
> * MODIFY i_list.
> * CLEAR: i_list, lips-vbeln.
> * ENDSELECT.
> * ENDLOOP.
>
> * CH01 - Changed to select multiple delivery lines &
> del qty
> * summing the total deliveries per OBD# and date
> LOOP AT i_list.
> SELECT avbeln sum( alfimg ) b~wadat_ist
> INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
> FROM lips AS a INNER JOIN
> likp AS b ON avbeln = bvbeln WHERE a~vgbel =
> i_list-vbeln
> AND a~vgpos = i_list-posnr
> AND a~pstyv = i_list-pstyv
> group by avbeln bwadat_ist.
> i_list2 = i_list.
> APPEND i_list2.
> ENDSELECT.
> IF sy-subrc <> 0.
> i_list2 = i_list.
> APPEND i_list2.
> ENDIF.
> ENDLOOP.
> i_list[] = i_list2[].
> *End CH01
>
> COMMIT WORK AND WAIT.
>
> LOOP AT i_list.
> IF i_list-wadat_ist IS INITIAL.
> CONTINUE.
> ELSE.
> i_list-days = i_list-wadat_ist - i_list-erdat.
> ENDIF.
> MODIFY i_list.
> CLEAR: i_list.
> COMMIT WORK AND WAIT.
> ENDLOOP.
>
> COMMIT WORK AND WAIT.
>
> LOOP AT i_list.
> IF i_list-vbeln IS INITIAL.
> DELETE i_list.
> ENDIF.
> ENDLOOP.
> COMMIT WORK AND WAIT.
>
> *JR
> LOOP AT i_list.
> SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
> WHERE vbeln = i_list-vbeln
> AND parvw = 'WE'.
> MODIFY i_list.
> ENDLOOP.
> *END JR
>
> gt_outtab[] = i_list[].
> COMMIT WORK AND WAIT.
>
>
> ENDFORM.
>
> *----
> -
> * FORM alv *
> *----
> -
> * ........ *
> *----
> -
> FORM alv.
>
> PERFORM e03_eventtab_build USING gt_events[]. "+EC1
> PERFORM e04_comment_build USING
> gt_list_top_of_page[]. "+EC1
> prognm = sy-repid. "+EC1
>
>
> CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
> EXPORTING
> i_callback_user_command = 'USER_COMMAND'
> i_callback_program = g_repid
> it_fieldcat = gt_fieldcat[]
> it_events = gt_events[] "+ESC
> it_sort = it_sort[]
> *----
> -
+EC1
> * Addition +EC1
> *----
> -
+EC1
> is_variant = g_variant
> i_save = g_save
> *----
> -
+EC1
> * End Addition +EC1
> *----
> -
+EC1
> TABLES
> t_outtab = gt_outtab.
>
> COMMIT WORK AND WAIT.
>
>
> ENDFORM.
>
>
> *----
> -
> * FORM fieldcat_init *
> *----
> -
> * ........ *
> *----
> -
> * --> I_FIELDCAT *
> *----
> -
> FORM fieldcat_init
> USING i_fieldcat TYPE slis_t_fieldcat_alv.
> DATA: ls_fieldcat TYPE slis_fieldcat_alv.
> DATA: pos TYPE i VALUE 1.
> CLEAR ls_fieldcat.
<b>Please note to keep on incrementing pos variable for column position.</b>
<b> pos = pos + 1.</b>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'VBELN'.
> ls_fieldcat-ref_tabname = 'VBAK'.
> ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
<b> pos = pos + 1.</b> ===> after every append to field catalog.
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'POSNR'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
<b>> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'ETERN'.
> ls_fieldcat-ref_tabname = 'VBEP'.
> ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.</b>
>
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'MATNR'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'MVGR1'.
> ls_fieldcat-ref_tabname = 'MVKE'.
> ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'WERKS'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> * ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'LGORT'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> * ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'ERDAT'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> * ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'WADAT_IST'.
> ls_fieldcat-ref_tabname = 'LIKP'.
> * ls_fieldcat-key = 'X'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'DAYS'.
> ls_fieldcat-ref_fieldname = 'DAYS'.
> ls_fieldcat-seltext_s = '# Of Days'.
> ls_fieldcat-seltext_m = '# Of Days'.
> ls_fieldcat-seltext_l = '# Of Days'.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> *Begin CH01
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'KWMENG'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> ls_fieldcat-outputlen = 7.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'LFIMG'.
> ls_fieldcat-ref_tabname = 'LIPS'.
> ls_fieldcat-outputlen = 7.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'OBD'.
> ls_fieldcat-seltext_s = 'OBD'.
> ls_fieldcat-seltext_m = 'Outbound Del'.
> ls_fieldcat-seltext_l = 'Outbound Delivery'.
> ls_fieldcat-outputlen = 10.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> * ls_fieldcat-col_pos = pos.
> * ls_fieldcat-fieldname = 'OBD_POS'.
> * ls_fieldcat-seltext_s = 'OBD Ln'.
> * ls_fieldcat-seltext_m = 'Outbound Del Ln'.
> * ls_fieldcat-seltext_l = 'Outbound Del Line'.
> * ls_fieldcat-outputlen = 10.
> * APPEND ls_fieldcat TO i_fieldcat.
> * CLEAR ls_fieldcat.
> *
> *End CH01
>
> *JR
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'SOLDTO'.
> ls_fieldcat-ref_tabname = 'VBAP'.
> ls_fieldcat-seltext_m = 'Sold To'.
> ls_fieldcat-seltext_l = 'Sold To'.
> ls_fieldcat-outputlen = 10.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'SHIPTO'.
> ls_fieldcat-ref_tabname = 'VBPA'.
> ls_fieldcat-seltext_m = 'Ship To'.
> ls_fieldcat-seltext_l = 'Ship To'.
> ls_fieldcat-outputlen = 10.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
> *END JR
>
> ls_fieldcat-col_pos = pos.
> ls_fieldcat-fieldname = 'EDATU'.
> ls_fieldcat-ref_tabname = 'VBEP'.
> ls_fieldcat-seltext_m = 'Requested Delivery date'.
> ls_fieldcat-seltext_l = 'Requested Delivery date'.
> ls_fieldcat-outputlen = 20.
> APPEND ls_fieldcat TO i_fieldcat.
> CLEAR ls_fieldcat.
>
>
> *FOR ALV SORT & SUBTOTAL
> CLEAR it_sort.
> it_sort-spos = '0'.
> it_sort-fieldname = 'VBELN'.
> it_sort-tabname = 'GT_OUTTAB'.
> it_sort-up = 'X'.
> * it_sort-subtot = 'X'.
> APPEND it_sort.
>
> CLEAR it_sort.
> it_sort-spos = '1'.
> it_sort-fieldname = 'POSNR'.
> it_sort-tabname = 'GT_OUTTAB'.
> it_sort-up = 'X'.
> it_sort-subtot = 'X'.
> * it_sort-subtot = 'X'.
> APPEND it_sort.
> *
> CLEAR it_sort.
> it_sort-spos = '2'.
> it_sort-fieldname = 'MATNR'.
> it_sort-tabname = 'GT_OUTTAB'.
> it_sort-up = 'X'.
> * it_sort-subtot = 'X'.
> APPEND it_sort.
>
> CLEAR it_sort.
> it_sort-spos = '3'.
> it_sort-fieldname = 'MVGR1'.
> it_sort-tabname = 'GT_OUTTAB'.
> it_sort-up = 'X'.
> * it_sort-subtot = 'X'.
> APPEND it_sort.
> *
> CLEAR it_sort.
> it_sort-spos = '4'.
> it_sort-fieldname = 'ERDAT'.
> it_sort-tabname = 'GT_OUTTAB'.
> it_sort-up = 'X'.
> * it_sort-subtot = 'X'.
> APPEND it_sort.
>
>
> CLEAR it_sort.
> it_sort-spos = '5'.
> it_sort-fieldname = 'WADAT_IST'.
> it_sort-tabname = 'GT_OUTTAB'.
> it_sort-down = 'X'.
> * it_sort-subtot = 'X'.
> APPEND it_sort.
>
> *
> * CLEAR it_sort.
> * it_sort-spos = '6'.
> * it_sort-fieldname = 'PERNR'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
> *
> * CLEAR it_sort.
> * it_sort-spos = '7'.
> * it_sort-fieldname = 'VORNA'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
> * CLEAR it_sort.
> * it_sort-spos = '8'.
> * it_sort-fieldname = 'NACHN'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
> * CLEAR it_sort.
> * it_sort-spos = '9'.
> * it_sort-fieldname = 'VKGRP'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
> * CLEAR it_sort.
> * it_sort-spos = '10'.
> * it_sort-fieldname = 'VBELN'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
> * CLEAR it_sort.
> * it_sort-spos = '11'.
> * it_sort-fieldname = 'ERDAT'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
> * CLEAR it_sort.
> * it_sort-spos = '12'.
> * it_sort-fieldname = 'BEZEI'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> ** it_sort-subtot = 'X'.
> * APPEND it_sort.
> *
>
> * clear it_sort.
> * it_sort-spos = '1'.
> * it_sort-fieldname = 'BELNR'.
> * it_sort-tabname = 'GT_OUTTAB'.
> * it_sort-up = 'X'.
> * append it_sort.
>
>
> ENDFORM.
>
> *----
> -
+EC1
> * Addition +EC1
> *----
> -
+EC1
> *&----
> -
> *& Form VARIANT_INIT
> *&----
> -
> * text
> *----
> -
> * --> p1 text
> * <-- p2 text
> *----
> -
> FORM variant_init.
> *
> CLEAR g_variant.
> g_variant-report = g_repid.
> ENDFORM. " VARIANT_INIT
>
>
>
> *----
> -
> * FORM f4_for_variant *
> *----
> -
> * ........ *
> *----
> -
> FORM f4_for_variant.
> *
> CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
> EXPORTING
> is_variant = g_variant
> i_save = g_save
> * it_default_fieldcat =
> IMPORTING
> e_exit = g_exit
> es_variant = gx_variant
> EXCEPTIONS
> not_found = 2.
> IF sy-subrc = 2.
> MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
> WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
> ELSE.
> IF g_exit = space.
> p_vari = gx_variant-variant.
> ENDIF.
> ENDIF.
> ENDFORM.
> *&----
> -
> *& Form PAI_OF_SELECTION_SCREEN
> *&----
> -
> * text
> *----
> -
> FORM pai_of_selection_screen.
> *
> IF NOT p_vari IS INITIAL.
> MOVE g_variant TO gx_variant.
> MOVE p_vari TO gx_variant-variant.
> CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
> EXPORTING
> i_save = g_save
> CHANGING
> cs_variant = gx_variant.
> g_variant = gx_variant.
> ELSE.
> PERFORM variant_init.
> ENDIF.
> ENDFORM. " PAI_OF_SELECTION_SCREEN
> *----
> -
+EC1
> * End Addition +EC1
> *----
> -
+EC1
>
>
> *----
> -
> * FORM e03_eventtab_build *
> *----
> -
> * ........ *
> *----
> -
> * --> E03_LT_EVENTS *
> *----
> -
> FORM e03_eventtab_build USING e03_lt_events TYPE
> slis_t_event.
> DATA: ls_event TYPE slis_alv_event.
>
> CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
> EXPORTING
> i_list_type = 0
> IMPORTING
> et_events = e03_lt_events.
> READ TABLE e03_lt_events WITH KEY name =
> slis_ev_top_of_page
> INTO ls_event.
> IF sy-subrc = 0.
> MOVE gc_formname_top_of_page TO ls_event-form.
> APPEND ls_event TO e03_lt_events.
> ENDIF.
> ENDFORM.
>
> *----
> -
> * FORM e04_comment_build *
> *----
> -
> * ........ *
> *----
> -
> * --> E04_LT_TOP_OF_PAGE *
> *----
> -
> FORM e04_comment_build USING e04_lt_top_of_page TYPE
> slis_t_listheader.
> DATA: ls_line TYPE slis_listheader.
>
> *Report Title
> CLEAR ls_line.
> ls_line-typ = 'H'.
> ls_line-info = text-007.
> APPEND ls_line TO e04_lt_top_of_page.
> *
> *
> **Doc Type Desc.
> * clear ls_line.
> * ls_line-typ = 'S'.
> * ls_line-key = text-008.
> ** ls_line-info = p_matnr.
> * append ls_line to e04_lt_top_of_page.
> *
> * clear ls_line.
> * ls_line-typ = 'S'.
> * ls_line-key = text-009.
> ** ls_line-info = p_werks.
> * append ls_line to e04_lt_top_of_page.
> *
> *
> * clear ls_line.
> * ls_line-typ = 'S'.
> * ls_line-key = text-010.
> ** ls_line-info = p_stlan.
> * append ls_line to e04_lt_top_of_page.
> *
> * clear ls_line.
> * ls_line-typ = 'S'.
> * ls_line-key = text-011.
> ** ls_line-info = p_stlal.
> * append ls_line to e04_lt_top_of_page.
> *
> * clear ls_line.
> * ls_line-typ = 'S'.
> * ls_line-key = text-012.
> ** ls_line-info = p_stlal.
> * append ls_line to e04_lt_top_of_page.
>
>
>
> ENDFORM.
>
> *----
> -
> * FORM top_of_page *
> *----
> -
> * ........ *
> *----
> -
> FORM top_of_page.
>
> CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
> EXPORTING
> it_list_commentary = gt_list_top_of_page.
>
>
> ENDFORM.
>
> *----
> -
> * FORM auth_check *
> *----
> -
> * ........ *
> *----
> -
> FORM auth_check.
>
> AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
> ID 'VKORG' FIELD p_vkorg.
> IF sy-subrc NE 0.
> MESSAGE e054 WITH p_vkorg.
> ENDIF.
>
>
> ENDFORM. " auth_check
>
>
> *&----
> -
> *& Form USER_COMMAND
> *&----
> -
> FORM user_command USING r_ucomm LIKE sy-ucomm
> rs_selfield TYPE slis_selfield.
>
> CASE r_ucomm.
> WHEN '&IC1'.
> PERFORM display_so_order USING r_ucomm
> rs_selfield.
>
> ENDCASE.
>
> ENDFORM.
>
> *&----
> -
> *& Form display_sales_order
> *&----
> -
> * text
> *----
> -
> * -->P_R_UCOMM text
> * -->P_RS_SELFIELD text
> *----
> -
> FORM display_so_order USING r_ucomm LIKE sy-ucomm
> rs_selfield TYPE slis_selfield.
>
> CASE rs_selfield-sel_tab_field.
> WHEN '1-VBELN'.
> SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
> CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
> WHEN '1-MATNR'.
> SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
> CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
> WHEN '1-OBD'.
> SET PARAMETER ID 'VL' FIELD rs_selfield-value.
> CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
> WHEN OTHERS.
> MESSAGE i000(z1) WITH 'Please Click on the Valid
> Selection'.
> EXIT.
> ENDCASE.
>
>
> ENDFORM. " display_sales_order
>
> *----
> -
> * FORM EDit_table *
> *----
> -
> * ........ *
> *----
> -
Message was edited by: Anurag Bankley -
Unable to capture field values in Master agreement Line Items
I am trying to get the field values from master agreement line items page. I have written the following code to get the line item details which is working fine to capture part number and quantity->
agreementBean = doc.getRootParentIBean();
lineItemCollection = agreementBean.getLineItems();
collectionsize = lineItemCollection.size();
for(i=0;i<collectionsize;i++){
collectionbean = lineItemCollection.get(i);
partNum = ""+collectionbean.getPartNumber() ;
Quantity = ""+collectionbean.getQuantity();
throw doc.createApplicationException(null,partNum + " , " + Quantity );
Now, my problem is that I am unable to capture the following field item values in the master agreement > line items page.
1. Price Unit
2. Unit Price
3. Product Category
4. Plant
Please help me to find the values.
Thankx in Advance.
Su
Edited by: subrataindra on Aug 10, 2010 11:11 AMThis will return the name of the plant.
.getExtensionField("PLANT").get().getDisplayName(session);
Check if this returns the product category
collectionbean.getExtensionField("ITEM_CAT").get().getDisplayName();
This will Return the Price
collectionbean.getExtensionField("PRICE").get().getPrice();
(return type :BigDecimal)
This will return the currency
collectionbean.getExtensionField("PRICE").get().getCurrency;
(Return type:String)
Similarly to retrieve other fields for which there are no standard functions, use .getExtensionField("Field ID")
Hope this helps
Regards,
Immanuel -
To split the payment document value as per the line items of the P O
To split the payment document value as per the line items of the purchase order in the period of payment, so that the payment amounts are measured against the Capex order assigned as account assignment in the purchase order.(Account assignment tab for the individual line item in the PO.
Example:
Inputs:
Purchase Order 3100012345, line item 10 value 6000 line item 20 value 4000
VAT @10% , account assignment for PO line item 10(Internal Order no 10001) & line item 20 Internal Order 10002) G/ R no 5105105101 for Rs10,000.
The I/R doc 501501501 appears as follows: (MIRO)
Line 10: Value Rs 6,000
20: Value Rs 4,000
VAT Rs 600
Rs 400
Total Rs11, 000
Withholding Tax Rs 1,100
The accounting entry for MIRO happens as follows: doc 2102102101
GR/IR Dr Rs 10,000
VAT Dr Rs 1.000
Vendor Cr Rs9, 900
TDS due Cr Rs1, 100
The business expects the payment report as follows:payment doc 2001200101
PO Line item Internal Order MIRO Invoice Payment Payment period Amount
A/c doc number doc number
3400012345 10 10001 5605605601 2102102101 2001200101 001/2009 5940
3400012345 20 10002 5605605601 2102102101 2001200101 001/2009 3960
Currently we are able to show the amounts as Rs 6000 for line item 10 & Rs 4000 for line item 20.
The problems faced.
1. The VAT line items are auto created, hence the reference of purchase order number and line item are not available. So the VAT portion which is part of payment liability does not get reflected against the PO.(not able to show the VAT portion , when we try to show the payment amount per PO line item.)
2. The withholding tax is also a problem; WHT is not calculated and assigned per line item. It is calculated on the total amount of basic and VAT. Because of these reasons, the payment could not be shown properly according to the line item of the purchase order.
3. When part payment is made, against invoices, there is no provision to assign a payment amount against a particular line item. Further, when final payment is made in different period, the clearing document will get generated. That adds to the complexity of differentiating full payments and part payments final clearing.
4. When residual payment is made, a new line item is created. Here assignment of Purchase order line item against payment for residual items become a problem.
5. Many a times advance payments are made. Later the invoice is created and balance payment is made. In those situations, the clearing document creates one more line item and makes payment for the balance item. This adds complexity in bringing balance payment alone and to split as per the purchase order line item. The clearing document number system is multi dimensional. It creates two line items for the same item (one at the time of advance and another the time of clearing.)
6. When full payment is made, the payment document number and clearing document numbers are same. In cases of subsequent or partial or residual payment, the document numbers are different. Because of this, the part payment amounts are shown in the period, where the final payment and clearing are made.
Please suggest a way to split the payment amount in the exact posting period with all the considerations given above.
Regards
Sundararajan
Edited by: Sundarajan Venkatachari on Sep 30, 2009 11:04 AMHi,
See Note 301077 - User exits for the interface to accounting, although I think that there isn't this kind of option. Note 429117 - Collective note advice note SD-FI interface will be useful too.
I think that SAP Note 1085921 - Document split perhaps will help you
Regards
Eduardo -
Selection of data from RSEG for various PO line items
Hi ,
We have a requirement to calculate the total goods receipt value and break up cost for transportation also. In purchase order there are various conditions (base price, transportation,surcharge). I am trying to get all the goods movement for a PO line item and total goods receipts. Similarly all the documents from RSEG(we are using split invoice) for that PO line item, so for each PO line item RSEG has entries as many as conditions (i am trying to get all the conditions for PO line item from KONV table) . If the total goods receipts and invoiced amounts are different, i need to calculate the expected value based on conditions on PO for the remaining quantity.
The problem is each condition in PO line item has one RSEG entry, but in the field KSCHL(condition type) does not have any value for base price, but it has for other conditions.
is there any specific reason for not updating that for base price.
Thanks in advanceHi,
The 'Free Items' indicator in the overview is only used to facilitate
the switching off of the Inv.Receipt flag and the GR-based IV flag.
Note that the 'Free Items' indicator is not stored on the PO item
table EKPO.
The Inv.Receipt flag (and the GR-based IV flag) are the fields that
really controls if an item is 'free' or not.
So, the field is initiated based on the values in those fields rather
than from input from the user.
When an invoice is expected it's not a free-item. This indicator
invoice receipt is chosen from the main-item and also from the
customization maintained for item category 0 in table T163.
I am afraid that I have to say that in standard SAP design
it is not possible to default the "Free item" flag.
Regards,
Edit -
Defaulting the Sotrage location for all the line items in my sales order
Hi,
I have a scenario to default the storage location automatically in my sales order for all the line items. It is not going to change for a particular sales org. Dist. channel & Division combination. Can you pls. suggest me a solution for this.
Thanks
Ghanesh.Hi,
You can default the storage location by using the below user exit
Storage location
Auto determination of storage location as u2018XXXXu2019 for sales order
Include - MV45AFZB
Form - USEREXIT_SOURCE_DETERMINATION
IF (VBAK-AUART = 'XXXX' and VBAK-VKORG = 'XXXX' and VBAK-VTWEG = 'XX').
VBAP-LGORT = 'ABCD'.
Regards,
Gopal.
Edited by: Gopalakrishnan S on Feb 25, 2010 7:35 AM -
Incorrect field KNA1-STCEG in output list for input tax Line items-RFUMSV00
Hi all,
I found the incorrect field in RFUMSV00 - Advance Return for Tax on Sales/Purchases. If you want to configure the output list for Input tax: Line items, there is the field VAT Registration No. which has to be LFA1-STCEG, but there is incorrect field KNA1-STCEG. After that I cannot find the values for this field in my output.
In the output list for Output tax: Line items there is correct field in configuration /LFA1-STCEG/.
I tried to find some SAP notes but without avail.
Thanks for help.
MiroslavHi,
Please check the following OSS note:-
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=736203
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=640269
It is picked up from bseg-stceg and not from lfa1-stceg or kna1-stceg
Regards,
Gaurav -
Using DMR for multiple GR line item
Hi,
I would like to ask for some clarification in using DMR.
For example is I have multiple line item for a GR with separate Inspection Lot Number. How will it be handled during DMR?
A scenario is for a example, I have 10 lot. First 9 lot skipped then 10th lot inspected, then if fail do normal inspection for the next 5 lot.
How will the system behave if GR is done at the same time for the 10 line item.
Thank you,
RaymondDear Raymond
Also there is another dimension to this. There are two type of timing fo Dynamic modification rule
1) Dynamic Modification at Lot Creation
For dynamic modification at lot creation, the quality level is updated when an inspection lot is created. The system assumes that the forthcoming inspection will lead to an acceptance of the inspection lot or characteristic.
An inspection lot, which is created immediately after the quality level is updated, uses the information in the updated quality level without a usage decision having been made.
If dynamic modification is carried out at lot creation and the inspection lot is subsequently rejected, the system updates the quality level again when the usage decision is made. The new inspection stage is used by the system to calculate the sample sizes for the next inspection lot.Changing the quality level does not affect inspection lots that were created in the meantime.
2) Dynamic Modification with the Usage Decision
For dynamic modification with the usage decision, the system updates the quality level when you make the usage decision. At this point, the system evaluates the conditions for an inspection stage change based on the dynamic modification rule and, depending on the results of the current inspection, it determines whether or not the inspection stage should occur.
Regards
Gajesh -
Table for tax code line item after miro
Can anybody tell table for tax code line item (other than BSET) after MIRO.
RajHi,
First let me explain you the logic in this repot.
If a document have more than one GL accounts relevant for tax and having the same tax code. So there is only one tax line for that tax code in BSET.
Now in the standard reports like S_ALR_87012357, output has the tax base amount etc, based on tax line from BSET which is a single line the above document. However this single line contains multiple tax relevant account and thus SAP can not show all the G/L account for this single line in the report S_ALR_87012357. So SAP picks up the first account in the output.
The declaration in this report is not wrong, as the total gets calculated based on the tax code and which is correct and meets the tax reporting requirement.
If you want to see the G/L account wise output, you can use the program RFUMSV10. Refer OSS note 1175418 "RFUMSV00: G/L account display" for details.
https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1175418
In your report, you can use this program logic for reference.
Regards,
Gaurav -
Function Module for FB01 Vendor line items postings in 3.1 Version
Hello all,
Is there any Function Module for FB01 Vendor line items postings in 3.1 Version. I do not want to go for BDC. Please suggest.
Thanks,
SubbaHi,
search for function module ACCPOSTING* or get development class of transaction FB01 and goto SE80, enter development class - and search in function group's function module.
Cheers.
...Reward if useful. -
How user can get a Sales Text for the any Line Item in the Billing?
Salute Masters ! !
How user can get a Sales Text for the any Line Item in the Billing?
It's coming for other Order (Line Item for Bought out Item at Project Site - Some Item they procure at project site & complete the task).
Where I can configure in system for all.
Rgds
Srivastav
09973504950Hi,
Sales text can be copied from customer to order , order to delivery and delivery to billing .
Check the T-code : VOTXN , do the customization as per your requirement.
check the below link :
http://help.sap.com/saphelp_erp60_sp/helpdata/en/dd/55f993545a11d1a7020000e829fd11/content.htm -
What is table name in SAP R/3 for PM order line item data
Hello,
I am extracting data for PM module and Interested in PM order line item data. Table AUFK is for PM order header master data.
Is there any other table for PM order line item master data?
Thanks,
IshakHi Ishak,
The item table is AUFP.
Thanks.
Maybe you are looking for
-
Hey, I'm connecting to the net using an Ethernet cable to my MacBook with the following network settings. IP Address: 192.168.y.{0-250} Subnet Mask: 255.255.255.0 Router: 192.168.y.x (where 'y' is the same number as in the IP address) DNS Server:
-
My late 2007 15" MBP seems to be having a hard drive on the edge of failure. Coincidence or not, it comes the day after the Apple Store replaced my logic board because of the NVidia card failure associated with the black scrren of death. No indicatio
-
'connect to itunes problem' HELP NEEDED
hi, My iPod touch screen is frozen on a picture of the iTunes icon above the USB connector. I am assuming this is telling me to connect it to my iTunes. this happened after i tried downloading the 4.0 software. when i connect my ipod, i get the messa
-
DB_HEAP access method with db_hotbackup utility
I open a Db handle with DB_HEAP access method and do nothing about it . When first created , the db file is 8kb , but after excuting db_hotbackup utility the db file is 4kb. if I do db_hotbackup under the failover environment , BDB give me an error m
-
Messages being quarantined but also remaining in queue after being released
This is on the new Office 365 Exchange Online Portal which we have been automatically transferred to. Two problems: 1. I have a rule to bypass spam filter for certain domains (our customers) yet they appear to still get quarantined (this rule used to