A set of values for a range having a lower and upper limit can be uploaded into a report variant all you need to do is seperate the values with the value '&&'.
Setup the value ranges in a spreadsheet and then cut paste the concatenated values column into a text file.
For example in Excel with formula " =CONCATENATE(A1,"&&",B1)"
Col1 Col2 Concatenate with '&&'
101 105 101&&105
110 115 110&&115
120 125 120&&125
130 135 130&&135
140 145 140&&145
150 155 150&&155
160 165 160&&165
170 175 170&&175
180 185 180&&185
190 195 190&&195
200 205 200&&205
Text file then will look like this
101&&105
110&&115
120&&125
130&&135
140&&145
150&&155
160&&165
170&&175
180&&185
190&&195
200&&205
Then when you are in the 'Select Ranges' tab for entering the Multiple Selection use 'Shift-F11' to read the text file values into SAP.
AKA : Systems, Applications Products is a widely used and constantly evolving Enterprise Systems Application that keeps an enormous number of people and computers occupied worldwide
Friday, July 22, 2011
Tuesday, August 31, 2010
Purchase Order Free Item Field
Screen Field RM06E-UMSON does not exist in a table but is derived or implied by the status of other fields for the line item. For example as found in Program SAPLMEPO and Form LESEN_BELEG:
* set the indicator for free shipment
IF pot-repos EQ space AND pot-pstyp NE pstyp-kons AND
pot-pstyp NE pstyp-umlg.
pot-umson = 'X'.
ENDIF.
This implies that if the REPOS field (Invoice Receipt) is Blank and the PSTYP field (Item Category) is not Consignment(Value 2) or Stock Transfer(Value 7) then this is a Free Shipment item.
* set the indicator for free shipment
IF pot-repos EQ space AND pot-pstyp NE pstyp-kons AND
pot-pstyp NE pstyp-umlg.
pot-umson = 'X'.
ENDIF.
This implies that if the REPOS field (Invoice Receipt) is Blank and the PSTYP field (Item Category) is not Consignment(Value 2) or Stock Transfer(Value 7) then this is a Free Shipment item.
Tuesday, October 14, 2008
Query Code to Retrieve Sales Order Pricing
The following code pieces are adaptions of SAP code and can be used to retrieve line item pricing conditions for SD documents. A straightforward ABAP select statement can be used as the pricing condition is in KONV. Use the field KNUMV (Condition number) from Sales Order Header (VBAK table) and the field POSNR (Position Number) from Sales Order Detail(VBAP table) to link to the KONV table. e.g.
select single * into konv from konv
where knumv = vbak-knumv
and kposn = vbap-posnr
and kschl = 'PB00'.
Alternatively for complex scenarios you can use function modules to retrieve the data into a table and read the required values.
First define the DATA code section as follows:
* internal tables -------------------------------------------------*
data: tkomk like standard table of komk
with key key_uc
initial size 2
with header line.
data: begin of tkomp occurs 10.
include structure komp.
data: end of tkomp.
data: begin of tkomg occurs 10.
include structure komg.
data: end of tkomg.
data: begin of lt_komk occurs 1.
include structure komk.
data: end of lt_komk.
* internal table order conditions ---------------------------------*
data: da_xkomv like komv occurs 0 with header line.
data: da_xkonh like konh occurs 0 with header line.
data: da_xkonp like konp occurs 0 with header line.
data: da_xkonm like konm occurs 0 with header line.
data: da_xkonw like konw occurs 0 with header line.
data: da_xkomp like komp occurs 0 with header line.
data: ls_xkomp like komp.
* internal structure to read order conditions ---------------------*
data: da_comm_head_i like komk.
data: da_knumv_empty like order_view-header.
Next define your field for the specific pricing condition value, PB00 in this case and then apply the following code for the data retrieval,
* Do not refresh da_xkomv as Function Module 'PRICING_GET_CONDITIONS' will not re-read * * DB for previously read condition key field KNUMV
* See Comments in Program LV61AA11 and Form KONV_EINLESEN
refresh: da_xkomp, da_xkonh, da_xkonp,
da_xkonm, da_xkonw.
clear: da_xkomv,da_xkomp, da_xkonh, da_xkonp,
da_xkonm, da_xkonw.
da_comm_head_i-mandt = sy-mandt.
da_comm_head_i-kalsm = vbak-kalsm.
da_comm_head_i-kappl = 'V'.
da_comm_head_i-waerk = vbak-waerk.
da_comm_head_i-knumv = vbak-knumv.
da_comm_head_i-vbtyp = vbak-vbtyp.
if lt_komk-belnr ne vbak-vbeln.
call function 'SD_SALES_PRICING_INFORMATION'
EXPORTING
i_posnr = '00000'
i_read_doc = 'X'
i_vbeln = vbak-vbeln
IMPORTING
e_komk = tkomk
TABLES
ftkomk = lt_komk.
delete lt_komk where belnr ne vbak-vbeln.
endif.
da_comm_head_i-hwaer = tkomk-hwaer.
call function 'SD_SALES_PRICING_INFORMATION'
EXPORTING
i_posnr = vbap-posnr
i_vbeln = vbak-vbeln
IMPORTING
e_komp = tkomp
TABLES
ftkomk = lt_komk.
ls_xkomp = tkomp.
append ls_xkomp to da_xkomp.
call function 'PRICING_GET_CONDITIONS'
EXPORTING
comm_head_i = da_comm_head_i
TABLES
tkomv = da_xkomv
skomk = lt_komk
skomp = da_xkomp
skonh = da_xkonh
skonp = da_xkonp
skonm = da_xkonm
skonw = da_xkonw
EXCEPTIONS
error_message = 1
others = 2.
* Read da_xkomv for specific pricing condition e.g. PB00
read table da_xkomv with key
knumv = da_comm_head_i-knumv
kposn = vbap-posnr
kschl = 'PB00'.
if sy-subrc = 0.
move da_xkomv-kbetr to kbetr.
endif.
* retrieve other conditions the same way
select single * into konv from konv
where knumv = vbak-knumv
and kposn = vbap-posnr
and kschl = 'PB00'.
Alternatively for complex scenarios you can use function modules to retrieve the data into a table and read the required values.
First define the DATA code section as follows:
* internal tables -------------------------------------------------*
data: tkomk like standard table of komk
with key key_uc
initial size 2
with header line.
data: begin of tkomp occurs 10.
include structure komp.
data: end of tkomp.
data: begin of tkomg occurs 10.
include structure komg.
data: end of tkomg.
data: begin of lt_komk occurs 1.
include structure komk.
data: end of lt_komk.
* internal table order conditions ---------------------------------*
data: da_xkomv like komv occurs 0 with header line.
data: da_xkonh like konh occurs 0 with header line.
data: da_xkonp like konp occurs 0 with header line.
data: da_xkonm like konm occurs 0 with header line.
data: da_xkonw like konw occurs 0 with header line.
data: da_xkomp like komp occurs 0 with header line.
data: ls_xkomp like komp.
* internal structure to read order conditions ---------------------*
data: da_comm_head_i like komk.
data: da_knumv_empty like order_view-header.
Next define your field for the specific pricing condition value, PB00 in this case and then apply the following code for the data retrieval,
* Do not refresh da_xkomv as Function Module 'PRICING_GET_CONDITIONS' will not re-read * * DB for previously read condition key field KNUMV
* See Comments in Program LV61AA11 and Form KONV_EINLESEN
refresh: da_xkomp, da_xkonh, da_xkonp,
da_xkonm, da_xkonw.
clear: da_xkomv,da_xkomp, da_xkonh, da_xkonp,
da_xkonm, da_xkonw.
da_comm_head_i-mandt = sy-mandt.
da_comm_head_i-kalsm = vbak-kalsm.
da_comm_head_i-kappl = 'V'.
da_comm_head_i-waerk = vbak-waerk.
da_comm_head_i-knumv = vbak-knumv.
da_comm_head_i-vbtyp = vbak-vbtyp.
if lt_komk-belnr ne vbak-vbeln.
call function 'SD_SALES_PRICING_INFORMATION'
EXPORTING
i_posnr = '00000'
i_read_doc = 'X'
i_vbeln = vbak-vbeln
IMPORTING
e_komk = tkomk
TABLES
ftkomk = lt_komk.
delete lt_komk where belnr ne vbak-vbeln.
endif.
da_comm_head_i-hwaer = tkomk-hwaer.
call function 'SD_SALES_PRICING_INFORMATION'
EXPORTING
i_posnr = vbap-posnr
i_vbeln = vbak-vbeln
IMPORTING
e_komp = tkomp
TABLES
ftkomk = lt_komk.
ls_xkomp = tkomp.
append ls_xkomp to da_xkomp.
call function 'PRICING_GET_CONDITIONS'
EXPORTING
comm_head_i = da_comm_head_i
TABLES
tkomv = da_xkomv
skomk = lt_komk
skomp = da_xkomp
skonh = da_xkonh
skonp = da_xkonp
skonm = da_xkonm
skonw = da_xkonw
EXCEPTIONS
error_message = 1
others = 2.
* Read da_xkomv for specific pricing condition e.g. PB00
read table da_xkomv with key
knumv = da_comm_head_i-knumv
kposn = vbap-posnr
kschl = 'PB00'.
if sy-subrc = 0.
move da_xkomv-kbetr to kbetr.
endif.
* retrieve other conditions the same way
Monday, October 13, 2008
How to add extra address fields to Query
If you to want add some of the extra customer address fields such as, Street 2 and Street 3, to a query you will find that they are not part of the standard table KNA1 but are located in the address table that is linked to via the address number field KNA1-ADRNR.
To fetch the values you can make use of the standard function module ADDR_GET_COMPLETE and follow the process set out below to enhance you infoset.
First add the type pool definition used by the function module to the DATA code section plus the data definitions used for the retrieval part.
* Declare transfer structure
* Include type szadr.
type-pools: szadr.
* Data definitions
data: addr1_complete type szadr_addr1_complete.
data: wa_addr1_lin type szadr_addr1_line.
Next define an additional field for the data element.
Then define the source code to retrieve the values for the data element.
* Specify parameters
*break-point.
clear: cust_addr_street2, cust_addr_street3, cust_addr_street3.
*addrnumber = kna1-adrnr.
call function 'ADDR_GET_COMPLETE'
exporting addrnumber = kna1-adrnr
importing addr1_complete = addr1_complete
exceptions parameter_error = 1
address_not_exist = 2
internal_error = 3.
* You can access and process the data read by LOOPing over the tables
* in ADDR1_COMPLETE.
* The subtable ADDR1_TAB has the type structure SZADR_ADDR1_LINE,
* so you must access the fields with ADDR1_COMPLETE-DATA-.
loop at addr1_complete-addr1_tab into wa_addr1_lin.
move wa_addr1_lin-data-str_suppl1 to cust_addr_street2.
move wa_addr1_lin-data-str_suppl2 to cust_addr_street3.
move wa_addr1_lin-data-str_suppl3 to cust_addr_street4.
endloop.
Finally Save and Generate the infoset after assigning the new data element to a report group. The field will then be available for use in the Query definition.
To fetch the values you can make use of the standard function module ADDR_GET_COMPLETE and follow the process set out below to enhance you infoset.
First add the type pool definition used by the function module to the DATA code section plus the data definitions used for the retrieval part.
* Declare transfer structure
* Include type szadr.
type-pools: szadr.
* Data definitions
data: addr1_complete type szadr_addr1_complete.
data: wa_addr1_lin type szadr_addr1_line.
Next define an additional field for the data element.
Then define the source code to retrieve the values for the data element.
* Specify parameters
*break-point.
clear: cust_addr_street2, cust_addr_street3, cust_addr_street3.
*addrnumber = kna1-adrnr.
call function 'ADDR_GET_COMPLETE'
exporting addrnumber = kna1-adrnr
importing addr1_complete = addr1_complete
exceptions parameter_error = 1
address_not_exist = 2
internal_error = 3.
* You can access and process the data read by LOOPing over the tables
* in ADDR1_COMPLETE.
* The subtable ADDR1_TAB has the type structure SZADR_ADDR1_LINE,
* so you must access the fields with ADDR1_COMPLETE-DATA-
loop at addr1_complete-addr1_tab into wa_addr1_lin.
move wa_addr1_lin-data-str_suppl1 to cust_addr_street2.
move wa_addr1_lin-data-str_suppl2 to cust_addr_street3.
move wa_addr1_lin-data-str_suppl3 to cust_addr_street4.
endloop.
Finally Save and Generate the infoset after assigning the new data element to a report group. The field will then be available for use in the Query definition.
Tuesday, August 29, 2006
Thursday, July 21, 2005
Using STVARV to Maintain TVARV Variables for SAP
SAP has a transaction STVARV to maintain your own selection variables for report variants.
This means you can have named variables for your saved variants so if a set of common parameters or selection options change you do not have to change a bunch of variants you just maintain the named variable in table TVARV.
Where do you apply selection variables in variants?
Whenever you create a variant you see screen with a matrix of check boxes in rows next to your Selection screen field names, if you check the box in the 'L' column that corresponds to the field you want to default and the click the 'Selection variables' button you get a screen where you can apply the TVARV defined values.
This means you can have named variables for your saved variants so if a set of common parameters or selection options change you do not have to change a bunch of variants you just maintain the named variable in table TVARV.
Where do you apply selection variables in variants?
Whenever you create a variant you see screen with a matrix of check boxes in rows next to your Selection screen field names, if you check the box in the 'L' column that corresponds to the field you want to default and the click the 'Selection variables' button you get a screen where you can apply the TVARV defined values.
Monday, January 10, 2005
Saturday, January 08, 2005
Resetting the SAP Posting Period
Ever had the situation where the SAP transaction MMPV has been run and set with the wrong period?
The other situation is where you use the setting for posting to previous period or negative quantities and you forget to set the radio buttons for these options.
Fortunately SAP provides a simple program to correct this but executing it requires a slightly cryptic procedure. The program is called RMMMINIT and it resets the period but it requires the user set a PID (parameter id) with the current date in the format YYYYMMDD. The PID is MMPI_READ_NOTE and if you where running the RMMMINIT program on October 19 th 2005 the value for the PID would be 20051019.
The SAP notes related to this little endeavour are 487381 and 369637.
The other situation is where you use the setting for posting to previous period or negative quantities and you forget to set the radio buttons for these options.
Fortunately SAP provides a simple program to correct this but executing it requires a slightly cryptic procedure. The program is called RMMMINIT and it resets the period but it requires the user set a PID (parameter id) with the current date in the format YYYYMMDD. The PID is MMPI_READ_NOTE and if you where running the RMMMINIT program on October 19 th 2005 the value for the PID would be 20051019.
The SAP notes related to this little endeavour are 487381 and 369637.
Subscribe to:
Posts (Atom)