System First Record
Hi all,
begin
FND_MESSAGE.SET_STRING('Pre Calculate');
FND_MESSAGE.SHOW;
go_block(':XX_DISCOUNT_MANAGER_V');
FIRST_RECORD;
WHILE :System.Last_Record <> 'TRUE' --OR :SYSTEM.FIRST_RECORD= 'TRUE')
LOOP
if :XX_DISCOUNT_MANAGER_V.DISCOUNT = 'Y' then
:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE:=(((100-:XX_DISCOUNT_MANAGER_V.DISCOUNT_RATE)/100)*:XX_DISCOUNT_MANAGER_V.LIST_PRICE);
:XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE := (:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
:XX_DISCOUNT_MANAGER_V.NET_PRICE := :XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE;
end if;
--(:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
--:XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE := (:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
NEXT_RECORD;
IF :System.Last_Record = 'TRUE' THEN
if :XX_DISCOUNT_MANAGER_V.DISCOUNT = 'Y' then
:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE:=(((100-:XX_DISCOUNT_MANAGER_V.DISCOUNT_RATE)/100)*:XX_DISCOUNT_MANAGER_V.LIST_PRICE);
:XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE := (:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
:XX_DISCOUNT_MANAGER_V.NET_PRICE := :XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE;
--(:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
end if;
EXIT;
END IF;
END LOOP;
end;
This is the code i have used ,if i have multiple records i can do this operation.If i have multiple records i can do the operations,if there is one record means i'm unable to do this operation.
I also want the cursor should be in the slected record.Itis very urget can any one help me in this issue...
Regards
Siva
Siva,
I think this is what you want:
begin
FND_MESSAGE.SET_STRING('Pre Calculate');
FND_MESSAGE.SHOW;
go_block(':XX_DISCOUNT_MANAGER_V');
FIRST_RECORD;
WHILE :System.Last_Record <> 'TRUE' --OR :SYSTEM.FIRST_RECORD= 'TRUE')
LOOP
if :XX_DISCOUNT_MANAGER_V.DISCOUNT = 'Y' then
:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE:=(((100-:XX_DISCOUNT_MANAGER_V.DISCOUNT_RATE)/100)*:XX_DISCOUNT_MANAGER_V.LIST_PRICE);
:XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE := (:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
:XX_DISCOUNT_MANAGER_V.NET_PRICE := :XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE;
end if;
--(:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
--:XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE := (:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
NEXT_RECORD;
END LOOP;
/* Process last record */
if :XX_DISCOUNT_MANAGER_V.DISCOUNT = 'Y' then
:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE:=(((100-:XX_DISCOUNT_MANAGER_V.DISCOUNT_RATE)/100)*:XX_DISCOUNT_MANAGER_V.LIST_PRICE);
:XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE := (:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
:XX_DISCOUNT_MANAGER_V.NET_PRICE := :XX_DISCOUNT_MANAGER_V.EXTENDED_PRICE;
--(:XX_DISCOUNT_MANAGER_V.OVERRIDE_UNIT_PRICE)*(:XX_DISCOUNT_MANAGER_V.QUANTITY);
end if;
end;
Only thing you should probably add is a check to see id the record is empty (no record in the block).
Grtz
Bram Schiltmans
Similar Messages
-
How to skip first record while inserting data from a flat file to BW system
Hi Experts,
In my project we have to upload flat file into a BW system. I have written a program and it is working fine.
Now we have got another requirement. The flat file will have a header record (first row). While uploading the flat file we have to skip this record. How I can do so?
The code is as below:
FORM upload1.
DATA : wf_title TYPE string,
lt_filetab TYPE filetable,
l_separator TYPE char01,
l_action TYPE i,
l_count TYPE i,
ls_filetab TYPE file_table,
wf_delemt TYPE rollname,
wa_fieldcat TYPE lvc_s_fcat,
tb_fieldcat TYPE lvc_t_fcat,
rows_read TYPE i,
p_error TYPE char01,
l_file TYPE string.
DATA: wf_object(30) TYPE c,
wf_tablnm TYPE rsdchkview.
wf_object = 'myprogram'.
DATA i TYPE i.
DATA:
lr_mdmt TYPE REF TO cl_rsdmd_mdmt,
lr_mdmtr TYPE REF TO cl_rsdmd_mdmtr,
lt_idocstate TYPE rsarr_t_idocstate,
lv_subrc TYPE sysubrc.
TYPES : BEGIN OF test_struc,
/bic/myprogram TYPE /bic/oimyprogram,
txtmd TYPE rstxtmd,
END OF test_struc.
DATA : tb_assum TYPE TABLE OF /bic/pmyprogram.
DATA: wa_ztext TYPE /bic/tmyprogram,
myprogram_temp TYPE ziott_assum,
wa_myprogram TYPE /bic/pmyprogram.
DATA : test_upload TYPE STANDARD TABLE OF test_struc,
wa2 TYPE test_struc.
DATA : wa_test_upload TYPE test_struc,
ztable_data TYPE TABLE OF /bic/pmyprogram,
ztable_text TYPE TABLE OF /bic/tmyprogram,
wa_upld_text TYPE /bic/tmyprogram,
wa_upld_data TYPE /bic/pmyprogram,
t_assum TYPE ziott_assum.
DATA : wa1 LIKE test_upload.
wf_title = text-026.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = wf_title
default_extension = 'txt'
file_filter = 'Tab delimited Text Files (*.txt)'
CHANGING
file_table = lt_filetab
rc = l_count
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
OTHERS = 3. "#EC NOTEXT
IF sy-subrc <> 0.
EXIT.
ENDIF.
LOOP AT lt_filetab INTO ls_filetab.
l_file = ls_filetab.
ENDLOOP.
CHECK l_action = 0.
IF l_file IS INITIAL.
EXIT.
ENDIF.
l_separator = 'X'.
wa_fieldcat-fieldname = 'test'.
wa_fieldcat-dd_roll = wf_delemt.
APPEND wa_fieldcat TO tb_fieldcat.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
CLEAR wa_test_upload.
Upload file from front-end (PC)
File format is tab-delimited ASCII
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
has_field_separator = l_separator
TABLES
data_tab = i_mara
data_tab = test_upload
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
EXIT.
ELSE.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
IF test_upload IS NOT INITIAL.
DESCRIBE TABLE test_upload LINES rows_read.
CLEAR : wa_test_upload,wa_upld_data.
LOOP AT test_upload INTO wa_test_upload.
CLEAR : p_error.
rows_read = sy-tabix.
IF wa_test_upload-/bic/myprogram IS INITIAL.
p_error = 'X'.
MESSAGE s153 WITH wa_test_upload-/bic/myprogram sy-tabix.
CONTINUE.
ELSE.
TRANSLATE wa_test_upload-/bic/myprogram TO UPPER CASE.
wa_upld_text-txtmd = wa_test_upload-txtmd.
wa_upld_text-txtsh = wa_test_upload-txtmd.
wa_upld_text-langu = sy-langu.
wa_upld_data-chrt_accts = 'xyz1'.
wa_upld_data-co_area = '12'.
wa_upld_data-/bic/zxyzbcsg = 'Iy'.
wa_upld_data-objvers = 'A'.
wa_upld_data-changed = 'I'.
wa_upld_data-/bic/zass_mdl = 'rrr'.
wa_upld_data-/bic/zass_typ = 'I'.
wa_upld_data-/bic/zdriver = 'yyy'.
wa_upld_text-langu = sy-langu.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_data.
MOVE-CORRESPONDING wa_test_upload TO wa_upld_text.
APPEND wa_upld_data TO ztable_data.
APPEND wa_upld_text TO ztable_text.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ztable_data.
DELETE ADJACENT DUPLICATES FROM ztable_text.
IF ztable_data IS NOT INITIAL.
CALL METHOD cl_rsdmd_mdmt=>factory
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_r_mdmt = lr_mdmt
EXCEPTIONS
invalid_iobjnm = 1
OTHERS = 2.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
**Lock the Infoobject to update
CALL FUNCTION 'RSDG_IOBJ_ENQUEUE'
EXPORTING
i_objnm = wf_object
i_scope = '1'
i_msgty = rs_c_error
EXCEPTIONS
foreign_lock = 1
sys_failure = 2.
IF sy-subrc = 1.
MESSAGE i107(zddd_rr) WITH wf_object sy-msgv2.
EXIT.
ELSEIF sy-subrc = 2.
MESSAGE i108(zddd_rr) WITH wf_object.
EXIT.
ENDIF.
*****Update Master Table
IF ztable_data IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'M'
I_T_ATTR = lt_attr
TABLES
i_t_table = ztable_data
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '054'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
MESSAGE e054(zddd_rr) WITH 'myprogram'.
ELSE.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'S'
txtnr = '053'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
*endif.
*****update Text Table
IF ztable_text IS NOT INITIAL.
CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
EXPORTING
i_iobjnm = 'myprogram'
i_tabclass = 'T'
TABLES
i_t_table = ztable_text
EXCEPTIONS
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'zddd_rr'
msgty = 'E'
txtnr = '055'
msgv1 = text-033
EXCEPTIONS
OTHERS = 3.
ENDIF.
ENDIF.
ELSE.
MESSAGE s178(zddd_rr).
ENDIF.
ENDIF.
COMMIT WORK.
CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'
EXPORTING
i_chabasnm = 'myprogram'
IMPORTING
e_chktab = wf_tablnm
EXCEPTIONS
name_error = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
****Release locks on Infoobject
CALL FUNCTION 'RSDG_IOBJ_DEQUEUE'
EXPORTING
i_objnm = 'myprogram'
i_scope = '1'.
ENDIF.
ENDIF.
PERFORM data_selection .
PERFORM update_alv_grid_display.
CALL FUNCTION 'MESSAGES_SHOW'.
ENDFORM.
Please let me know how I can skip first record of the flat file?
Regards,
Sgo through this hope u can get some idea
REPORT ztest no standard page heading line-size 255.
Declaration *
TYPES t_itab1 TYPE alsmex_tabline.
types: begin of t_csks,
kostl like csks-kostl,
end of t_csks.
types: begin of t_cska,
kstar like cska-kstar,
end of t_cska.
data: begin of t_flatfile,
docdate like COHEADER-BLDAT,
postdate like COHEADER-BUDAT,
doctext like COHEADER-BLTXT,
costele like RK23F-KSTAR,
amount like RK23F-WTGBTR,
scostctr like RK23F-SKOSTL,
rcostctr like RK23F-EKOSTL,
rintorder like RK23F-EAUFNR,
end of t_flatfile.
data: begin of t_flatfile1,
docdate like COHEADER-BLDAT,
postdate like COHEADER-BUDAT,
doctext like COHEADER-BLTXT,
costele like RK23F-KSTAR,
amount like RK23F-WTGBTR,
scostctr like RK23F-SKOSTL,
rcostctr like RK23F-EKOSTL,
rintorder like RK23F-EAUFNR,
NUM LIKE SY-INDEX,
end of t_flatfile1.
data: itab like table of t_flatfile with header line.
data: itab2 like table of t_flatfile1 with header line.
DATA: it_itab1 TYPE STANDARD TABLE OF t_itab1 WITH HEADER LINE,
MESSTAB1 LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE,
MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
data: begin of bdcdata occurs 0.
include structure bdcdata.
data: end of bdcdata.
data:t_lin type i VALUE '0',
u_rec type i VALUE '0',
s_rec type i VALUE '0'.
data: it_csks type standard table of t_csks,
wa_csks type t_csks.
data: it_cska type standard table of t_cska,
wa_cska type t_cska.
*Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
parameters: p_docdat LIKE COHEADER-BLDAT obligatory,
p_postda LIKE COHEADER-BUDAT obligatory,
p_doctxt LIKE COHEADER-BLTXT.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-011.
parameters: p_file LIKE RLGRAP-FILENAME obligatory,
DIS_MODE LIKE CTU_PARAMS-DISMODE DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b2.
A T S E L E C T I O N S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM get_local_file_name USING p_file.
*Start of Selection
START-OF-SELECTION.
Perform get_Excel_data.
perform validate_data.
Perform Process_Data.
end-of-selection
end-of-selection.
perform display_data.
*& Form get_local_file_name
text
-->P_P_FILE text
FORM get_local_file_name USING P_P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.
ENDFORM. " get_local_file_name
*& Form get_Excel_data
text
--> p1 text
<-- p2 text
FORM get_Excel_data .
FIELD-SYMBOLS : <FS>.
DATA : V_INDEX TYPE I.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 2
i_begin_row = 1
i_end_col = 256
i_end_row = 9999 "65536
TABLES
intern = it_itab1
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Message text-013 type 'E'.
ENDIF.
IF IT_ITAB1[] IS INITIAL.
Message text-001 type 'E'.
else. "IF IT_ITAB1[] IS INITIAL.
data: itab2 like itab occurs 0 with header line.
SORT IT_ITAB1 BY ROW COL.
LOOP AT IT_ITAB1.
MOVE :IT_ITAB1-COL TO V_INDEX.
ASSIGN COMPONENT V_INDEX OF STRUCTURE itab2 TO <FS>.
MOVE : IT_ITAB1-VALUE TO <FS>.
AT END OF ROW.
MOVE-CORRESPONDING itab2 TO itab.
APPEND itab.
CLEAR:itab,itab2.
ENDAT.
endloop.
describe table itab lines t_lin.
endif. "IF IT_ITAB1[] IS INITIAL.
ENDFORM. " get_Excel_data
*& Form Process_Data
text
--> p1 text
<-- p2 text
FORM Process_Data .
data:l_tabix type sy-tabix.
data:l_periv like t001-periv,
l_monat like bkpf-monat,
l_gjahr like bkpf-gjahr,
l_amt(21) type c.
data: l_ddate(10),
l_pdate(10).
WRITE p_docdat TO l_ddate.
WRITE p_postda TO l_pdate.
clear: l_periv,l_monat,l_gjahr.
select single periv from t001 into l_periv where bukrs = '5000'. "P_bukrs
if sy-subrc eq 0.
l_gjahr = p_postda+0(4).
call function 'FI_PERIOD_DETERMINE'
EXPORTING
i_budat = p_postda
i_bukrs = '5000' "p_bukrs
i_periv = l_periv
i_gjahr = l_gjahr
IMPORTING
e_monat = l_monat.
clear:l_periv.
endif.
loop at itab2.
refresh:bdcdata.
clear:bdcdata.
l_tabix = sy-tabix.
perform bdc_dynpro using 'SAPLK23F1' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'COHEADER-SEND_REC_REL'
'10SAP'.
perform bdc_field using 'RK23F-STATUS'
'S'.
perform bdc_field using 'COHEADER-BLDAT'
itab-docdate.
l_ddate.
perform bdc_field using 'COHEADER-BUDAT'
itab-postdate.
l_pdate.
perform bdc_field using 'COHEADER-PERIO'
l_monat. "'9'.
perform bdc_field using 'COHEADER-BLTXT'
itab-doctext.
p_doctxt.
perform bdc_field using 'RK23F-KSTAR'
itab2-costele.
WRITE itab2-amount TO l_amt.
l_amt = itab-amount.
condense l_amt no-gaps.
perform bdc_field using 'RK23F-WTGBTR'
l_amt.
itab-amount.
perform bdc_field using 'RK23F-WAERS'
'USD'.
*perform bdc_field using 'RK23F-SGTXT'
itab-doctext.
perform bdc_field using 'RK23F-SKOSTL'
itab2-scostctr.
perform bdc_field using 'BDC_CURSOR'
'RK23F-EAUFNR'.
perform bdc_field using 'RK23F-EKOSTL'
itab2-rcostctr.
perform bdc_field using 'RK23F-EAUFNR'
itab2-rintorder.
perform bdc_dynpro using 'SAPLK23F1' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=POST'.
perform bdc_field using 'COHEADER-SEND_REC_REL'
'10SAP'.
perform bdc_field using 'RK23F-STATUS'
'S'.
perform bdc_field using 'COHEADER-BLDAT'
itab-docdate.
l_ddate.
perform bdc_field using 'COHEADER-BUDAT'
itab-postdate.
l_pdate.
perform bdc_field using 'COHEADER-PERIO'
'9'.
l_monat.
perform bdc_field using 'COHEADER-BLTXT'
itab-doctext.
p_doctxt.
perform bdc_field using 'BDC_CURSOR'
'RK23F-KSTAR'.
perform bdc_field using 'RK23F-WAERS'
'USD'.
CALL TRANSACTION 'KB15N' USING BDCDATA MODE DIS_MODE MESSAGES INTO MESSTAB.
If sy-subrc = 0.
s_rec = s_rec + 1.
ELSE.
u_rec = u_rec + 1.
move ITAB2-NUM to messtab1-msgv1.
concatenate itab2-costele ' | ' itab2-scostctr ' | ' itab2-rcostctr ' | ' itab2-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
endif.
clear:itab2.
endloop.
ENDFORM. " Process_Data
BDC_DYNPRO *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
BDC_FIELD *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ''. "NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
skip 2.
write:/15 text-002.
skip 2.
write:/8 text-003.
SKIP.
write:/12 text-008,
25 P_DOCDAT.
SKIP.
write:/12 text-009,
25 P_POSTDA.
SKIP.
write:/12 text-012,
25 P_DOCTXT.
SKIP.
write:/12 text-004,
25 p_file.
skip 2.
write:/8 text-005,
60 t_lin.
skip.
write:/8 text-006,
60 s_rec.
skip.
write:/8 text-007,
60 u_rec.
skip.
write:/10 'row no',
20 'Information'.
skip.
loop at messtab1.
write:/10 messtab1-msgv1,
20 messtab1-msgv2.
clear:messtab1.
endloop.
ENDFORM. " display_data
*& Form validate_data
text
--> p1 text
<-- p2 text
FORM validate_data .
data: l_tabix1 type sy-tabix.
data: l_tabix2 type sy-tabix.
if not itab[] is initial.
select kostl from CSKS into table it_csks.
if sy-subrc eq 0.
sort it_csks by kostl.
endif.
select kstar from CSKA into table it_cska.
if sy-subrc eq 0.
sort it_cska by kstar.
endif.
loop at itab.
l_tabix1 = sy-tabix.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab-scostctr
IMPORTING
OUTPUT = itab-scostctr .
read table it_csks into wa_csks with key kostl = itab-scostctr.
if sy-subrc ne 0.
u_rec = u_rec + 1.
L_TABIX2 = l_tabix1 + 1.
move l_tabix2 to messtab1-msgv1.
move l_tabix1 to messtab1-msgv1.
move itab-rintorder to messtab1-msgv2.
concatenate itab-costele ' | ' itab-scostctr ' | ' itab-rcostctr ' | ' itab-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
clear:wa_csks.
CLEAR:L_TABIX2.
continue.
endif.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab-rcostctr
IMPORTING
OUTPUT = itab-rcostctr .
read table it_csks into wa_csks with key kostl = itab-rcostctr.
if sy-subrc ne 0.
u_rec = u_rec + 1.
L_TABIX2 = l_tabix1 + 1.
move l_tabix2 to messtab1-msgv1.
move l_tabix1 to messtab1-msgv1.
concatenate itab-costele ' | ' itab-scostctr ' | ' itab-rcostctr ' | ' itab-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
clear:wa_csks.
CLEAR:L_TABIX2.
continue.
endif.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = itab-costele
IMPORTING
OUTPUT = itab-costele .
read table it_cska into wa_cska with key kstar = itab-costele.
if sy-subrc ne 0.
u_rec = u_rec + 1.
L_TABIX2 = l_tabix1 + 1.
move l_tabix2 to messtab1-msgv1.
move l_tabix1 to messtab1-msgv1.
concatenate itab-costele ' | ' itab-scostctr ' | ' itab-rcostctr ' | ' itab-rintorder into messtab1-msgv2.
condense messtab1-msgv2.
condense messtab1-msgv1.
append messtab1.
clear:wa_csks.
CLEAR:L_TABIX2.
continue.
endif.
move-corresponding itab to itab2.
MOVE l_tabix1 TO ITAB2-NUM.
append itab2.
clear: itab2.
clear:itab.
endloop.
else.
message 'No records in File' type 'S'.
endif.
ENDFORM. " validate_data -
First record is not an IDoc control record (check file)
Hi Experts,
I try to build an interface between a non SAP system and a SAP system via IDOC.
I created an .xml test file that I would like to upload now in system with program RSEINB00, but i have error
First record is not an IDoc control record (please check file).
What do I need to do? This is example file I uploaded
?xml version="1.0" encoding="UTF-8"?>
<EXCHANGE_RATE01>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<IDOCTYP>EXCHANGE_RATE01</IDOCTYP>
<MESTYP>EXCHANGE_RATE</MESTYP>
<MESCOD>010</MESCOD>
<SNDPOR>XML_2_IDOC</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>INCENTAGE</SNDPRN>
<RCVPOR>SAPQH3</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>QH3CLNT100</RCVPRN>
<CREDAT>20110526</CREDAT>
<CRETIM>204404</CRETIM>
</EDI_DC40>
<E1ECXHANGE_RATE SEGMENT="1">
<LOG_SYSTEM>QH3CLNT100</LOG_SYSTEM>
<UPD_ALLOW>X</UPD_ALLOW>
<DEV_ALLOW>000</DEV_ALLOW>
<E1BP1093_0 SEGMENT="1">
<RATE_TYPE>RUFX</RATE_TYPE>
<FROM_CURR>USD</FROM_CURR>
<TO_CURRNCY>RUB</TO_CURRNCY>
<VALID_FROM>20120105</VALID_FROM>
<EXCH_RATE>5000</EXCH_RATE>
<FROM_FACTOR>100</FROM_FACTOR>
<TO_FACTOR>1</TO_FACTOR>
<EXCH_RATE_V>0.00000</EXCH_RATE_V>
<FROM_FACTOR_V>0</FROM_FACTOR_V>
<TO_FACTOR_V>0</TO_FACTOR_V>
</E1BP1093_0>
</E1ECXHANGE_RATE>
</ IDOC>
</EXCHANGE_RATE01>
kr,
StefHi Udo,
I thought I posted it in another forum, still not solved.....
kr,
Stef -
First record is not an IDOC control record - Error
When I am trying to import orders in my test system through RSEINB00 , it is giving me this error "First record is not an IDOC control record"
But if I manually do it through test tool , it post successfully.
I tried different files which have been posted into production client successfully but still the same error.
It was working just fine until yesterday. Today I modified one file and ran it and it gave me the error. Now its giving me the error in all the file i try.
Any clues ??Hi,
Please check the partner profile (WE20) and IDoc ports (WE21) setup, perhaps someone changed them by mistake.
Also please check the IDoc file content whether there is IDoc control record (EDIDC) information or not.
Regards,
Ferry Lianto -
Inbound IDOC:First record is not an IDoc control record
Dear Experts,
I am currently testing an inbound IDOC with program RSEINB00. Unfortunatelly I always get the errror "First record is not an IDoc control record (please check file)".
So apparently it picks up the file, but there are some format errors I guess?
Does anybody have an idea what to do?
this is file uplaoded:
<?xml version="1.0" encoding="UTF-8"?>
<EXCHANGE_RATE01>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<IDOCTYP>EXCHANGE_RATE01</IDOCTYP>
<MESTYP>EXCHANGE_RATE</MESTYP>
<MESCOD>010</MESCOD>
<SNDPOR>XML_2_IDOC</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>INCENTAGE</SNDPRN>
<RCVPOR>SAPQH3</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>QH3CLNT100</RCVPRN>
<CREDAT>20110526</CREDAT>
<CRETIM>204404</CRETIM>
</EDI_DC40>
<E1ECXHANGE_RATE SEGMENT="1">
<LOG_SYSTEM>QH3CLNT100</LOG_SYSTEM>
<UPD_ALLOW>X</UPD_ALLOW>
<DEV_ALLOW>000</DEV_ALLOW>
<E1BP1093_0 SEGMENT="1">
<RATE_TYPE>RUFX</RATE_TYPE>
<FROM_CURR>USD</FROM_CURR>
<TO_CURRNCY>RUB</TO_CURRNCY>
<VALID_FROM>20120105</VALID_FROM>
<EXCH_RATE>5000</EXCH_RATE>
<FROM_FACTOR>100</FROM_FACTOR>
<TO_FACTOR>1</TO_FACTOR>
<EXCH_RATE_V>0.00000</EXCH_RATE_V>
<FROM_FACTOR_V>0</FROM_FACTOR_V>
<TO_FACTOR_V>0</TO_FACTOR_V>
</E1BP1093_0>
</E1ECXHANGE_RATE>
</ IDOC>
</EXCHANGE_RATE01>
kr,
StefHi Stef,
I have just generated a file from my system, to give you an idea of how a file should look for the program RSEINB00 to import:
EDI_DC40_U1000000000000865239700 3012 DEBMAS06 DEBMAS SAPBCI LS BCICLNT100 GG_TEST LS TVNBTS 20120111135033 20120111135032
E2KNA1M005 1000000000000865239000001000000010050000000001Ms. 000000000000 0 DEBI US 0000000100 Mercedes Lee HAWTHORNE MINERAL 1030 89415 NV A5 B2C LEE E12312312 1520 1520 Fifth Street 775-949-2668 +481111111 323232323 0000000003 0000 0000000000 0 2902100601 00 EN
E2KNA11002 100000000000086523900000200000102
Hope this helps,
Grzegorz -
Oracle Forms returns the first record in the database when performing query
Once in a while when we query for a record on a form, say by first name Tom, then it returns the first record in the database. Other times it return the Tom's record. It only happens once in a while and if you close the form and reopen it and requery for Tom, then it brings Tom's record.
Does anyone know the issue what could be happening. It just happens every now and then that it's hard to reproduce.
ORacle Forms 10GR2
ORacle Application Server 10.1.3
thanksthen it returns the first record in the databaseI'm not sure if i understand you correctly. Do you mean forms ignores the searc-condition you entered? I would check SYSTEM.LAST_QUERY at the moment this happens to check if the condition gets somehow lost.
-
Alert to be fired only for first record when duplicate entries exist
Hello,
This is related to Oracle forms 10g.
I have a multi record block wherein I am entering and storing some codes, something like below
Code Description
=====================
ABCD AAAAAAAAAAAA
PQRS BBBBBBBBBBBBB
DDDD SSSSSSSSSSS
ABCD DHGFKSDHKSHG
PQRS DFJHHGS
EEEE SDT85604ET
=====================
Now I need to display an alert/msg from when-validate-item of the Code field. So now if I am on first record, the alert/msg will be displayed for code ABCD which is Ok. Now on next record I enter a different code PQRS as given above, the alert will again be displayed which is Ok. If I enter a code which was previously entered in the multi record block and alert/msg had been displayed at that first time, the alert/msg need not be displayed now again i.e. if I enter ABCD again in fourth record, the alert should not be displayed.
Note that this need to be done at the data entry time itself. I guess may be it can be done using record groups/ plsql table.
Any help with a way to solve this issue will be highly appreciated..
Thanks and Regards...As you have already guessed, you have to be able to keep track of how many times a value has been entered. If you know what all of the possible "CODE" values are at design-time, you could create a counter variable for each value, but this would be a total pain. A better solution would be to keep a dynamic running total that you can quickly check against. For this I recommend you use a Forms Record Group. Take a look at the Forms - Record Group Processing (Duplicate Value Checking) demo I wrote. Using the Forms Rec_Group package provided in this demo, you could easly modify the process listed in the document to work in your scenario. Follow all of the steps in the demo. For your situation, you will need to modify the When-Validate-Item trigger so that instead of checking for dupicates and failing the form if a duplicate is found, you will check the number of entries for a value in the record group and display a message if the count is 0 or not display a message if the count is greater than 0. Your modified WVI trigger might look like this:
DECLARE
ignore NUMBER := 0;
bignore BOOLEAN := FALSE;
BEGIN
IF ( :YOUR_BLOCK.CODE IS NOT NULL ) THEN
ignore := Rec_Group.Get_Number(Rec_Group.rg_name, :YOUR_BLOCK.CODE);
IF ( ignore = 0 ) THEN
-- Display your message
ELSE
-- Don't display any message
END IF;
/* add the code to the record group */
bIgnore := Rec_Group.Add_Value(rec_group.rg_name, :YOUR_BLOCK.CODE, :system.trigger_record);
END IF;
END;Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly.
Edited by: CraigB on Mar 30, 2011 3:07 PM -
Does re-running a MDM Initial Load restart from the first record?
Is there a way to restart an Initial load? I was running a new initial materials load in my ECC system for MDM (MDM_CLNT_EXTR) which was running a very long time (5 days). The background job hit a bad piece of data and crashed.
My question is: when I re-run my initial load job, will it start over from the first record, or will it pick up from the last material/IDOC and resume processing? I would prefer not to re-process all 1.7M materials since the job was very near the end before it crashed.
Thanks,
DenisHello,
There are two modes which are available in Client Extractor, Initial and Delta.
If you select Initial it will start from the first record, that you mention in the selection Criteria.
In Delta mode, any new records created will be sent to MDM.
For your issue, in the initial mode, select the Material Number from and to, which have not been updated in MDM.
This is will ensure, that only the records that have not been sent.
Regards,
Abhishek -
Invalid Descriptor Index After First Record
recordCount = 1;
if(rs != null)
rs.last();
totalRows = rs.getRow();
rs.first();
System.out.println("Total Rows: "+totalRows);
if (rs != null) while ( rs.next() )
hasResults = true;
for(rowCount = 0; rowCount < totalRows; rowCount++)
for(columnCount = 0; columnCount < 9; columnCount++)
SearchMenu.fieldArray[rowCount][columnCount].setText(rs.getString(recordCount));
recordCount++;
}I am using the above code to read and display data in a 20 row 9 column array of text fields. The database has 9 columns. The first record in a query is displaying correctly, but then I get Invalid Descriptor Index (and no more records are displayed). Can anyone help? Thanks a bunch.I went ahead and tried resetting the recordCount to 1
after each row like you suggested, but that produced
the same error and problem. Then you have another problem. But I doubt this is happening.
It is my understanding
that the first object in the resultset's second row
is one past the last object of the first row, so
resetting this count doesn't make sense to me
anyway.I don't know what you mean exactly but I am pretty sure this is wrong.
Try this.
recordCount = 1;
if(rs != null)
rs.last();
totalRows = rs.getRow();
rs.first();
System.out.println("Total Rows: "+totalRows);
if (rs != null) while ( rs.next() )
hasResults = true;
recordCount = 1;//new line here!
for(rowCount = 0; rowCount < totalRows; rowCount++)
for(columnCount = 0; columnCount < 9; columnCount++)
SearchMenu.fieldArray[rowCount][columnCount].setText(rs.getString(recordCount));
recordCount++;
} -
Focusing on report's first record. Is that possible
Is there a trick to do this? The idea is to search for records and when the results are back just press the enter key taking us to another page with the values of the first record.
Of course the records are hyperlinked and set with their values.
I always appreciate your comments and ideas. I have search and the closest I found is css style a:focus but that doesn't put the cursor automatically on the first hyperlink.
thank you in advance for your help.
juan“AccuWeather.com” provides the weather data for both phones. I have been to two Verizon stores and both of them have said they don’t know how to fix the problem. They both said that the settings are very precise and that I must live too close to the Indian Wells border. Well, I do live close to Indian Wells, but if the settings are that precise, how close I live to that city seems irrelevant, and I don’t understand why the system can’t tell that I’m in the city of Palm Desert and not Indian Wells? Both of them suggested I try contacting Samsung. I tried that but gave up.
If you can fix this, you’re a genius.
David
>>Personal information removed to comply with the Verizon Wireless Terms of Service<<
Edited by: Verizon Moderator -
Merge 2 internal tables into one and show first record from common fields
Hello PPl,
I have 3 tables kna1 knb1 and knvp i have to join kna1 and knb1 on kunnr and move the data into an internal table it_data then on the basis of that data in it_data i have to retrieve records FOR ALL ENTRIES from KNVP and move it into it_knvp.
Then both it_data and it_knvp should be merged in it_alv and from that internal table report has to be displayed.
[NOTE: i had tried using loop twice but the report got messed up]
Apart from that for these set of values
0000000004
0000000418
0000000954
0000001190
0000001222
0000001451
0000001453
0000001455
0000001470
0000001508
finally knvp is showing records in such a way that for 2 records kunnr is same and so does all the other fields except PARZA and KUNN2 so the req. is to display only the first record among 2.
Plz help me by providing code for that its urgent......
Below i m providing my code so far, i hope it will be of some help.
TREMENDOUS REWARD POINTS GURANTEED!!!!!
REPORT zfanz_alv_report_whv.
TYPE-GROUPS *
TYPE-POOLS: slis.
TYPES *
TYPES: BEGIN OF ty_data,
kunnr TYPE kunnr,
ort01 TYPE ort01,
pstlz TYPE pstlz,
regio TYPE regio,
bukrs TYPE bukrs,
zterm TYPE zterm,
END OF ty_data,
BEGIN OF ty_knvp,
vkorg TYPE vkorg,
vtweg TYPE vtweg,
spart TYPE spart,
parvw TYPE parvw,
parza TYPE parza,
kunn2 TYPE kunn2,
lifnr TYPE lifnr,
END OF ty_knvp,
BEGIN OF ty_alv,
kunnr TYPE kunnr,
ort01 TYPE ort01,
pstlz TYPE pstlz,
regio TYPE regio,
bukrs TYPE bukrs,
zterm TYPE zterm,
vkorg TYPE vkorg,
vtweg TYPE vtweg,
spart TYPE spart,
parvw TYPE parvw,
parza TYPE parza,
kunn2 TYPE kunn2,
lifnr TYPE lifnr,
END OF ty_alv,
BEGIN OF ty_kna1,
kunnr TYPE kunnr,
END OF ty_kna1,
BEGIN OF ty_knb1,
bukrs TYPE bukrs,
END OF ty_knb1.
*DATA: IT_KNVP TYPE KNVP,
DATA: it_knvp TYPE STANDARD TABLE OF ty_knvp WITH HEADER LINE.
DATA: it_data TYPE STANDARD TABLE OF ty_data WITH HEADER LINE.
Report data to be shown.
DATA: it_alv TYPE STANDARD TABLE OF ty_alv WITH HEADER LINE.
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
*DATA: fieldcatalog type standard table of slis_fieldcat_alv with header
*line.
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
*TABLES
tables:knvp,kna1,knb1.
CONSTANTS *
CONSTANTS: c_kunnr TYPE char5 VALUE 'KUNNR',
c_ort01 TYPE char5 VALUE 'ORT01',
c_pstlz TYPE char5 VALUE 'PSTLZ',
c_regio TYPE char5 VALUE 'REGIO',
c_bukrs TYPE char5 VALUE 'BUKRS',
c_zterm TYPE char5 VALUE 'ZTERM',
c_vkorg TYPE char5 VALUE 'VKORG',
c_vtweg TYPE char5 VALUE 'VTWEG',
c_spart TYPE char5 VALUE 'SPART',
c_parvw TYPE char5 VALUE 'PARVW',
c_parza TYPE char5 VALUE 'PARZA',
c_kunn2 TYPE char5 VALUE 'KUNN2',
c_lifnr TYPE char5 VALUE 'LIFNR'.
WORKAREA *
DATA: wa_data TYPE ty_data,
wa_knvp TYPE ty_knvp,
wa_alv TYPE ty_alv,
wa_fcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv.
======================= Selection Screen ==========================
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*DATA: wa_kunnr LIKE kna1-kunnr,
wa_bukrs LIKE knb1-bukrs,
wa_vkorg LIKE knvp-vkorg,
wa_vtweg LIKE knvp-vtweg,
wa_spart LIKE knvp-spart,
wa_parvw LIKE knvp-parvw.
SELECT-OPTIONS *
SELECT-OPTIONS s_kunnr FOR kna1-kunnr NO INTERVALS OBLIGATORY
SELECT-OPTIONS: s_bukrs FOR knb1-bukrs NO-EXTENSION NO INTERVALS,
s_vkorg FOR knvp-vkorg NO-EXTENSION NO INTERVALS,
s_vtweg FOR knvp-vtweg NO-EXTENSION NO INTERVALS,
s_spart FOR knvp-spart NO-EXTENSION NO INTERVALS,
s_parvw FOR knvp-parvw NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN: END OF BLOCK b1.
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON s_kunnr.
PERFORM validate_data.
START-OF-SELECTION *
START-OF-SELECTION.
PERFORM get_data. "fetch data from table and perform join on them
PERFORM final_table.
PERFORM build_fieldcatalog. "populate field catalog
PERFORM build_layout.
PERFORM grid_display. "display the result in ALV grid
END-OF-SELECTION *
END-OF-SELECTION.
describe
SUBROUTINES (FORMS)
*& Form get_data
Gets the information to be shown in the report.
Join on tables KNA1, KNB1 and for all enteries in KNVP
--> p1 text
<-- p2 text
FORM get_data.
SELECT kna1~kunnr
kna1~ort01
kna1~pstlz
kna1~regio
knb1~bukrs
knb1~zterm
INTO TABLE it_data
FROM kna1 INNER JOIN knb1
ON kna1kunnr = knb1kunnr
WHERE kna1~kunnr IN s_kunnr
AND knb1~bukrs IN s_bukrs.
SELECT vkorg
vtweg
spart
parvw
parza
kunn2
lifnr
INTO TABLE it_knvp FROM knvp
FOR ALL ENTRIES IN it_data
WHERE knvp~kunnr = it_data-kunnr
AND vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND spart IN s_spart
AND parvw IN s_parvw.
ENDFORM. " get_data
*ENDFORM. " get_data
*& Form FINAL_TABLE
text
--> p1 text
<-- p2 text
FORM final_table .
LOOP AT it_data.
it_alv-kunnr = it_data-kunnr.
it_alv-ort01 = it_data-ort01.
it_alv-pstlz = it_data-pstlz.
it_alv-regio = it_data-regio.
it_alv-bukrs = it_data-bukrs.
it_alv-zterm = it_data-zterm.
APPEND it_alv.
CLEAR it_alv.
ENDLOOP.
LOOP AT it_knvp.
it_alv-vkorg = it_knvp-vkorg.
it_alv-vtweg = it_knvp-vtweg.
it_alv-spart = it_knvp-spart.
it_alv-parvw = it_knvp-parvw.
it_alv-parza = it_knvp-parza.
it_alv-kunn2 = it_knvp-kunn2.
it_alv-lifnr = it_knvp-lifnr.
APPEND it_alv.
CLEAR it_alv.
ENDLOOP.
ENDFORM. " FINAL_TABLE
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
IF it_alv[] IS NOT INITIAL.
wa_fcat-fieldname = c_kunnr.
wa_fcat-seltext_l = 'Customer Master'(001).
wa_fcat-col_pos = 1.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_ort01.
wa_fcat-seltext_l = 'City'(002).
wa_fcat-col_pos = 2.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_pstlz.
wa_fcat-seltext_l = 'Postal Code'(003).
wa_fcat-col_pos = 3.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_regio.
wa_fcat-seltext_l = 'Region'(004).
wa_fcat-col_pos = 4.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_bukrs.
wa_fcat-seltext_l = 'Company Code'(005).
wa_fcat-col_pos = 5.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_zterm.
wa_fcat-seltext_l = 'Terms of payment'(006).
wa_fcat-col_pos = 6.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_vkorg.
wa_fcat-seltext_l = 'Sales Organization'(007).
wa_fcat-col_pos = 7.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_vtweg.
wa_fcat-seltext_l = 'Distribution Channel'(008).
wa_fcat-col_pos = 8.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_spart.
wa_fcat-seltext_l = 'Division'(009).
wa_fcat-col_pos = 9.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_parvw.
wa_fcat-seltext_l = 'Partner function'(010).
wa_fcat-col_pos = 10.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_kunn2.
wa_fcat-seltext_l = 'Customer number of partner'(011).
wa_fcat-col_pos = 11.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_lifnr.
wa_fcat-seltext_l = 'Account Number of Vendor'(012).
wa_fcat-col_pos = 12.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
wa_fcat-fieldname = c_parza.
wa_fcat-seltext_l = 'Partner counter'(013).
wa_fcat-col_pos = 13.
APPEND wa_fcat TO fieldcatalog.
CLEAR wa_fcat.
*fieldcatalog-fieldname = c_kunnr.
fieldcatalog-seltext_l = 'Customer Master'(001).
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_ort01.
fieldcatalog-seltext_l = 'City'(002).
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_pstlz.
fieldcatalog-seltext_l = 'Postal Code'(003).
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_regio.
fieldcatalog-seltext_l = 'Region'(004).
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_bukrs.
fieldcatalog-seltext_l = 'Company Code'(005).
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_zterm.
fieldcatalog-seltext_l = 'Terms of payment'(006).
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_vkorg.
fieldcatalog-seltext_l = 'Sales Organization'(007).
fieldcatalog-col_pos = 7.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_vtweg.
fieldcatalog-seltext_l = 'Distribution Channel'(008).
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_spart.
fieldcatalog-seltext_l = 'Division'(009).
fieldcatalog-col_pos = 9.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_parvw.
fieldcatalog-seltext_l = 'Partner function'(010).
fieldcatalog-col_pos = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_kunn2.
fieldcatalog-seltext_l = 'Customer number of partner'(011).
fieldcatalog-col_pos = 11.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_lifnr.
fieldcatalog-seltext_l = 'Account Number of Vendor'(012).
fieldcatalog-col_pos = 12.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = c_parza.
fieldcatalog-seltext_l = 'Partner counter'(013).
fieldcatalog-col_pos = 13.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDIF.
ENDFORM. " BUILD_FIELDCATALOG
*& Form build_layout
text
--> p1 text
<-- p2 text
form build_layout .
Set layout field for field attributes(i.e. input/output)
wa_layout-stylefname = 'FIELD_STYLE'.
wa_layout-zebra = 'X'.
endform. " build_layout
*& Form GRID_DISPLAY
text
FORM grid_display. "using t_data type ty_tbl_data.
IF it_alv[] IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
IS_LAYOUT = wa_layout
it_fieldcat = fieldcatalog[]
TABLES
t_outtab = it_alv[]
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.
ENDIF.
ENDIF.
ENDFORM. "GRID_DISPLAY
*& Form VALIDATE_DATA
text
--> p1 text
<-- p2 text
FORM validate_data .
DATA : li_kna1 TYPE STANDARD TABLE OF ty_kna1,
li_knb1 TYPE STANDARD TABLE OF ty_knb1,
li_knvp TYPE STANDARD TABLE OF ty_knvp.
SELECT kunnr
FROM kna1
INTO TABLE li_kna1
WHERE kunnr IN s_kunnr.
IF sy-subrc <> 0.
MESSAGE 'Invalid Customer Number'(013) TYPE 'E'.
ENDIF.
SELECT bukrs
FROM t001
INTO TABLE li_knb1
WHERE bukrs IN s_bukrs.
IF sy-subrc <> 0.
MESSAGE 'Invalid Company Code'(014) TYPE 'E'.
ENDIF.
SELECT vkorg
FROM tvko
INTO TABLE li_knvp
WHERE vkorg IN s_vkorg.
IF sy-subrc <> 0.
MESSAGE 'Invalid Sales Organization'(015) TYPE 'E'.
ENDIF.
SELECT vtweg
FROM tvtw
INTO TABLE li_knvp
WHERE vtweg IN s_vtweg.
IF sy-subrc <> 0.
MESSAGE 'Invalid Distribution Channel'(016) TYPE 'E'.
ENDIF.
SELECT spart
FROM tspa
INTO TABLE li_knvp
WHERE spart IN s_spart.
IF sy-subrc <> 0.
MESSAGE 'Invalid Division'(017) TYPE 'E'.
ENDIF.
SELECT parvw
FROM tpar
INTO TABLE li_knvp
WHERE parvw IN s_parvw.
IF sy-subrc <> 0.
MESSAGE 'Invalid Partner function'(018) TYPE 'E'.
ENDIF.
ENDFORM. " VALIDATE_DATA*1----
FORM get_data.
SELECT kna1~kunnr
kna1~ort01
kna1~pstlz
kna1~regio
knb1~bukrs
knb1~zterm
INTO TABLE it_data
FROM kna1 INNER JOIN knb1
ON kna1kunnr = knb1kunnr
WHERE kna1~kunnr IN s_kunnr
AND knb1~bukrs IN s_bukrs.
CHECK it_data[] IS NOT INITIAL.
SELECT kunnr
vkorg
vtweg
spart
parvw
parza
kunn2
lifnr
INTO TABLE it_knvp FROM knvp
FOR ALL ENTRIES IN it_data
WHERE kunnr = it_data-kunnr
AND vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND spart IN s_spart
AND parvw IN s_parvw.
IF sy-subrc EQ 0.
SORT it_knvp BY kunnr.
ENDIF.
ENDFORM. " get_data
*2----
FORM final_table .
LOOP AT it_data INTO wa_data.
READ TABLE it_knvp
INTO wa_knvp
WITH KEY kunnr = wa_data-kunnr
BINARY SEARCH .
IF sy-subrc = 0.
MOVE-CORRESPONDING wa_data TO wa_alv.
MOVE-CORRESPONDING wa_knvp TO wa_alv.
APPEND wa_alv TO it_alv.
ENDIF.
ENDLOOP.
ENDFORM. " FINAL_TABLE
Edited by: Faisal Khan on Mar 27, 2008 1:59 PM -
Report without the first record using JasperReports
Hi everyone,
I�m using JasperReports127 but the first record is not being showed...
I really don�t know why... Does someone had the same problem?!
I follow this tutorial:
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/reports.html
Gustavo CallouI forgot to say that what ir really interesting is that in the iReport Aplication the report works fine... but in the jsc not...
my setor.jrxml is bellow:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="classic"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.scriptlethandling" value="0" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />
<queryString><![CDATA[select *
from tb_setor
where tb_setor.incodigosetor > '0'
order by tb_setor.vanome
]]></queryString>
<field name="INCODIGOSETOR" class="java.math.BigDecimal"/>
<field name="VANOME" class="java.lang.String"/>
<field name="VARAMAL" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
<staticText>
<reportElement
x="61"
y="5"
width="412"
height="40"
key="staticText"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Center">
<font size="28" isBold="true"/>
</textElement>
<text><![CDATA[Setores]]></text>
</staticText>
<line direction="TopDown">
<reportElement
x="0"
y="48"
width="534"
height="0"
forecolor="#000000"
key="line"
positionType="FixRelativeToBottom"/>
<graphicElement stretchType="NoStretch" pen="2Point"/>
</line>
<line direction="TopDown">
<reportElement
x="0"
y="3"
width="534"
height="0"
forecolor="#000000"
key="line"/>
<graphicElement stretchType="NoStretch" pen="2Point"/>
</line>
</band>
</title>
<pageHeader>
<band height="9" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="20" isSplitAllowed="true" >
<rectangle radius="0" >
<reportElement
mode="Opaque"
x="1"
y="1"
width="534"
height="17"
forecolor="#000000"
backcolor="#999999"
key="element-22"/>
<graphicElement stretchType="NoStretch" pen="Thin"/>
</rectangle>
<staticText>
<reportElement
x="0"
y="1"
width="267"
height="16"
forecolor="#FFFFFF"
key="element-90"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="" size="12"/>
</textElement>
<text><![CDATA[Setor]]></text>
</staticText>
<staticText>
<reportElement
x="267"
y="1"
width="267"
height="16"
forecolor="#FFFFFF"
key="element-90"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="" size="12"/>
</textElement>
<text><![CDATA[Ramal]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="19" isSplitAllowed="true" >
<line direction="TopDown">
<reportElement
x="0"
y="17"
width="535"
height="0"
forecolor="#808080"
key="line"
positionType="FixRelativeToBottom"/>
<graphicElement stretchType="NoStretch" pen="Thin"/>
</line>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="1"
width="267"
height="15"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="Times-Roman" size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{VANOME}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="267"
y="1"
width="267"
height="15"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="Times-Roman" size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{VARAMAL}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="27" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="325"
y="4"
width="170"
height="19"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font fontName="Helvetica" size="10"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="499"
y="4"
width="36"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">
<font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<line direction="TopDown">
<reportElement
x="0"
y="1"
width="535"
height="0"
forecolor="#000000"
key="line"/>
<graphicElement stretchType="NoStretch" pen="2Point"/>
</line>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="1"
y="6"
width="209"
height="19"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="Times-Roman" size="10"/>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport> -
The detailRegion is always forced to populate the first record from the Master region
Hi fellow Spry enthusiasts,
My question is in regards the undesirable data population of
the regiondetail on initial load. I have 2 sections, one which is
my master region (which goes out and retrieves a bunch of records),
and a related detailregion which reacts based on the master.
However, every time I initiate a query of the master region to
retrieve records, the detail region also responds and automatically
grabs the FIRST record of the master region (which is undesirable
in my case because I do not want the detail region to react UNTIL I
select a record in the master region). Let me know if this makes
sense.
Psuedo Code:
var moveRequestor = new
Spry.Data.XMLDataSet("cfc/QueryThatReturnsABunchOfEmployeeRecords")>
<span spry:region="moveRequestor">
{EM_ID}
{NAME}
<span spry:detailregion="moveRequestor">
{EM_ID}
{NAME}
{PHONE}This question was posted a while ago, and was one of the
search results that came up when I was looking for my own answer. I
had a nearly identical question and answered it here:
Disabling
default linked region and detailregiondisply until click
Hopefully it will help others too! -
ResultSet loop back to first record
I have an Access table : products
I have a total of 7 products. When I use rs.next(), it will scroll for each record until the last record.
How do I make it go back to the first record after it hit the last record ?
I hv tried rs.first() and rs.last(0 method, but it doesn't work and give me TYPE FORWARD kind of error, further clarify with some expert, they said it is because my cursor state is the Forward Type only ... so cannot loop back....
Then I also use the cn.createConnection(ResultSet.InSensitive Result ... kind of stuff ... all cannot work as Access seems like cannot go backward ...
Any other good suggestion ?1. Use this, st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Or,
2. Store your result set in a temporary array and scroll thru this array for subsequent repetitive iterations.
Sudha -
Asp code does not render for first record in looped recordset
I have posted this question on a javascript forum as it
contains javascript code however it was believed to be an asp
issue.
The following head section javascript code contains the
function showBigImage( isource,bigImage,header ) function call of
discussion:
var currentImage;
function showBigImage( isource,bigImage,header ) {
var theImage = document.getElementById( 'largeimage' );
theImage.src = isource;
currentImage = bigImage;
document.getElementById( 'photoHeader' ).innerHTML=header;
document.getElementById( 'largeimage' ).alt=header;
The following rendered looped recordset code illustrates how
the "header" parameter of this showBigImage(
isource,bigImage,header ) function call does not render ONLY FOR
THE FIRST RECORD OF THE RECORDSET as it is blank:
<a href= "javascript:;" > <td height=36
valign="middle" class="small_img" onmouseover="showBigImage(
'imagescript.asp?path=images/portable_stage.jpg&width=250','images/portable_stage.jpg',''
)"> <img
src="imagescript.asp?path=images/portable_stage.jpg&width=36"
border="0" alt="" /> </td> </a>
<a href= "javascript:;" > <td height=36
valign="middle" class="small_img" onmouseover="showBigImage(
'imagescript.asp?path=images/seated_riserset.jpg&width=250','images/seated_riserset.jpg', 'Portable
stage configuration using 9 units of the 3 ft x 8 ft platforms in 3
different heights' )"> <img
src="imagescript.asp?path=images/seated_riserset.jpg&width=36"
border="0" alt="" /> </td> </a>
<a href= "javascript:;" > <td height=36
valign="middle" class="small_img" onmouseover="showBigImage(
'imagescript.asp?path=images/Stageset.jpg&width=250','images/Stageset.jpg','Portable
stage configuration using 16 units of the 4 ft x 8 ft platforms'
)"> <img
src="imagescript.asp?path=images/Stageset.jpg&width=36"
border="0" alt="" /> </td> </a>
<a href= "javascript:;" > <td height=36
valign="middle" class="small_img" onmouseover="showBigImage(
'imagescript.asp?path=images/Runset.jpg&width=250','images/Runset.jpg','Portable
stage runset configuration' )"> <img
src="imagescript.asp?path=images/Runset.jpg&width=36"
border="0" alt="" /> </td> </a>
Because of this problem, the caption text does not display
for this first image record once the thumbnail images are moused
over. You can view this page example at
http://www.canchair.com/new_web_product_detail.asp?ProductID=198&ProductFamily=1&ProductFa milySub=10Please help with this issue!!!
Maybe you are looking for
-
Error Message when taking video after OS 4.3 update
Anyone else getting this message "This movie format is not supported" after taking video? This just started after the OS 4.3 update. I did turn the phone off and on just to see if it was a fluke but it still happens. Thanks ~Ken
-
iPhone 4 (iOS 7.1.1) not recognized by iTunes 11.1.5 on Mac OSX Mavericks. Have tried all of the recommendations on the apple support site, I am running all current up to date versions of iTunes(11.1.5), Mac OSX(Mavericks), AND iOS 7.1.1 on my iPhone
-
i bought my macbook pro 2 months a go..it has become very slow as i don't have movies etc. should i format my mac , please advice ???
-
hello everyboby i have reverse the miro and cancel the migo document .but when i reverse the excise invoice system give error that first reverse the excise cenvet cedit which you have taken.please help me out.
-
Help Error in RSQL module of database interface
I have my RFC using OO. I can excute it in the ECC System, but when i using java to call the function , the error 'Error in RSQL module of database interface' return. I don't know why? If any help, that will be great. in SM21 , there is it: BV5 Conv