Put value into internal table field
Hello Gurus,
I have one field which I stored into one variable through cncatenate statment in variable VAR1.
and I have another variable VAR2 have some amount.
now I want to put this amount to the field which is present into the VAR1.
ex: VAR1 = 't_display-co1'
VAR2 = 200
now I wnat to put this 200 into t_display-co1
o/p t_display-co1 = 200.
How should I do this?
Please Help.....
CONCATENATE 'w_display-' col_name into var1.
ASSIGN VAR1 to <fs>.
Thanks in adv.
Check this sample
data: begin of t_display,
col1(10) type c,
end of t_display.
FIELD-SYMBOLS: <fs> type any.
data: var2 type i,
var1 type string.
var2 = 200.
var1 = 't_display-col1'.
assign (var1) to <fs> CASTING TYPE c.
if sy-subrc = 0.
<fs> = var2.
endif.
Vikranth
Similar Messages
-
Capturing check box value into internal table
Hi all,
I am displaying the output including check box through following internal table.
The checkbox is displayed before every record.
<b>LOOP AT it_qals.
WRITE:/ it_qals-t_val AS CHECKBOX,
5 it_qals-werk,
12 it_qals-prueflos,
30 it_qals-matnr,
50 it_qals-charg,
62 it_qals-lagortchrg.
hide: it_qals .
ENDLOOP.</b>
I selected some of the records through check the checkboxes. when i click the <b>PUSHBUTTON TRANSFER</b>, those selected records only should transfer. i don't know how to modify the internal table with latest checkbox values. Initially checkbox values are blank.
Is there any solution except Function Module.
i would appreciate an earlier reply.
Regards
PrabhuHello,
Create one more table and transfer your entries into new table.
I have attached my code for you.
Regards,
Naimesh
REPORT ZTEST_NP NO STANDARD PAGE HEADING.
TABLES: MARA, MAKT.
DATA: BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
SEL,
END OF IT_MARA.
DATA: IT_MARA1 LIKE IT_MARA OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SET PF-STATUS 'ZTEST'.
PERFORM GET_DATA.
PERFORM WRITE_DATA.
TOP-OF-PAGE.
PERFORM HEADER.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'SELECT'.
PERFORM GET_DATA_SELECTED.
PERFORM WRITE_DATA_SELE.
WHEN 'SELALL'.
PERFORM SELECT_ALL.
SY-LSIND = 0.
PERFORM HEADER.
PERFORM WRITE_DATA.
WHEN 'DESEL'.
PERFORM DESELECT_ALL.
SY-LSIND = 0.
PERFORM HEADER.
PERFORM WRITE_DATA.
ENDCASE.
*& Form GET_DATA
FORM GET_DATA.
SELECT MATNR
INTO TABLE IT_MARA
FROM MARA
WHERE MATNR LIKE 'IN10020%'.
LOOP AT IT_MARA.
SELECT SINGLE MAKTX
INTO IT_MARA-MAKTX
FROM MAKT
WHERE MATNR = IT_MARA-MATNR
AND SPRAS = SY-LANGU.
MODIFY IT_MARA.
CLEAR IT_MARA.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form WRITE_DATA
FORM WRITE_DATA.
ULINE /(50).
LOOP AT IT_MARA.
WRITE: / '|' NO-GAP, IT_MARA-SEL AS CHECKBOX NO-GAP,
'|' NO-GAP, (10) IT_MARA-MATNR NO-GAP,
'|' NO-GAP, (35) IT_MARA-MAKTX NO-GAP,
'|' NO-GAP.
ENDLOOP.
ULINE /(50).
ENDFORM. " WRITE_DATA
*& Form HEADER
FORM HEADER.
ULINE /(50).
WRITE: / '|' NO-GAP, (1) ' ' NO-GAP,
'|' NO-GAP, (10) 'Material' NO-GAP,
'|' NO-GAP, (35) 'Description' NO-GAP,
'|' NO-GAP.
ENDFORM. " HEADER
*& Form GET_DATA_SELECTED
FORM GET_DATA_SELECTED.
DATA: L_CNT TYPE I.
DO.
L_CNT = L_CNT + 1.
READ LINE L_CNT FIELD VALUE IT_MARA-MATNR INTO IT_MARA1-MATNR
IT_MARA-MAKTX INTO IT_MARA1-MAKTX
IT_MARA-SEL INTO IT_MARA1-SEL.
IF SY-SUBRC = 0.
IF IT_MARA1-SEL = 'X'.
APPEND IT_MARA1.
CLEAR IT_MARA1.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " GET_DATA_SELECTED
*& Form WRITE_DATA_SELE
FORM WRITE_DATA_SELE.
PERFORM HEADER.
ULINE /(50).
LOOP AT IT_MARA1.
WRITE: / '|' NO-GAP, IT_MARA1-SEL AS CHECKBOX,
'|' NO-GAP, (10) IT_MARA1-MATNR NO-GAP,
'|' NO-GAP, (35) IT_MARA1-MAKTX NO-GAP,
'|' NO-GAP.
ENDLOOP.
ULINE /(50).
ENDFORM. " WRITE_DATA_SELE
*& Form SELECT_ALL
FORM SELECT_ALL.
LOOP AT IT_MARA.
IT_MARA-SEL = 'X'.
MODIFY IT_MARA.
CLEAR IT_MARA.
ENDLOOP.
ENDFORM. " SELECT_ALL
*& Form DESELECT_ALL
FORM DESELECT_ALL.
LOOP AT IT_MARA.
IT_MARA-SEL = ' '.
MODIFY IT_MARA.
CLEAR IT_MARA.
ENDLOOP.
ENDFORM. " DESELECT_ALL -
Regarding passing selection screen values into internal table
Hi,
I have created one selection screen with fields
<b>POSNR LIKE VBAP-POSNR</b>
<b>SELECT-OPTIONS: s_posnr FOR vbap-posnr.</b>
I had created one internal table as:
<b>DATA: BEGIN OF i_item OCCURS 0,
posnr LIKE vbap-posnr,
END OF i_item.</b>
Now what i want is to pass what ever entries available in <b>s_posnr into i_item</b> internal table.
If user gives 10 in select-screen i_item should have 10,
If user gives 10 to 30 in select-screen i_item should have 10,20,30 entries.
If user gives nothing in s_posnr of selection screen
then i_item should have all the valid item no's[POSNR's]
from respective sales order.
Can anybody tell me how can i solve this issue!
Thanks in advance.
Thanks & Regards,
Prasad.Hi Prasad,
I guess somewhere on your selection screen there is also a parameter for sales order (eg. pa_vbeln)?
Then:
SELECT posnr
FROM vbap
INTO TABLE i_item
WHERE vbeln EQ pa_vbeln
AND posnr IN s_posnr.
Will get all position numbers in your internal table.
Regards,
John. -
KKA2 values into internal table
Hi,
I would like to create a report which accepts multiple WBS elements and display with all records which comes at KKA2.
KKA2 accept sinlge record, but whatever the values displaying at KKA2, i want in my Z report.
Please let me know how can I fetch those records as it is a module pool program, i didnt find option to use SUBMIT PROGRAM.
Even I may not able to use Export and Import memory id's to read it.
Please guide me.
Regards,
Amarnath SMany of those tables are not much relevant, nevertheless better use an Abap trace (or analyze source code) to identify a subset of forms or an FM executed so you just could call those forms or FM in you report.
Regards,
Raymond
PS 1 : With luck you shoud find a FM like AD19...
PS 2 : Why did your functional not ask for KKAJ (Oh! a report) -
Split String value into internal table at Carriage return
Hi All,
I have given a string type context ( text edit box ) to the user to enter the values. The data can have carriage returns also.
My Requirement is that I want to split the data at carriage returns and store it in my tables.
I tired with a constant value of '%CR_LF' as available in CL_ABAP_CHAR_UTILITIES but to no good result.
Can the Experts suggest some solution?/??
Thankx in advance.
Regds,
SriniHi Srini,
Have you looked at your string containing the text in the debugger to verify that you really have <CR>+<LF> (i.e. reflecting CL_ABAP_CHAR_UTILITIES=>CR_LF, which should be easily visible when looking at the hex codes of the string)? Maybe it's just a <LF> (i.e. CL_ABAP_CHAR_UTILITIES=>NEWLINE). Might be good to do a REPLACE first using a regular expression for identifying the line feeds and then doing the SPLIT.
Cheers, harald
p.s.: If you still cannot get it to work, provide some more details of what you're doing... -
How can i pass calculated value to internal table
Hi
i have to pass calculated value into internal table
below field are coming from database view and i' m passing view data into iznew1
fields of iznew1
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
VGABE LIKE EKBE-VGABE,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
KOSTL LIKE EKKN-KOSTL,
NAME1 LIKE LFA1-NAME1,
NAME2 LIKE LFA1-NAME2,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
KNUMV LIKE EKKO-KNUMV,
GJAHR LIKE EKBE-GJAHR,
and now i want to pass
one field ED1 which i has calculated separatly and i want to pass this value into iznew1
but error is coming that iznew1 is a table with out header line has no component like ED1.
so how can i pass calculated value to internal table iznew1,When you declare your internal table , make an addtion occurs 0
eg . data : begin of iznew occurs 0 ,
fields ...
add the field here ed1.
end of iznew.
now when you are calculating the value of ed1,
you can pass the corresponding value of ed1 and modify table iznew.
eg
loop at iznew.
iznew-ed1 = ed1.
modify iznew.
endloop. -
Getting Issue while uploading CSV file into internal table
Hi,
CSV file Data format as below
a b c d e f
2.01E14 29-Sep-08 13:44:19 2.01E14 SELL T+1
actual values of column A is 201000000000000
and columen D is 201000000035690
I am uploading above said CSV file into internal table using
the below coding:
TYPES: BEGIN OF TY_INTERN.
INCLUDE STRUCTURE KCDE_CELLS.
TYPES: END OF TY_INTERN.
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
EXPORTING
I_FILENAME = P_FILE
I_SEPARATOR = ','
TABLES
E_INTERN = T_INTERN
EXCEPTIONS
UPLOAD_CSV = 1
UPLOAD_FILETYPE = 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.
ENDIF.
am getting all columns data into internal table,
getting problem is columan A & D. am getting values into internal table for both; 2.01E+14. How to get actual values without modifying the csv file format.
waiting for your reply...
thanks & regards,
abhiHi Saurabh,
Thanks for your reply.
even i can't double click on those columns.
b'se the program needs be executed in background there can lot of csv file in one folder. No manual interaction on those csv files.
regards,
abhi -
Assigning value to Field - Symbol ( which is type of internal table field )
Hi All,
I am facing problem to assign the value to a field symbol. My requirement is creating a dynamic internal table and populate values into that internal table, so that i can display the values .
I am having a structure with fields like status , Plant1 name , Plant2 name.....Plant n .
So i declared an internal table it_tab with this structure.
I am having one more table which having number of records for Plant1 ,Plant 2 ,....Plant n based on some condition.
I need to count the number of records for Plant1 and i need to put in the internal table it_tab.
For this i created field-symbol .
Here, t_deployment table will have the plants 1,2,3...and
t_devobject will have some records for these plants.
LOOP AT T_DEPLOYMENT.
clear w_count.
LOOP AT T_DEVOBJECT WHERE ZDEPLOYMENT = T_DEPLOYMENT-DOMVALUE_L AND
ZADSTATUS = '10'.
w_count = w_count + 1.
ENDLOOP.
concatenate 'it_tab-' t_deployment-domvalue_l into var_bet_name.
assign var_bet_name to <bet_var_name>.
now my internal table field i.e. it_tab-plant1 came into <bet_var_name> . But i want to assign a value for it.
at last what i need is it_tab-plant1 = w_count.
whaterver the w_count has value that needs to assign to it_tab-plant1. But i don't want to assign directly it it_tab-plant1. I want to assign dynamically. Because tommorrow some more plants added to t_deployments , i don't want to make changes to my program. It should take care....w/o changing the program.
I tried the following statement.
(<bet_var_name>) = w_count. But its not working.
Please let me know how i can get this.
Thanks in Advance.
Pavan.Hi pavan,
As ur requirement is creating a dynamic internal table,
try the following way,
remember the fieldcat should be of type LVC not SLIS.
BUILD LT_LVCFIELDCAT in a way that, the value from the internal table becomes the fieldname
ex:-
loop at it_models INTO WA_MODELS.
LS_LVCFIELDCAT-FIELDNAME = WA_models-MODEL.
LS_LVCFIELDCAT-SELTEXT = WA_models-MODEL.
append ls_lvcfieldcat to lt_lvcfieldcat.
endloop.
DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVCFIELDCAT
IMPORTING
EP_TABLE = DREF.
ASSIGN dref->* TO <TEMP_TAB>.
now basing on the fieldcatalog <temp_tab> is build.
NOW FILL <TEMP_TAB>.
WHILE FILLING, ASSIGN COMPONENT IDX/NAME.....
this statement will be very usefull.
i hope this will be help full.
pls reward the points if it helps u.
regards
Hyma -
Values cannot added into z-table fields.. (have full points..)
Hi All,
I have one problem .
I made a z-table,included a z-structure, two times in this z-table.
while inserting some values in the table field. it is ok with the z-table fields but i am able to inseert values in the z-structure fields used in the table.
Thankx in advance..
LakhanHi..Lakhan..
Observe these points carefully . you will get the solution.
To add the Same structure multiple times in the Same Table We have to Assign the Suffix while including the Structure.
How To:
Open the Table in Change mode in SE11
Select the Menu path : EDIT->Include->INSERT.
Enter Structure : <Your Z structure>
Suffix : <any character string Eg: A>
Save .
Now you can see all the Fields from include structure will have Suffix A.
Same way you can include the Structure Several times to the
Table using a different suffix each time.
This ensures that the field names are not duplicated.
Finally Activate your Table.
Now create the entries.
<b>Reward if Helpful</b> -
How to populate internal table field with text data?
Hello Experts,
I was able to load text file to a internal table but data is not populating each field. Can someone help me how to populate each field of internal table from text file?
Here is the text file:
io_name, io_type, io_txsht, io_txlng, io_datatype, io_length
ZEA_IO1, CHA, IO Test, IO Test 1, CHAR, 20
ZEA_IO2, CHA, IO Test, IO Test 2, CHAR, 20
Here is the Code:
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab-bapi[]
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
I appreciate your help.
Regards,
MauI have used tab delimited file.
Here are file contents
io_name io_type io_txsht io_txlng io_datatype io_length
ZEA_IO1 CHA IO Test IO Test 1 CHAR 20
ZEA_IO2 CHA IO Test IO Test 2 CHAR 20
And here is program used
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
<b>FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'</b>
TABLES
data_tab = itab-bapi[]
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
This program is working fine. You can test it.
Only problem is as the column headings are big for some columns, they are getting truncated which you can always change by changing the column width in declaration
Please let me know if this helps.
ashish -
REP-1425 report formula DO_SQL error putting value into column
Hi all
I have opened a report 2.5 in Oracle9i Reports Developer and, it converted ok. However, when I run the report (paper layout), the message
rep-1425 report formula DO_SQL error putting value
into column. Column may not be referenced by parameter
triggers
appears. There are several report level formula columns and corresponding placeholder columns that are the cause of this error. The formula has the following :
SRW.DO_SQL('SELECT RPAD(''DAILY TABLE AUDIT REPORT'',60,''.'')||TO_CHAR(SYSDATE,''DD-MON-YYYY'') INTO :REPORT_TIT FROM DUAL');
COMMIT;
RETURN('');
I can't work out what this error message really means as the column, report_tit is a placeholder column and, the formula column is not a parameter trigger!! The report_tit placeholder is used as a source for a layout field. I noticed that the layout field is defined as a placeholder column in the converted report but in the reports 2.5 version, it is defined as a layout field.
I can do a work around by replacing the SRW.DO_SQL statement with a normal PL/SQL SELECT statement. However, I wonder if anyone else has had the same problem and, if anyone can help provide an answer as to what this error really means and, also, how I can retain the SRW.DO_SQL statement and/or an alternative work around to the one that I have described.
Thanks.
Therese Hughes
Forest Products CommisionHi again
The firewall proved to be the problem after all! The firewall set in Reports config-files is not used for WebServices, it has to be set within the stub:
Properties prop = System.getProperties();
prop.put("http.proxyHost","yourProxyServer");
prop.put("http.proxyPort","youProxyServerPort");
I inserted this in my java-code and after some problems (see below), restarting Report Builder turned the trick, the report works now.
Cheers
Tino
Here there mail I set up before I found that restarting Report Builder helped:
Thanks for your answer, putting in the proxy-settings actually helped some - the same error message is
popping up, but instantly and not after 10 seconds like before:
My proxy lines look like this, I also tried "http://proxy.ch.oracle.com", but "proxy.ch.oracle.com" proved to
be the correct syntax:
public Float getRate(String country1, String country2) throws Exception
Float returnVal = null;
Properties prop = System.getProperties();
prop.put("http.proxyHost","proxy.ch.oracle.com");
prop.put("http.proxyPort","8080");
URL endpointURL = new URL(endpoint);
Call call = new Call();
I tested the new proxy-entries by disabling the proxy preference in JDeveloper, so I could verify the added
proxy-lines in the code work - they do. If I change the proxy to some incorrect value like
"proxyy.ch.oracle.com", they fail.
After unsuccessfully trying recompile and re-import of Java classes, I rebuild the report from scratch and
stumbled over the same problem. Now the question is, whether I'm still doing something wrong with the
proxy or whether there is another problem after passing the firewall....
------------------------------------------------------------------------------------------------------------- -
How to populate dynamic internal table fields with data??
Hi Folks,
How to assign a particular internal table field to a dynamically assigned internal table?
I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
Now i created a dynamic internal table which has the same column as in my DB table.
I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
Looking for reply...
Best Regards,
Sayakhi,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '1000'
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*declare intern_tmp as internal table tb_data in wich you want the data
*and declare a field symbol <fs_123>
LOOP AT intern.
ASSIGN COMPONENT intern-col OF STRUCTURE
intern_tmp TO <fs_123>.
IF NOT <fs_123> IS ASSIGNED.
CLEAR intern.
CLEAR intern_tmp.
CONTINUE.
ENDIF.
<fs_123> = intern-value.
AT END OF row.
CLEAR tb_data.
MOVE-CORRESPONDING: intern_tmp TO tb_data.
APPEND tb_data.
CLEAR intern_tmp.
ENDAT.
CLEAR intern.
ENDLOOP.
**paste this code and you can see the data in ur tables dynamically.
Thanks
Nitin Sachdeva -
How to update value in internal table from cdpos taking fname n value_new?
hello everyone,
i want to insert value in internal table from cdpos table taking field name from fname and value from value_new.but the problem is i am not getting how to map the corresponding field of internal table with fname value which is the field name.
for example
i
fieldname
value
name1
raj
name2
sharma
i want to update field name1. this name1 is there in fname with updated value in value_new how to make name1 with fname value
thanks and regards
laxmikant soniHi Laxmikant,
If I have understood your requirement correctly, you need to update an internal table with latest 'value_new' from cdpos table where 'fname' = 'fieldname' .
Hope the below logic will help you:
FIELD-SYMBOLS: <wa_intab> LIKE LINE OF lt_intab. "the internal table you want to change
LOOP AT lt_intab ASSIGNING <wa_intab> .
READ TABLE lt_cdpos INTO wa_cdpos "lt_cdpos contains latest data selected from CDPOS
WITH KEY fname = <wa_intab>-fieldname.
IF sy-subrc = 0.
<wa_intab>-value = wa_cdpos-value_new.
ELSE.
"//logic if the name is not there in CDPOS
ENDIF.
CLEAR wa_cdpos.
ENDLOOP.
If you wish to improve performance, I suggest using
1. "transporting value_new" addition in READ TABLE,
2. select only the data which you require from CDPOS,
3. create the internal tables with only fields which you require,
4. when you are using SELECT,LOOP AT statements, limit records by using WHERE condition
Regards,
Kavya -
Function module to get data into internal table from Excel file sheets
Hi,
I have to upload customers from excel file.
we are donloading customer data excel file sheets.
Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
so i have 3-4 sheet in one excel file.
now my requirement is to get the data from excel file into internal table.
is there any function module.
Thanks & RegardsI am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
Upload the data into an internal table, like the way that I am describing in the above:
DATA: L_MAX_COL_NB TYPE I.
DATA: l_file_name LIKE RLGRAP-FILENAME.
Just to be sure that is the correct type for the FM.
l_file_name = P_FILE_NAME.
L_MAX_COL_NB = 58. "Maximum nb of colums that the FM can read.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file_name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = L_MAX_COL_NB
I_END_ROW = 9999
TABLES
INTERN = PT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
Now you should upload the data into your own itab. The Function Module will return to you all the an itab
from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
FIELD-SYMBOLS:
<F_REC> LIKE WA_UPLOAD_FILE, "working are of the uploading file
<F_FIELD> TYPE ANY.
DATA: COLUMN_INT TYPE I,
C_FIELDNAME(30) TYPE C.
PERFORM GET_FIELDCATOLG TABLES FIELDCAT
USING 'ZECO_CHARALAMBOUS_FILE'.
LOOP AT PT_EXCEL.
AT NEW ROW.
ASSIGN WA_UPLOAD_FILE TO <F_REC>.
ENDAT.
COLUMN_INT = PT_EXCEL-COL.
READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
ASSIGN (C_FIELDNAME) TO <F_FIELD>.
<F_FIELD> = PT_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
CLEAR WA_UPLOAD_FILE.
ENDAT.
ENDLOOP.
With Regards
George
Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM -
OO ALV displaying without Values despite Internal table contains
My below OO ALV displaying without Values despite Internal table contains the values ...
Help please ...
REPORT zsd_concession1 NO STANDARD PAGE HEADING
LINE-SIZE 285
LINE-COUNT 64
MESSAGE-ID zz.
Program Description ******************************
This report is to Calculate consession against Quotations
complying standards for enhanced Performance, Readability &
Maintenance.
Change Log *********************************
Remedy # / Who When Why / What
Transport #
CLASS lcl_event_handler DEFINITION DEFERRED.
*& Data Definitions .
DATA: BEGIN OF vbap_wa,
vbeln TYPE vbak-vbeln, "Quotation#
erdat TYPE vbak-erdat, "Quot date
knumv TYPE vbak-knumv, "Cond Rec#
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF vbap_wa,
BEGIN OF konv_wa,
knumv TYPE konv-knumv, "Cond#
kposn TYPE konv-kposn, "Cond Item#
kappl TYPE konv-kappl, "Applic
kschl TYPE konv-kschl, "Cond Typ
kbetr TYPE konv-kbetr, "Price ZBP1,ZNAA,ZNAX
END OF konv_wa,
BEGIN OF vbpa_wa,
vbeln TYPE vbpa-vbeln, "Quot#
posnr TYPE vbpa-posnr, "Item#
parvw TYPE vbpa-parvw, "Prt Fn
kunnr TYPE vbpa-kunnr, "Cust#
END OF vbpa_wa,
BEGIN OF result_wa,
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF result_wa.
DATA: ikonv LIKE STANDARD TABLE OF konv_wa,
ivbap LIKE STANDARD TABLE OF vbap_wa,
ivbpa LIKE STANDARD TABLE OF vbpa_wa,
iresult LIKE STANDARD TABLE OF result_wa.
*Work storage
DATA: BEGIN OF ws,
vbeln TYPE vbak-vbeln,
ok_code TYPE sy-ucomm,
alv_save TYPE c, "ALV save
alv_variant TYPE disvariant, "ALV Variant
alv_sort TYPE lvc_t_sort, "Sort table
END OF ws.
*Data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
l_smenu TYPE REF TO cl_ctmenu,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
e_dclick TYPE REF TO lcl_event_handler.
*Data declarations for ALV Interactive list
DATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
*Field-Symbols
FIELD-SYMBOLS:
<konv> LIKE konv_wa,
<vbap> LIKE vbap_wa.
*Constants
CONSTANTS:
c_end_row TYPE i VALUE 65000.
*CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
*CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: sec_wa LIKE LINE OF iresult.
*Reading the selected data into a variable
READ TABLE iresult INDEX e_row-index INTO sec_wa.
*Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*Calling the ALV containing the field values
CALL SCREEN 101.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vbeln FOR ws-vbeln DEFAULT '2002354788' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
PERFORM setup_screen_defaults.
START-OF-SELECTION.
PERFORM gather_report_data.
END-OF-SELECTION.
PERFORM create_output.
*& Form initialization
FORM setup_screen_defaults.
CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
REFRESH: ivbpa, ikonv, ivbap, iresult.
ENDFORM. " setup_screen_defaults
*& Form gather_report_data
FORM gather_report_data.
SELECT vbeln posnr parvw kunnr
INTO TABLE ivbpa
FROM vbpa
WHERE vbeln IN s_vbeln
AND ( parvw = 'SP' OR "SoldTO
parvw = 'WE' OR "ShipTo
parvw = 'ZT' ). "Top Parent
SELECT vkvbeln vkerdat vkknumv vpposnr vp~matnr
z1zansicat z1zansigrd z2~zcurrvaltnarea
z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
m1mstav vpkwmeng vp~netpr
INTO CORRESPONDING FIELDS OF TABLE ivbap
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vpvbeln = vkvbeln
INNER JOIN zmarall AS z1
ON z1matnr = vpmatnr
INNER JOIN zco002 AS z2
ON z2matnr = vpmatnr
INNER JOIN zglbprc AS zg
ON zgmatnr = vpmatnr
INNER JOIN mara AS m1
ON m1matnr = vpmatnr
WHERE vk~vbeln IN s_vbeln
AND vk~auart = 'AG'."AG = Quot
SORT ivbap BY posnr matnr.
SELECT kvknumv kvkposn kvkappl kvkschl kv~kbetr
INTO TABLE ikonv
FROM konv AS kv
FOR ALL ENTRIES IN ivbap
WHERE kv~knumv = ivbap-knumv
AND kv~kposn = ivbap-posnr
AND kv~kappl EQ 'V'
AND ( kv~kschl EQ 'ZBP1'
OR kv~kschl EQ 'ZNAX'
OR kv~kschl EQ 'ZNAA' ).
SORT ikonv BY knumv kposn.
LOOP AT ivbap ASSIGNING <vbap>.
CLEAR konv_wa.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZBP1'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-lprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAX'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAA'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
ENDLOOP.
SORT ivbap BY posnr matnr.
LOOP AT ivbap INTO vbap_wa.
MOVE-CORRESPONDING vbap_wa TO result_wa.
APPEND result_wa TO iresult.
CLEAR: vbap_wa, result_wa.
ENDLOOP.
ENDFORM. " gather_report_data
*& Form create_output
FORM create_output.
CALL SCREEN 100.
FREE: iresult.
ENDFORM. " create_output
*& Module PBO_0100 OUTPUT
text
MODULE pbo_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF c_cont1 IS INITIAL.
*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT1'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Alv layout
PERFORM alv_100_layout.
PERFORM save_alv_layout.
*Alv field catalogue
PERFORM alv_100_fieldcat.
*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
i_save = ws-alv_save
is_variant = ws-alv_variant
CHANGING
it_outtab = iresult[]
it_sort = ws-alv_sort
it_fieldcatalog = it_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Create object of the event class
*and setting handler for double click
CREATE OBJECT e_dclick.
SET HANDLER e_dclick->handle_double_click FOR c_alv1.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*& Module PAI_0100 INPUT
text
MODULE pai_0100 INPUT.
ws-ok_code = sy-ucomm.
CASE ws-ok_code.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
CLEAR ws-ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*& Form alv_100_layout
text
--> p1 text
<-- p2 text
FORM alv_100_layout.
ty_lay1-numc_total = 'X'. " Numc total line
ty_lay1-cwidth_opt = 'X'. " Optimal column width
ty_lay1-detailinit = 'X'. " Show values that are initial in
ty_lay1-sel_mode = 'A'. " Column selection mode
ty_lay1-no_merging = 'X'. " No merging while sorting columns
ty_lay1-keyhot = 'X'.
ty_lay1-grid_title = 'SD Concessions'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = ' '.
ENDFORM. " alv_100_layout
*& Form alv_100_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'zcurrcstusd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Cost $'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 7.
ty_fieldcat-fieldname = 'zzbrndnm'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Brand'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 8.
ty_fieldcat-fieldname = 'zqedscgrp'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'QE'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'mstav'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Status'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'kwmeng'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Qty'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 10.
ty_fieldcat-fieldname = 'lprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'List Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 11.
ty_fieldcat-fieldname = 'sprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Discount'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 12.
ty_fieldcat-fieldname = 'netpr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Quot Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 13.
ty_fieldcat-fieldname = 'mrgn'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Margin%'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_100_fieldcat
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.
*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CCONT2'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ALV layout
PERFORM alv_101_layout.
*ALV fieldcatalogue
PERFORM alv_101_fieldcat.
*Sorting the output by field position
SORT iresult BY posnr.
*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = iresult[]
it_fieldcatalog = it_fieldcat.
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.
ENDMODULE. " PBO_0101 OUTPUT
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
ENDMODULE. " PAI_0101 INPUT
*& Form alv_101_layout
text
--> p1 text
<-- p2 text
FORM alv_101_layout.
ty_lay2-grid_title = 'Line Details'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.
ENDFORM. " alv_101_layout
*& Form alv_101_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat.
REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_101_fieldcat
*& Form save_alv_layout
text
--> p1 text
<-- p2 text
form save_alv_layout.
ws-alv_save = 'A'.
ws-alv_variant-report = sy-repid.
endform. " save_alv_layoutHello
Creating fieldcatalogs manually is one of the major error sources in ALV programming.
There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
Regards
Uwe
Maybe you are looking for
-
Intermittant server error when trying to compile jsp.
Hi, I'm testing my jsp on different browser versions, and on different connection speeds, and I'm finding a consistent problem with using weblogic v6.1sp1 and slower connections. (about 56k) In IE 5/5
-
Viewing html page of an applet
I am trying to write an applet. When I viewed the html page for the first time, it worked fine. But now it doesnt work properly. All the contents are not shown. I recompiled my code but the mistake remains. Please help
-
My intention here is to implement a function that do something to a Collection. The function recusively "knock off" one element from the Collection and call recursively until it hits certain base case. Also, I would like my Collection argument untouc
-
JDK 1.5 does not run in client mode
Hello all, I just downloaded JDK 1.5 update 17 for windows 64 bit. This does not support "client" mode. I read forums and found out that other 64 bit vms take the "java -client" argument and internally still work in server mode. Do I have to do some
-
Whenever I launch Dreamweaver (8.0.2 on Mac OS X 10.3.9), not only the last site I was working on gets opened, but also a PAGE that I close down as soon as Dreamweaver is launched. How do I set Dreamweaver NOT to open the page when it is launched? Ma