Very urgent..Formula count
Hi All
I have a Query got 4 RKFs(local) 2 Formula(ckfs), the out put is like this,
rkf1 rkf2 fkf1 fkf2
0 30 1 0
0 0 0 0
20 0 0 1
Result 1 1
i have created these 2 fks based on 2 rkfs when i try to count the FKfs to get the total as like in Result iam not geting that Result and Ovaral Result Part in my Report.....and count......!
and i have creared one more FKF´s based on the FKF1 puting a Count(FKF1)
and in the properties Calucutlae Result as...SUMMATION. Stil its giving the
sum of FKF´1 ==1.
Is there any solution for this pls let me know
Thanks in advance
San
Hi,
I dont see any strange behavior in your Query result.
1. I guess you must be having consdition in your Query.Isn't it? thats y overall result values are not matching to sum of individual values.
(thats why overall result for 80,445...though you see only one Keyfigure value i.e 120,509...)
Please note that Overall result remains unchanged regardless of condition.
2.So when you remove Ftrans ID from drilldown, there are no Keyfigure values(individual values).So overall result is 0.... this is normal behavior.
so you need not worry about it....
deactivate the condition then check and compare the result for better idea.( then you will see overall result matching with summation of individual values).
Message was edited by:
Murali
Similar Messages
-
Counting Unique Records: very urgent
Hi,
I have to create a query for which i have to count the unique records appearing for a particular selection. For that i created a CK and in its agregation set Count all values <> 0 For customer. we are having Modality in my rows and CK in column. Now what happens if for 4 different records there is one customer then output appears one against that modality but it should show 4. As such there is no unique field in the cube that i can count. But we have maintined a Count key figure against each record in the cube that has value 1 for each row. But as it is a Key figure i cannot use it in aggregation. Is there any way to solve this situation....
Please help. Its very urgent..
Thanks
Points assured.Hello,
Use Exception Aggregation as Customer. It will work.
Crearte CKF
Assign 1 initial value
Count all properties
Exception aggretion is Customer.
I think It should work
Thanks,
Kishore
@KR -
Error during GR(very very urgent)
Hi all,
i am using a developed program for GR.i used this program before.there was no error.but now i am facing error like
<b>PO ordered quqntity exceeded by 18,000 EA.</b>.i am using <b>BAPI_GOODSMVT_CREATE</b> for goods transfer.
In the selection screen, i am putting
PO number- PO1
material number- MAT
GR quantity- 18,000
delivery order-111
i want to receive the material MAT of quantity 18,000 from that PO.initially i have ordered PO quntity as 1 lakh. Till now i have received 42,000 materials,now i try to receive 18,000 materials.but it is showing this type of error.
This error is fired from the return parameter of that BAPI only.error having message class-M7 & error no-022
is comming.
i am giving my coding below.plz suggest where is the problem.it is very very urgent.recently my company has added some patches to update the SAP.is this the cause for that error.plz suggest.
any idea will be highly appreaciated.
Regards
REPORT zmui001
LINE-SIZE 140
LINE-COUNT 65
NO STANDARD PAGE HEADING.
*-- DATA DECLARATION--
*-- tables
TABLES : ekpo,
ekbe,
marv.
*--Includes
INCLUDE : <icon>. " Include for Icons
*-- Types
TYPES : BEGIN OF t_mseg,
ebeln LIKE ekko-ebeln,
name1 LIKE lfa1-name1,
lifnr LIKE lfa1-lifnr,
eknam LIKE t024-eknam,
mblnr LIKE mkpf-mblnr,
matnr LIKE ekpo-matnr,
maktx LIKE makt-maktx,
lgort LIKE mseg-lgort,
charg LIKE mseg-charg, "chg: 10/17/2005
menge LIKE mseg-menge,
budat LIKE mkpf-budat,
bldat LIKE mkpf-bldat, " chg : 08/18/2003
xblnr LIKE mkpf-xblnr,
END OF t_mseg.
DATA: BEGIN OF t_ekbe,
ebeln LIKE ekbe-ebeln,
ebelp LIKE ekbe-ebelp,
bwart LIKE ekbe-bwart,
matnr LIKE ekbe-matnr,
menge LIKE ekbe-menge,
END OF t_ekbe,
BEGIN OF t_ekpo,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
menge LIKE ekpo-menge,
END OF t_ekpo.
TYPES : BEGIN OF t_options.
INCLUDE STRUCTURE itcpo.
TYPES : END OF t_options.
*--Internal tables
DATA: BEGIN OF i_item OCCURS 50. "Create Material Document Item
INCLUDE STRUCTURE bapi2017_gm_item_create.
DATA: END OF i_item .
DATA: BEGIN OF i_return OCCURS 20. "Return parameter
INCLUDE STRUCTURE bapiret2.
DATA: END OF i_return.
DATA: BEGIN OF i_part OCCURS 0, " Internal table for split data
part(20),
END OF i_part.
DATA: BEGIN OF i_return1 OCCURS 20. "Return parameter
INCLUDE STRUCTURE bapiret1.
DATA: END OF i_return1.
*-- Work areas
DATA: BEGIN OF wa_header . "Material Document Header Data
INCLUDE STRUCTURE bapi2017_gm_head_01.
DATA: END OF wa_header .
DATA: BEGIN OF wa_return . "Output Structure
INCLUDE STRUCTURE bapi2017_gm_head_ret.
DATA: END OF wa_return .
*-- Work areas
DATA: wa_mseg TYPE t_mseg,
wa_ekbe LIKE t_ekbe,
wa_ekpo LIKE t_ekpo,
wa_options TYPE t_options,
i_ekbe LIKE STANDARD TABLE OF t_ekbe,
i_ekbe2 LIKE STANDARD TABLE OF t_ekbe,
i_ekpo LIKE STANDARD TABLE OF t_ekpo.
*---Variables
DATA: v_first, " variable to get first digit
v_set TYPE c,
v_found TYPE p,
v_menge TYPE p,
v_ebeln LIKE ekko-ebeln,
v_lifnr LIKE ekko-lifnr,
v_belnr LIKE ekbe-belnr,
v_postdate LIKE mkpf-budat,
v_bukrs LIKE marv-bukrs,
v_datum LIKE sy-datum,
v_lgort LIKE mard-lgort, " Stge. location
v_bwart LIKE mseg-bwart, " Movement type
v_infnr LIKE eina-infnr, " Info record no.
v_ltsnr LIKE eina-ltsnr.
*---Constants
CONSTANTS: c_comma TYPE c VALUE ',', " For splitting data at commas
c_01(2) TYPE c VALUE '01', " For movement code in Bapi
c_b TYPE c VALUE 'B', " For mvt. Indicator in Bapi
c_save(4) TYPE c VALUE 'SAVE', " For button text
c_clear(5) TYPE c VALUE 'CLEAR', " For clear button
c_mvmt(4) TYPE c VALUE 'MVMT',
c_ok(2) TYPE c VALUE 'OK',
c_error(5) TYPE c VALUE 'Error'.
*--SELECTION SCREEN DESIGN--
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS: p_bar(75) , " Scanned data from barcode
p_ebeln LIKE ekko-ebeln, " PO number
p_matnr LIKE ekpo-matnr, " Material number
p_menge LIKE ekpo-menge, " Quantity
p_lifnr LIKE ekko-lifnr, " Vendor code
p_frbnr LIKE mkpf-frbnr, " Reference doc for goods mvt
p_status(5) TYPE c.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN PUSHBUTTON 15(10) v_save USER-COMMAND mvmt.
SELECTION-SCREEN PUSHBUTTON 40(10) v_clear USER-COMMAND clear.
INITIALIZATION -
INITIALIZATION.
v_save = c_save .
v_clear = c_clear.
*--AT SELECTION_SCREEN--
AT SELECTION-SCREEN .
IF sy-ucomm = c_clear.
PERFORM f_clear.
ELSE.
IF sy-ucomm <> c_mvmt.
if not sy-tabix is initial and sy-ucomm <> c_mvmt.
*--- Extracting the data by splitting the scanned values.
PERFORM f_get_split_data.
*--- Validating the input data.
PERFORM f_check_inputs.
ELSE .
*--- Validating the input data.
PERFORM f_check_inputs.
*-- Determining the posting date and period check.
PERFORM f_get_posting_date.
*---Post goods movement
PERFORM f_post_receipt.
ENDIF.
ENDIF.
SUBROUTINES *
*& Form f_check_inputs
Validating the input parameters
FORM f_check_inputs.
*-- Validating material no.
SELECT SINGLE matnr INTO p_matnr
FROM mara
WHERE matnr = p_matnr.
IF sy-subrc = 4.
p_status = c_error.
MESSAGE e003(zm) WITH 'Material no.'.
ENDIF.
*-- Validating JHT reference no.
SELECT SINGLE ebeln
lifnr
bukrs
INTO (p_ebeln, v_lifnr , v_bukrs)
FROM ekko
where unsez = p_unsez. chg:07072003
WHERE ebeln = p_ebeln.
IF sy-subrc = 4.
p_status = c_error.
MESSAGE e003(zm) WITH 'Purchase order no.'.
ENDIF.
*-- Validating material po combination
SELECT SINGLE *
FROM ekpo
WHERE ebeln = p_ebeln
AND matnr = p_matnr.
IF sy-subrc = 4.
p_status = c_error.
MESSAGE e003(zm) WITH 'Purchase order no.' ' and Material no.'.
ENDIF.
*--- Checking for DO entry . (chng : 30/06/2003)
IF p_frbnr IS INITIAL.
MESSAGE e018(m7) WITH 'Delivery no.'.
p_status = c_error.
PERFORM f_clear.
ENDIF.
*-- Validating material po do combination
SELECT SINGLE a~belnr
INTO v_belnr
FROM ekbe AS a
INNER JOIN mkpf AS b
ON abelnr = bmblnr
AND agjahr = bmjahr
WHERE a~ebeln = ekpo-ebeln
AND a~ebelp = ekpo-ebelp
AND b~xblnr = p_frbnr.
IF sy-subrc = 0.
MESSAGE e019(zm) WITH v_belnr.
p_status = c_error.
PERFORM f_clear.
ENDIF.
p_status = c_ok.
ENDFORM. " f_check_inputs
*& Form f_get_split_data
Extracting the data by splitting the Scanned data
FORM f_get_split_data.
*-- Splitting the data at commas
SPLIT p_bar AT c_comma INTO TABLE i_part.
*-- Assigning the parts to variables.
LOOP AT i_part.
v_first = i_part-part+0(1).
TRANSLATE v_first TO UPPER CASE.
CASE v_first .
WHEN 'V'.
p_lifnr = i_part-part+1(10).
WHEN 'P'.
p_matnr = i_part-part+1(18).
WHEN 'Q'.
p_menge = i_part-part+1(13).
WHEN 'K'.
p_ebeln = i_part-part+1(10).
WHEN 'D'.
p_frbnr = i_part-part+2(16).
WHEN OTHERS.
CONTINUE.
ENDCASE.
ENDLOOP.
ENDFORM. " f_get_split_data
*& Form f_get_posting_date
Determing the posting date for document
FORM f_get_posting_date.
*-- get the current period for todays date.
DATA: l_period LIKE t009b-poper.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
i_periv = 'K4'
IMPORTING
e_buper = l_period
E_GJAHR =
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*-- Determining whether the open period
SELECT SINGLE *
FROM marv
WHERE bukrs = v_bukrs.
IF sy-subrc = 0.
IF l_period = marv-lfmon .
v_postdate = sy-datum.
ELSE.
CALL FUNCTION 'BAPI_CCODE_GET_FIRSTDAY_PERIOD'
EXPORTING
companycodeid = v_bukrs
fiscal_period = marv-lfmon
fiscal_year = marv-lfgja
IMPORTING
first_day_of_period = v_postdate
return = i_return1.
IF NOT i_return[] IS INITIAL.
LOOP AT i_return1.
MESSAGE i016(zm) WITH i_return-message.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " f_get_posting_date
*& Form f_post_receipt
Post the goods receipt for entered data.
FORM f_post_receipt.
PERFORM f_fill_item.
PERFORM f_fill_header.
PERFORM f_execute_transfer.
PERFORM f_clear.
ENDFORM. " f_post_receipt
*& Form f_fill_item
Updating the item data for the GR
FORM f_fill_item.
Checking for IQC cycle is done here.(chng : 23/07/2003)
PERFORM f_check_iqc.
*---- Assigning movement type as per IQC cycle.(chng : 23/07/2003)
IF v_lgort IS INITIAL.
MOVE '101' TO i_item-move_type.
SELECT SINGLE lgort INTO i_item-stge_loc
FROM ekpo
where ebeln = v_ebeln and " chg :07/07/2003
WHERE ebeln = p_ebeln AND
matnr = p_matnr .
ELSE.
MOVE v_lgort TO i_item-stge_loc.
MOVE v_bwart TO i_item-move_type.
ENDIF.
MOVE p_matnr TO i_item-material.
MOVE p_menge TO i_item-entry_qnt.
move v_ebeln to i_item-po_number. " 07/07/2003
MOVE p_ebeln TO i_item-po_number.
MOVE v_lifnr TO i_item-vendor.
MOVE c_b TO i_item-mvt_ind.
select single ebelp into i_item-po_item " chg :29/07/2003
from ekpo
where ebeln = p_ebeln
and matnr = p_matnr
and elikz = ''.
SELECT ebeln
ebelp
matnr
menge
INTO CORRESPONDING FIELDS OF TABLE i_ekpo
FROM ekpo
WHERE ebeln = p_ebeln
AND matnr = p_matnr
AND loekz = '' .
SORT i_ekpo BY ebeln ebelp matnr.
LOOP AT i_ekpo INTO wa_ekpo.
IF v_found = 0.
SELECT ebeln ebelp
bwart menge
INTO CORRESPONDING FIELDS OF TABLE i_ekbe
FROM ekbe
WHERE ebeln = p_ebeln
AND ebelp = wa_ekpo-ebelp
AND matnr = p_matnr.
and elikz = '' . CHG -- 03/19/2004
IF sy-subrc = 0.
LOOP AT i_ekbe INTO wa_ekbe .
IF wa_ekbe-bwart = '101'.
v_menge = v_menge + wa_ekbe-menge.
ENDIF.
IF wa_ekbe-bwart = '102'.
v_menge = v_menge - wa_ekbe-menge.
ENDIF.
IF wa_ekbe-bwart = '122'.
v_menge = v_menge - wa_ekbe-menge.
ENDIF.
ENDLOOP.
chng: 03/19/2004 compare po qty against receipt
v_menge = v_menge + p_menge .
IF wa_ekpo-menge >= v_menge .
v_found = 1.
MOVE wa_ekpo-ebelp TO i_item-po_item.
ENDIF.
ELSE .
v_found = 1.
MOVE wa_ekpo-ebelp TO i_item-po_item.
ENDIF.
ENDIF.
CLEAR : wa_ekbe, i_ekbe, v_menge.
ENDLOOP.
IF v_found = 0 .
MESSAGE e003(zm) WITH ' delivery items'.
ENDIF.
APPEND i_item.
CLEAR : i_item, v_found .
ENDFORM. " f_fill_item
*& Form f_check_iqc
Checking the storage location for the (chng : 23/07/2003)
FORM f_check_iqc.
CALL FUNCTION 'Z_M_GET_IQC_STATUS'
EXPORTING
matnr = p_matnr
lifnr = v_lifnr
IMPORTING
lgort = v_lgort
bwart = v_bwart
ltsnr = v_ltsnr
infnr = v_infnr
EXCEPTIONS
non_iqc_vendor = 1
OTHERS = 2.
IF sy-subrc <> 0.
CLEAR : v_lgort , v_bwart , v_ltsnr.
ENDIF.
ENDFORM. " f_check_iqc
*& Form f_fill_header
Updating data in the header
FORM f_fill_header.
MOVE v_postdate TO wa_header-pstng_date.
MOVE sy-datum TO wa_header-doc_date.
MOVE p_frbnr TO wa_header-ref_doc_no.
ENDFORM. " f_fill_header
*& Form f_execute_transfer
Executing the goods movement.
FORM f_execute_transfer.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_header
goodsmvt_code = c_01
IMPORTING
goodsmvt_headret = wa_return
TABLES
goodsmvt_item = i_item
return = i_return.
IF i_return[] IS INITIAL .
COMMIT WORK.
*--- UPdating Info record for IQC cycle ind.(chng : 23/07/2003)
IF NOT v_ltsnr IS INITIAL.
UPDATE eina SET ltsnr = v_ltsnr
WHERE infnr = v_infnr.
ENDIF.
REFRESH : i_item.
CLEAR : wa_header,v_ltsnr , v_infnr,v_bwart,v_lifnr.
MESSAGE i012(migo) WITH wa_return-mat_doc.
PERFORM f_do_print.
ELSE.
REFRESH : i_item.
CLEAR : wa_header,v_ltsnr , v_infnr,v_bwart,v_lifnr.
PERFORM write_errors.
ENDIF.
ENDFORM. " f_execute_transfer
FORM write_errors.
WRITE: 0(90) sy-uline ,
/0'|',
3 'System messages for GR posting',
90 '|',
/0(90) sy-uline .
LOOP AT i_return.
CASE i_return-type.
WHEN 'E'.
MESSAGE i016(zm) WITH i_return-message.
WHEN 'W'.
MESSAGE i017(zm) WITH i_return-message.
WHEN 'I'.
WRITE: /0'|',
icon_yellow_light AS ICON ,
'|',
10 i_return-message,
90 '|'.
MESSAGE i018(zm) WITH i_return-message.
WHEN 'S'.
WRITE: /0'|',
icon_green_light AS ICON ,
'|',
10 i_return-message,
90 '|'.
MESSAGE i018(zm) WITH i_return-message.
WHEN OTHERS.
WRITE: /0'|',
icon_red_light AS ICON ,
'|',
10 i_return-message,
90 '|'.
MESSAGE e016(zm) WITH i_return-message.
ENDCASE.
AT LAST .
WRITE:/0(90) sy-uline .
ENDAT.
ENDLOOP.
ENDFORM. " write_errors
*& Form f_clear
Clearing the input parameters
FORM f_clear.
CLEAR : p_ebeln ,
p_bar,
p_matnr,
p_frbnr,
v_lifnr,
p_menge,
p_status.Hi all,
can anyone suggest any idea?
Regrds
pabitra -
Please check my code where i am wrong ,-very urgent please
Hi ,
i am getting all values execpt the values from table t685 , kolnr and kotabnr and i am using three selects and moving the values in it_output_report.
this is very urgent
REPORT zmaster_condition LINE-COUNT 80 LINE-SIZE 225.
D A T A *
INCLUDE zmaster_condition_top.
S E L E C T I O N S *
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
SELECT-OPTIONS: s_kvewe FOR t683s-kvewe,
s_kappl FOR t683s-kappl,
s_kalsm FOR t683s-kalsm,
s_kschl FOR t683s-kschl,
s_kabnr FOR t682i-kotabnr.
SELECTION-SCREEN END OF BLOCK b01.
*SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-s04.
*PARAMETERS: p_vari LIKE disvariant-variant.
*SELECTION-SCREEN END OF BLOCK b4.
**SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
*SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS R1 RADIOBUTTON GROUP RADI1 DEFAULT 'X'.
*SELECTION-SCREEN END OF BLOCK b02.
A T S E L E C T I O N - S C R E E N *
M A I N P R O G R A M *
START-OF-SELECTION.
*Initializing the local tables.
CLEAR:it_t682i,it_t683s,it_t685,it_output_report.
REFRESH:it_t682i,it_t683s,it_t685,it_output_report.
*Selection of data from pricing procedure tables using a join.
*SELECT Akvewe Akappl Akalsm Astunr A~zaehk
Akschl Bkolnr Bkotabnr Ckozgf
INTO TABLE it_output_report
FROM t683s as A
JOIN t682i as B
ON Akvewe eq Bkvewe and
Akappl eq Bkappl
JOIN t685 as C
ON Bkvewe eq Ckvewe and
Bkappl eq Ckappl and
Bkozgf eq Ckozgf
WHERE A~KVEWE = 'B' and
A~KAPPL = 'V1' .
A~KALSM IN S_KALSM and
A~KSCHL IN S_KSCHL and
B~KOTABNR IN S_KABNR.
*Selection of data from pricing procedure tables
*SELECT * FROM t683s APPENDING CORRESPONDING FIELDS OF TABLE it_t683s
WHERE kvewe = 'B'
and kappl = 'V1'.
SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
INTO TABLE it_t682i
WHERE kvewe = 'B'
AND kappl = 'V1'.
SELECT kvewe kappl kalsm stunr zaehk kschl FROM t683s
INTO TABLE it_t683s
WHERE kvewe = 'B'
AND kappl = 'V1'
AND kalsm IN s_kalsm.
*SELECT kvewe kappl kschl kozgf FROM t685
INTO TABLE it_t685
WHERE kvewe = 'B'
AND kappl = 'V1'
and KSCHL in S_KSCHL
AND KOZGF in s_kabnr.
SELECT kvewe kappl kschl kozgf FROM t685
INTO TABLE it_t685
WHERE kvewe = 'B'
AND kappl = 'V1'
and KSCHL in S_KSCHL
AND KOZGF in s_kabnr.
*clear it_t685.
*loop at it_t685.
it_output_report-kschl = it_t685-kschl.
it_output_report-kozgf = it_t685-kozgf.
it_output_report-kozgf = it_t682i-kozgf.
it_output_report-kolnr = it_t682i-kolnr.
it_output_report-kotabnr = it_t682i-kotabnr.
*endloop.
clear it_t683s.
loop at it_t683s.
it_output_report-kvewe = it_t683s-kvewe.
it_output_report-kappl = it_t683s-kappl.
it_output_report-kalsm = it_t683s-kalsm.
it_output_report-stunr = it_t683s-stunr.
it_output_report-zaehk = it_t683s-zaehk.
it_output_report-kschl = it_t683s-kschl.
it_output_report-kozgf = it_t682i-kozgf.
it_output_report-kolnr = it_t682i-kolnr.
it_output_report-kotabnr = it_t682i-kotabnr.
APPEND IT_OUTPUT_REPORT.
clear it_output_report.
*loop at it_t685.
it_output_report-kschl = it_t685-kschl.
it_output_report-kozgf = it_t685-kozgf.
it_output_report-kozgf = it_t682i-kozgf.
it_output_report-kolnr = it_t682i-kolnr.
it_output_report-kotabnr = it_t682i-kotabnr.
endloop.
*MOVE : it_t683s-kvewe TO it_output_report-kvewe.
E N D - O F - S E L E C T I O N
END-OF-SELECTION.
*Output to a list
FORMAT COLOR 2 .
WRITE:/2 'Usage',09 'App',17 'Proced',24 'Step',
37 'Counter',50 'CondType',63 'Description',85 'AccSeq',
97 'AccSeqNum',108 'ConTable'.
WRITE:/1(225) sy-uline.
loop at it_output_report.
WRITE:/ it_output_report-kvewe UNDER 'Usage',
it_output_report-kappl UNDER 'App',
it_output_report-kalsm UNDER 'Procedure',
it_output_report-stunr UNDER 'Step',
it_output_report-zaehk UNDER 'Counter',
it_output_report-kschl UNDER 'CondType',
it_output_report- UNDER 'Description',
it_output_report-kozgf UNDER 'AccSeq',
it_output_report-kolnr UNDER 'AccSeqNum',
it_output_report-kotabnr UNDER 'ConTable'.
it_output_report- UNDER 'SalesOrg',
it_output_report- UNDER 'DocType'.
it_output_report- UNDER 'Customer'.
endloop.
INCLUDE ZMASTER_CONDITION_TOP *
*Table declaration
Tables:T682I,
T683S,
T685,
NACH,
B005.
*Data declaration for internal tables
DATA:Begin of it_output_report occurs 0,
KVEWE LIKE T683S-KVEWE, "Usage of the condtion table
KAPPL LIKE T683S-KAPPL, "Application
KALSM LIKE T683S-KALSM, "Procedure for pricing
STUNR LIKE T683S-STUNR, "step number
ZAEHK LIKE T683S-ZAEHK, "condition counter
KSCHL LIKE T683S-KSCHL, "condition type
KOZGF LIKE T685-KOZGF, "Access sequence
KOLNR LIKE T682I-kOLNR, "Access sequence number
KOTABNR LIKE T682I-KOTABNR, "Condition Table
End of it_output_report.
DATA: BEGIN OF IT_T683S OCCURS 10 ,
KVEWE LIKE T683S-KVEWE, "Usage of the condtion table
KAPPL LIKE T683S-KAPPL, "Application
KALSM LIKE T683S-KALSM, "Procedure for pricing
STUNR LIKE T683S-STUNR, "step number
ZAEHK LIKE T683S-ZAEHK, "condition counter
KSCHL LIKE T683S-KSCHL,
KOZGF LIKE T685-KOZGF, "condition type
END OF IT_T683S.
DATA: BEGIN OF IT_T685 OCCURS 10,
kvewe like t685-kvewe,
kappl like t685-kappl,
KSCHL LIKE T685-KSCHL,
KOZGF LIKE T685-KOZGF, "Access sequence
END OF IT_T685 .
DATA: BEGIN OF IT_T682I OCCURS 0,
KVEWE LIKE T682I-KVEWE,
KAPPL LIKE T682I-KAPPL,
KOZGF LIKE T682I-KOZGF, "Access sequence
KOLNR LIKE T682I-kOLNR, "Access sequence number
KOTABNR LIKE T682I-KOTABNR, "Condition TableHi,
I think may be you should check with T682I-KOZGF(Access sequence) instead of T682I-KOTABNR(Condition table).
In select-options declare like
s_KOZGF FOR t682i-KOZGF
SELECT kvewe kappl kschl kozgf FROM t685
INTO TABLE it_t685
WHERE kvewe = 'B'
AND kappl = 'V1'
and KSCHL in S_KSCHL
AND KOZGF in s_KOZGF. //change s_kabnr to s_kozgf
Thanks,
Veni. -
Very Urgent Table Column Design
Hi,
This is what i have done, I am having a table with 2 columns.One is Text view and the other is Link to Action. I set the Table row count as 10. Table design is standard and all columns design is standard. Now The first text view column appears blue in colour and the second Link to action appears in White. To make both to have same white colour i made the table as Read only now both columns appear as white. If the table have more than 10 records it works fine. But if it is less say 4 records then first four records are in white remaining are in light blue. I want to make every thing to appear same white or same blue color. How to do this .
Kindly Help this is very Urgent
Rkhi rk.......
try this out.......
consider your are having 4 records but the line count is 10 in the table.
insert 6 empty records into the table.
it will work fine.
---regards,
alex b justin -
SQL Loader Oracle 10g problem in upload date with time data -- Very urgent.
Hi
I am trying to upload data using SQL loader. There are three columns in the table
defined as DATE. When I tried upload a data like this '2007-02-15 15:10:20', it is not loading time part. The date stored as 02/15/2008' only. There is not time on that. I tried with many different format nothing work. Can please help me ?
I have also tried with to_date --> to_timestamp it did not work.
The application is going to be in production, I cannot change DATE to TIME STAMP. This is very urgent.
LASTWRITTEN "decode(:LASTWRITTEN,'null',Null, to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:Mi:SS'))",
CREATEDON "decode(:CREATEDON,'null',Null, to_date(:CREATEDON,'YYYY-MM-DD HH24:Mi:SS'))",
LASTUPDATEDON(21) "decode(:LASTUPDATEDON,'null',Null, to_date(:LASTUPDATEDON(21),'DD/MM/YYYY HH24:MI:SS'))"Your problem is most likely in decode - the return type in your expression will be character based on first search value ('null'), so it will be implicitly converted to character and then again implicitly converted to date by loading into date column. At some of this conversions you probably are loosing your time part. You can try instead use cast:
SQL> desc t
Name Null? Type
LASTWRITTEN DATE
CREATEDON DATE
LASTUPDATEDON DATE
SQL> select * from t;
no rows selected
SQL> !cat t.ctl
LOAD DATA
INFILE *
INTO TABLE T
TRUNCATE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
LASTWRITTEN
"decode(:LASTWRITTEN,'null',cast(Null as date),
to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:MI:SS'))",
CREATEDON
"decode(:CREATEDON,'null',cast(Null as date),
to_date(:CREATEDON,'YYYY-MM-DD HH24:MI:SS'))",
LASTUPDATEDON
"decode(:LASTUPDATEDON,'null',cast(Null as date),
to_date(:LASTUPDATEDON,'DD/MM/YYYY HH24:MI:SS'))"
BEGINDATA
2007-02-15 15:10:20,null,null
null,2007-02-15 15:10:20,null
null,null,15/02/2007 15:10:20
SQL> !sqlldr userid=scott/tiger control=t.ctl log=t.log
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Feb 29 00:20:07 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 3
SQL> select * from t;
LASTWRITTEN CREATEDON LASTUPDATEDON
15.02.2007 15:10:20
15.02.2007 15:10:20
15.02.2007 15:10:20Best regards
Maxim -
Getting the tablespace name(its very urgent)
Hi,
Can anyone help me to get the query to find the tablespace used by the users in the database
Its Very urgent please
Thanks,
Murali.V@Murali,
...the tablespace used by the users...What did you mean exactly ?
Default tablespace doesn't say that user cannot create a table in an other tablespace.
You can see what tablespace are used by the user's segments :
SQL> select default_tablespace
2 from user_users;
DEFAULT_TABLESPACE
PSDEFAULT
SQL> select tablespace_name, count(*)
2 from user_segments
3* group by tablespace_name
SQL> /
TABLESPACE_NAME COUNT(*)
AAAPP 102
AALARGE 4
ADAPP 429
AMAPP 2
[...]@Talifhani,
SELECT tablespace_name FROM dba_tablespaces; This give all tablespace from database.
Nicolas. -
Very urgent - Usage of IsError function in HFR
Hi All,
Its very urgent requirement for us.
How can we use the is error function in HFR.bcoz if the both values in formula ex: a/b ; a=0,b=0; then it shows some garbage value.i came to know we can achieve that
by using iserror function.but i dnt know how use it.
Thanks,
RaviHi
It can be done in this way using IfThen condition
IfThen(IsErr((reference row/column),0,(reference row/column))
where IfThen checks the condition
Condition is IsErr, it returns true when reference formula row/column,has #error value, so you many assign 0 (or whatever value you want) else returns actual calulated value from formula row/column,.
PS: Only formula rows and columns can result in #error.
Cheers
Vikas Naidu -
Very urgent please ----repetting values in the output
I am getting values for acc seq access seq number and codndition table repeting values as in the output of the report, please have a look in my code and please do respond immediatley.
regards always, below is my code and output
REPORT zmaster_condition LINE-COUNT 80 LINE-SIZE 225.
D A T A *
INCLUDE zmaster_condition_top.
S E L E C T I O N S *
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
SELECT-OPTIONS: s_kvewe FOR t683s-kvewe,
s_kappl FOR t683s-kappl,
s_kalsm FOR t683s-kalsm,
s_kschl FOR t683s-kschl,
s_kabnr FOR t682i-kotabnr,
s_kozgf FOR t682i-kozgf.
SELECTION-SCREEN END OF BLOCK b01.
*SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-s04.
*PARAMETERS: p_vari LIKE disvariant-variant.
*SELECTION-SCREEN END OF BLOCK b4.
**SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
*SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS R1 RADIOBUTTON GROUP RADI1 DEFAULT 'X'.
*SELECTION-SCREEN END OF BLOCK b02.
A T S E L E C T I O N - S C R E E N *
M A I N P R O G R A M *
START-OF-SELECTION.
*Initializing the local tables.
CLEAR:it_t682i,it_t683s,it_t685.
REFRESH:it_t682i,it_t683s,it_t685.
clear it_output_report.
refresh it_output_report.
*Selection of data from pricing procedure tables
SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
INTO TABLE it_t682i
WHERE kvewe = 'B'
AND kappl = 'V1'.
SELECT kvewe kappl kalsm stunr zaehk kschl FROM t683s
INTO TABLE it_t683s
WHERE kvewe = 'B'
AND kappl = 'V1'
and kschl in s_kschl
AND kalsm IN s_kalsm.
sort it_t683s by kvewe kappl.
DELETE adjacent duplicates FROM
it_t683s .
SELECT kvewe kappl kschl kozgf FROM t685
INTO TABLE it_t685
WHERE kvewe = 'B'
AND kappl = 'V1'
AND kschl IN s_kschl
AND kozgf IN s_kozgf.
LOOP AT it_t683s.
it_output_report-kvewe = it_t683s-kvewe.
it_output_report-kappl = it_t683s-kappl.
it_output_report-kalsm = it_t683s-kalsm.
it_output_report-stunr = it_t683s-stunr.
it_output_report-zaehk = it_t683s-zaehk.
it_output_report-kschl = it_t683s-kschl.
SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
INTO TABLE it_t682i
WHERE kvewe = it_t683s-kvewe
AND kappl = it_t683s-kappl
and kozgf in s_kozgf
and kotabnr in s_kabnr.
clear it_t682i.
loop at it_t682i.
it_output_report-kozgf = it_t682i-kozgf.
it_output_report-kozgf = it_t682i-kozgf.
it_output_report-kolnr = it_t682i-kolnr.
it_output_report-kotabnr = it_t682i-kotabnr.
APPEND it_output_report.
CLEAR it_output_report.
endloop.
APPEND it_output_report.
ENDLOOP.
E N D - O F - S E L E C T I O N
END-OF-SELECTION.
*Output to a list
FORMAT COLOR 2 .
WRITE:/2 'Usage',09 'App',17 'Proced',24 'Step',
37 'Counter',50 'CondType',63 'Description',85 'AccSeq',
97 'AccSeqNum',108 'ConTable'.
WRITE:/1(225) sy-uline.
LOOP AT it_output_report.
WRITE:/ it_output_report-kvewe UNDER 'Usage',
it_output_report-kappl UNDER 'App',
it_output_report-kalsm UNDER 'Procedure',
it_output_report-stunr UNDER 'Step',
it_output_report-zaehk UNDER 'Counter',
it_output_report-kschl UNDER 'CondType',
it_output_report- UNDER 'Description',
it_output_report-kozgf UNDER 'AccSeq',
it_output_report-kolnr UNDER 'AccSeqNum',
it_output_report-kotabnr UNDER 'ConTable'.
it_output_report- UNDER 'SalesOrg',
it_output_report- UNDER 'DocType'.
it_output_report- UNDER 'Customer'.
ENDLOOP.
output of the report:
Usage App Proced Step Counter CondType AccSeq AccqNum ConTable
B V1 V10000 220 00 ZCR1 Z200 05 511
B V1 V10000 220 01 ZRAS Z200 05 511
B V1 V10000 225 00 ZTPT Z200 05 511
B V1 V10000 230 00 ZOP4 Z200 05 511
B V1 V10001 010 01 RD03 Z200 05 511
B V1 V10002 010 00 ZREP Z200 05 511
B V1 V10000 200 00 ZOP3 z200 05 511
B V1 V10000 130 00 ZOC3 z200 05 511i would like to thanks you for your valuable help.
i am still getting repeated values for access seq , access number and cond table,last three columns in the output, pls see as it it is very urgent...
here is the code:
REPORT zmaster_condition LINE-COUNT 80 LINE-SIZE 225.
D A T A *
INCLUDE zmaster_condition_top.
S E L E C T I O N S *
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
SELECT-OPTIONS: s_kvewe FOR t683s-kvewe,
s_kappl FOR t683s-kappl,
s_kalsm FOR t683s-kalsm,
s_kschl FOR t683s-kschl,
s_kabnr FOR t682i-kotabnr.
s_kozgf FOR t682i-kozgf.
SELECTION-SCREEN END OF BLOCK b01.
*SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-s04.
*PARAMETERS: p_vari LIKE disvariant-variant.
*SELECTION-SCREEN END OF BLOCK b4.
**SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
*SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS R1 RADIOBUTTON GROUP RADI1 DEFAULT 'X'.
*SELECTION-SCREEN END OF BLOCK b02.
A T S E L E C T I O N - S C R E E N *
M A I N P R O G R A M *
START-OF-SELECTION.
*Initializing the local tables.
CLEAR:it_t682i,it_t683s,it_t685.
REFRESH:it_t682i,it_t683s,it_t685.
REFRESH it_output_report.
SELECT kvewe kappl kalsm stunr zaehk kschl FROM t683s
INTO TABLE it_t683s
WHERE kvewe IN s_kvewe
AND kappl IN s_kappl
AND kalsm IN s_kalsm
AND kschl IN s_kschl.
*delete adjacent duplicates from it_t683s comparing
kvewe kappl kschl.
SELECT kvewe kappl kozgf kolnr kotabnr FROM t682i
INTO TABLE it_t682i
FOR ALL ENTRIES IN it_t683s
WHERE kvewe = it_t683s-kvewe
AND kappl = it_t683s-kappl
AND kozgf IN s_kozgf
AND kotabnr IN s_kabnr.
LOOP AT it_t683s.
it_output_report-kvewe = it_t683s-kvewe.
it_output_report-kappl = it_t683s-kappl.
it_output_report-kalsm = it_t683s-kalsm.
it_output_report-stunr = it_t683s-stunr.
it_output_report-zaehk = it_t683s-zaehk.
it_output_report-kschl = it_t683s-kschl.
move-corresponding it_t683s to it_output_report.
sort it_t683s.
sort it_t682i.
READ TABLE it_T682i with KEY KVEWE = it_T683s-KVEWE
kappl = it_t683s-kappl.
LOOP AT it_T682i WHERE KVEWE = it_T683s-KVEWE
AND kappl = it_t683s-kappl.
AND kotabnr IN s_kabnr.
IF SY-SUBRC EQ 0.
move-corresponding it_T682i to it_output_report.
it_output_report-kozgf = it_t682i-kozgf.
it_output_report-kolnr = it_t682i-kolnr.
it_output_report-kotabnr = it_t682i-kotabnr.
ENDIF.
APPEND it_output_report.
ENDLOOP.
*DATA TAB(4).
*DATA VKORG LIKE TAB-VKORG.
*CONCATENATE it_t683s-kvewe it_t682i-kotabnr INTO TAB .
*SELECT SINGLE VKORG INTO VKORG FROM TAB WHERE
KSCHL = 'ZRC1'.
E N D - O F - S E L E C T I O N
END-OF-SELECTION.
*Output to a list
FORMAT COLOR 2 .
WRITE:/2 'Usage',09 'App',15 'Proced',24 'Step',
37 'Counter',50 'CondType',63 'Description',85 'AccSeq',
97 'AccSeqNum',108 'ConTable'.
WRITE:/1(225) sy-uline.
LOOP AT it_output_report.
WRITE:/ it_output_report-kvewe UNDER 'Usage',
it_output_report-kappl UNDER 'App',
it_output_report-kalsm UNDER 'Proced',
it_output_report-stunr UNDER 'Step',
it_output_report-zaehk UNDER 'Counter',
it_output_report-kschl UNDER 'CondType',
it_output_report- UNDER 'Description',
it_output_report-kozgf UNDER 'AccSeq',
it_output_report-kolnr UNDER 'AccSeqNum',
it_output_report-kotabnr UNDER 'ConTable'.
it_output_report- UNDER 'SalesOrg',
it_output_report- UNDER 'DocType'.
it_output_report- UNDER 'Customer'.
here is the output:
Report to list out all Condition Records for Output and Pricing.
Usage App Proced Step Counter CondType AccSeq AccSeqNum ConTable
B V1 V05000 010 01 AF00 Z001 05 551
B V1 V05000 020 02 MAIL Z001 05 551
B V1 V05000 030 01 ESYM Z001 05 551
B V1 V06000 010 01 AN00 Z001 05 551
B V1 V06000 020 02 MAIL Z001 05 551 -
CODING EXAMPLE - LAYOUT ALV - ( very urgent )
Could any body please give me the coding example
where slis_layout_alv is used ? Please treat this as very urgent.
Yours sincerely,
SAURAV LAHIRYHi Saurav,
Please check this code.
REPORT y56098rdup_list
NO STANDARD PAGE HEADING LINE-SIZE 240 LINE-COUNT 65(8) .
Declartion of Tables.
TABLES: ztril_logtable,zreasoncodes,zsdcustxref, usr21, adrp.
TABLES-POOLS
TYPE-POOLS: slis.
Internal tables declarations.
Declaration of output internal table
DATA: BEGIN OF tb_output OCCURS 0,
user_id TYPE xubname, " Requestor ID
role TYPE zrole, "Role
kunnr TYPE kunnr , "Customer Number 1
customer_name TYPE name1, "Customer Name
stras TYPE stras_gp, "Street Address
ort01 TYPE city, "City
regio TYPE regio, "State
pstlz TYPE pstlz, "Postal Code
land1 TYPE land1_gp, "COUNTRY CODE
po_box TYPE ad_pobx, "PO Box Number
tril_po_postal TYPE zpobox_postal, "PO BOX Postal Code
tril_err_msg TYPE zerr_message, "Error Message
reason_type TYPE zreason_type, "Reason Type
reason_code TYPE zreason_code, "Reason Code
perc_prob TYPE zprobability , "Probability Percentage
pattern_number TYPE z_pattern_no, "Match Pattern Number
country_code TYPE land1, "COUNTRY CODE
user_id_name(92) TYPE c, "UserID + Fast Name + Last Name
zlkunnr LIKE zsdcustxref-zlkunnr, "Legacy Customer NO
saplegcustno(20) TYPE c, "SAP + Legacy Customer No
reason_desc LIKE zreasoncodes-reason_desc, "Reason Description
saplegcustno1(20) TYPE c,
END OF tb_output.
Declation of work area.
DATA: wa_output LIKE tb_output.
Declaration of Internal Table.
DATA: tb_fill_output LIKE tb_output OCCURS 0 WITH HEADER LINE,
wa_fill_output LIKE tb_fill_output.
Declaration of internal table for ZREASONCODES
DATA: BEGIN OF tb_reasoncodes OCCURS 0.
INCLUDE STRUCTURE zreasoncodes.
DATA: END OF tb_reasoncodes.
DATA: wa_reasoncodes LIKE tb_reasoncodes.
Declaration of internal table ZSDCUTXREF.
DATA: BEGIN OF tb_zsdcustxref OCCURS 0,
zlkunnr LIKE zsdcustxref-zlkunnr, " Legacy Customer No
zlsourc LIKE zsdcustxref-zlsourc, " Legacy customer source code
kunnr LIKE zsdcustxref-kunnr, " Customer No
END OF tb_zsdcustxref.
Declation of work area.
DATA: wa_zsdcustxref LIKE tb_zsdcustxref.
Declaration of internal table for USR21.
DATA: BEGIN OF tb_usr21 OCCURS 0,
bname LIKE usr21-bname, " USER NAME IN USER MASTER RECORD
persnumber LIKE usr21-persnumber, " PERSON NUMBER
name_first LIKE adrp-name_first, " FIRST NAME
name_last LIKE adrp-name_last, " LAST NAME
END OF tb_usr21.
Declation of work area.
DATA: wa_usr21 LIKE tb_usr21.
Declaration of internal table for ADRP.
DATA: BEGIN OF tb_adrp OCCURS 0,
persnumber LIKE adrp-persnumber, " PERSON NUMBER
name_first LIKE adrp-name_first, " FIRST NAME
name_last LIKE adrp-name_last, " LAST NAME
END OF tb_adrp.
DATA: wa_adrp LIKE tb_adrp.
Declaration for fieldcatalog
DATA: tb_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
Declaration for events
DATA: tb_events TYPE slis_t_event,
wa_event TYPE slis_alv_event.
Declaration for Layout
DATA: tb_layout TYPE slis_layout_alv,
wb_layout TYPE slis_layout_alv.
DATA: wa_line TYPE slis_listheader,
tb_list_header TYPE slis_t_listheader.
DATA: g_date1(40) TYPE c,
g_date2(40) TYPE c,
g_date3(80) TYPE c.
Declaration for Selection Screen Fields
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_userid FOR ztril_logtable-user_id, "Requestor ID
s_r_type FOR zreasoncodes-reason_type, " Reason Type
s_r_code FOR zreasoncodes-reason_code
MATCHCODE OBJECT zr_code. " Reason Code
PARAMETERS : p_frmdat LIKE ztril_logtable-curr_date OBLIGATORY, " from date
p_to_dat LIKE ztril_logtable-curr_date OBLIGATORY. " to date
SELECTION-SCREEN: END OF BLOCK b1.
Declaration for Varialbes
DATA: g_sc_no(20) TYPE c, " To combine the SAP & Legacy Customer No
g_user_name(92) TYPE c. " To concatnate the Userid and User Name.
DATA : tb_repid LIKE trdir-name.
tb_repid = 'Y56098RDUP_LIST'.
*tb-repid type sy-repid.
DATA: BEGIN OF tb_user OCCURS 0,
user_id LIKE ztril_logtable-user_id,
END OF tb_user.
To get the P_USERID F4 Functionality for LOW and HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_userid-low.
SELECT user_id FROM ztril_logtable INTO TABLE tb_user.
SORT tb_user.
DELETE ADJACENT DUPLICATES FROM tb_user.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_USERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_USERID'
value_org = 'S'
TABLES
value_tab = tb_user
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e210(zsd).
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_userid-high.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_USERID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_USERID'
value_org = 'S'
TABLES
value_tab = tb_user
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e210(zsd).
ENDIF.
At selection screen event.
AT SELECTION-SCREEN.
Validation of User_id(USER_ID) & Reason Type(REASON_CODE)
PERFORM checking_user_id.
Validation of Reason type from the table ZREASONCODES
PERFORM check_reasontype.
Validation of Reason code from the table ZREASONCODES
PERFORM check_reasoncode.
Validation for checking From-Date
PERFORM checking_from_date.
Validation for checking To-Date
PERFORM checking_to_date.
Start of selection event.
START-OF-SELECTION.
REFRESH data & clear data.
PERFORM refresh_tables.
Get ZTRIL_LOGTABLE Data.
PERFORM get_tril_logtable.
Get data from ZREASONCODE.
PERFORM get_reasoncode_data.
Get the data Customer No from ZSDCUSTREF based on ZTRIL_LOGTABLE-KUNNR
PERFORM get_sdcustrefdata.
Get the data First Name and Last Name
PERFORM get_data_from_usr21_adrp.
Updateing the output internal table i.e. IT_OUTPUT data
PERFORM fill_output_data.
Displaying output data with two different Rows.
PERFORM output_data.
Populate the field catelog.
PERFORM build_fieldcatlog.
Declartion Events.
PERFORM event_call.
Top of page Information
PERFORM top_of_page.
Declation of Layout
PERFORM layout USING tb_layout.
To get the Output Format( Simple List/ ALV )
PERFORM grid_display.
*& Form get_tril_logtable
To get the data from table ztril_logtable
FORM get_tril_logtable.
REFRESH: tb_output.
Reading data from the table ZTRIL_LOGTABLE
SELECT user_id
role "Role
kunnr "Customer Number 1
customer_name "Customer Name
stras "Street Address
ort01 "City
regio "State
pstlz "Postal Code
land1 "COUNTRY CODE
po_box "PO Box Number
tril_po_postal "PO BOX Postal Code
tril_err_msg "Error Message
reason_type "Reason Type
reason_code "Reason Code
perc_prob
pattern_number
FROM ztril_logtable INTO
CORRESPONDING FIELDS OF
TABLE tb_output
WHERE
( curr_date GE p_frmdat AND curr_date LE p_to_dat )
( curr_date BETWEEN p_frmdat AND p_to_dat )
AND
user_id IN s_userid
AND reason_code IN s_r_code
AND reason_type IN s_r_type.
IF sy-subrc NE 0.
MESSAGE i202(zsd).
ENDIF.
ENDFORM. " get_tril_logtable
*& Form get_reasoncode_data
To get the Reason code and Reason type
FORM get_reasoncode_data .
checking internal table initial data.
IF NOT tb_output[] IS INITIAL.
SELECT reason_type
reason_code
reason_desc
FROM zreasoncodes
INTO CORRESPONDING FIELDS OF TABLE tb_reasoncodes
WHERE reason_type IN s_r_type
AND reason_code IN s_r_code.
ENDIF.
ENDFORM. " get_reasoncode_data
*& Form get_sdcustrefdata
To get the legasy customer number data
FORM get_sdcustrefdata .
IF NOT tb_output[] IS INITIAL.
SELECT zlkunnr " Legacy Customer No
zlsourc " Legacy customer source code
kunnr " Customer No
FROM zsdcustxref INTO TABLE tb_zsdcustxref
FOR ALL ENTRIES IN tb_output
WHERE kunnr EQ tb_output-kunnr.
ENDIF.
ENDFORM. " get_sdcustrefdata
*& Form fill_output_data
To get the final data into the Internal Table
FORM fill_output_data .
IF NOT tb_output[] IS INITIAL.
SORT tb_output BY role user_id.
LOOP AT tb_output INTO wa_output.
READ TABLE tb_reasoncodes INTO wa_reasoncodes
WITH KEY
reason_type = wa_output-reason_type
reason_code = wa_output-reason_code BINARY SEARCH.
IF sy-subrc EQ 0.
wa_output-reason_desc = wa_reasoncodes-reason_desc.
CLEAR wa_reasoncodes.
ENDIF.
READ TABLE tb_zsdcustxref INTO wa_zsdcustxref
WITH KEY
kunnr = wa_output-kunnr.
IF sy-subrc EQ 0.
CONCATENATE wa_zsdcustxref-zlkunnr
wa_zsdcustxref-zlsourc
INTO
g_sc_no SEPARATED BY ' - '.
wa_output-saplegcustno1 = wa_zsdcustxref-zlkunnr.
wa_output-saplegcustno1 = g_sc_no.
ELSE.
wa_output-saplegcustno = wa_output-kunnr.
CLEAR: wa_reasoncodes,g_sc_no.
ENDIF.
READ TABLE tb_usr21 INTO wa_usr21 WITH KEY bname = wa_output-user_id.
IF sy-subrc EQ 0.
CONCATENATE wa_usr21-bname
CONCATENATE wa_usr21-name_first
wa_usr21-name_last
INTO
g_user_name SEPARATED BY space.
wa_output-user_id_name = g_user_name.
ENDIF.
MODIFY tb_output FROM wa_output
TRANSPORTING
reason_desc
saplegcustno
user_id_name
saplegcustno1.
CLEAR: g_user_name,wa_usr21, wa_adrp.
ENDLOOP.
ENDIF.
ENDFORM. " fill_output_data
*& Form get_data_from_USR21_ADRP
To get the first name and last name from ADRP table
FORM get_data_from_usr21_adrp .
IF NOT tb_output[] IS INITIAL.
SELECT bname
persnumber
FROM usr21
INTO CORRESPONDING FIELDS OF TABLE tb_usr21
FOR ALL ENTRIES IN tb_output
WHERE bname EQ tb_output-user_id.
IF NOT tb_usr21[] IS INITIAL.
SELECT persnumber
name_first
name_last
FROM adrp INTO TABLE tb_adrp
FOR ALL ENTRIES IN tb_usr21
WHERE persnumber EQ tb_usr21-persnumber.
ENDIF.
ENDIF.
LOOP AT tb_usr21 INTO wa_usr21.
READ TABLE tb_adrp INTO wa_adrp WITH KEY persnumber = wa_usr21-persnumber.
IF sy-subrc EQ 0.
wa_usr21-name_first = wa_adrp-name_first.
wa_usr21-name_last = wa_adrp-name_last.
CLEAR wa_adrp.
MODIFY tb_usr21 FROM wa_usr21 TRANSPORTING name_first name_last.
ENDIF.
ENDLOOP.
ENDFORM. " get_data_from_USR21_ADRP
*& Form build_fieldcatlog
It is used to build the fieldcatlog
FORM build_fieldcatlog .
wa_fieldcat-col_pos = 1.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'USER_ID'.
wa_fieldcat-seltext_l = 'Requestor ID'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'USER_ID_NAME'.
wa_fieldcat-seltext_l = 'Requestor Name'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'SAPLEGCUSTNO'.
wa_fieldcat-seltext_l = 'SAP & Legacy Customer No'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'CUSTOMER_NAME'.
wa_fieldcat-seltext_m = 'Customer Name'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 5.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'STRAS'.
wa_fieldcat-seltext_m = 'Street Address'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 6.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_m = 'City'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 7.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REGIO'.
wa_fieldcat-seltext_m = 'State'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 8.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PSTLZ'.
wa_fieldcat-seltext_m = 'Postal Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 9.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'LAND1'.
wa_fieldcat-seltext_m = 'Country Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 10.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PO_BOX'.
wa_fieldcat-seltext_m = 'PO BOX NO'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 11.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'TRIL_PO_POSTAL'.
wa_fieldcat-seltext_m = 'PO Box Postal Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 12.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_TYPE'.
wa_fieldcat-seltext_m = 'Reason Type'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 13.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_CODE'.
wa_fieldcat-seltext_m = 'Reason Code'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 14.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'REASON_DESC'.
wa_fieldcat-seltext_m = 'Reason Description'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 15.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PERC_PROB'.
wa_fieldcat-seltext_m = 'TOP %'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 16.
wa_fieldcat-tabname = 'TB_FILL_DATA'.
wa_fieldcat-fieldname = 'PATTERN_NUMBER'.
wa_fieldcat-seltext_m = 'Match Pattern'.
wa_fieldcat-input = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-datatype = 'N'.
APPEND wa_fieldcat TO tb_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form event_call
It is used to call the events
FORM event_call .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = tb_events
EXCEPTIONS
list_type_wrong = 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. " event_call
*& Form grid_display
To display the output in ALV Grid format
FORM grid_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = tb_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
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 = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = wb_layout
it_fieldcat = tb_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = tb_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 = tb_output
t_outtab = tb_fill_output
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. " grid_display
*& Form top_of_page
It is used to display the Top-of-page
FORM top_of_page .
CLEAR: wa_line, tb_list_header[].
wa_line-typ = 'H'.
wa_line-info = 'Duplicates Ignored by Requestor Report'.
APPEND wa_line TO tb_list_header.
CLEAR wa_line.
wa_line-typ = 'S'.
WRITE p_frmdat TO g_date1 DD/MM/YY.
WRITE p_to_dat TO g_date2 DD/MM/YY.
CONCATENATE 'From Date : ' g_date1 ' To Date : ' g_date2
INTO g_date3 SEPARATED BY space .
wa_line-info = g_date3.
APPEND wa_line TO tb_list_header.
CLEAR wa_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = tb_list_header.
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. " top_of_page
*& Form layout
It is used to display the output layout
FORM layout USING p_tb_layout.
tb_layout-detail_popup = 'X'.
tb_layout-colwidth_optimize = 'X'.
ENDFORM. " layout
*& Form refresh_tables
TO Refresh the internal table workarea
FORM refresh_tables .
REFRESH: tb_output, tb_reasoncodes, tb_zsdcustxref, tb_usr21, tb_fill_output.
CLEAR: wa_output, wa_reasoncodes, wa_zsdcustxref, wa_usr21, wa_fill_output.
ENDFORM. " refresh_tables
*& Form SET_PF_STATUS
It is used to populate the PF_STATUS
FORM set_pf_status USING tb_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. " SET_PF_STATUS
*& Form USER_COMMAND
To avoid the shortdump of ALV Report
FORM user_command USING rf_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM. "user_command
*& Form check_reasoncode
Checking Reason Code
FORM check_reasoncode .
IF NOT s_r_type IS INITIAL.
SELECT SINGLE reason_code FROM zreasoncodes INTO s_r_code
WHERE reason_type IN s_r_type
AND reason_code IN s_r_code.
IF sy-subrc NE 0.
SET CURSOR FIELD 'S_R_CODE-LOW'.
MESSAGE e204(zsd).
ELSEIF s_r_code = 'TP'.
MESSAGE e208(zsd).
ENDIF.
ENDIF.
ENDFORM. " check_reasoncode
*& Form check_reasontype
Checking Reason Type
FORM check_reasontype .
IF s_r_type-low = 'TP' OR
s_r_type-high = 'TP'.
MESSAGE e208(zsd).
ENDIF.
SELECT SINGLE reason_type FROM zreasoncodes INTO s_r_type
WHERE reason_type IN s_r_type.
IF sy-subrc NE 0.
MESSAGE e201(zsd).
ENDIF.
ENDFORM. " check_reasontype
*& Form checking_From_date
Checking From Date
FORM checking_from_date .
SELECT SINGLE
curr_date
FROM ztril_logtable
INTO ztril_logtable-curr_date
WHERE curr_date EQ p_frmdat.
IF sy-subrc NE 0.
MESSAGE e205(zsd).
ENDIF.
ENDFORM. " checking_From_date
*& Form checking_To_date
Checking To_date
FORM checking_to_date .
SELECT SINGLE
curr_date
FROM ztril_logtable
INTO ztril_logtable-curr_date
WHERE curr_date EQ p_to_dat.
IF sy-subrc NE 0.
MESSAGE e206(zsd).
elseif p_frmdat lt p_to_dat.
Message e209(zsd).
ELSEIF p_frmdat GT p_to_dat.
MESSAGE e207(zsd).
ENDIF.
ENDFORM. " checking_To_date
*& Form checking_user_id
text
FORM checking_user_id .
SELECT SINGLE user_id
FROM ztril_logtable
INTO s_userid
WHERE user_id IN s_userid.
IF sy-subrc NE 0.
MESSAGE e200(zsd).
ENDIF.
ENDFORM. " checking_user_id
*& Form output_data
To print the Legacy customer No and SAP no into two different rows.*
FORM output_data .
LOOP AT tb_output INTO wa_output.
wa_fill_output-user_id = wa_output-user_id.
wa_fill_output-role = wa_output-role.
wa_fill_output-saplegcustno = wa_output-kunnr.
wa_fill_output-user_id_name = wa_output-user_id_name.
wa_fill_output-customer_name = wa_output-customer_name.
wa_fill_output-stras = wa_output-stras.
wa_fill_output-ort01 = wa_output-ort01.
wa_fill_output-regio = wa_output-regio.
wa_fill_output-pstlz = wa_output-pstlz.
wa_fill_output-land1 = wa_output-land1.
wa_fill_output-po_box = wa_output-po_box.
wa_fill_output-tril_po_postal = wa_output-tril_po_postal.
wa_fill_output-tril_err_msg = wa_output-tril_err_msg.
wa_fill_output-reason_type = wa_output-reason_type.
wa_fill_output-reason_code = wa_output-reason_code.
wa_fill_output-country_code = wa_output-country_code.
wa_fill_output-reason_desc = wa_output-reason_desc.
wa_fill_output-pattern_number = wa_output-pattern_number.
wa_fill_output-perc_prob = wa_output-perc_prob.
CLEAR: wa_output-user_id,
wa_output-role,
wa_output-kunnr,
wa_output-user_id_name,
wa_output-stras,
wa_output-ort01,
wa_output-regio,
wa_output-pstlz,
wa_output-land1,
wa_output-po_box,
wa_output-tril_po_postal,
wa_output-tril_err_msg,
wa_output-reason_type,
wa_output-reason_code,
wa_output-country_code,
wa_output-reason_desc,
wa_output-customer_name,
wa_output-pattern_number,
wa_output-perc_prob.
APPEND wa_fill_output TO tb_fill_output.
IF NOT wa_output-saplegcustno1 IS INITIAL.
CLEAR: wa_fill_output-user_id,
wa_fill_output-role,
wa_fill_output-kunnr,
wa_fill_output-user_id_name,
wa_fill_output-stras,
wa_fill_output-ort01,
wa_fill_output-regio,
wa_fill_output-pstlz,
wa_fill_output-land1,
wa_fill_output-po_box,
wa_fill_output-tril_po_postal,
wa_fill_output-tril_err_msg,
wa_fill_output-reason_type,
wa_fill_output-reason_code,
wa_fill_output-country_code,
wa_fill_output-reason_desc,
wa_fill_output-customer_name,
wa_fill_output-pattern_number,
wa_fill_output-perc_prob.
wa_fill_output-saplegcustno = wa_output-saplegcustno1.
APPEND wa_fill_output TO tb_fill_output.
CLEAR: wa_output.
ENDIF.
ENDLOOP.
ENDFORM. " output_data -
CRM Ibase Component Warranty Details....Very Very Urgent
I have created a component in an ibase using the fm CRM_ICSS_CREATE_COMPONENT and added the warranty details using the fm CRM_IBCWTY_IL_API_CREATE. Now i need to update the counter and Qualification Requirement in the component relationships.
Can anyone help me in this.
It is very urgent....
Edited by: Bharath Srinivas on Apr 17, 2008 5:20 PM
Edited by: Bharath Srinivas on Apr 17, 2008 5:43 PMHere you go :-
Use method ENLARGE_COMPONENT_DATA.
Create warranty link
DATA: it_interlinkage_to_create TYPE crmt_il_ibcwty_maint_ext_tab,
is_interlinkage_to_create TYPE crmt_il_ibcwty_maint_ext,
lv_object_guid TYPE comt_product_guid,
lv_object_reference TYPE crmt_il_wty_reference,
ls_prwty TYPE crmm_prwty,
ls_product_id TYPE comt_product_id,
ls_warranty_guid TYPE comt_product_guid.
ls_product_id = 'STD_WAR_1Y'. "Default warranty product
SELECT SINGLE product_guid FROM comm_product INTO ls_warranty_guid
WHERE product_id = ls_product_id.
is_interlinkage_to_create-warranty_guid = ls_warranty_guid.
is_interlinkage_to_create-start_date = ls_comp_det3-valfr.
is_interlinkage_to_create-end_date = ls_comp_det3-valto .
is_interlinkage_to_create-determine_dates = 'X'.
INSERT is_interlinkage_to_create INTO TABLE it_interlinkage_to_create.
lv_object_reference = '02'.
LOOP AT it_ibap_struc1_tab INTO is_ibap_struc1_tab.
lv_object_guid = is_ibap_struc1_tab-guid_compc.
ENDLOOP.
DATA: it_messages TYPE comt_il_error_tab,
it_interlinkage TYPE crmt_il_data_ibcwty_tab.
CALL FUNCTION 'CRM_IBCWTY_IL_API_CREATE'
EXPORTING
iv_object_guid = lv_object_guid
iv_object_reference = lv_object_reference
iv_timestamp = l_timestamp
iv_enqmode = 'E'
iv_raise_exception = 'X'
iv_save = 'X'
it_interlinkage_to_create = it_interlinkage_to_create
IMPORTING
et_messages = it_messages
et_interlinkage = it_interlinkage
EXCEPTIONS
error_occurred = 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. -
Passing parameter from Servlet to javascript in JSP. Very Urgent - 5 jukes!
Well my servlet will retrieve questions from database.
Then the player will answer the question in the JSP and submit the answer to the servlet to process.
Each time an answer is submitted, or a "Next Question" button is clicked, the countdown time will restart.
And will reload the page with a new question.
So how can i do that?
This is my servlet, JSP, javascript
=====================================================================
* Interacts with the player depending on his types of selection and output them
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class GameQuestionServlet extends HttpServlet
String sSQL = null;
String sCategory = null;
String paramName = null;
User userObject = null;
Questions gameQsObj = new Questions();
HttpSession session;
int cnt = -1;
int score = 0;
boolean connected = false;
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
session = request.getSession(false);
//System.out.println("Testing Score:" + score);
if(connected == true)
Questions object = (Questions)gameQsObj.getQsList().elementAt(cnt);
System.out.println("\n" + object.sAns1);
System.out.println(object.sAns2);
System.out.println(object.sAns3 + "\n");
Enumeration enum = request.getParameterNames();
while(enum.hasMoreElements())
paramName = (String)enum.nextElement();
if(paramName.equals("mcq"))
System.out.println(request.getParameter("mcq"));
score = Integer.parseInt(userObject.score.trim());
System.out.println("Player old score: " + score);
//Check to see if the selected answer matches the correct answer
if((object.sCorrect).equals(request.getParameter("mcq")))
score = score + 10;
else
if((object.sCorrect).equals(request.getParameter("mcq")))
score = score + 10;
else
if((object.sCorrect).equals(request.getParameter("mcq")))
score = score + 10;
else
score = score - 10;
System.out.println("Player current score: " + score);
else //will only go into this once
userObject = (User)session.getAttribute("user");
System.out.println("\n"+userObject.nric);
System.out.println(userObject.name);
System.out.println(userObject.password);
System.out.println(userObject.email);
System.out.println(userObject.score+"\n");
//depending on user selection
sCategory = request.getParameter("qsCategory");
sSQL = "SELECT * FROM " + sCategory;
gameQsObj.getQuestions(sSQL, sCategory);
score = Integer.parseInt(userObject.score);
connected = true;
System.out.println("Connected:" + connected);
System.out.println("Before:" + userObject.score);
cnt = cnt + 1; //increment to retrieve next question
userObject.score = Integer.toString(score);
System.out.println("After:" + userObject.score);
if(cnt < 3) //setting for the number of questions per game.
//request.setAttribute("qsCnt", cnt); //count of the question number
request.setAttribute("aQs", gameQsObj.getQsList().elementAt(cnt));
System.out.println(request.getAttribute("aQs"));
System.out.println("This is question number: "+ cnt);
getServletConfig().getServletContext().getRequestDispatcher("/JSP/PlayGame.jsp").forward(request, response);
else
//forward to the result page
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
<%@ page import="Questions" %>
<HTML>
<HEAD>
<TITLE>Play Game</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var refreshinterval=10
var displaycountdown="yes"
var starttime
var nowtime
var reloadseconds=0
var secondssinceloaded=0
function starttime() {
starttime=new Date()
starttime=starttime.getTime()
countdown()
function countdown() {
nowtime= new Date()
nowtime=nowtime.getTime()
secondssinceloaded=(nowtime-starttime)/1000
reloadseconds=Math.round(refreshinterval-secondssinceloaded)
if (refreshinterval>=secondssinceloaded) {
var timer=setTimeout("countdown()",1000)
if (displaycountdown=="yes") {
window.status="You have "+reloadseconds+ " second before timeout"
else {
hide();
clearTimeout(timer)
//window.location.reload(true)
function hide() {
//hidelayer
if(gameLayers.style.visibility == "visible"){
gameLayers.style.visibility = "hidden"
oops.style.visibility = "show"
window.onload=starttime
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD="post" ACTION="http://localhost:8080/Java_Assignment2/servlet/GameQuestionServlet">
<DIV ID="oops" STYLE="position:absolute; left:300px; top:30px; width:120px; height:150px; z-index:2; visibility:hidden">
Oops! 30 seconds time up!!! <BR><BR>
<INPUT TYPE="submit" VALUE="Next Question">
<INPUT TYPE="hidden" NAME="nextQs" VALUE="Next Question">
</DIV>
<DIV ID="gameLayers" STYLE="position:absolute; left:300px; top:30px; width:120px; height:150px; z-index:3; visibility:show">
<TABLE BORDER="0">
<TR>
<TH><BIG>Questions:</BIG></TH>
</TR>
<%
Questions aQsObj = (Questions)request.getAttribute("aQs");
String aQsBody = aQsObj.sQs;
String aQsAns1 = aQsObj.sAns1;
String aQsAns2 = aQsObj.sAns2;
String aQsAns3 = aQsObj.sAns3;
%>
<TR>
<TD><B><%= aQsBody%></B></TD>
</TR>
<TR>
<TD>
<SELECT SIZE="3" NAME="mcq">
<OPTION SELECTED><%= aQsAns1 %></OPTION>
<OPTION><%= aQsAns2 %></OPTION>
<OPTION><%= aQsAns3 %></OPTION>
</SELECT><BR><BR>
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="submit" VALUE="Submit Your Answer">
<INPUT TYPE="hidden" NAME="submitAns" VALUE="Submit Your Answer">
</TD>
</TR>
</TABLE>
</DIV>
</FORM>
</BODY>
</HTML>
This must be answered before 28th of september.
Please help. It is indeed very urgent.this is just a skeleton code.. alot of stuff is not here..
<FORM name = "form1" action="../servlet/wateverSevlet>
<input type="text" name="searchStr" size="40">
<INPUT type="hidden" id=answer name=answer size=7>
<input type="button" name="button" value="Submit Answer" onClick="javascript:submitCheck(document.form1.searchStr.value);">
<input type="button" name="button" value="Skip Question" onClick="javascript:submitCheck('skip');">
</form>
<SCRIPT LANGUAGE="JavaScript">
function submitCheck(str)
form1.answer.value = str
form1.submit()
</script>i assuming you are submitting it to the same servlet regardless of whether the user clicks the skip question or the submit question button. -
Delete data dynamically with JSP and servlet (Very Urgent)
Hi,
I am new with servlets and JSP. On my jsp page I am populating customer names in a drop box from database and I have 3 buttons ADD, DELETE and EDIT.
Now when I press DELETE buttong I am calling delete function which is writen in Javascript on my jsp file only,now I want to pass these selcted values ehich I have stored in an array to be pass to servlet,so I can write Delete query for it and delete.
Could anyone help with sample code>
Here what I am trying to say:
<HTML>
<HEAD>
<script language="JavaScript" type="text/javascript">
<!--
function remove()
var u = confirm("Are you sure you want to Delete Selected names?")
if (u==true)
var selectedArray = new Array();
var selObj = document.getElementById('CUSTOMER_NAME');
var i;
var count = 0;
for (i=0; i<selObj.options.length; i++) {
if (selObj.options.selected) {
selectedArray[count] = selObj.options[i].value;
count++;
alert("names to be deleted are:"+selectedArray);
// selectedArray has the selected items stored
alert("Items Deleted!")
else
alert("No data were deleted!!You pressed Cancel!")
//-->
</script>
</HEAD>
<BODY>
//calling servlet on action tag of form
<FORM METHOD= 'POST' ACTION='Remove_Customer'>
<form ><INPUT TYPE='submit' NAME='DELETE' VALUE='DELETE' onclick="remove()"></TD></form>
<form><INPUT TYPE='submit' NAME='MODIFY' VALUE='MODIFY' onclick="modification()" ></TD></form>
</BODY>
</HTML>
PLEASE HELPME,it's very urgent.
Since the selected Array is in javascrip language , I don't know how can I pass that to servlet.
request.getParameter is not working,since it's an array
Many thanks in Advance.Hey,
I am having problem deleting multiple values.
If I just select one value,it deletes it
But for multiple values the code is not working right.
If there 2 values selcted then the last value gets deleted,if there are more than 2 values selected none values delete.
Could plese check the code,and let meknow what mistake am I doing?
Please help
String delName="";
int pos = tStr.indexOf(",");
System.out.println(pos);
if (pos != -1)
delName = tStr.substring(0, tStr.indexOf(","));
tStr = tStr.substring(tStr.indexOf(",") + 1 );
System.out.println("DElName:"+delName);
System.out.println("tStr::"+tStr);
delName = tStr;
delete_Customer(delName);
Thanks
ASH -
Error while opening a module. plz help me, very urgent.
when i try to open a module, the following error message appears on my screen.
" no j2ee component found in d:\krisp\programs\servlets".
i've installed bea in c: drive and my servlet program is in d: drive.
plz help me, it's very urgent.Can you provide some more information? What were you doing when this happened?
Can you post the entire error message?
-- Rob
WLS Blog http://dev2dev.bea.com/blog/rwoollen/ -
Need help, MMC tree got deleted, very urgent.
Hi,
My sap MMC tree, got deleted in the server. I have been trying to restore since 2 days and couldnt succeed, please help me.
1) i have uncared the sapmmc.sar from Kernal\NT\I386\MMC\sapmmc.sar file
2) i got about 7 files, in which there is one sapmmc file i have tried to double click it, n check but no go.
3) i also tried to run the Sapstartsrv.exe file and fill in up the values in pop up window. & filled up the following values :-
SID: DEV
NR: 00
StartProfile: (entire start profile path given)
user: devadm
passwd; (given)
- but it says "the account name is invalid or does not exist or the password is invalid for account name specified"/
- no go in both the cases.
Please need help very urgent.
Regards,
Satish.siva,
I am getting same error since 2 days
SID: DEV
NR: 00
Start Profile: (entire start profile path)
User: <hostname>/devadm
passwd: ****
Error:
cannot install service
create service failed:421
The account name is invalid or doesnot exist, or the passwd is invalid for the account name specified.
Edited by: satish c on Jun 4, 2008 11:12 AM -
How to write code for this logic in a routine, very urgent --help me
hi all,
i want to apply this logic into one subroutin ZABC.
here i m giving my logic ,can any body help me in coding for this, this is very urgent, i hv to submit on wednesday.
4.1 Read the company code number BSEG-BUKRS from document line item.
4.2 Fetch PRDHA from MARA into GV_PRDHA where MATNR = BSEG-MATNR.
4.3 Fetch Business area (GSBER) from ZFIBU into GV_GSBER where (PRDHA = GV_PRDHA and BUKRS = BSEG-BUKRS) OR (PRDHA = GV_PRDHA and BUKRS = SPACE).
4.4 If business area match is found, go to step 3.9. Else continue.
4.5 If BKPF-BLART IN set ZVS_POSDT OR BKPF-XBLNR starts with I0*, execute steps below. Else, go to Step 3.6.
i. MOVE: BSEG-BKURS TO work area field WA_ZFIBUE-BUKRS,
BSEG-MATNR TO work area field WA_ZFIBUE-MATNR,
GV_PRDHA TO work area field WA_ZFIBUE-PRDHA,
BSEG-HKONT TO work area field WA_ZFIBUE-HKONT,
BSEG-GSBER TO work area field WA_ZFIBUE-GSBER,
BSEG-PSWBT TO work area field WA_ZFIBUE-PSWBT,
BKPF-BUDAT TO work area field WA_ZFIBUE-BUDAT,
SY-DATUM TO work area field WA_ZFIBUE-CREDATE,
SY-UZEIT TO work area field WA_ZFIBUE-CRETIME,
Fetch running serial number (WA_ZFIBUE-SERIALNO) from ZFICO. This number will be stored in ZFICO with PARAMTYPE = "BPM030307", SUBTYPE = "ZFIBUE" and KEY1 = "SERIALNO". The actual serial number will be stored in the field VALUE1.
i. Insert WA_ZFIBUE INTO ZFIBUE.
ii. Send email notification to the user (if it is not already sent to user on the same posting date).
Use function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail.
Fetch email address and date of last email from ZFICO. These values will be stored in ZFICO with PARAMTYPE = "BPM030307", SUBTYPE = "EMAIL" and KEY1 = "<USERNAME>". The email address will be stored in the field VALUE1 and posting date in VALUE2. Once mail is sent, VALUE2 is updated with latest posting date (BKPF-BUDAT).
iii. Increment the running serial number and update ZFICO with new serial number.
a. GV_ SERIALNO = WA_ZFIBUE-SERIALNO + 1
b. Update ZFICO Set value1 = GV_SERIALNO
Where PARAMTYPE = "BPM030307" AND
SUBTYPE = "ZFIBUE" AND
KEY1 = "SERIALNO".
iv Move VDFT to BSEG-GSBER.
v. Exit routine.
4.6 Fetch MTART into GV_MTART from MARA where MATNR = BSEG-MATNR.
4.7 If SY-BATCH = INITIAL AND GV_MTART <> ROH, issue the error message - Maintain the mapping of product hierarchy <PRDHA> from article <MATNR> for <BUKRS>. Else, go to step 3.8.
4.8 If SY-BATCH <> INITIAL AND GV_MTART <> ROH, issue the error message - Maintain product hierarchy on article master. Go to step 3.10.
4.9 Move GV_GSBER TO BSEG-GSBER.
4.10 Exit Routine
plz give me reply asap --this is very urgent
thanks in advance
swathiHi Swathi,
If it's very very urgent then you better get on with it, don't waste time on the web. Chop chop.
Maybe you are looking for
-
Read lines from text-file in specified [ITEM]
Hello, are there any functions integrated in Labview to read a text-file which looks like this: [ITEM-NAME_01] parameter1 = here parameter2 = 1123 parameter3 = a453 [ITEM-NAME_02] parameter4 = here parameter5 = 1123 parameter6 = a453 Can this be done
-
Can anyone recomend a tutorial video or book for starting with Dreamweaver?
I want to start designing my own webpages, but have zero experience with that. So if anyone could recomend me a good course, either video or book, i would greatly appriciate it! Thanks in advance!
-
Tengo el Photoshop CS3 (Version 10.0) instalado en un MAC (IOS 10.8.5), y al iniciar sesion se aparece el siguiente error (anexo pantalla y la totalidad de la descripcion), ¿Como lo puedo solucionar? Un Saludo Process: Adobe Updater [928] Pat
-
Hi, I have successfully exececute sap rfc from vb and reterive data. But i could not display the download data in table ??? any help Private Sub Command1_Click() Dim SAPFunction As Object ' functions Dim FM As Object ' our func
-
Quicktime quits when I start streaming
Quicktime quits on me whenever I try to open a .mov that streams, whether I open it in Firefox/Safari, or download the .mov file, and open it in Quicktime player. I know the files isn't corrupted b/c it plays on my other mac. Any ideas?