Add Header to HTTPServletRequest
Hi,
I need to write a test class that sends an HTTP request to a servlet, this request needs a custom header adding to it, can this be done in java?
I haven't been able to find a way of doing this, HttpServletRequest has no addHeader() method and I've been looking at URL and HttpURLConnection class has no method to add a header (that I can tell).
Does anyone know if:
1. is it possible to add your own headers to http requests in java?
and
2. if so, what objects do I need to use?
Thanks.
HttpServletRequest doesn't have an addHeader()/ setHeader() method, HttpServletResponse does!
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletResponse.html#addHeader(java.lang.String,%20java.lang.String)
Think about it, you'd be setting the header when you're responding to a request right? The request is what comes in from the client; it's pretty much immutable ( you can't set parameters for example. (But you can set attributes )); go through the API and you'll see that there are hardly any setters. The response is what you generate. So that's where you do most of the stuff you want.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
----------------------------------------------------------------
Similar Messages
-
How to add header and fooder in text file
Hi,
i have created simple application for generate report from database into text file.
But i need to add header and fooder in text file. I dont know is there any API for adding these.
Can anyone help me to create header and fooder in text file.
the below text are needs to be print in the header
name of the table :
Recorder type :
file creation time:
the below text are needs to be print in the footer
Recorder Number:
Record Type;
the actual code is
pst = con.prepareStatement("select REQUEST, DOMAIN_NAME, TRUNC(DATE_OF_CONFIGURATION) AS dateofConfig FROM employee where id=300");
rs = pst.executeQuery();
while (rs.next()) {
request = rs.getString("REQUEST");
domain_name = rs.getString("DOMAIN_NAME");
dateofconfig = rs.getString("dateofConfig");
System.out.println(request + " " + domain_name + " " + dateofconfig);
data.add(request + " " + domain_name + " " + dateofconfig);
System.out.println("before calling method");
writeToFile(data, "c:/Employee.txt");
System.out.println("file created successfull");
rs.close();
pst.close();
private static void writeToFile(List list, String path) {
BufferedWriter out = null;
try {
File file = new File(path);
out = new BufferedWriter(new FileWriter(file, true));
for (Object obj : list) {
String s= obj.toString();
out.write(s);
out.newLine();
out.close();
} catch (IOException e) {
}Thanks
Jasmin
Edited by: user13836688 on Mar 21, 2011 4:06 AM
Edited by: user13836688 on Mar 21, 2011 4:07 AM
Edited by: user13836688 on Mar 21, 2011 4:08 AMuser13836688 wrote:
i have created simple application for generate report from database into text file.First off, when posting code, use [code]...[/code]. or '' tags, not '<code>'.
But i need to add header and fooder in text file. I dont know is there any API for adding these.
Can anyone help me to create header and fooder in text file.Well you plainly have the code to write the file contents; and furthermore your report seems to be contained in a List called 'data'. Why not just add the header and footer lines to it? I'd also suggest making 'data' a LinkedList. That way you can add the header afterwards with no performance hit, just in case the information it contains isn't available at the start of your report loop.
Winston -
How to Add Header and Footer in Flat file
HI All,
I am using ODI 11g.
MY interface is populating data from joining to 2 tables through sql query and Loads in to Flat file.
But i need to add Header and Footer in the Flat file.
In the below 3 lines
The 1st line is header ....2nd line is Data ....3rd line is Footer.
Any ideas how to work on this.
HSB9KT.KTPRTO.EBSDATA.D0000000 20120626020636
CFFE00263 SOLGSR014991340000527894536058173880207SOLNE06242012072420120000009048382650000247MRS
T00000000000000000000
Thanks,
LonyHi Drieux,
i am able to add Header and Footer in this.
But i want the header like Its like HSB9KT.KTPRTO.EBSDATA.D0000000 || SYSDATE (YYYYMMDDHHMMSS)
In my Out put i only see header as HSB9KT.KTPRTO.EBSDATA.D0000000 .
I have added a Variable where i am using SELECT to_char(sysdate,'YYYYMMDDHHMMSS') FROM DUAL query.
create header (HSB9KT.KTPRTO.EBSDATA.D0000000 #v_DATE)
/*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=FFT_SOLSNP$CRLOAD_FILE=/home/tarak/FFT_SOL.datSNP$CRFILE_FORMAT=FSNP$CRFILE_SEP_FIELD=0x0009SNP$CRFILE_SEP_LINE=0x000ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=descrSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=1SNP$CRLENGTH=994SNP$CRPRECISION=994SNP$CR$$SNPS_END_KEY*/
Any idea why this sysdate part is not showing in Header. -
Need to add Header and footer in an alv grid display output.
How can I add header and footer in an alv grid dispay output.
For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".HI,
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_html_end_of_list = 'END_OF_LIST_HTML'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
DATA: ls_text TYPE sdydo_text_element,
l_grid TYPE REF TO cl_gui_alv_grid,
f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
ls_text = 'Footer title'.
adds and icon (red triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IL'.
adds test (via variable)
CALL METHOD end->add_text
EXPORTING
text = ls_text
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Bold text'
sap_emphasis = 'strong'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Nor'.
adds new line (start new line)
CALL METHOD end->new_line.
display text(bold)
CALL METHOD end->add_text
EXPORTING
text = 'Yellow '
sap_emphasis = 'str'.
adds and icon (yellow triangle)
CALL METHOD end->add_icon
EXPORTING
sap_icon = 'IC''.
display text(normal)
CALL METHOD end->add_text
EXPORTING
text = 'Mor'.
*set height of this section
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = l_grid.
CALL METHOD l_grid->parent->parent->(f)
EXPORTING
id = 3
height = 14.
ENDFORM. "end_of_list_html.
This will solve it. Post if you need more help in this.
Regards,
Madhu. -
Add Header and Footer in Live Cycle ES2
Hi,
We are quite new to the use of live cycle pdf generation. Can anyone help us with information as to how we can add header and footers to our pdf files using livecycle ES2.
And further, we would like to know whether header and footer adding is available in the trial version of Livecycle ES2?Hi,
Thanks for the reply.
We have another newly raised problem in the header and footer adding from Livecycle ES2. According to the PDF that you referred in the previous reply, we can add graphics to the PDF header, but we are unable to find a DDX tag that would enable us to add a image URL.
Can you please help us again on the above?
Purnima -
i want to add header to my ALV report
i am using cl_salv_table method
i want to write a few sentences.
in addition i want to add a button to my report,
which will display the values the user put in the selection screen.
please give me detailed explenation
thanksDisplay header:--steps
1. call the factory method and it reruns the ref variable..
try.
call method cl_salv_table=>factory
exporting
list_display = list_display
importing
r_salv_table = vref_alv
changing
t_table = i_sflight.
catch cx_salv_msg into oref_error.
l_text_alv_e = oref_error->get_text( ).
message i000 with l_text_alv_e.
leave list-processing.
endtry.
2. Create header object and attached it with ALV
data: lr_grid type ref to cl_salv_form_layout_grid.
1st step: create the grid object
create object lr_grid.
2nd step: add some text items
lr_grid->create_header_information( row = 1 column = 1
text = 'Flight List Grp ##'(fll) ).
lr_grid->create_text( row = 2 column = 1
text = 'Please check utilization'(uti) ).
3rd step: declare grid as header of list
vref_alv->set_top_of_list( value = lr_grid ).
Display - button steps:
1. Create pf status and Set pf status:
Create pf-status and add ur custom button with a fcode then set this status with alv.
vref_alv->set_screen_status( pfstatus = 'SALV_TABLE_STANDARD'
report = sy-repid
set_functions = p_alv->c_functions_all ).
2. Get all the events and set the event handler for this added button.
data: lr_event type ref to cl_salv_events_table.
get the EVENT object
lr_event = p_alv->get_event( ).
set handler :
lcl_handler=>on_added_function for lr_event,
2. Create the local class to handle this event:
class lcl_handler definition.
public section.
class-methods:
on_added_function for event added_function of cl_salv_events_table
importing e_salv_function, " type salv_de_function
endclass. "lcl_handler definition
CLASS lcl_handler IMPLEMENTATION
class lcl_handler implementation.
method on_added_function.
data: l_oref_columns type ref to cl_salv_columns_table,
l_oref_column type ref to cl_salv_column_table,
l_oref_column1 type ref to cl_salv_column,
l_except1 type ref to cx_salv_not_found, "Exception
l_text1 type string, "Exception msg
l_lvc_s_colo type lvc_s_colo.
case e_salv_function.
when '<fcode of ur button>'.
write ur logic here.
endcase.
endmethod.
endclass. "lcl_handler IMPLEMENTATION
Regards,
Joy.
Edited by: Joyjit Ghosh on Jul 13, 2008 12:16 PM -
How to add header and footer to a file through ODI?
hi,
I want to add header and footer to my file..............footer should contain a counter so that page number can be displayed...................
Can anyone please guide me .................
Thanks .............
Ritikawhat is the utility you are using to create file . Interface or OdiSqlUnload ?
and what do you want to have Header and Footer as and how are you concluding the File as page 1 and page 2 etc ... ? -
How to add header line in a file from XI system using file adapters
Hi All,
I need to add header line (Column names) in a file coming from XI system.
I am using file adapters.
Thanks & Regards,
Gaurav MittalThe Receiver File Adapter is configured, using the following settings:
1) Choose File Content Conversion as the Message Protocol.
2) You give the addHeaderLine parameter as 1
3) For the fieldSeparator parameter you need to give field separator for both list and substructure (referring to the data type above). For eg: it may be a , (comma) for substructure in a comma separated file.
4) The endSeparator parameter needs to given for substructure only. For eg: it may be a nl (new line)
5) Give the file name, the directory and the Construction mode. Activate all the settings. Receiver File Adapter with F.C.C. is configured.
please visit the blog.
/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2 -
How to add header to a file in mapping
Hi,
I need to add header to a file , the header information i am getting is dynamic , it is an IP address of the m/c from where i received the file and keeps on changing.
Can we add this information in the header in mapping or there is any other way to acheive this.This IP is used to make a lookup at a latter stage for verification purpose.
Regards,
SRiHi Sri,
Write Java class or an ABAP class
in Java class or ABAP class write logic to find the first word or line
once you find that word in your incoming file, you need to replace with a string which has the static header+firstword what you have searched
for exmple
Incoming file
abcd
<abc>123</abc>
<def>321</def>
Your logic should find "abcd"
String Header = "http://www.sap.sdn.com"
String A = "abcd" (bcoz u kow u r searching for this word)
now concat A+Header and return the string
IF you are writing an ABAP or Java class include this in Interface Mapping
Hope this helps. -
JAVA API to add header and footer in MS Word
Hi,
please help me out, I am hanging with this concept.
The problem is I need to add a headers in ms word file using java. I come to know that the API is support for this task is 1.apache POI 2.jacob
I dont know which class file I need to use to do this, If anyone knows about this please let me know or send the URL's
Thankyou,
Baskaran.kya i have used POI but i don know the class file in POI. i just now trying jacob., can u send the API and Class file to add header and footers in ms word.
-
Using OLE add Header to MS Word Document in ABAP Program
Dear Friends,
I have a requirement where I want to add Header and Footer to MS Word through OLE in ABAP Program
I am able to open the word document, through OLE,
I am stuck @ the following step.
CALL METHOD OF LO_APPLICATION 'ActiveDocument' = LO_DOCUMENT.
IF SY-SUBRC <> 0. EXIT. ENDIF.
CALL METHOD OF LO_DOCUMENT 'Sections' = LO_SECTIONS.
IF SY-SUBRC <> 0. EXIT. ENDIF.
Please let me know.
Thanks
RajeshHi Rajesh,
You have to use GET PROPERTY & SET PROPERTY attributes of OLE2_OBJECT to use headers.
Just a sample code snippet for your reference :-
DATA : GS_TABLE TYPE OLE2_OBJECT ,
GS_RANGE TYPE OLE2_OBJECT,
GS_CELLTYPE OLE2_OBJECT,
CALL METHOD OF GS_TABLE 'Cell' = gs_cell
EXPORTING #1 = '1'
#2 = '1'.
GET PROPERTY OF gs_cell 'Range' = gs_range.
SET PROPERTY OF gs_range 'Text' = 'VGUID'.
CALL METHOD OF gs_table 'Cell' = gs_cell
EXPORTING #1 = '1'
#2 = '2'.
For more details search on SCN for code on creating MS word document using OLE automation.
Regards
Abhii -
I continue to get an error message when trying to add Header
I continue to get an error message when trying to add Header & Footer. Therefore I am unable to add page numbers to my pdf. Help!!
Sounds like the PDF has an issue. You can try to save it, close, and reopen to see if that fixes it. If there are no tags or other markup, you could print it to a new PDF and try on the new file.
-
Add Header, footer and Margin programmatically in Adobe Acrobat 7.0
I am using adobe acrobat 7.0 profesinal, We receive multiple PDF files then we have
to add header and footers and also change the Megins in these files.
Is this possible we can made these changes using Code written in VBA, VB6 etc.
So my point is add header & footer programmatically using VBA and VB6.
Is there need to access any APIs.?
What I have to to for this purpose??
Thanks in advance
Aftab.Do they print if you chose to shrink to printable area in the printing options? I'm wondering if it's possible that your printer has a default border and the header/footer is getting cut off.
-
Hi,
I am trying to add header to my ALV grid report using the FM REUSE_ALV_COMMENTARY_WRITE'
It is displaying a blank window.
My code is
*& Report YGTSPRODUCT
*& Author : Krishna Chaitanya Nandimandalam
*& Desc : Display Products by Product Characteristics
REPORT YGTSPRODUCT.
*& Structure declarations
type-pools : slis.
TYPES : BEGIN OF TY_CTSNUMC,
GUID_CTSNUMC TYPE /SAPSLL/CTSNUMC-GUID_CTSNUMC, "Primary Key as GUID in "RAW" Format
GUID_MOBJ TYPE /SAPSLL/CTSNUMC-GUID_MOBJ, "Primary Key as GUID in "RAW" Format
STCTS TYPE /SAPSLL/CTSNUMC-STCTS, "Numbering Scheme for Customs Tariff System
CCNGN TYPE /SAPSLL/CTSNUMC-CCNGN, "Number (Generic/Structured)
CRTSP TYPE /SAPSLL/PRGEN-CRTSP, "UTC Time Stamp When Object Was Added
CHTSP TYPE /SAPSLL/PRGEN-CHTSP, "UTC Time Stamp When Object Was Changed
END OF TY_CTSNUMC.
TEST --CREATING ANOTHER STUCTURE TO GET THE COMMON FIELD FOR GUID_PR
TYPES : BEGIN OF TY_PRCTSC,
GUID_PRCTSC TYPE /SAPSLL/PRCTSC-GUID_PRCTSC, "Primary Key as GUID in "RAW" Format
GUID_PR TYPE /SAPSLL/PRCTSC-GUID_PR, "Primary Key as GUID in "RAW" Format
STCTS TYPE /SAPSLL/PRCTSC-STCTS, "Numbering Scheme for Customs Tariff System
GUID_CTSNUMC TYPE /SAPSLL/PRCTSC-GUID_CTSNUMC, "Primary Key as GUID in "RAW" Format
END OF TY_PRCTSC.
TYPES : BEGIN OF TY_PRGEN,
GUID_PRGEN TYPE /SAPSLL/PRGEN-GUID_PRGEN, "Primary Key as GUID in "RAW" Format
GUID_PR TYPE /SAPSLL/PR-GUID_PR, "Primary Key as GUID in "RAW" Format
ATTR20A TYPE /SAPSLL/PRGEN-ATTR20A, "Substance ID
ATTR05A TYPE /SAPSLL/PRGEN-ATTR05A, "Materail Type
ATTR10A TYPE /SAPSLL/PRGEN-ATTR10A, "Materail Group
ATTR05B TYPE /SAPSLL/PRGEN-ATTR05B, "Sub-Family
END OF TY_PRGEN.
TYPES : BEGIN OF TY_PNTPR,
GUID_PR TYPE /SAPSLL/PR-GUID_PR,
PRVSY TYPE /SAPSLL/PNTPR-PRVSY, "R3 MATERIAL NUMBER
GRVSY TYPE /SAPSLL/PNTPR-GRVSY, "LOGICAL SYSTEM GROUP
END OF TY_PNTPR.
*TYPES : D_PSUI TYPE /SAPSLL/PRODUCT_SELECT_UI_S-QUAL_STA. "PRODUCT STATUS
*TYPES : BEGIN OF D_CORSTA,
GUID_MOBJ TYPE /SAPSLL/CORSTA-GUID_MOBJ,
QUAL_STA TYPE /SAPSLL/CORSTA-QUAL_STA,
CHTSP TYPE /SAPSLL/CORSTA-CHTSP,
END OF D_CORSTA.
>PRODUCT STAUS
*DATA : BEGIN OF T_CORSTA OCCURS 0,
GUID_MOBJ TYPE /SAPSLL/CORSTA-GUID_MOBJ,
QUAL_STA TYPE /SAPSLL/CORSTA-QUAL_STA,
END OF T_CORSTA.
TYPES : BEGIN OF TY_PR,
GUID_PR TYPE /SAPSLL/PR-GUID_PR, "Primary Key as GUID in "RAW" Format
CRTSP TYPE /SAPSLL/PR-CRTSP, "PRODUCT CREATED ON
CHTSP TYPE /SAPSLL/PR-CHTSP, "PRODUCT CHANGED ON
END OF TY_PR.
TYPES : BEGIN OF TY_PRT,
GUID_PR TYPE /SAPSLL/PRT-GUID_PR, "Primary Key as GUID in "RAW" Format
PRTXT TYPE /SAPSLL/PRT-PRTXT, "Materail description
END OF TY_PRT.
TYPES : BEGIN OF TY_FINAL,
*T_PRCTSC
GUID_PRCTSC TYPE /SAPSLL/PRCTSC-GUID_PRCTSC, "Primary Key as GUID in "RAW" Format
GUID_PR TYPE /SAPSLL/PRCTSC-GUID_PR, "Primary Key as GUID in "RAW" Format
STCTS TYPE /SAPSLL/PRCTSC-STCTS, "Numbering Scheme for Customs Tariff System
GUID_CTSNUMC TYPE /SAPSLL/PRCTSC-GUID_CTSNUMC, "Primary Key as GUID in "RAW" Format
*T_CTSNUMC
GUID_CTSNUMC TYPE /SAPSLL/CTSNUMC-GUID_CTSNUMC, "Primary Key as GUID in "RAW" Format
GUID_MOBJ TYPE /SAPSLL/CTSNUMC-GUID_MOBJ, "Primary Key as GUID in "RAW" Format
STCTS TYPE /SAPSLL/CTSNUMC-STCTS, "Numbering Scheme for Customs Tariff System
CCNGN TYPE /SAPSLL/CTSNUMC-CCNGN, "Number (Generic/Structured)
CRTSP TYPE /SAPSLL/PRGEN-CRTSP, "UTC Time Stamp When Object Was Added
CHTSP TYPE /SAPSLL/PRGEN-CHTSP, "UTC Time Stamp When Object Was Changed
*T_PRGEN
GUID_PRGEN TYPE /SAPSLL/PRGEN-GUID_PRGEN, "Primary Key as GUID in "RAW" Format
GUID_PR TYPE /SAPSLL/PR-GUID_PR, "Primary Key as GUID in "RAW" Format
ATTR20A TYPE /SAPSLL/PRGEN-ATTR20A, "Substance ID
ATTR05A TYPE /SAPSLL/PRGEN-ATTR05A, "Materail Type
ATTR10A TYPE /SAPSLL/PRGEN-ATTR10A, "Materail Group
ATTR05B TYPE /SAPSLL/PRGEN-ATTR05B, "Sub-Family
*T_PNTPR
GUID_PR TYPE /SAPSLL/PR-GUID_PR, "Primary Key as GUID in "RAW" Format
PRVSY TYPE /SAPSLL/PNTPR-PRVSY, "R3 MATERIAL NUMBER
GRVSY TYPE /SAPSLL/PNTPR-GRVSY, "LOGICAL SYSTEM GROUP
T_PR
GUID_PR TYPE /SAPSLL/PR-GUID_PR, "Primary Key as GUID in "RAW" Format
CRTSP TYPE /SAPSLL/PR-CRTSP, "PRODUCT CREATED ON
CHTSP TYPE /SAPSLL/PR-CHTSP, "PRODUCT CHANGED ON
*T_PRT
GUID_PR TYPE /SAPSLL/PRT-GUID_PR, "Primary Key as GUID in "RAW" Format
PRTXT TYPE /SAPSLL/PRT-PRTXT, "Materail description
END OF TY_FINAL.
*& INTERNAL TABLE AND WORK AREA DECLARATIONS
DATA :
T_CTSNUMC TYPE STANDARD TABLE OF TY_CTSNUMC INITIAL SIZE 0,
T_PRCTSC TYPE STANDARD TABLE OF TY_PRCTSC INITIAL SIZE 0, "TEST INCLUDED NEW STRUCTURE TO GET GUID_PR
T_PRGEN TYPE STANDARD TABLE OF TY_PRGEN INITIAL SIZE 0,
T_PNTPR TYPE STANDARD TABLE OF TY_PNTPR INITIAL SIZE 0,
T_PR TYPE STANDARD TABLE OF TY_PR INITIAL SIZE 0,
T_PRT TYPE STANDARD TABLE OF TY_PRT INITIAL SIZE 0,
T_CORSTA TYPE STANDARD TABLE OF D_CORSTA INITIAL SIZE 0,
T_FINAL TYPE STANDARD TABLE OF TY_FINAL INITIAL SIZE 0.
DATA :
WA_CTSNUMC TYPE TY_CTSNUMC,
WA_PRCTSC TYPE TY_PRCTSC, "TEST INCLUDED NEW STRUCTURE TO GET GUID_PR
WA_PRGEN TYPE TY_PRGEN,
WA_PNTPR TYPE TY_PNTPR,
WA_PR TYPE TY_PR,
WA_PRT TYPE TY_PRT,
WA_CORSTA TYPE D_CORSTA,
WA_FINAL TYPE TY_FINAL.
*& ALV DATA DECLARATIONS
DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
lw_fieldcat LIKE LINE OF lt_fieldcat,
lt_fieldcat1 TYPE slis_t_fieldcat_alv,
lw_fieldcat1 LIKE LINE OF lt_fieldcat,
lt_listheader TYPE slis_t_listheader,
lw_listheader LIKE LINE OF lt_listheader, lt_events TYPE slis_t_event,
lw_events LIKE LINE OF lt_events.
*& DATA DECLARATIONS FOR SELECTION SCREEN
DATA : G_STCTS TYPE /SAPSLL/CTSNUMC-STCTS, "NUMBER SCHEME
G_ATTR20A TYPE /SAPSLL/PRGEN-ATTR20A, "SUBSTANCE ID
G_PRVSY TYPE /SAPSLL/PNTPR-PRVSY, "R3 MATERIAL NUMBER
G_GRVSY TYPE /SAPSLL/PNTPR-GRVSY, "LOGICAL SYS GROUP
G_QSTA TYPE /SAPSLL/PRODUCT_SELECT_UI_S-QUAL_STA, "PRODUCT STATUS
G_CORSTA TYPE /SAPSLL/CORSTA-QUAL_STA, "PRODUCT STATUS
G_CRTSP TYPE /SAPSLL/PR-CRTSP, "PRODUCT CREATED ON
G_CHSTP TYPE /SAPSLL/PR-CHTSP. "PRODUCT CHANGED ON
*& SELECTION-SCREEN DECLARATIONS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_STCTS FOR G_STCTS OBLIGATORY, "NUMBER SCHEME
S_AT20A FOR G_ATTR20A, "SUBSTANCE ID
S_PRVSY FOR G_PRVSY, "R3 MATERIAL NUMBER
S_GRVSY FOR G_GRVSY, "LOGICAL SYS GROUP
S_QSTA FOR G_QSTA, "PRODUCT STATUS
S_CORSTA FOR G_CORSTA, "PRODUCT STATUS
S_CRTSP FOR G_CRTSP, "PRODUCT CREATED ON
S_CHSTP FOR G_CHSTP. "PRODUCT CHANGED ON
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME. " TITLE. " TEXT-002.
PARAMETERS : BOTH RADIOBUTTON GROUP RG1,
EXICLASS RADIOBUTTON GROUP RG1.
SELECTION-SCREEN END OF BLOCK B2.
*& INITIALIZATION
INITIALIZATION .
CLEAR : WA_CTSNUMC,
WA_PRCTSC,
WA_PRGEN,
WA_PNTPR,
WA_PR,
WA_PRT,
WA_FINAL.
REFRESH : T_CTSNUMC,
T_PRCTSC,
T_PRGEN,
T_PNTPR,
T_PR,
T_PRT,
T_FINAL.
*& START OF SELECTION
START-OF-SELECTION.
LW_EVENTS-NAME = 'TOP_OF_PAGE' .
LW_EVENTS-FORM = 'SUB' .
APPEND LW_EVENTS TO LT_EVENTS . PERFORM LIST_HEADER.
IF BOTH EQ 'X'.
PERFORM VALIDATE_NSCHEME.
PERFORM GET_DATA.
PERFORM BUILD_FIELDCAT.
PERFORM LIST_HEADER.
PERFORM f_events CHANGING lt_events.
PERFORM DISP_ALV_DATA.
ENDIF.
*& Form VALIDATE_NSCHEME
*& VALIDATE NUMBER SCHEME
FORM VALIDATE_NSCHEME .
DATA : L_STCTS TYPE /SAPSLL/CTSNUMC-STCTS.
SELECT SINGLE STCTS FROM /SAPSLL/CTSNUMC INTO L_STCTS
WHERE STCTS IN S_STCTS .
IF SY-SUBRC <> 0.
MESSAGE 'Invalid Numbering Scheme for Customs Tariff System'
TYPE 'E'.
ENDIF .
ENDFORM. " VALIDATE_NSCHEME
*& Form GET_DATA
GET DATA INTO FINAL TABLE
FORM GET_DATA .
SELECT GUID_CTSNUMC "Primary Key as GUID in "RAW" Format
GUID_MOBJ "Primary Key of Main Object
STCTS "Numbering Scheme for Customs Tariff System
CCNGN "Number (Generic/Structured)
CRTSP "UTC Time Stamp When Object Was Added
CHTSP "UTC Time Stamp When Object Was Changed
FROM /SAPSLL/CTSNUMC
INTO TABLE T_CTSNUMC
WHERE STCTS IN S_STCTS.
*DELETE ADJACENT DUPLICATES FROM T_CTSNUMC COMPARING GUID_CTSNUMC.
IF T_CTSNUMC IS NOT INITIAL.
GET GUID_PR FOR THE CORRESPONDING GUID_CTSNUMC
SELECT GUID_PRCTSC "Primary Key as GUID in "RAW" Format
GUID_PR "Primary Key as GUID in "RAW" Format
STCTS "Numbering Scheme for Customs Tariff System
GUID_CTSNUMC "Primary Key as GUID in "RAW" Format
FROM /SAPSLL/PRCTSC
INTO TABLE T_PRCTSC
for all entries in t_ctsnumc
WHERE GUID_CTSNUMC EQ T_CTSNUMC-GUID_CTSNUMC.
IF T_PRCTSC IS NOT INITIAL.
GET FIELDS FROM PRGEN BASED ON THE GUID_PR
SELECT GUID_PRGEN "Primary Key as GUID in "RAW" Format
GUID_PR "Primary Key as GUID in "RAW" Format
ATTR20A "SUBSTANCE ID
ATTR05A "Materail Type
ATTR10A "Materail Group
ATTR05B "Sub-Family
FROM /SAPSLL/PRGEN
INTO TABLE T_PRGEN
FOR ALL ENTRIES IN T_PRCTSC
WHERE GUID_PR EQ T_PRCTSC-GUID_PR.
DELETE ADJACENT DUPLICATES FROM T_PRGEN COMPARING GUID_PR.
GET FIELDS FROM PNTPR BASED ON THE GUID_PR
SELECT GUID_PR "Primary Key as GUID in "RAW" Format
PRVSY "R3 MATERIAL NUMBER
GRVSY "LOGICAL SYSTEM GROUP
FROM /SAPSLL/PNTPR
INTO TABLE T_PNTPR
FOR ALL ENTRIES IN T_PRCTSC
WHERE GUID_PR EQ T_PRCTSC-GUID_PR.
*DELETE ADJACENT DUPLICATES FROM T_PRGEN COMPARING GUID_PR.
GET CORSTA-QUAL_STA FOR STATUS CATEGORY BESED ON THE T_CTSNUMC-GUID_MOBJ
*SELECT GUID_MOBJ
QUAL_STA
FROM /SAPSLL/CORSTA
INTO TABLE T_CORSTA
FOR ALL ENTRIES IN T_CTSNUMC
WHERE GUID_MOBJ EQ T_CTSNUMC-GUID_MOBJ.
MISSING FIELD >>>>>>>PRODUCT STATUS
GET CRSTP CHSTP FROM PR BASED ON GUID_PR
SELECT GUID_PR "Primary Key as GUID in "RAW" Format
CRTSP "PRODUCT CREATED ON
CHTSP "PRODUCT CHANGED ON
FROM /SAPSLL/PR
INTO TABLE T_PR
FOR ALL ENTRIES IN T_PRCTSC
WHERE GUID_PR EQ T_PRCTSC-GUID_PR.
*DELETE ADJACENT DUPLICATES FROM T_PR COMPARING GUID_PR.
GET PRTXT FROM PRT BASED ON GUID_PR
SELECT GUID_PR "Primary Key as GUID in "RAW" Format
PRTXT "MATERIAL DESCRIPTION
FROM /SAPSLL/PRT
INTO TABLE T_PRT
FOR ALL ENTRIES IN T_PRCTSC
WHERE GUID_PR EQ T_PRCTSC-GUID_PR.
*DELETE ADJACENT DUPLICATES FROM T_PRT COMPARING GUID_PR.
ENDIF.
ENDIF.
FILLING DATA INTO T_FINAL
REFRESH T_FINAL.
LOOP AT T_PRCTSC INTO WA_PRCTSC.
WA_FINAL-GUID_PRCTSC = WA_PRCTSC-GUID_PRCTSC.
WA_FINAL-GUID_PR = WA_PRCTSC-GUID_PR.
WA_FINAL-STCTS = WA_PRCTSC-STCTS.
WA_FINAL-GUID_CTSNUMC = WA_PRCTSC-GUID_CTSNUMC.
READ TABLE T_CTSNUMC INTO WA_CTSNUMC WITH KEY GUID_CTSNUMC = WA_PRCTSC-GUID_CTSNUMC.
IF SY-SUBRC = 0.
WA_FINAL-GUID_CTSNUMC = WA_CTSNUMC-GUID_CTSNUMC.
WA_FINAL-GUID_MOBJ = WA_CTSNUMC-GUID_MOBJ.
WA_FINAL-STCTS = WA_CTSNUMC-STCTS.
WA_FINAL-CCNGN = WA_CTSNUMC-CCNGN.
WA_FINAL-CRTSP = WA_CTSNUMC-CRTSP.
WA_FINAL-CHTSP = WA_CTSNUMC-CHTSP.
ENDIF.
READ TABLE T_PRGEN INTO WA_PRGEN WITH KEY GUID_PR = WA_PRCTSC-GUID_PR.
IF SY-SUBRC = 0.
WA_FINAL-GUID_PRGEN = WA_PRGEN-GUID_PRGEN.
WA_FINAL-GUID_PR = WA_PRGEN-GUID_PR.
WA_FINAL-ATTR20A = WA_PRGEN-ATTR20A.
WA_FINAL-ATTR05A = WA_PRGEN-ATTR05A.
WA_FINAL-ATTR10A = WA_PRGEN-ATTR10A.
WA_FINAL-ATTR05B = WA_PRGEN-ATTR05B.
ENDIF.
READ TABLE T_PNTPR INTO WA_PNTPR WITH KEY GUID_PR = WA_PRCTSC-GUID_PR.
IF SY-SUBRC = 0.
WA_FINAL-GUID_PR = WA_PNTPR-GUID_PR.
WA_FINAL-PRVSY = WA_PNTPR-PRVSY.
WA_FINAL-GRVSY = WA_PNTPR-GRVSY.
ENDIF.
READ TABLE T_PR INTO WA_PR WITH KEY GUID_PR = WA_PRCTSC-GUID_PR.
IF SY-SUBRC = 0.
WA_FINAL-GUID_PR = WA_PR-GUID_PR.
WA_FINAL-CRTSP = WA_PR-CRTSP.
WA_FINAL-CHTSP = WA_PR-CHTSP.
ENDIF.
READ TABLE T_PRT INTO WA_PRT WITH KEY GUID_PR = WA_PRCTSC-GUID_PR.
IF SY-SUBRC = 0.
WA_FINAL-GUID_PR = WA_PRT-GUID_PR.
WA_FINAL-PRTXT = WA_PRT-PRTXT.
ENDIF.
APPEND WA_FINAL TO T_FINAL.
DELETE ADJACENT DUPLICATES FROM T_FINAL COMPARING ATTR20A.
CLEAR WA_FINAL.
ENDLOOP.
ENDFORM. " GET_D
*& Form BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
FORM BUILD_FIELDCAT .
REFRESH LT_FIELDCAT.
lw_fieldcat-col_pos = 1.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'ATTR20A'.
lw_fieldcat-seltext_m = 'SUBSTANCE ID'.
lw_fieldcat-outputlen = '15'.
lw_fieldcat-FIX_COLUMN = 'X'.
lw_fieldcat-KEY = 'X'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 2.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'PRVSY'.
lw_fieldcat-seltext_m = 'R3 MAT NBR'.
lw_fieldcat-outputlen = '14'.
lw_fieldcat-FIX_COLUMN = 'X'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 3.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'PRTXT'.
lw_fieldcat-seltext_m = 'MAT DESCRIPTION'.
lw_fieldcat-outputlen = '19'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 4.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'GRVSY'.
lw_fieldcat-seltext_m = 'LOGICAL SYS GRP'.
lw_fieldcat-outputlen = '21'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 5.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'QUAL_STA'.
lw_fieldcat-seltext_m = 'PRODUCT STATUS'.
lw_fieldcat-outputlen = 'x'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 6.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'CRTSP'.
lw_fieldcat-seltext_m = 'PRODUCT CREATED ON'.
lw_fieldcat-outputlen = '21'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 7.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'CHTSP'.
lw_fieldcat-seltext_m = 'PRODUCT CHANGED ON'.
lw_fieldcat-outputlen = '21'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 8.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'ATTR05A'.
lw_fieldcat-seltext_m = 'MATERIAL TYPE'.
lw_fieldcat-outputlen = '18'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 9.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'ATTR10A'.
lw_fieldcat-seltext_m = 'MATERIAL GRP'.
lw_fieldcat-outputlen = '18'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 10.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'ATTR05B'.
lw_fieldcat-seltext_m = 'SUB-FAMILY'.
lw_fieldcat-outputlen = '18'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 11.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'CCNGN'.
lw_fieldcat-seltext_m = 'SUBID CLASSIFICATION'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 12.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'CCNGN'.
lw_fieldcat-seltext_m = 'SUBID CLASSIFICATION'.
APPEND lw_fieldcat TO lt_fieldcat.
lw_fieldcat-col_pos = 13.
lw_fieldcat-tabname = 'T_FINAL'.
lw_fieldcat-fieldname = 'CCNGN'.
lw_fieldcat-seltext_m = 'SUBID CLASSIFICATION'.
APPEND lw_fieldcat TO lt_fieldcat.
CLEAR LW_FIELDCAT.
ENDFORM. " BUILD_FIELDCAT
*& Form LIST_HEADER
text
--> p1 text
<-- p2 text
FORM LIST_HEADER .
DATA : LT_LISTHEADER TYPE slis_t_listheader,
LW_LISTHEADER LIKE LINE OF lt_listheader.
LW_LISTHEADER-TYP = 'H'.
LW_LISTHEADER-INFO = 'DISPLAY PRODUCTS BY PRODUCT CHARACTERISTIC'.
APPEND LW_LISTHEADER TO LT_LISTHEADER.
LW_LISTHEADER-TYP = 'S' .
LW_LISTHEADER-KEY = 'TIME' .
LW_LISTHEADER-INFO = SY-UZEIT .
APPEND LW_LISTHEADER TO LT_LISTHEADER.
LW_LISTHEADER-TYP = 'S' .
LW_LISTHEADER-KEY = 'DATE' .
LW_LISTHEADER-INFO = SY-DATUM .
APPEND LW_LISTHEADER TO LT_LISTHEADER.
LW_LISTHEADER-TYP = 'S' .
LW_LISTHEADER-KEY = 'CLIENT' .
LW_LISTHEADER-INFO = SY-MANDT .
APPEND LW_LISTHEADER TO LT_LISTHEADER.
ENDFORM. " LIST_HEADER
*& Form DISP_ALV_DATA
text
--> p1 text
<-- p2 text
FORM DISP_ALV_DATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'I_REPID'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE1'
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'GTS Substance- Product Classification Report'.
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = LT_EVENTS
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_FINAL
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. " DISP_ALV_DATA
FORM SUB.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LT_LISTHEADER.
I_LOGO =*
I_END_OF_LIST_GRID =*
I_ALV_FORM =*
ENDFORM.
Any suggestions and help will be appreciated!
Regards,
KittuHi Ram,
When I had put a Break point on the FM Reuse_alv_grid_display
The parameter IT_EVENTS is not getting populated and it is not calling the FORM SUB.
But LT_EVENTS is holding the data 'TOP_OF_PAGE' and the form name as SUB.
FORM DISP_ALV_DATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'I_REPID'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE1'
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'GTS Substance- Product Classification Report'.
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = LT_EVENTS
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_FINAL
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. " DISP_ALV_DATA
FORM SUB.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LT_LISTHEADER.
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM.
Any suggestions will be apprectiated.
Regards,
Kittu -
Acrobat Pro 9.4.6 Add Header and Footer - can't save selection -
The "window" which opens when you select add Header and Footer is too large so no "accept" option is displayed. Can onlt exit by closing window
The "window" which opens when you select add Header and Footer is too large so no "accept" option is displayed. Can onlt exit by closing window
Maybe you are looking for
-
Margins problem when printing to PDF (Pages '09 v4.0.3 build 766)
Hi, I don't know if this is connected to the latest Mac OS X v10.6.4 update, but some of my machines exhibit a very curious behaviour. + multiple pages A4 document + choose File > Print, click on "Save as PDF", under the PDF button ++ set pages 6 & 7
-
Adding a second iPhone 5 to another iPhone 5 preorder plan
Currently, I have an iPhone 4 on AT&T, and when I pre-ordered my iPhone 5 I decided to switch to verizon. So I ordered the CDMA version of the iPhone 5 and selected to create a new plan, and checked out and my iPhone was ordered. But now my brother w
-
Problem with String to Int conversion
Dear Friends, Problem with String to Int conversion I am having a column where most of the values are numeric. Only 4 values are non numeric. I have replaces those non numeric values to numeric in order to maintain the data type. CASE Grade.Grade WH
-
How to manage credit for same customer in different sectors
Dear Gurus, Here is the scenario, My client have four different sectors but a customer can buy from multiple sectors.The credit management for the same customer must be handled differently for each sector.The credit exposure for all sectors should
-
How can I minimize all image windows within photoshop?
Hi all, First post on the forum. I'm using CS3 on win XP. I'm creating a massive montage of over 60 images, I want to import the lot & minimise them all. 60 individual mimimizes are a pain. Can I minimise them all ? Thanks Daryl