Code to equate table value to work area field name
Hello Experts,
How to match a certain value fetched from table to the internal table field.
For instance: transparent table has a column containing values as
AMOUNT
QUANTITY
there is another work area structure associated with different internal table consisting of amount and quantity fields.
Now depending on whether the record from transparent table has fetched AMOUNT or QUANTITY, i have to read either the amount or quantity value from the work area.
Can any one please suggest a technique to do it?
Thanks,
Pankaj
Hi
Try This:
suppose you have zitab table as trans. Table and another table itab1 with work area wa.
First you need to select values from Zitab to an internal table say itab.
sort itab by <field name>
loop at itab.
read table itab1 into wa with key quantity = itab-quantity
amount = itab-amount.
endloop.
This will read table itab1 where quantity and amount from itab table matches.
hope this will work for you.
thanks
Lalit Gupta
Similar Messages
-
Dynamic Work Area Field name Assignment.
hi Guru,
data: it_SFLIGHT type TABLE OF SFLIGHT,
wa_SFLIGHT TYPE SFLIGHT,
lv_field TYPE string.
lv_field = 'CARRID'. " Field name
wa_SFLIGHT-<lv_field> = 'vivek'. " Assigning Value to workarea.
When i try this i am getting the error.
Regards.
Vivekananthan.SHi,
assign (p_tc_name) to <tc>.
TYPES:
BEGIN OF st_mytable,
name1 TYPE string,
name2 TYPE string,
age TYPE i,
END OF st_mytable.
DATA:
gi_mytable TYPE STANDARD TABLE OF st_mytable,
g_mytable TYPE st_mytable.
* Define field symbols
FIELD-SYMBOLS:
<myfield1> TYPE ANY,
<myfield2> TYPE ANY,
<myfield3> TYPE ANY,
<myline> TYPE ANY.
* Fill table with data
g_mytable-name1 = 'John'.
g_mytable-name2 = 'Johnson'.
g_mytable-age = 25.
APPEND g_mytable TO gi_mytable.
g_mytable-name1 = 'Claudio'.
g_mytable-name2 = 'Jensen'.
g_mytable-age = 45.
APPEND g_mytable TO gi_mytable.
* The normal way to do it
LOOP AT gi_mytable INTO g_mytable.
WRITE: / g_mytable-name1, g_mytable-name2 ,g_mytable-age.
ENDLOOP.
SKIP 2.
* Do it with field symbols
LOOP AT gi_mytable ASSIGNING <myline>.
ASSIGN COMPONENT 1 OF STRUCTURE <myline> TO <myfield1>.
ASSIGN COMPONENT 2 OF STRUCTURE <myline> TO <myfield2>.
ASSIGN component 3 OF STRUCTURE <myline> TO <myfield3>.
WRITE: / <myfield1>,<myfield2>,<myfield3>.
ENDLOOP.
* Unassign field symbols
UNASSIGN <myfield1>.
UNASSIGN <myfield2>.
UNASSIGN <myfield3>.
UNASSIGN <myline>.
Regards,
Prabhudas -
Getting error Uni code check when modifying Ztable from work area?
Hi all,
Getting error Uni code check when modifying Ztable from work area?
and how to increment counter when data modified?
FM 'popup_to_confirm'.
IMPORTING
answer = RES.
CHECK
RES = '1'.
WRITE :/ 'UPDATE'.
MODIFY ZPPT_PPDPLAN FROM GWA_FIN_PROD.
thanks in advance..what error you are getting. make sure source and Target are of similar sturcture.
-
Work area field value not getting populated in table control grid.
Hi all,
I am currently facing an issue where I have declared a variable and have fetched the workarea field name in it. To be exact, the variable contains the workarea name whose value I am finally populating to the table control. Now although the workarea name when manually copied and pasted in field name in debugging mode exhibits the value of the it, Im unable to fetch the same value in the variable as I have only the work area name in it. I need the value of the workarea-field to be in the variable.Please provide your valuable suggestions for this issue...
Regards,
Edited by: Vishwanath Sreedharen on Jan 2, 2012 3:25 PMHi Nabheet,
Please consider the below example...
DATA: l_var(30) TYPE C.
CONCATENATE 'wa' '-' I_FIELD2-NAME INTO l_var.
The i_field2-name contains the name of a custom table field CP_CUSTOM_GRP. So now the l_var contains wa_cp_custom_grp.
Now consider the wa_cp_custom_grp has a value 'BA'.
Now my issue is the l_var contains wa_cp_custom_grp but not its value(too obvious)... Would like to know whether is there a way through which the value of this wa_cp_custom_grp 'BA' could be populated to the variable l_var... -
How to create dynamic strcture and accepting runtime value in work area
Hi,
I am using RFC_READ_TABLE for joining more than table and written select query but into clause work area value is passed but it is short dump is displaying with too few many fields in into clause .work area WA need some casting type conversion which accepts the some run time value and should have some structure for it.how to create dynamic structure?hi
good
go through this and use in your report accordingly.
If you are trying to read some information from SAP and you can't find the right BAPI then RFC_READ_TABLE can do the job for you.
RFC_READ_TABLE is powerful RFC it gives you the access to all tables and views in SAP. I basically used RFC_READ_TABLE for Material Master Search application on the Intranet.
Now you may say there are lots of BAPI for this functionality. You are right but I had to work around the BAPI to get Prices (Moving Average Price) and it just did not work very well. Because of the nature of the application I had to use RFC_READ_TABLE because then I can use powerful SQL expression for searching. RFC_READ_TABLE give you the ability to code the where clause which is quite enough.
I have included part of the code use in asp page to read ENT1027 for Mgroup and M description & number but without object creation. The other part of the code reads MBEW for price & quantity.
Code
lt;%
'#######################Diming the Structures
Call BAPIRFC.DimAs("Rfc_Read_Table", "FIELDS", MaterialSelection_RS)
Call BAPIRFC.DimAs("Rfc_Read_Table", "OPTIONS", Selection_RS)
'########################Search Type########################
' C contanis
' S Start with
' E Ends with
if searchtype = "C" then
FormatedSearch_Keyword = "%" & Search_Keyword & "%"
elseif searchtype = "S" then
FormatedSearch_Keyword = Search_Keyword & "%"
else searchtype = "E" then
FormatedSearch_Keyword = "%" & Search_Keyword
end if
'################# Flaged for deletion Materials #####################
if showdeleted = "No" then
Selection_RS.AddNew Array("TEXT"),Array("LVORM <> 'X' AND")
end if
'############## users can search three material group ################
'############## GROUPS: OFFICESUP TECOMHARD TECOMSOFT ###############
'##USER STILL CAN NAROW THEIR SEARCH BY SELECTING ON OF THREE#########
if MGroup = "ALL" then
Selection_RS.AddNew Array("TEXT"),Array("MATKL IN ('OFFICESUP','TECOMHARD','TECOMSOFT')")
else
Selection_RS.AddNew Array("TEXT"),Array("MATKL = '"& MGroup &"' and ")
end if
'#######################ADDING SEARCH KEYWORD TO STRUCTURE##############
if not Search_Keyword = "" then
Selection_RS.AddNew Array("TEXT"),Array(" MAKTG LIKE '" & FormatedSearch_Keyword & "'")
end if
Selection_RS.Update
'#######################ADD RETURNED FIELDS#########################
MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATNR","000000","000000" ,"","")
MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATKL","000000","000000" ,"","")
MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MAKTG","000000","000000" ,"","")
MaterialSelection_RS.Update
call BAPIRFC.Rfc_Read_Table("ENT1027", Material_RS, MaterialSelection_RS, Selection_RS, "~", "", "0", "0")
If Err.Number > 0 then
Response.Write "Error:" & "<BR>"
Response.Write " Err.number...... " & Err.Number & "<BR>"
Response.Write " Err.Description. " & Err.Description & "<BR>"
end if
'###########LOOP THROUGH RECORDSET
if not Material_RS is nothing then
do while not Material_RS.eof
loop
end if
%>
thanks
mrutyun^ -
Update database table from a work area
hi!
I have a workarea that is like the corresponding database table. There are a lot of fields so I dont want to update each field with an UPDATE but instead I want to do som sort of:
UPDATE dbase_table
FROM work_area
WHERE dbase_table-primary_key = work_area-primary_key
I could only find a statement called UPDATE dbase_table FROM work_area but I dont understand how without specifying a WHERE clause it knows which rows to update.
regards
BaranUPDATE dbtab FROM wa. or
UPDATE (dbtabname) FROM wa.
Extras:
1. ... CLIENT SPECIFIED
2. ... CONNECTION con
Effect
Changes one single line in a database table, using a primary key to identify the line and taking the values to be changed from the specified work area, wa. The data is read out of wa from left to right, matching the line structure of the database table dbtab. The structure of wa remains unchanged. This means that wa must be at least as wide (see DATA) as the line structure of dbtab, and have the same alignment. Otherwise, a runtime error occurs.
If either the database table, dbtab, or the work area, wa, contain Strings, wa must be compatible with the line structure of dbtab.
Example
Changing the telephone number of the customer with customer number '12400177' in the current client:
DATA wa TYPE scustom.
SELECT SINGLE * FROM scustom INTO wa
WHERE id = '12400177'.
wa-telephone = '06201/44889'.
UPDATE scustom FROM wa.
When the command has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1).
Examples
Update discount for the customer with the customer number '00017777' to 3 percent (in the current client):
DATA: wa TYPE scustom.
SELECT SINGLE * FROM scustom INTO wa
WHERE id = '00017777'.
wa-discount = '003'.
UPDATE scustom FROM wa.
The Return Code is set as follows:
SY-SUBRC = 0:
The specified line has been updated.
SY-SUBRC = 4:
The system could not update any line in the table, since there is no line with the specified primary key.
BR< JAcek -
Difference between tables statement and work area
Hi
i would like know the difference between these statement.
tables: vttk.
data :itab type standard table of vttk,
wa_itab like line of vttk.
what will happen with the table statement keyword ???
whether any difference between the ouput created through tables and wa_itab statement???Hi
HI,
INTERNAL Table and it's background:
===================================
Internal table acts as a container which is used to store the record sets. That is used to store the data fetched from the database table.
So due to performance reason every time access to database would not be so good and decrease the performance. So you just select the data from the database and store it in the intermediate table. This table is called INTERNAL TABLE. So it's an replica of the database. The design foes like this,
PRESENTATION SERVER <> APPLICATION SERVER <>
DATABASE SERVER.
So everytime gain accessing to database results in high resource usage and bad permformance.
So always play around with internal tables. So obviously the whenever you access the data in the INTERNAL TABLE, the application server will be used.
WORK AREA:
==========
When ever you loop at the internal table, the current record should be stored in a temporary work place. That is called WORK AREA.
LOOP AT ITAB INTO WORKAREA.
ENDLOOP.
ITAB :An internal table
WORKAREA:An instance of internal table
Go thru the link below
Internal tables
appending internal tables.
<b>Reward if usefull</b> -
How to delete the records from database table without using work area
Hi all,
The purpose of the down program is to delete the entire contents from all the tables. The deletion of the table should be in sorted manner. Is there any other way to write the code more efficiently,
TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR, ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL, ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
DELETE ZFFMCTL_AP.
IF SY-SUBRC = 0.
DELETE ZFFMMHDR_AP.
IF SY-SUBRC = 0.
DELETE ZFFM_CHANGE_LOG.
IF SY-SUBRC = 0.
DELETE ZFFMDTL_AR.
IF SY-SUBRC = 0.
DELETE ZFFMHDR_AR.
IF SY-SUBRC = 0.
DELETE ZFFMDTL_JV.
IF SY-SUBRC = 0.
DELETE ZFFMHDR_JV.
IF SY-SUBRC = 0.
DELETE ZFFMDTL_SKF.
IF SY-SUBRC = 0.
DELETE ZFFMHDR_SKF.
IF SY-SUBRC = 0.
DELETE ZFINVOICE_DETAIL.
IF SY-SUBRC = 0.
DELETE ZFFMMASTER.
IF SY-SUBRC = 0.
DELETE ZFFMLOGREAD_CLUS.
IF SY-SUBRC = 0.
DELETE ZFFMCTL.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
Waiting for response,
Thanks in advance
JohnWrite this way....
TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR, ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL, ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
DELETE ZFFMCTL_AP.
CHECK SY_SUBRC = 0.
DELETE ZFFMMHDR_AP.
CHECK SY_SUBRC = 0.
DELETE ZFFM_CHANGE_LOG.
CHECK SY_SUBRC = 0.
DELETE ZFFMDTL_AR.
CHECK SY_SUBRC = 0.
DELETE ZFFMHDR_AR.
CHECK SY_SUBRC = 0.
DELETE ZFFMDTL_JV.
CHECK SY_SUBRC = 0.
DELETE ZFFMHDR_JV.
CHECK SY_SUBRC = 0.
DELETE ZFFMDTL_SKF.
CHECK SY_SUBRC = 0.
DELETE ZFFMHDR_SKF.
CHECK SY_SUBRC = 0.
DELETE ZFINVOICE_DETAIL.
CHECK SY_SUBRC = 0.
DELETE ZFFMMASTER.
CHECK SY_SUBRC = 0.
DELETE ZFFMLOGREAD_CLUS.
CHECK SY_SUBRC = 0.
DELETE ZFFMCTL. -
HI SDN COMMUNITY..!!
I HAVE TO USE THE WA_SEKPO-FIELDNAME DYNAMICALLY..
DATA: BEGIN OF WA_SEKPO,
EBELN TYPE EBELN,
BRTWR TYPE BRTWR,
EFFWR TYPE EFFWR,
MENGE TYPE MENGE,
END OF WA_SEKPO.
DATA: SEKPO LIKE TABLE OF WA_SEKPO.
DATA: VAR_FNAME TYPE STRING.
FIELD-SYMBOLS: <FS> TYPE ANY.
STRUCTURE OF <b>EDITPOS</b>(INTERNAL TABLE)
|OBJECTID |TABNAME|FNAME | F_NEW | F_OLD
|4500016340 |EKPO |BRTWR | 26 | 11
|4500016340 |EKPO |EFFWR | 25 | 12
|4500016340 |EKPO |MENGE | 22 | 13
INTERNAL TABLE :
<b>EDITPOS</b> CONTAINS VALUES FOR : BRTWR
EFFWR
MENGE
IT MAY CONTAIN VALUES FOR MORE FIELDS.
NOW PROBLEM IS
I HAVE TO UPDATE MY INTERNAL TABLE : SEKPO
FOR FIELDNAMES : BRTWR
EFFWR
MENGE
BUT I DONT HAVE TO HARD CODE IT FOR EACH FIELD.
PLEASE CHECK, HOW THIS CAN BE ACHIVED?
WA_SEKPO-BRTWR = WA_EDITPOS-F_NEW.
PLEASE UPDATE THE CODE:
LOOP AT EDITPOS INTO WA_EDITPOS.
ASSIGN WA_EDITPOS-FNAME TO <FS>.
CONCATENATE 'WA_SEKPO-' <FS> INTO VAR_FNAME.
WA_SEKPO-(<FS>) = WA_EDITPOS-F_NEW.
* MODIFY TABLE SEKPO FROM WA_SEKPO
* TRANSPORTING <FS>.
ENDLOOP.
HELP WILL BE APPRICIATED
THANKS IN ADVANCE
VIJAY RAHEJAHI
STRUCTURE OF EDITPOS(INTERNAL TABLE)
|OBJECTID |TABNAME|FNAME | F_NEW | F_OLD
|4500016340 |EKPO |BRTWR | 26 | 11
|4500016340 |EKPO |EFFWR | 25 | 12
|4500016340 |EKPO |MENGE | 22 | 13
LOOP AT EDITPOS INTO WA_EDITPOS.
IF WA_EDITPOS = 'BRTWR'.
WA_SEKPO-BRTWR = WA_EDITPOS-F_NEW.
MODIFY TABLE SEKPO FROM WA_SEKPO
TRANSPORTING BRTWR.
ELSEIF WA_EDITPOS = 'EFFWR'.
WA_SEKPO-EFFWR = WA_EDITPOS-F_NEW.
MODIFY TABLE SEKPO FROM WA_SEKPO
TRANSPORTING EFFWR.
ELSEIF WA_EDITPOS = 'MENGE'.
WA_SEKPO-EFFWR = WA_EDITPOS-F_NEW.
MODIFY TABLE SEKPO FROM WA_SEKPO
TRANSPORTING MENGE.
ENDIF.
ENDLOOP.
I AM TRYING TO ACHIEVE THE ABOVE FUNCTIONALITY DYNAMICALLY,
AS I AM UNAWARE OF ENTRIES IN Internal Table: EDITPOS.
It contains values: BRTWR/EFFWR/MENGE
But it may contain more,SO i cannot straight away HARD code it for modifying entries in SEKPO.
for which i have written the code:
LOOP AT EDITPOS INTO WA_EDITPOS.
ASSIGN WA_EDITPOS-FNAME TO <FS>.
CONCATENATE 'WA_SEKPO-' <FS> INTO VAR_FNAME.
WA_SEKPO-<FS> = WA_EDITPOS-F_NEW.
MODIFY TABLE SEKPO FROM WA_SEKPO
TRANSPORTING <FS>.
ENDLOOP.
But there it shown Error before Activating the code: that <fs> is not a component of work area wa_sekpo
WA_SEKPO-<FS>
that is the problem,How to assign fieldname to a work area Dynamically.
Regards,
Vijay Raheja -
Dynamic access to work area fields
Hi
I've got a DataBase table with 20 fields with different names.
field1
field2
field3.
field20
I'm using a work area to read values and i wanna read an specific field of this work area.
The problem is the following:
I don't know the name of the field i need to access, instead, i have it in a field symbol.
Is there any way i can get the value of this field???Hi,
Try the following example
DATA: i_TAB LIKE PA0001 OCCURS 0 WITH HEADER LINE,
l_field(50) TYPE C,
l_fieldname(50) TYPE C VALUE 'UNAME'.
FIELD-SYMBOLS: <fieldxx> TYPE ANY,
<valxx> TYPE ANY.
ASSIGN l_fieldname TO <fieldxx>.
SELECT * FROM PA0001 INTO TABLE I_TAB.
LOOP AT I_TAB.
CONCATENATE 'I_TAB-' <fieldxx> INTO l_field.
ASSIGN (l_field) TO <valxx>.
WRITE <valxx>.
ENDLOOP. -
How to get work area - Variable name at runtime
hi all,
in this snippet.
how can we retrieve the field name.
this write statement merely writes the contents stored.
how is it possible to write the field name.............?
DO.
ASSIGN COMPONENT sy-index
OF STRUCTURE <wa> TO <comp>.
IF sy-subrc = 0.
WRITE / <comp>.
ELSE.
EXIT.
ENDIF.
ENDDO.
Naveen...In More detail....
Find the help ID for various fields:
TYPES: MYTYPE LIKE SBOOK-CLASS.
DATA: F1 LIKE SBOOK-LUGGWEIGHT,
F2 TYPE MYTYPE,
F3 LIKE F1,
HLP(30) TYPE C,
NAME(30) TYPE C VALUE 'SBOOK-ORDER_DATE'.
FIELD-SYMBOLS: <G1>, <G2>.
DESCRIBE FIELD F1 HELP-ID HLP. WRITE: /(5) 'F1:', HLP.
DESCRIBE FIELD F2 HELP-ID HLP. WRITE: /(5) 'F2:', HLP.
DESCRIBE FIELD F3 HELP-ID HLP. WRITE: /(5) 'F3:', HLP.
ASSIGN (NAME) TO <G1>.
DESCRIBE FIELD <G1> HELP-ID HLP. WRITE: /(5) '<G1>:', HLP.
ASSIGN F2 TO <G2>.
DESCRIBE FIELD <G2> HELP-ID HLP. WRITE: /(5) '<G2>:', HLP.
Result: The following help IDs are output:
F1: SBOOK-LUGGWEIGHT
F2: SBOOK-CLASS
F3: SBOOK-LUGGWEIGHT
<G1>:
<G2>: SBOOK-CLASS -
Form works but field names don't carry over to email
I created a form and set it up to generate an email
containing the information, which will be transmitted to my client.
Everything works fine, except I can't get the form field names to
carry over to the email. For example, I just get the completed
field info w/o the labels, and I'd like to make it easier for my
client to disseminate the information.
Here's the code:
<form action="
http://fcdesign.net/v-cgi/forms.cgi"
method="get"
enctype="multipart/form-data" name="bwccontact"
id="bwccontact"
onsubmit="MM_validateForm('Name','','R','Street_Address','','R','City','','R','State','', 'R','Zip','','R','Phone','','R','Questions_or_Comments','','R');return
document.MM_returnValue">
<input type=hidden name="print_blank_fields"
value="1">
<table>
<tr>
<th width="197" align="right">
Name: </th>
<td colspan="3">
<input name="Name" type="text" size="30" />
</td>
</tr>
<tr>
<th align="right">
Street Address: </th>
<td colspan="3">
<input type="text" name="Street_Address" size="30" />
</td>
</tr>
<tr>
<th align="right">
City: </th>
<td colspan="3">
<input type="text" name="City" size="30" />
</td>
</tr>
<tr>
<th align="right">
State: </th>
<td width="27">
<input name="State" type="text" size="4" maxlength="2"
/> </td>
<td width="115"> </td>
<td width="131"> </td>
</tr>
<tr>
<th align="right">
Zip: </th>
<td colspan="3">
<input name="Zip" type="text" size="12" maxlength="10"
/> </td>
</tr>
<tr>
<th align="right">
Phone: </th>
<td colspan="3">
<input name="Phone" type="text"
onblur="MM_changeProp('Phone','','value','','INPUT/TEXT')"
value="(xxx) xxx-xxxx" size="30" /> </td>
</tr>
<tr>
<th align="right">
Email: </th>
<td colspan="3">
<input name="Email" type="text" size="30" maxlength="35"
/> </td>
</tr>
<tr>
<th height="40" align="right" valign="top"
nowrap="nowrap">
Questions or Comments: </th>
<td colspan="3">
<textarea name="Questions_or_Comments" cols="40"
rows="5"></textarea> </td>
</tr>
<tr>
<th align="right" nowrap="nowrap"> Preferred Contact:
</th>
<td colspan="3"><input type="radio"
name="Preferred_Contact_Method" value="Phone" checked="checked"
class="checkbox" />
Phone
<input type="radio" name="Preferred_Contact_Method"
value="Email" class="checkbox" />
Email </td>
</tr>
<tr>
<th align="right" nowrap="nowrap">
Best Time to Reach You: </th>
<td colspan="3">
<input name="Best_Time_to_Reach_You" type="text"
value="daytime or evening?" size="30" /> </td>
</tr>
<tr>
<th></th>
<td colspan="3"><input type="submit"
name="Form_Submit" value="Submit Form" />
<input name="Form_Reset" type="reset" value="Reset Form"
/></td>
</tr>
<tr>
<th></th>
<td colspan="3"> </td>
</tr>
</table>
<input type="hidden" name="_vDeckformid" value="567" />
</form>doh!
I am truly a nincompoop...it was in the utility provided by
my web hosting company...nevermind!!! -
Modify dynamic internal table from dynamic work area using index...
ASSIGN w_text TO <fs>.
ASSIGN w_temp TO <fs1>.
lint_tab_iw49[] = <tab>.
lint_tab_iw49_t[] = <tab>.
DELETE ADJACENT DUPLICATES FROM lint_tab_iw49 COMPARING aufnr.
LOOP AT lint_tab_iw49 INTO lws_tab_iw49.
READ TABLE lint_object_tab1 INTO lws_object_tab1
WITH KEY aufnr = lws_tab_iw49-aufnr.
IF sy-subrc EQ 0.
Collect operations in rows of an internal table.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZOPERN' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
CONCATENATE w_text <fs> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split operations into an internal table to get operations in rows.
SPLIT w_text AT ',' INTO TABLE lint_vornr.
DELETE lint_vornr WHERE vornr = ' '.
DESCRIBE TABLE lint_vornr LINES w_lines.
Collect costs in rows of an internal table
CLEAR: w_idx, w_nn, w_xx, w_text.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZCOST' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
<fs1> = <fs>.
CONCATENATE w_text <fs1> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split costs into an internal table to get costs in rows.
SPLIT w_text AT ',' INTO TABLE lint_escost.
DELETE lint_escost WHERE cost = ' '.
DESCRIBE TABLE lint_escost LINES w_lines_cost.
Append lines of lint_escost from 1 to w_lines to lint_escost1.
Collect currencies in rows of an internal table
CLEAR: w_idx, w_nn, w_xx, w_text.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZCURR' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
<fs1> = <fs>.
CONCATENATE w_text <fs1> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split costs into an internal table to get costs in rows.
SPLIT w_text AT ',' INTO TABLE lint_curr.
DELETE lint_curr WHERE curr = ' '.
DESCRIBE TABLE lint_curr LINES w_lines_curr.
Append lines of lint_curr from 1 to w_lines to lint_curr1.
ENDIF.
PERFORM update_object_tab_for_iw49n.
ENDLOOP.
ENDIF.
ENDFORM. " modify_object_tab
*& Form update_object_tab_for_IW49N
text
--> p1 text
<-- p2 text
FORM update_object_tab_for_iw49n .
DATA: lws_temp TYPE string VALUE 'where aufnr = lws_tab_iw49-aufnr',
lw_index TYPE sy-index.
READ TABLE <tab> TRANSPORTING NO FIELDS WITH KEY ('AUFNR') =
lws_tab_iw49-aufnr.
IF sy-subrc EQ 0.
lw_index = sy-tabix.
LOOP AT <tab> INTO <wa1> FROM lw_index.
IF <wa1>-aufnr NE lws_tab_iw49-aufnr.
EXIT.
ELSE.
CLEAR lw_index.
lw_index = sy-tabix.
lw_index = 1.
WHILE lw_index LE w_lines.
READ TABLE lint_escost INTO lws_escost INDEX lw_index.
IF sy-subrc EQ 0.
lw_index = lw_index + 1.
<wa1>-zzcost1 = lws_escost-cost.
ENDIF.
READ TABLE lint_curr1 INTO lws_curr INDEX lw_index.
IF sy-subrc EQ 0.
<wa1>-zzcurr1 = lws_curr-curr.
ENDIF.
MODIFY <tab> FROM <wa1> "TRANSPORTING ('ZZCOST1') ('ZZCURR1')
INDEX sy-tabix.
IF sy-subrc EQ 0.
ENDIF.
lw_index = lw_index + 1.
ENDWHILE.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " update_object
Hi,
With referene to the code snippet above I want to modify <tab> from <wa1> on specific indices or with specific where condition.
Is it achievable... How?
Many thanks in advance.
Thanks & Regards,
ShreyaYou might have to split the code in to two parts to keep the formatting intact.
-
Error while Appending a work-area in a table
Hi Experts,
Requirement :- I want to append a row in the the table but the work-area with which i am appendign the values is of different type than the target so i am getting error .
Code :- APPEND WA_SOURCE TO RESULT_PACKAGE
Error :- A line of RESULT_PACKAGE not mutually convertible in a Unicode program..........
Is there any way to append the one-by one values in the RESULT_PACKAGE fields.
As i cn't change the type of my source work-area.
Don't we have something like :-
Append Result_package
Result_package_field1 = wa-field1
Result_package_field2 = wa_field2.....
PLEASE HELP
Regards,
rg
Edited by: R G on Mar 26, 2009 10:34 AMHello,
I can't change the Work-area type....
Can't we appened a line in any table by providing direct values??????
You DONOT have to change the TYPE of your Work Area. You create a new work area.
You can try something like this:
DATA:
WA_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.
MOVE CORRESPONDING WA_SOURCE TO WA_RESULT_PACKAGE.
APPEND WA_RESULT_PACKAGE TO RESULT_PACKAGE.
CLEAR WA_RESULT_PACKAGE.
Or Else,
DATA:
WA_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.
MOVE WA_SOURCE-F1 TO WA_RESULT_PACKAGE-F1.
MOVE WA_SOURCE-F2 TO WA_RESULT_PACKAGE-F2.
MOVE WA_SOURCE-F3 TO WA_RESULT_PACKAGE-F3.
APPEND WA_RESULT_PACKAGE TO RESULT_PACKAGE.
CLEAR WA_RESULT_PACKAGE.
BR,
Suhas
Edited by: Suhas Saha on Mar 26, 2009 10:44 AM -
Internal Table - Work Area issue
Guru's:
I am selecting the mentioned fields from TVAKT into t_itt1 (internal table) - I however an encountering "you canot use an internal table as a work area" as an error.
DATA: s_bezei LIKE tvakt-bezei,
s_auart LIKE tvakt-auart.
DATA t_itt1 LIKE tvakt OCCURS 0.
DATA z_itt LIKE tvakt.
its at this stage of the code that I am facing this problem
SELECT spras auart bezei FROM tvakt
INTO t_itt1
WHERE bezei IN s_bezei
AND auart IN s_auart.
would appreciate your help.Hello,
You need to change the declaration of the s_spras to use the IN clause:
See these for more informations: http://help.sap.com/saphelp_nw04/helpdata/en/18/a1f251e28b11d295f500a0c929b3c3/frameset.htm and Create a Ranges Table Type.
Regards.
Maybe you are looking for
-
Dear all , i need material , plant , vendor , price (buying price / processing charge) . is there any report for the same ( excluding ME1p) Pl guide
-
Nokia Suite/Nokia Store finally working
I had not tried downloading/installing an app from the Nokia store from within Nokia Suite in quite a while, as it never seemed to work. On a lark, I decided to see whether anything had changed since installing the latest version of Nokia Suite. To m
-
Is apple working of a fix for this update error? 8.0.1 needs 610mb of space. Every time I try to install the latest update, I get this error: "Updating to iOS 8.0.2 requires at least 610 MB of free space on your iPhone. Please change your media syn
-
Air 15 known issues - wrong screen size and dpi
Will the next update of Air 15 solve the issues below.. the dpi problem with iPhone 6 plus is a show stopper, i cant get away with delivering a reduced dpi ... under pressure to update 20+ applications ... Known Issues AIR 15.0.0.183 [ iPhone 6 Pl
-
Reports server failed to start with OPMN
hi We r using oracle application server 10g(904) in sunsparc machine..we have configured reports server with opmn..while starting all the process using opmnctl startall im getting the error Failed to start the managed process after the maximum retry