MM/DD/YYYY to DD/MM/YYYY in selection screen
hi experts,
i have problem with date format.in my sap system date format is mm/dd/yyyy.
when the user selects particular date in selection screen it was displaying the format mm/dd/yyyy.
but the user wants dd/mm/yyyy format.
please give me some idea.
Sorry as i have gone through so many postings .
But i didnt find any answer for this .
Moderators please excuse, because the problem is not resolved tillnow.
Hi Vinay,
Always remember one thing.
Date, Time, Currency and Quantity fields are always stored in data base without field
seperator/decimal and thousand seperator. So what ever way u give in selection screen internal format will remain same.
Date: YYYYMMDD
Time: HHMMSS
eg: Just declare a date field as select option. Enter some value and go to debug mode.
What u r seeing in this select option low/high value?
It will be in YYYYMMDD format correct?
But what it is displaying in screen is as per user setting.
Here is the solution for ur problem.
Ask the user to change his/her user setting to DD/MM/YYYY format.
I think this setting is not available. But they can try with DD.MM.YYYY.
U can try this with tcode SU3. User settings will be effective from next login.
eg: If u change ur setting now, it is valid from next logon. Try this urself and convey to the user about the same.
Hope it helps.
Thanks,
Vinod.
Similar Messages
-
How to use MM/YYYY Format in the selection Screen?
There is this program RMCB0300 where the date format in the selection screen has MM/YYYY Format.
I am working on a report which requires it "Period" Field in the selection screen to be in the same format.
However, i am trying to give the select option as " SL_SPMON FOR S031-SPMON MODIF ID PER." and declaring S031 table in the declaration part.
But still, its not been able to provide me F4 help in the inpur screen.
Can someone please provide me some guidance in this regard?Hi,
the following works for me..
*& Report ZPMONAT *
report zpmonat .
tables: s031.
selection-screen begin of block abc.
select-options: sl_spmon for s031-spmon.
selection-screen end of block abc.
at selection-screen on value-request for sl_spmon-low.
perform monat_f4.
at selection-screen on value-request for sl_spmon-high.
perform monat_f4.
start-of-selection.
end-of-selection.
*& Form monat_f4
* text
* --> p1 text
* <-- p2 text
form monat_f4 .
data: begin of mf_dynpfields occurs 1.
include structure dynpread.
data: end of mf_dynpfields.
data: mf_returncode like sy-subrc,
mf_monat like isellist-month,
mf_hlp_repid like sy-repid.
field-symbols: <mf_feld>.
* Wert von Dynpro lesen
get cursor field mf_dynpfields-fieldname.
append mf_dynpfields.
mf_hlp_repid = sy-repid.
do 2 times.
call function 'DYNP_VALUES_READ'
exporting
dyname = mf_hlp_repid
dynumb = sy-dynnr
tables
dynpfields = mf_dynpfields
exceptions
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
if sy-subrc = 3.
* Aktuelles Dynpro ist Wertemengenbild
mf_hlp_repid = 'SAPLALDB'.
else.
read table mf_dynpfields index 1.
* Unterstriche durch Blanks ersetzen
translate mf_dynpfields-fieldvalue using '_ '.
exit.
endif.
enddo.
if sy-subrc = 0.
* Konvertierung ins interne Format
call function 'CONVERSION_EXIT_PERI_INPUT'
exporting
input = mf_dynpfields-fieldvalue
importing
output = mf_monat
exceptions
error_message = 1.
if mf_monat is initial.
* Monat ist initial => Vorschlagswert aus akt. Datum ableiten
mf_monat = sy-datlo(6).
endif.
call function 'POPUP_TO_SELECT_MONTH'
exporting
actual_month = mf_monat
importing
selected_month = mf_monat
return_code = mf_returncode
exceptions
factory_calendar_not_found = 01
holiday_calendar_not_found = 02
month_not_found = 03.
if sy-subrc = 0 and mf_returncode = 0.
* ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
* <MF_FELD> = MF_MONAT.
call function 'CONVERSION_EXIT_PERI_OUTPUT'
exporting
input = mf_monat
importing
output = mf_dynpfields-fieldvalue.
collect mf_dynpfields.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = mf_hlp_repid
dynumb = sy-dynnr
tables
dynpfields = mf_dynpfields
exceptions
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07. "<<== note 148804
endif.
endif.
endform. " monat_f4
Regards,
Suresh Datti -
Date format needs to be in selection screen mm/dd/yyyy but in alv output ..
hi
i need help on displaying date in alv output
date format needs to be in selection screen mm/dd/yyyy but in alv output ..it should be displayed as yyyymmdd
regards
Nishanthi,
you are passing the value to ALv using an internal table.
so store the format YYYYMMDD date in the internal table and pass it to ALV.
use the below FM
DD/MM/YYYY -> YYYYMMDD
<b>CONVERSION_EXIT_PDATE_INPUT</b>
rgds
Anver -
Change mm/dd/yyyy to dd/mm/yyyy when selecting date via dateSelector??
Hi Experts,
i have attribute of date type that has been binded to input field in a web dynpro Java application. when application is executed user can select a date via DateSelector that appears automatically.
Problem is after the date has been selected input field is populated in mm/dd/yyyy format ( ex 03/28/2008). My client wants that to be changed . It must read 28/03/2008 (dd/mm/yyyy).
I tried creating simple type using base type Date and setting representation dd/MM/yyyy however that does NOT work!!
Edited by: Eureka on Mar 28, 2008 5:30 PMHi,
Simple type with representation dd/MM/yyyy works for me.
Here is what I have done.
Create a simple type
Name :testDateFormat
package : com.test
Dictionary : Local Dictionary
Built-In-Type : Date
In the Representation Tab :
Format : dd/MM/yyyy
In the WD view created a context of type : com.test.testDateFormat and assinged the context to the inputfield
Now I see date format dd/MM/yyyy, make sure the u specify the correct format.
regards,
AE -
Hello All,
I have created a F4 help for one field.
In my program i have used this field for parameters statement.
Here is the problem:
when i run the program i can see the value when i press F4 but when i do some actions and if i come back the same screen F4 is not working.
Can any one tell me what is the problem with F4.
Regards,
LisaHello Navneeth,
I have declared like this
SELECTION-SCREEN BEGIN OF SCREEN 100.
PARAMETERS: P_ZZZZ TYPE XXXX-YYYY.
SELECTION-SCREEN END OF SCREEN 100.
In the table XXXX i have a field YYYY and i have included search help for this in DDIC.
Regards,
Lisa -
Valiadtion of date in dd.mm.yyyy format
i have a selection screen in which i want user to enter date in dd.mm.yyyy format only.how can i validate that.any FM.
i also want that date to be changed in yyyymmdd format coz i have to update that in a field which has yyyymmdd format.
so is there any fm for this also ( to change dd.mm.yyyy to yyyymmdd).
any pointers will help.Hi Govind,
Based on the user defaults in the transaction SU01 the date will be verified based on the date format selected in the user details.
Declare the selection screen variable as of type Sy-DATUM.
what ever format you had entered the date in the selection screen the variable will hold the value in the format yyyymmdd.
no need to do any format for the date.
hope this might help you.
regards,
Phani. -
Data element for mm.yyyy
Hello Experts,
Is there any data element for a field with the format mm.yyyy .
I need to place this field in the selection screen and i want to have an F4 help too.
It will be better if i am provided with the database table name too.
Please help. Useful answer will be rewarded.
Regards,
VijayalakshmiHi ,
Data element for a field with the format mm.yyyy is FTI_MONTH_YEAR.
You can use this in selection screen as:
selection-screen begin of block b1 with frame.
parameters:p_date TYPE fti_month_year.
selection-screen end of block b1.
Regards,
Shanmugapriya
**Reward if u find helpful -
Function module to get any date format in DD.MM.YYYY
Hi Experts,
i want a FM which can convert any type of date format user entered on selection screen in DD.MM.YYYY
date format entered by user can be any of below format
DD/MM/YYYY
MM/DD/YYYYY
DD/MMM/YYYY
MM.DD.YYYY
YYYY/MM/DD
i want date format in DD.MM.YYYY
Also is there any FM which can tell us that day of today date is 25th or not .Read forum rules of engagement before posting.
Basic date posts are not permitted. -
Hi all,
I am working with a Oracle 9i R2 database
SQL>select TO_CHAR(sysdate, 'MM/DD/YYYY') CHRDATE from dual;
CHRDATE
11/14/2005
SQL>select TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') mydate from dual;
MYDATE
14-NOV-05
I want to retain the 4 digit year. Please suggest what I am doing incorrect.
ThanksYour select statement,SQL>select TO_DATE(TO_CHAR(sysdate,...is equivalent toselect sysdate...And whenever you select a date, SQL Plus has to convert it to a character format before it can display it on the SQL Plus output screen.
The four-digit year IS being retained internally ...until you display it on the screen. If you just set the default date format for displaying dates to include the four-digit year, you will see the full year:
SQL> select SYSDATE mydate from dual;
MYDATE
14-NOV-05
SQL> alter session set nls_date_format = 'MM/DD/YYYY';
SQL> select SYSDATE mydate from dual;
MYDATE
11/14/2005
SQL> select TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') mydate from dual;
MYDATE
11/14/2005 -
How to change the date format YYYYMMDD to MM/DD/YYYY
Hi ,
How to change the date format YYYYMMDD to MM/DD/YYYY .
Ex : 20071008 to 10/08/2007
Is there any function module for this ??
Regards
RahulHi Sharma,
check the code:
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-031.
PARAMETERS: date1 RADIOBUTTON GROUP rad1 DEFAULT 'X', "SAP date format YYYYDDMM
date2 RADIOBUTTON GROUP rad1, "Date format like aprial31, 2006
date3 RADIOBUTTON GROUP rad1, "Date format like 31 apr,2006
date4 RADIOBUTTON GROUP rad1, "Date format like DD/MM/YYYY
date5 RADIOBUTTON GROUP rad1. "Date format like DD.MM.YYYY
SELECTION-SCREEN END OF BLOCK b2
FORM getmonth .
SELECT mnr
ktx
ltx
INTO TABLE T_month
FROM t247
WHERE spras = 'EN'.
IF sy-subrc NE '0'.
MESSAGE I "Message - Not able to get month values from the table T247
ENDIF.
ENDFORM.
DATA : temp_date(16) TYPE c,
temp1_date(60) TYPE c,
year(4) TYPE c,
daymonth(11) TYPE c,
daymonth1(11) TYPE c,
month(9) TYPE c,
day(2) TYPE c,
mon LIKE t247-ktx,
len TYPE i .
MOVE date TO temp1_date .
CONDENSE temp1_date NO-GAPS.
MOVE temp1_date TO temp_date .
IF date2 EQ 'X'. "The date format is like Aprial 31, 2007
CONDENSE temp_date NO-GAPS.
SPLIT date AT ',' INTO daymonth year.
IF STRLEN( year ) NE '4'.
error = 'X'.
WRITE : 'Invalid date format.'.
ELSE.
daymonth1 = daymonth.
CONDENSE daymonth1 NO-GAPS.
_len = STRLEN( _daymonth1 ).
l_len = 13 - len.
SHIFT daymonth1 RIGHT BY len PLACES.
CONDENSE daymonth1 NO-GAPS.
month = daymonth1.
CONDENSE month NO-GAPS.
SORT t_month BY monthltx.
READ TABLE t_month WITH KEY monthltx = month.
IF sy-subrc <> 0.
error = 'X'.
WRITE : 'Invalid date format.' .
ELSE.
len = STRLEN( month ).
CONDENSE daymonth NO-GAPS.
SHIFT daymonth LEFT BY len PLACES.
day = daymonth.
CONDENSE day NO-GAPS.
CONCATENATE year t_month-monthnumber day INTO o_date.
ENDIF.
ENDIF.
ELSEIF p_date3 EQ 'X'. "The date format is like 31 apr, 2007
CONDENSE temp_date NO-GAPS.
SPLIT i_date AT ',' INTO daymonth year.
IF STRLEN( year ) NE '4'.
error = 'X'.
WRITE : 'Invalid date format.'.
ELSE.
daymonth1 = daymonth.
CONDENSE daymonth1 NO-GAPS.
SHIFT daymonth1 LEFT BY 2 PLACES.
CONDENSE daymonth1 NO-GAPS.
month = daymonth1.
CONDENSE month NO-GAPS.
TRANSLATE month TO UPPER CASE.
SORT t_month BY monthstx.
MOVE month to mon.
READ TABLE t_month WITH KEY monthstx = mon.
IF sy-subrc <> 0.
error = 'X'.
WRITE : 'Invalid date format.' .
ELSE.
CONDENSE daymonth NO-GAPS.
day = daymonth+0(2).
CONDENSE day NO-GAPS.
CONCATENATE year t_month-monthnumber day INTO o_date.
ENDIF.
ENDIF.
ELSEIF p_date4 EQ 'X' OR p_date5 EQ 'X'. "Date format is like DD.MM.YYYY or DD/MM/YYYY
CONDENSE temp_date NO-GAPS.
IF STRLEN( temp_date ) EQ 10.
o_date0(4) = temp_date6(4).
o_date4(2) = temp_date3(2).
o_date6(2) = temp_date0(2).
ELSE.
error = 'X'.
WRITE : 'Invalid date format.' .
ENDIF.
ENDIF.
IF STRLEN( o_date ) NE '8'.
error = 'X'.
WRITE : 'Invalid date format.'.
ENDIf.
ENDFORM. " f0100_conv_date
Reward if helpful.
Regards,
Harini.S -
How to change date format in select-option (mm.yyyy).
Hi,
Plz, How to change date format in select-option (mm.yyyy).
in my selection screen date type selection-option is there ,when i am enter date it's taken dd.mm.yyyy format,but i want mm.yyyy format.
how to set that .
Regards,
Kk.sorry
parameters : pmonyr type spmon or
select-options : sspmon for PGPL-spmon .
or what table ccontains spmon.
regards
shiba dutta -
Select -option Date field in MM/YYYY format!
Hi.. Friends..
Iam having DATE field as selection screen SELECT_OPTION parameter.
And I am fetching records from one of my tables with where condition of this select-option.
Now my reuirement is to modify that DATE select-option with 7 characters i.e. MM/YYYY
So if user enters 09/2008 as DATE-LOW.. I have to fetch all records of September 2008.
If user enters 09/2008(lower limit) and 02/2009(Upper limit)...
I have to fetch records between... September 1st 2008 to 28th february 2009.
What is the simplest way to impliment this?
Thanks,
Naveen.IHi
Use data element SPMON as in below code.
TABLES: S001.
DATA: l_year(4) TYPE n,
l_month(3) TYPE n,
g_sdate TYPE sy-datum,
g_edate TYPE sy-datum.
RANGES: gr_pdate FOR sy-datum.
CONSTANTS: lc_low TYPE sy-datum VALUE '00010101',
lc_high TYPE sy-datum VALUE '99990101'.
SELECT-OPTIONS: s_spmon FOR s001-spmon.
l_year = s_spmon-low(4).
l_month = s_spmon-low+4(2).
* Get the first day of PERIOD-LOW
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
i_periv = 'K2'
i_poper = l_month
IMPORTING
e_date = g_sdate
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
l_year = s_spmon-high(4).
l_month = s_spmon-high+4(2).
* Get the last day of PERIOD-HIGH
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
i_periv = 'K2'
i_poper = l_month
IMPORTING
e_date = g_edate
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
IF NOT s_spmon-low IS INITIAL.
gr_pdate-low = g_sdate.
ELSE.
gr_pdate-low = lc_low.
ENDIF.
IF NOT s_spmon-high IS INITIAL.
gr_pdate-high = g_edate.
ELSE.
gr_pdate-high = lc_high.
ENDIF.
IF NOT s_spmon-low IS INITIAL OR NOT s_spmon-high IS INITIAL.
gr_pdate-option = 'BT'.
gr_pdate-sign = 'I'.
APPEND gr_pdate.
ENDIF.
" SELECT RECORDS
" >>> SELECT field1 field2 FROM TAB1 WHERE erdat IN gr_pdate. <<< -
Why has 1582/10 (yyyy/mm) only 21 days?
SQL> edit
Escrito file afiedt.buf
1 with
2 yyyy as (select to_char(rownum-4713,'s0009') yyyy from dual connect by rownum <= 9999+4713)
3 ,mm as (select to_char(rownum,'09') mm from dual connect by rownum <= 12)
4 select last_day(to_date(yyyy||mm,'syyyymm'))-to_date(yyyy||mm,'syyyymm')+1 as days
5 ,to_char(min(to_date(yyyy||mm,'syyyymm')),'syyyy/mm') as min_yyyymm
6 ,to_char(max(to_date(yyyy||mm,'syyyymm')),'syyyy/mm') as max_yyyymm
7 from yyyy,mm
8 where yyyy.yyyy != 0
9 group by last_day(to_date(yyyy||mm,'syyyymm'))-to_date(yyyy||mm,'syyyymm')+1
10* order by days
SQL> /
DAYS MIN_YYYY MAX_YYYY
21 1582/10 1582/10
28 -4712/02 9999/02
29 -4708/02 9996/02
30 -4712/04 9999/11
31 -4712/01 9999/12If Oracle supports old calendar of each countriesnope. there is only one gregorian calendar. some countries just took a while to get around to using it. it'd be like asking if they support the julian calendar, which they don't (don't confuse the julian calendar with "julian days").
and the only way you'd have a problem now is if you were storing historical dates, and something happened in britian on Oct 10th, 1582. Because while britian recognized that date, pope gregory did not, and oracle will convert it to Oct 15.
side note, it made things somewhat confusing for people born in those times. most of America's founding fathers were alive when Britian switched to Gregorian, so all of a sudden, ages, contract durations, and prison sentences had to be adjusted. -
Custom purchase requsitionto vendor open and cleared payment report
dear all i develop report but i cant ableto show in that open amount and cleared amount of vender in that report so please see this report and feedback me for logic to show open and clear amount of vendor purchase orderwise or vendorwise
report zpo_purchase_history no standard page heading message-id 00.
TABLES : bsik, bsak, lfa1, lfb1, skb1, t001, bapifvdexp_vzzbepp.
type-pools:slis,ICON.
types :begin of ty_po,
banfn type eban-banfn,
"Purchase Requisition Number
bnfpo type eban-bnfpo,
"Item Number of Purchase Requisition
ekgrp type eban-ekgrp, "Purchasing Group
badat type eban-badat,
"Requisition (Request) Date
menge type eban-menge,
KNTTP TYPE EBAN-KNTTP,
PSTYP type eban-PSTYP,
"Purchase Requisition Quantity
meins type eban-meins,
"Purchase Requisition Unit of Measure
lifnr type ekko-lifnr, "Vendor Account Number
bedat type ekko-bedat, "Purchasing Document Date
ebeln type ekpo-ebeln,
"Purchasing Document Number
ebelp type ekpo-ebelp,
"Item Number of Purchasing Document
matkl type ekpo-matkl, "Material Group
mtart type ekpo-mtart, "Material Type
matnr type ekpo-matnr, "Material Number
txz01 type ekpo-txz01, "Short Text
menge1 type ekpo-menge, "Purchase Order Quantity
meins1 type ekpo-meins,
"Purchase Order Unit of Measure
balqty type ekpo-menge, "Balance Quantity
netpr type ekpo-netpr,
"Net Price in Purchasing Document
peinh type ekpo-peinh, "Price Unit
mblnr type mseg-mblnr,
"Number of Material Document
zeile type mseg-zeile, "Item in Material Document
menge2 type mseg-menge, "GR Quantity
meins2 type mseg-meins, "GR Unit of Measure
werks type mseg-werks, "Plant
charg type mseg-charg, "Batch
belnr type rbkp-belnr,
"Document Number of an Invoice Document
bldat type ekbe-bldat, "Document Date in Document
belnr_b type rbkp-belnr,
SHKZG type ekbe-SHKZG , "Debit/Credit Indicator
DMBTR type bsik-dmbtr, "Amount in Local Currency
DMBTR_C type bsAk-dmbtr, "Amount in Local Currency
thick(10) type c, "Thickness
width(10) type c, "Width
length(10) type c, "Length
grade(10) type c, "Grade
BELNR_d type bseg-belnr,
xblnr type bkpf-xblnr,
awkey type bkpf-awkey,
RMWWR type rbkp-RMWWR,
WMWST1 type rbkp-WMWST1,
end of ty_po.
types :begin of ty_ekko,
ebeln type ekko-ebeln,
lifnr type ekko-lifnr,
bedat type ekko-bedat,
end of ty_ekko.
types:begin of ty_ekpo,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
matnr type ekpo-matnr,
txz01 type ekpo-txz01,
menge type ekpo-menge,
meins type ekpo-meins,
netpr type ekpo-netpr,
peinh type ekpo-peinh,
banfn type ekpo-banfn,
bnfpo type ekpo-bnfpo,
mtart type ekpo-mtart,
end of ty_ekpo.
types :begin of ty_eban,
banfn type eban-banfn,
bnfpo type eban-bnfpo,
matnr type eban-matnr,
menge type eban-menge,
meins type eban-meins,
end of ty_eban.
types : begin of ty_ekbe,
ebeln type ekbe-ebeln,
ebelp type ekbe-ebelp,
belnr type ekbe-belnr,
bldat type ekbe-bldat,
gjahr type ekbe-gjahr,
buzei type ekbe-buzei,
matnr type ekbe-matnr,
DMBTR type ekbe-dmbtr,
shkzg type ekbe-shkzg,
end of ty_ekbe.
types : begin of ty_mseg,
mblnr type mseg-mblnr,
mjahr type mseg-mjahr,
zeile type mseg-zeile,
menge type mseg-menge,
meins type mseg-meins,
ebeln type mseg-ebeln,
ebelp type mseg-ebelp,
matnr type mseg-matnr,
werks type mseg-werks,
charg type mseg-charg,
end of ty_mseg.
types : begin of ty_rbkp,
belnr type rbkp-belnr,
gjahr type rbkp-gjahr,
bldat type rbkp-bldat,
lifnr type rbkp-lifnr,
ZUONR type rbkp-ZUONR,
RMWWR type rbkp-RMWWR,
WMWST1 type rbkp-WMWST1,
end of ty_rbkp.
types : begin of ty_bseg,
bukrs type bseg-bukrs,
belnr type bseg-belnr,
gjahr type bseg-gjahr,
buzei type bseg-buzei,
valut type bseg-valut,
wrbtr type bseg-wrbtr ,
augbl type bseg-augbl,
matnr type bseg-matnr,
lifnr type bseg-lifnr,
ebeln type bseg-ebeln,
end of ty_bseg.
types : begin of ty_rseg,
belnr type rseg-belnr,
gjahr type rseg-gjahr,
ebeln type rseg-ebeln,
ebelp type rseg-ebelp,
matnr type rseg-matnr,
bukrs type rseg-bukrs,
end of ty_rseg.
types : begin of ty_bsik,
belnr type bsik-belnr,
buzei type bsik-buzei,
DMBTR type bsik-DMBTR,
budat type bsik-budat,
shkzg type bsik-shkzg,
ebeln type bsik-ebeln,
lifnr type bsik-lifnr,
end of ty_bsik.
types : begin of ty_bsak,
belnr type bsak-belnr,
lifnr type bsak-lifnr,
ebeln type bsak-ebeln,
DMBTR_C type bsak-DMBTR,
ZUONR type bsak-ZUONR,
end of ty_bsak.
types: begin of ty_bkpf,
BELNR type bkpf-belnr,
xblnr type bkpf-xblnr,
awkey type bkpf-awkey,
end of ty_bkpf.
data: it_po type standard table of ty_po,
it_ekko type standard table of ty_ekko,
it_ekpo type standard table of ty_ekpo,
it_eban type standard table of ty_eban,
it_ekbe type standard table of ty_ekbe,
it_mseg type standard table of ty_mseg,
it_rbkp type standard table of ty_rbkp,
it_rseg type standard table of ty_rseg,
it_bseg type standard table of ty_bseg,
it_bsik type STANDARD TABLE OF ty_bsik with header line,
it_bsak type STANDARD TABLE OF ty_bsak,
it_bkpf type standard table of ty_bkpf,
wa_po type ty_po,
wa_ekko type ty_ekko,
wa_ekpo type ty_ekpo,
wa_eban type ty_eban,
wa_mseg type ty_mseg,
wa_rbkp type ty_rbkp,
wa_rseg type ty_rseg,
wa_bseg type ty_bseg,
wa_ekbe type ty_ekbe,
wa_bsik type ty_bsik,
wa_bsak type ty_bsak,
wa_bkpf type ty_bkpf.
data: it_fcat type slis_t_fieldcat_alv,
it_lshead type slis_t_listheader,
it_sort type slis_t_sortinfo_alv,
wa_fcat type slis_fieldcat_alv,
wa_lshead type slis_listheader,
wa_layout type slis_layout_alv,
wa_sort type slis_sortinfo_alv.
data :it_cl_data like table of clobjdat,
wa_cl_data like clobjdat.
data: values(10) type n.
data: value1(4) type N.
data: c_matkl type ekpo-matkl,
c_matnr type ekpo-matnr,
c_ekgrp type eban-ekgrp,
c_badat type eban-badat,
c_index type sy-tabix,
c_grmenge type mseg-erfmg,
c_low(10) type c,
c_high(10) type c,
c_date type string,
c_bukrs type ekko-bukrs,
c_WERKS type eban-WERKS.
data: gd_date(10).
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
*********Selection screen variables*********
selection-screen:begin of block b1 with frame title text-001.
select-options: s_bukrs for c_bukrs DEFAULT 'bmp1',
s_WERKS for c_WERKS,
s_matnr for c_matnr DEFAULT 'rm-01',
s_matkl for c_matkl ,
s_badat for c_badat ,"obligatory,
s_ekgrp for c_ekgrp.
parameters: ch_bal as checkbox.
selection-screen:end of block b1.
*initialization.
* PERFORM EVENT_CALL.
* PERFORM POPULATE_EVENT.
start-of-selection.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
perform getdata.
perform setdata.
perform fieldcat.
perform display.
*& Form GETDATA
form getdata .
select a~BANFN
a~bnfpo
a~ekgrp
a~badat
a~KNTTP
a~PSTYP
b~ebeln
b~ebelp
b~matkl
b~matnr
b~bukrs
into corresponding fields of table it_po
from eban as a inner join ekpo as b
on a~banfn = b~banfn and
a~bnfpo = b~bnfpo AND
A~KNTTP = B~KNTTP and
a~PSTYP = b~PSTYP
where a~badat in s_badat and
a~ekgrp in s_ekgrp and
a~WERKS in s_WERKS and
b~matnr in s_matnr and
b~matkl in s_matkl and
b~bukrs in s_bukrs and
b~loekz <> 'L' and
a~loekz <> 'X'.
if it_po[] is not initial.
select ebeln
ebelp
matnr
txz01
menge
meins
netpr
peinh
banfn
bnfpo
mtart
from ekpo into table it_ekpo
for all entries in it_po
where ebeln = it_po-ebeln and
ebelp = it_po-ebelp and
loekz <> 'L'.
select banfn
bnfpo
matnr
menge
meins
from eban into table it_eban
for all entries in it_po
where banfn = it_po-banfn and
bnfpo = it_po-bnfpo and
loekz <> 'X'.
if it_ekpo[] is not initial.
select ebeln
lifnr
bedat
from ekko into table it_ekko
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln.
select ebeln
ebelp
belnr
bldat
gjahr
buzei
matnr
DMBTR
shkzg
from ekbe into table it_ekbe
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and
ebelp = it_ekpo-ebelp .
*if it_ekbe-shkzg = 'H'.
**ekbe-dmbtr = ekbe-dmbtr * -1.
**ekbe-menge = ekbe-menge * -1.
*endif.
* select belnr
* gjahr
* ebeln
* ebelp
* from bseg into table it_bseg
* for all entries in it_ekpo
* where ebeln = it_ekpo-ebeln and
* ebelp = it_ekpo-ebelp.
select belnr
gjahr
ebeln
ebelp
matnr
bukrs
from rseg into table it_rseg
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and
ebelp = it_ekpo-ebelp.
endif.
if it_ekbe[] is not initial.
select mblnr
mjahr
zeile
menge
meins
ebeln
ebelp
matnr
werks
charg
from mseg into table it_mseg
for all entries in it_ekbe
where mblnr = it_ekbe-belnr and
mjahr = it_ekbe-gjahr and
zeile = it_ekbe-buzei and
bwart = '101'.
endif.
if it_rseg[] is not initial.
select belnr
gjahr
bldat
lifnr
ZUONR
RMWWR
WMWST1
from rbkp into table it_rbkp
for all entries in it_rseg
where belnr = it_rseg-belnr.
endif.
*if it_rseg[] is not initial.
* SELECT bukrs
* belnr
* gjahr
* buzei
* valut
* wrbtr
* augbl
* matnr
* lifnr
* ebeln
* INTO TABLE it_bseg
* FROM bseg
* FOR ALL ENTRIES IN it_rseg
* WHERE bukrs = it_rseg-bukrs and ebeln = it_rseg-ebeln and mwskz = ''.
*endif.
*loop at it_BKPF into wa_BKPF.
* values = wa_rbkp-belnr.
* value1 = wa_rbkp-gjahr.
data: aekey_1 type string .
*CONCATENATE values value1 into aekey_1.
* if it_BSEG[] is not initial.
*MESSAGE aekey_1 type 'I'.
SELECT single belnr xblnr awkey into wa_bkpf
from bkpf
where awkey = aekey_1.
SELECT SINGLe belnr
buzei
dmbtr
budat
shkzg
ebeln
lifnr
FROM bsik
INTO CORRESPONDING FIELDS OF wa_bsik
*FOR ALL ENTRIES IN it_bseg
WHERE
bukrs in s_bukrs and
lifnr = wa_rbkp-lifnr
and
*AND gjahr = it_bseg-gjahr
* AND
belnr = wa_bkpf-belnr.
insert wa_bsik into table it_bsik.
CLEAR wa_bsik.
CLEAR it_bsik.
*endloop.
* and ebeln = it_bseg-ebeln .
* select BELNR
** SHKZG
** DMBTR
* from bkpf into table it_bkpf
* for ALL ENTRIES IN it_rbkp
* where belnr = it_rbkp-belnr.
* ENDif.
IF IT_bseg[] IS NOT INITIAL.
select belnr
LIFNR
ebeln
DMBTR
ZUONR
from bsik into table it_bsik
for all entries in it_bseg
where belnr = it_bseg-belnr.
select belnr
LIFNR
ebeln
DMBTR
ZUONR
from bsak into table it_bsak
for all entries in it_bseg
where belnr = it_bseg-belnr.
ENDIF.
else.
message s002.
leave list-processing.
endif.
endform. " GETDATA
*& Form SETDATA
form setdata .
clear wa_po.
loop at it_po into wa_po.
c_index = sy-tabix.
********Calculate PR Quantity**********
clear wa_eban.
read table it_eban into wa_eban
with key banfn = wa_po-banfn
bnfpo = wa_po-bnfpo.
if sy-subrc eq 0.
move:wa_eban-menge to wa_po-menge,
wa_eban-meins to wa_po-meins.
endif.
********Calculate PO Quantity**********
clear wa_ekpo.
read table it_ekpo into wa_ekpo
with key banfn = wa_po-banfn
bnfpo = wa_po-bnfpo .
if sy-subrc eq 0.
move:wa_ekpo-txz01 to wa_po-txz01,
wa_ekpo-netpr to wa_po-netpr,
wa_ekpo-peinh to wa_po-peinh,
wa_ekpo-mtart to wa_po-mtart,
wa_ekpo-menge to wa_po-menge1,
wa_ekpo-meins to wa_po-meins1.
endif.
********Calculate Balance Quantity******
clear wa_mseg.
loop at it_mseg into wa_mseg
where ebeln = wa_po-ebeln and
ebelp = wa_po-ebelp.
c_grmenge = c_grmenge + wa_mseg-menge.
endloop.
move:wa_mseg-mblnr to wa_po-mblnr,
c_grmenge to wa_po-menge2,
wa_mseg-meins to wa_po-meins2,
wa_mseg-werks to wa_po-werks,
wa_mseg-charg to wa_po-charg.
wa_po-balqty = wa_eban-menge - c_grmenge.
clear : wa_rseg,wa_rbkp.
read table it_rseg into wa_rseg with key
ebeln = wa_mseg-ebeln
ebelp = wa_mseg-ebelp.
read table it_rbkp into wa_rbkp
with key belnr = wa_rseg-belnr
gjahr = wa_rseg-gjahr.
if sy-subrc eq 0.
move : wa_rbkp-belnr to wa_po-belnr,
wa_rbkp-bldat to wa_po-bldat,
wa_rbkp-RMWWR to wa_po-RMWWR,
WA_RBKP-WMWST1 TO WA_PO-WMWST1.
endif.
read table it_bseg into wa_bseg with key
ebeln = wa_rseg-ebeln
bukrs = wa_rseg-bukrs.
if sy-subrc eq 0.
move wa_bseg-belnr to wa_po-belnr_d.
endif.
* read table it_bkpf into wa_bkpf
* with key belnr = wa_ekbe-belnr.
* read table it_bseg into wa_bseg
* with key belnr = wa_bkpf-belnr.
CLEAR wa_bsik.
clear it_bsik.
read table it_bsik into wa_bsik
with key belnr = wa_bkpf-belnr.
* if wa_bsik-shkzg = 'H'.
* wa_bsik-DMBTR = wa_bsik-DMBTR * 1.
* endif.
if sy-subrc eq 0.
move : wa_bsik-belnr to wa_po-belnr,
wa_bsik-DMBTR to wa_po-DMBTR.
endif.
* clear wa_bsik.
* read table it_bsik into wa_bsik
* with key belnr = wa_bseg-belnr.
* if sy-subrc eq 0.
* move : wa_bsik-DMBTR to wa_po-DMBTR.
* endif.
*clear wa_bsak.
* read table it_bsak into wa_bsak
* with key belnr = wa_bseg-belnr.
* if sy-subrc eq 0.
* move : wa_bsak-DMBTR_C to wa_po-DMBTR_C.
* endif.
*clear : wa_rbkp.
*loop at it_bsik into wa_bsik.
*read table it_bsik into wa_bsik with key belnr = wa_rbkp-belnr.
*if sy-subrc eq 0.
* move : wa_bsik-DMBTR to wa_po-DMBTR.
* endif.
*endloop.
*********Assign Vendor,PO Date*********
clear wa_ekko.
read table it_ekko into wa_ekko
with key ebeln = wa_po-ebeln.
if sy-subrc eq 0.
move:wa_ekko-lifnr to wa_po-lifnr,
wa_ekko-bedat to wa_po-bedat.
endif.
*clear wa_ekko.
*read table it_ekko into wa_ekko
*with key lifnr = wa_po-lifnr.
*if sy-subrc eq 0.
* move: wa_bsik-DMBTR to wa_po-DMBTR.
* endif.
* call function 'ZSD_BATCH_CLASSIFICATION_DATA'
* exporting
** ch_charg = wa_po-charg
* ch_matnr = wa_po-matnr
* ch_werks = wa_po-werks
* tables
* cl_data = it_cl_data
** I_SEL_CHARACTERISTIC =
loop at it_cl_data into wa_cl_data.
if wa_cl_data-ausp1 ne '?'.
if wa_cl_data-atnam eq 'THICKNESS'.
move wa_cl_data-ausp1 to wa_po-thick.
elseif wa_cl_data-atnam eq 'LENGTH'.
move wa_cl_data-ausp1 to wa_po-length.
elseif wa_cl_data-atnam eq 'WIDTH'.
move wa_cl_data-ausp1 to wa_po-width.
elseif wa_cl_data-atnam eq 'GRADE'.
move wa_cl_data-ausp1 to wa_po-grade.
endif.
endif.
endloop.
modify it_po from wa_po index c_index.
clear :c_grmenge,wa_po,wa_ekpo,wa_mseg,c_index.
endloop.
endform. " SETDATA
*& Form FIELDCAT
* text
* --> p1 text
* <-- p2 text
form fieldcat .
perform buildfields using '1' 'BANFN' 'IT_PO' 'PR Number' '' ''.
* perform buildfields using '2' 'BNFPO' 'IT_PO' 'PR Item Number' '' ''.
perform buildfields using '2' 'KNTTP' 'IT_PO' 'A/c Assignment Cat' '' ''.
perform buildfields using '2' 'PSTYP' 'IT_PO' 'Item Cat' '' ''.
perform buildfields using '3' 'EKGRP' 'IT_PO' 'Purchase Group' '' ''.
perform buildfields using '4' 'BADAT' 'IT_PO' 'Request Date' '' ''.
perform buildfields using '5' 'MENGE' 'IT_PO' 'PR Quantity' 'X' ''.
perform buildfields using '6' 'MEINS' 'IT_PO' 'PR Unit' '' ''.
perform buildfields using '7' 'LIFNR' 'IT_PO' 'Vendor Number' '' ''.
perform buildfields using '8' 'EBELN' 'IT_PO' 'Purchasing Doc No' '' '' .
perform buildfields using '9' 'BEDAT' 'IT_PO' 'PO Date' '' ''.
perform buildfields using '10' 'MTART' 'IT_PO' 'Material Type' '' ''.
perform buildfields using '11' 'MATKL' 'IT_PO' 'Material Group' '' ''.
perform buildfields using '12' 'MATNR' 'IT_PO' 'Material Number' '' ''.
perform buildfields using '13' 'TXZ01' 'IT_PO' 'Material Desc' '' ''.
perform buildfields using '18' 'MENGE1' 'IT_PO' 'PO Quantity' 'X' ''.
perform buildfields using '19' 'MEINS' 'IT_PO' 'PO Unit' '' ''.
perform buildfields using '20' 'NETPR' 'IT_PO' 'Net Price' '' ''.
perform buildfields using '21' 'PEINH' 'IT_PO' 'Price Unit' '' ''.
perform buildfields using '22' 'MBLNR' 'IT_PO' 'GR Number' '' ''.
perform buildfields using '23' 'MENGE2' 'IT_PO' 'GR Quantity' 'X' ''.
perform buildfields using '24' 'MEINS2' 'IT_PO' 'GR Unit' '' ''.
perform buildfields using '25' 'BELNR' 'IT_PO' 'Invoice doc. number' '' ''.
perform buildfields using '26' 'BLDAT' 'IT_PO' 'Invoice Date' '' ''.
* perform buildfields using '26' 'BELNR_D' 'IT_POP' 'A/C Doc. No.' '' ''.
* perform buildfields using '26' 'AUGBL' 'IT_PO' 'Clearing Doc No.' '' ''.
perform buildfields using '26' 'DMBTR' 'IT_PO' 'OPEN AMOUNT' '' ''.
perform buildfields using '26' 'DMBTR' 'IT_PO' 'clear AMOUNT' '' ''.
* perform buildfields using '26' 'DMBTR_C' 'IT_PO' 'Clear balance' '' ''.
if ch_bal = 'X'.
perform buildfields using '27' 'BALQTY' 'IT_PO' 'Balance Quantity'
'X' ''.
endif.
perform buildfields using '26' 'WMWST1' 'IT_PO' 'TOTAL TAX ADDED' 'X' ''.
perform buildfields using '26' 'RMWWR' 'IT_PO' 'TOTAL AMOUNT IN INVOICE' 'X' ''.
endform. " FIELDCAT
*& Form BUILDFIELDS
* text
* -->P_0449 text
* -->P_0450 text
* -->P_0451 text
* -->P_0452 text
form buildfields using value(p_col_pos) like sy-cucol
value(p_fldname) type slis_fieldname
value(p_tabname) type slis_tabname
value(p_reptext) like dd03p-reptext
value(p_do_sum) type char1
value(hotspot) type char1.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fldname.
wa_fcat-tabname = p_tabname.
wa_fcat-reptext_ddic = p_reptext.
wa_fcat-do_sum = p_do_sum.
wa_fcat-hotspot = hotspot.
append wa_fcat to it_fcat.
clear wa_fcat.
endform. " BUILDFIELDS
*& Form DISPLAY
form display .
clear wa_layout.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
* wa_layout-box_fieldname = 'SEL'.
* wa_layout-edit = 'X'.
perform build_sort using 'BANFN' '1' 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND '
i_callback_top_of_page = 'TOP_OF_PAGE'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
i_background_id = 'ALV_BACKGROUND'
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'A'
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_po[]
exceptions
program_error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " DISPLAY
*& Form top_of_page
* text
form top_of_page. "#EC *
**********Create report header*********
refresh it_lshead.
clear wa_lshead.
**********To display date in header*********
* write: s_badat-low to c_low dd/mm/yyyy,s_badat-high to c_high
* dd/mm/yyyy.
* if s_badat-high is initial.
* concatenate 'Dated on' c_low into c_date separated by space.
* else.
* concatenate 'Dated between' c_low 'and' c_high into c_date separated
* by space.
* endif.
wa_lshead-typ = 'H'.
wa_lshead-info = 'PR To Payment History'.
* 'Pending Indents History -We had a requirement to retrieve "aging of receiveables" by customer. Basically, it goes thru each record and depending on the due date places the amounts in the following buckets (example). 0-30 day Overdue, 31-60 days Overdue, 61-90 days overdue, 30+ days overdue, 60+ days overdue) etc all the way to 6+ years overdue.
There are also cooresponding buckets for coming due analysis. For example, what is: 0-30 days coming due, 31-60 days coming due, 30+ days coming due, etc...
To do this, first I needed to be able be able to produce an open items statement at any given time in the past. Now, this seems impossible because of how the items go from open to cleared all the time. And an item that was open one month ago, may not be open anymore.
What I did was first remove any selections on item status. Then compare the posting date with teh key date in the past, if the posting date is less than or equal to the key date, keep the record.
Then compare the clearing date with the key date. First, keep all that are #. (This keeps all records still open from that posting date/key date)
Then, add another check for all items that were cleared after the key date (GT Key Date). This gives you the open items on that date.
Hope that makes sense. Let me know if you want clarification.
/smw -
Hi Experts,
In this following shown report Data base performance is consuming , can you please help me in this issue where can i increase my performance. Please help me urgent.
Report need performance
Program Name : ZSD_QUOTE *
Functional Analyst : TOBY *
Programmer : Vijay Joseph *
Start date : 03/14/2007 (MM/DD/YYYY) *
Initial CTS : DEVK913353 *
Description : This program will generate the Quote detls *
Includes : None *
Function Modules : None *
Logical database : None *
Transaction Code : ZQUOTE *
External references : None *
Modification Log *
Date | Modified by | CTS number | Comments *
03/14/2007|Vijay Joseph | DEVK913353 |Initial Development *
REPORT ZSD_QUOTE
line-size 252
line-count 40(0)
no standard page heading . .
*Tables
TABLES : VBAK,
EQUI,
EKKO.
*TYPES
TYPES : BEGIN OF T_VBAP,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
BNDDT LIKE VBAK-BNDDT,
NETWR LIKE VBAK-NETWR,
VKBUR LIKE VBAK-VKBUR,
BSTNK LIKE VBAK-BSTNK,
KUNNR LIKE VBAK-KUNNR,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
PSTYV LIKE VBAP-PSTYV,
KWMENG LIKE VBAP-KWMENG,
VGBEL LIKE VBAP-VGBEL,
VGPOS LIKE VBAP-VGPOS,
WERKS LIKE VBAP-WERKS,
END OF T_VBAP.
*Types for the likp and lips
TYPES : BEGIN OF T_LIPS,
VBELN LIKE LIKP-VBELN,
LFDAT LIKE LIKP-LFDAT,
POSNR LIKE LIPS-POSNR,
PSTYV LIKE LIPS-PSTYV,
MATNR LIKE LIPS-MATNR,
WERKS LIKE LIPS-WERKS,
VGBEL LIKE LIPS-VGBEL,
VGPOS LIKE LIPS-VGPOS,
END OF T_LIPS.
*Types for the EQUI
TYPES : BEGIN OF T_EQUI,
EQUNR LIKE EQUI-EQUNR,
SERNR LIKE EQUI-SERNR,
KDAUF LIKE EQBS-KDAUF,
KDPOS LIKE EQBS-KDPOS,
END OF T_EQUI.
*Types for the KNA1
TYPES : BEGIN OF T_KNA1,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
END OF T_KNA1.
*Types for the MAKT
TYPES : BEGIN OF T_MAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
SPRAS LIKE MAKT-SPRAS,
END OF T_MAKT.
*types for VBFA
TYPES : BEGIN OF T_VBFA,
VBELV LIKE VBFA-VBELV,
POSNV LIKE VBFA-POSNV,
VBELN LIKE VBFA-VBELN,
POSNN LIKE VBFA-POSNN,
VBTYP_N LIKE VBFA-VBTYP_N,
END OF T_VBFA.
*types for the output
TYPES : BEGIN OF T_OUTPUT,
VBELV LIKE VBFA-VBELV,
ERDAT LIKE VBAK-ERDAT,
BNDDT LIKE VBAK-BNDDT,
NETWR(15) type C, " LIKE VBAK-NETWR,
VBELN LIKE VBAK-VBELN,
BSTNK LIKE VBAK-BSTNK,
KUNNR LIKE VBAK-KUNNR,
KWMENG(15) TYPE C, " LIKE VBAP-KWMENG,
NAME1 LIKE KNA1-NAME1,
VKBUR LIKE VBAK-VKBUR,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
LFDAT LIKE LIKP-LFDAT,
SERNR LIKE EQUI-SERNR,
END OF T_OUTPUT.
*Types for the VBUP
TYPES : BEGIN OF T_VBUP,
vbeln LIKE VBUP-VBELN,
posnr LIKE VBUP-POSNR,
lfsta LIKE VBUP-LFSTA,
END OF T_VBUP.
*Internal Table
DATA : GIT_VBAP TYPE STANDARD TABLE OF T_VBAP,
GIT_LIPS TYPE STANDARD TABLE OF T_LIPS,
GIT_EQUI TYPE STANDARD TABLE OF T_EQUI,
GIT_KNA1 TYPE STANDARD TABLE OF T_KNA1,
GIT_MAKT TYPE STANDARD TABLE OF T_MAKT,
GIT_OUTPUT TYPE STANDARD TABLE OF T_OUTPUT,
GIT_VBUP TYPE STANDARD TABLE OF T_VBUP,
GIT_VBFA TYPE STANDARD TABLE OF T_VBFA.
*work Area
DATA : GWA_VBAP TYPE T_VBAP,
GWA_LIPS TYPE T_LIPS,
GWA_EQUI TYPE T_EQUI,
GWA_KNA1 TYPE T_KNA1,
GWA_MAKT TYPE T_MAKT,
GWA_OUTPUT TYPE T_OUTPUT,
GWA_VBUP TYPE T_VBUP,
GWA_VBFA TYPE T_VBFA.
*selection screen.
SELECTION-SCREEN : BEGIN OF BLOCK ZBLOCK WITH FRAME TITLE TEXT-015.
Select-options : S_VBELN FOR VBAK-VBELN,
S_ERDAT FOR VBAK-ERDAT, " OBLIGATORY,
S_EBELN FOR EKKO-EBELN MATCHCODE OBJECT MEKK,
S_SERNR FOR EQUI-SERNR MATCHCODE OBJECT EQSN.
PARAMETERS : P_WERKS LIKE VBAP-WERKS OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK ZBLOCK.
**************top of page*********************************************
TOP-OF-PAGE.
PERFORM SAPSD_TOP_OF_PAGE.
**************At selection screen*************************************
at selection-screen.
*for validating the Sales Order
PERFORM SAPSD_SCREEN_VALIDATION_VBELN.
*for validating the plant
PERFORM SAPSD_SCREEN_VALIDATION_WERKS.
*for the validating the PO number
PERFORM SAPSD_SCREEN_VALIDATION_PO.
*for the validating the serial number
PERFORM SAPSD_SCREEN_VALIDATION_SERIAL.
***************strart of selection************************************
START-OF-SELECTION.
*Get the data
PERFORM SAPSD_FETCH_DATA.
*For the final output table
PERFORM SAPSD_OUTPUT.
*& Form SAPSD_FETCH_DATA
text
--> p1 text
<-- p2 text
FORM SAPSD_FETCH_DATA .
*FETCH FROM THE VBAK AND VBAP.
SELECT VBAK~VBELN
VBAK~ERDAT
VBAK~BNDDT
VBAK~NETWR
VBAK~VKBUR
VBAK~BSTNK
VBAK~KUNNR
VBAP~POSNR
VBAP~MATNR
VBAP~PSTYV
VBAP~KWMENG
VBAP~VGBEL
VBAP~VGPOS
VBAP~WERKS
FROM VBAK INNER JOIN VBAP
ON VBAKVBELN EQ VBAPVBELN
INTO TABLE GIT_VBAP
WHERE VBAK~VBELN IN S_VBELN
AND VBAK~ERDAT IN S_ERDAT
AND VBAK~BSTNK IN S_EBELN
AND VBAP~PSTYV EQ 'IRRA'
AND VBAP~WERKS EQ P_WERKS.
IF SY-SUBRC EQ 0.
SORT GIT_VBAP BY VBELN.
else.
message e022(z1).
ENDIF.
*from vbfa
select VBELV
POSNV
VBELN
POSNN
VBTYP_N
into table git_vbfa
from vbfa
for all entries in git_vbap
where vbelv eq git_vbap-vbeln
and posnv eq git_vbap-posnr.
*FETCH DATA FROM THE LIKP AND LIPS
IF NOT GIT_VBAP IS INITIAL.
SELECT LIKP~VBELN
LIKP~LFDAT
LIPS~POSNR
LIPS~PSTYV
LIPS~MATNR
LIPS~WERKS
LIPS~VGBEL
LIPS~VGPOS
FROM LIKP INNER JOIN LIPS
ON LIKPVBELN EQ LIPSVBELN
INTO TABLE GIT_LIPS
FOR ALL ENTRIES IN GIT_VBFA
WHERE LIPS~VBELN EQ GIT_VBFA-VBELN
and LIPS~POSNR EQ GIT_VBFA-POSNN.
AND LIPS~WERKS EQ GIT_VBAP-WERKS.
AND LIPS~MATNR EQ GIT_VBAP-MATNR.
AND LIPS~POSNR EQ GIT_VBAP-POSNR.
AND LIPS~PSTYV EQ 'IRRA'.
AND LIPS~VGPOS EQ GIT_VBAP-POSNR.
IF SY-SUBRC EQ 0.
SORT GIT_LIPS BY VBELN.
ENDIF.
ENDIF.
*for getting the delivery status(dont take the delivered document number
*take only 'open'.
if not git_lips is initial.
select VBELN
posnr
lfsta
from vbup
into table git_vbup
for all entries in git_lips
where vbeln eq git_lips-vbeln
and posnr eq git_lips-posnr.
and ( lfsta EQ 'A' ) OR
( lfsta EQ 'B' ) .
if sy-subrc eq 0.
sort git_vbup by vbeln.
endif.
endif.
*To get the equipment number
IF NOT GIT_VBAP IS INITIAL.
SELECT EQUI~EQUNR
EQUI~SERNR
EQBS~KDAUF
EQBS~KDPOS
FROM EQUI INNER JOIN EQBS
ON EQUIEQUNR EQ EQBSEQUNR
INTO TABLE GIT_EQUI
FOR ALL ENTRIES IN GIT_VBAP
WHERE EQUI~SERNR IN S_SERNR
AND EQBS~KDAUF EQ GIT_VBAP-VBELN.
IF SY-SUBRC EQ 0.
SORT GIT_EQUI BY EQUNR.
ENDIF.
ENDIF.
*To get the customer name
IF NOT GIT_VBAP IS INITIAL.
SELECT KUNNR
NAME1
INTO TABLE GIT_KNA1
FROM KNA1
FOR ALL ENTRIES IN GIT_VBAP
WHERE KUNNR EQ GIT_VBAP-KUNNR.
IF SY-SUBRC EQ 0.
SORT GIT_KNA1 BY KUNNR.
ENDIF.
ENDIF.
*to get the material number
if not git_vbap is initial.
SELECT MATNR
MAKTX
SPRAS
INTO TABLE GIT_MAKT
FROM MAKT
FOR ALL ENTRIES IN GIT_VBAP
WHERE MATNR EQ GIT_VBAP-MATNR
AND SPRAS EQ SY-LANGU.
IF SY-SUBRC EQ 0.
SORT GIT_MAKT BY MATNR.
ENDIF.
endif.
ENDFORM. " SAPSD_FETCH_DATA
*& Form SAPSD_OUTPUT
text
--> p1 text
<-- p2 text
FORM SAPSD_OUTPUT .
data : l_vbelv like vbfa-vbelv.
LOOP AT GIT_VBAP INTO GWA_VBAP.
*for getting the delivey date
clear : gwa_lips.
read table git_vbfa into gwa_vbfa with key vbelv = gwa_vbap-vbeln
posnv = gwa_vbap-posnr.
if sy-subrc eq 0.
read table git_lips into gwa_lips
with key VBELN = GWA_vbfa-Vbeln
POSNR = GWA_vbfa-posnn
PSTYV = 'IRRA'.
IF SY-SUBRC EQ 0.
GWA_OUTPUT-LFDAT = GWA_LIPS-LFDAT.
READ TABLE GIT_VBUP INTO GWA_VBUP
WITH KEY VBELN = GWA_LIPS-VBELN
POSNR = GWA_LIPS-POSNR.
IF SY-SUBRC EQ 0.
IF GWA_VBUP-LFSTA EQ 'A' OR GWA_VBUP-LFSTA EQ 'B'.
clear : l_vbelv.
select single vbelv
into l_vbelv
from vbfa
where VBELN EQ gwa_vbap-vbeln.
*Quote Number
if sy-subrc eq 0.
GWA_OUTPUT-VBELV = L_VBELV.
endif.
*Move the details to the final table
GWA_OUTPUT-VBELN = GWA_VBAP-VBELN.
GWA_OUTPUT-ERDAT = GWA_VBAP-ERDAT.
GWA_OUTPUT-BNDDT = GWA_VBAP-BNDDT.
GWA_OUTPUT-NETWR = GWA_VBAP-NETWR.
GWA_OUTPUT-KUNNR = GWA_VBAP-KUNNR.
GWA_OUTPUT-KWMENG = GWA_VBAP-KWMENG.
GWA_OUTPUT-BSTNK = GWA_VBAP-BSTNK.
for getting the name from kna1
CLEAR : GWA_KNA1.
READ TABLE GIT_KNA1 INTO GWA_KNA1
WITH KEY KUNNR = GWA_VBAP-KUNNR.
IF SY-SUBRC EQ 0.
GWA_OUTPUT-NAME1 = GWA_KNA1-NAME1.
ENDIF.
GWA_OUTPUT-VKBUR = GWA_VBAP-VKBUR.
*for getting mateial number and description
CLEAR : GWA_MAKT.
READ TABLE GIT_MAKT INTO GWA_MAKT
WITH KEY MATNR = GWA_VBAP-MATNR
SPRAS = SY-LANGU.
IF SY-SUBRC EQ 0.
GWA_OUTPUT-MATNR = GWA_MAKT-MATNR.
GWA_OUTPUT-MAKTX = GWA_MAKT-MAKTX.
ENDIF.
for getting the serial number
clear : gwa_equi.
read table git_equi into gwa_equi
with key kdauf = gwa_vbap-vbeln
kdpos = gwa_vbap-posnr.
IF SY-SUBRC EQ 0.
GWA_OUTPUT-SERNR = gwa_equi-sernr.
ENDIF.
append gwa_output to git_output.
ENDIF.
ENDIF.
ENDIF.
CLEAR : GWA_VBAP,
GWA_OUTPUT.
ENDLOOP.
*free and refres the internal table
clear : git_vbap,
git_lips,
git_makt,
git_equi.
refresh : git_vbap,
git_lips,
git_makt,
git_equi.
free: git_vbap,
git_lips,
git_makt,
git_equi.
loop at git_output into gwa_output.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF INVERSE OFF.
WRITE : /1 sy-vline,
2 gwa_output-VBELV, "qte no
13 sy-vline,
14 gwa_output-ERDAT, "cr date
25 sy-vline,
26 gwa_output-BNDDT, "exp date
36 sy-vline,
37 gwa_output-NETWR, "qte value
53 sy-vline,
54 gwa_output-VBELN, "so
65 SY-VLINE,
66 gwa_output-BSTNK, "po
87 SY-VLINE,
88 gwa_output-KUNNR, "customer
99 SY-VLINE,
100 gwa_output-NAME1, "Name
136 sy-vline,
137 gwa_output-VKBUR, "S off
142 sy-vline,
143 gwa_output-MATNR, "Material
162 sy-vline,
163 gwa_output-MAKTX , "Description
204 sy-vline,
205 gwa_output-KWMENG, "Or Qty
221 sy-vline,
222 gwa_output-LFDAT, "Del Date
233 sy-vline,
234 gwa_output-SERNR, "Serial No
252 SY-VLINE.
uline.
clear : gwa_output.
endloop.
*free and refresh the internal table
refresh : git_output.
free : git_output.
ENDFORM. " SAPSD_OUTPUT
*& Form SAPSD_TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM SAPSD_TOP_OF_PAGE .
write: /15 text-016, 30 sy-repid.
FORMAT COLOR COL_HEADING INTENSIFIED ON INVERSE OFF.
ULINE.
WRITE : /1 sy-vline,
2 text-001, "QTE No
13 sy-vline,
14 text-002, "CR Date
25 sy-vline,
26 text-003, "EX Date
36 sy-vline,
37 text-004, "QT Value
53 sy-vline,
54 text-005, "SO
65 SY-VLINE,
66 text-006, "PO
87 SY-VLINE,
88 text-007, "Customer
99 sy-vline,
100 text-008, "Name
136 sy-vline,
137 text-009, "S off
142 sy-vline,
143 text-010, "Material
162 sy-vline,
163 text-011 , "Description
204 sy-vline,
205 text-012, "Or Qty
221 sy-vline,
222 text-013, "Del Date
233 sy-vline,
234 text-014, "Serial No
252 SY-VLINE.
ULINE.
ENDFORM. " SAPSD_TOP_OF_PAG,
*& Form SAPSD_SCREEN_VALIDATION_VBELN
text
--> p1 text
<-- p2 text
FORM SAPSD_SCREEN_VALIDATION_VBELN .
IF NOT S_VBELN IS INITIAL.
*To check the plant.If entry is wrong the an error message displayed.
DATA : l_VBELN LIKE VBAK-VBELN. "SO
Validating SO in selection screen
SELECT SINGLE VBELN INTO l_VBELN FROM VBAK
WHERE VBELN IN S_VBELN.
IF sy-subrc NE 0.
MESSAGE e023(Z1). " Invalid SO
ENDIF.
endif.
ENDFORM. " SAPSD_SCREEN_VALIDATION_VBELN
*& Form SAPSD_SCREEN_VALIDATION_WERKS
text
--> p1 text
<-- p2 text
FORM SAPSD_SCREEN_VALIDATION_WERKS .
IF NOT P_WERKS IS INITIAL.
*To check the plant.
*If entry is wrong the an error message displayed.
DATA : l_WERKS LIKE T001W-WERKS. "Plant
Validating Plant in selection screen
SELECT SINGLE WERKS INTO l_WERKS FROM T001W
WHERE WERKS EQ P_WERKS.
IF sy-subrc NE 0.
MESSAGE e024(Z1). " Invalid Plant
ENDIF.
ENDIF.
ENDFORM. " SAPSD_SCREEN_VALIDATION_WERKS
*& Form SAPSD_SCREEN_VALIDATION_PO
text
--> p1 text
<-- p2 text
FORM SAPSD_SCREEN_VALIDATION_PO .
IF NOT S_EBELN IS INITIAL.
*To check the plant.
*If entry is wrong the an error message displayed.
DATA : l_EBELN LIKE EKKO-EBELN. "PO
Validating PO in selection screen
SELECT SINGLE EBELN INTO l_EBELN FROM EKKO
WHERE EBELN IN S_EBELN.
IF sy-subrc NE 0.
MESSAGE e025(Z1). " Invalid PO
ENDIF.
ENDIF.
ENDFORM. " SAPSD_SCREEN_VALIDATION_PO
*& Form SAPSD_SCREEN_VALIDATION_SERIAL
text
--> p1 text
<-- p2 text
FORM SAPSD_SCREEN_VALIDATION_SERIAL .
IF NOT S_SERNR IS INITIAL.
*To check the SERIAL NO.
*If entry is wrong the an error message displayed.
DATA : l_SERNR LIKE EQUI-SERNR. "Serial No
Validating Serial NO in selection screen
SELECT SINGLE SERNR INTO l_SERNR FROM EQUI
WHERE SERNR IN S_SERNR.
IF sy-subrc NE 0.
MESSAGE e026(Z1). " Invalid Serial No
ENDIF.
ENDIF.
ENDFORM. " SAPSD_SCREEN_VALIDATION_SERIAL
Please help me in this .
Thanks & Regards
AhammadHi Shaik,
Please remove all the join select queries and use 'for all entries' varaiant of the select query. Check whether you can create and use indexes in ur queries.
Thanks and Regards,
Saurabh Chhatre
Maybe you are looking for
-
Im trying to transfer music, selected files and photos from Macbook Pro to Air
I need a fast and easy method to transfer ... any help is appreciated
-
In FM mode it shuts off after 60 sec.
Brand new, fully charged battery;.... in FM radio mode, ipod SHUTS ITSELF OFF after 60 sec. of play, FROM THE LAST TIME I TOUCH THE SCREEN. I made no default settings changes.Does the same thing repeatedly. I opened the pkg, charged ipod 4 hrs (USB2)
-
Hi Expert, by creating a colored workbook i notice the color was disappearing after the refresh. I decide to built a makro which can fix the color in each line. I done that manually. But i am looking for a makro which can dynamically color the cells.
-
Populate data into standard component alv from Zcomponent popup data selected
HI All I have to call Zcomponent in standard component and need to pass value into Zcomponent (table) and from Zcomponent select row and pass back to standard component. Steps 1) Created Zcomponent with interface node 2) Enhanced the standard compon
-
IMAC 2.16 GHZ INTEL CORE 2 DUO PERFORMANCE
Just picked up a 20' Imac 2.16 ghz intel core 2 duo with 2 gigs of ram. So before I drop Pro Tools for Logic, what kind of performance am I looking at?