Update a CLOB field in a table
Can some help me in updating a field of CLOB type in a table? The field has some HTML content and i want to search for a particular string and update it in the field.
eg:
<TR></TR> is part of the HTML content present in the field. I need to update it to <TR>aa</TR> across all the rows which has such a string.
Thanks
Try this
SQL> SELECT * FROM Y99
2 /
A
<TR></TR>
SQL> update y99 set a = replace(A,'<TR></TR>', '<TR>A</TR>')
2 /
1 row updated.
SQL> SELECT * FROM Y99
2 /
A
<TR>A</TR>
SQL>Regards
Singh
Similar Messages
-
Good morning.
I have a table....
Table1
ID CLOBTXT
123 null
456 Testing Text
I want to update the CLOB field in row 123 with the clob field from 456. For some reason I am unable to update it. I can insert the data from 456 into another table so I know it is reading it but I just cant update the 123 row.
Any ideas? I am new to CLOB and am trying to learn about how to handle them.
ThanksCan you be more specific about the Oracle version and the SQL you are using, and the error message you receive?
I just tried this simple test with no problems:
Oracle Database 10g Release 10.2.0.4.0 - 64bit Production
SQL> CREATE TABLE t (id NUMBER(3), clobtxt CLOB);
Table created.
SQL> INSERT INTO t VALUES (123, NULL);
1 row created.
SQL> INSERT INTO t VALUES (456, 'Testing text');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM t;
ID
CLOBTXT
123
456
Testing text
SQL> UPDATE t
2 SET clobtxt = (SELECT clobtxt FROM t WHERE id = 456)
3 WHERE id = 123;
1 row updated.
SQL> COMMIT;
Commit complete.
SQL> SELECT * FROM t;
ID
CLOBTXT
123
Testing text
456
Testing text
SQL> -
Updation of Custom Fields in AFRU table Using Customerexit
Hi all,
I added two fields in CO11n Tcode using SCREEN EXIT - CONFPP07 and iam trying to update these two fields in AFRU table
using CONFPP05. But iam unable to update these two field .
see this code in CONFPP05
LOOP AT afrud_tab.
afrud_tab-zzshift = wa_afrud-zzshift1 .
afrud_tab-zzoperator = wa_afrud-zzoperator1 .
MODIFY afrud_tab.
ENDLOOP.
Plz help me regarding this..Thanks for reply
Ya i added two fields in confpp07 .
see the code :
*& Include ZXCOFTOP
tables : afrud.
DATA : WA_AFRUD TYPE AFRUD,
IT_AFRUD TYPE TABLE OF AFRUD.
Include ZXCOFU24
MOVE afrud-zzshift1 TO wa_afrud-zzshift1.
MOVE afrud-zzoperator1 TO wa_afrud-zzoperator1.
Even though it is not updating . except these two fields.
Regards,
Srinivas -
Update Yes/No field in access table through oracle procedure
Hi,
How to update Yes/No field in access table through oracle procedure. all other fields like AutoNumber, Text I can update it. Yes/No field how to update? Please, any one can help me?
Thanks and Regards,
Sudha.Sudha Teki wrote:
select "fldPost" from tblPHd@ODBCLNKNot quite sure what you mean, but the way you select the column would indicate a case sensitive column name
Look at this example
SQL> create table t
2 ("this" varchar2(10))
3 /
Table created.
SQL> insert into t values ('hello')
2 /
1 row created.
SQL> select *
2 from t
3 /
this
hello
SQL> select this
2 from t
3 /
select this
ERROR at line 1:
ORA-00904: "THIS": invalid identifier
SQL> select "this"
2 from t
3 /
this
helloIs your column name also case sensitive? -
Hi,
I have to write an UPDATE statement to update a CLOB field. I know that there's a 4000 char limit on a string (in an UPDATE). Any suggestions ?
Please advise,
Marc.What about the PL/SQL solution I had above?
Simple (not thoroughly tested) split string routine:
DECLARE
test_string VARCHAR2(32000);
chunk VARCHAR2(255);
chunk_size NUMBER := 255;
pos NUMBER := 1;
BEGIN
test_string := RPAD('X',1210,'X');
CHUNK := SUBSTR(TEST_STRING,pos,chunk_size);
DBMS_OUTPUT.PUT_LINE(CHUNK);
WHILE pos < LENGTH(test_string)
LOOP
pos := pos + chunk_size;
CHUNK := SUBSTR(TEST_STRING,pos,chunk_size);
DBMS_OUTPUT.PUT_LINE(CHUNK);
END LOOP;
END;
/ -
Update of segment field in bseg table
hi
can any explain me about update of segment field in bseg table
segment is mentained in profit center master record ,and i want to generate trial balance segment wise and profit center wise
please suggest me steps to do in a new gl senario
thanks
cbHi,
You need to activate the assign scenarion FIN_SEGM to your ledgers in the below path:-
SPRO> Financial Accounting (New) > Financial Accounting Global Settings (New) > Ledgers > Ledger > Assign Scenarios and Customer Fields to Ledgers
Then you need to make document splitting characteristics based on Segment field in the below path:-
SPRO> Financial Accounting (New) > General Ledger Accounting (New) > Business Transactions > Document Splitting > Define Document Splitting Characteristics for General Ledger Accounting
Make the below entry:-
Field = SEGMENT
Zero Balance = Selected
Partner Field = PSEGMENT
Mandatory Field = Selected
Then you will be able to generate the balance sheet segment wise in report S_PL0_86000028 "Financial Statement: Actual/Actual Comparison". (Similar steps you can use for profir center wise balance sheet in addition.)
Regards,
Gaurav -
Update the Street field in ADRC table.
Hello !! Please I need some help.
I have to update the Street field in ADRC table.
I have this list.
Where I can put a Flag and an Update to do it.
Im really newbie. Im doing it in IDES, to test it first.
Help !
REPORT Z_LIST_ADRC LINE-SIZE 190
LINE-COUNT 65
NO STANDARD PAGE HEADING.
TABLES: ADRC.
DATA: BEGIN OF ITAB OCCURS 0,
ADDRNUMBER LIKE ADRC-ADDRNUMBER,
date_to like ADRC-date_to,
NAME1 LIKE ADRC-NAME1,
CITY1 LIKE ADRC-CITY1,
CITY2 LIKE ADRC-CITY2,
STREET LIKE ADRC-STREET,
MC_NAME1 LIKE ADRC-MC_NAME1,
MC_CITY1 LIKE ADRC-MC_CITY1,
MC_STREET LIKE ADRC-MC_STREET,
END OF ITAB.
SELECT ADDRNUMBER DATE_TO NAME1 CITY1 CITY2 STREET MC_NAME1 MC_CITY1 MC_STREET
FROM ADRC INTO TABLE ITAB.
LOOP AT ITAB.
WRITE : /001 ITAB-ADDRNUMBER,
007 ITAB-DATE_TO,
016 ITAB-NAME1,
040 ITAB-CITY1,
070 ITAB-CITY2,
090 ITAB-STREET,
120 ITAB-MC_NAME1,
150 ITAB-MC_CITY1,
170 ITAB-MC_STREET.
ENDLOOP.
TOP-OF-PAGE.
ULINE.
WRITE: /001 'n-addr',
007 'date',
016 'name',
040 'city1',
070 'city2',
090 'street',
120 'name-s',
150 'city1-s',
170 'city2-s'.
ULINE.HI,
data : itab like standard table of adrc.
select * from adrc into table itab.
loop at itab.
itab-street2 = 'New value'.
modify itab index sy-tabix.
endloop.
if not itab[] is initial.
modify adrc from table itab.
endif. -
How to update a custom field of MARC table using BAPI_MATERIAL_SAVEREPLICA
Hi,
I want to update a custom field (Appended field) of MARC table using BAPI_MATERIAL_SAVEREPLICA. Please help me in this issue. I cannot use BAPI_MATERIAL_SAVEDATA as this updated the MARC table record by record. I have to update bulk records at a time.
Thanks
Rahul.Hi,
Use the Documentation given for struture in BAPI docuemntation...
For loading data into custom fields of MARC use the structure - BAPI_TE_MARC.
First, structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN, MLGT, MVKE, MARM, MAKT) and the appropriate check structures BAPI_TE_<NAME> (<NAME> = MARAX, for example) have to be extended by the customer to include the required fields. The structures that are delivered as standard only contain the relevant key fields. When new fields are added to this structure, you should ensure that a field has the same name as the field in the database table. Furthermore, the fields in the structures BAPI_TE_<NAME> can only be CHARACTER fields. Data element BAPIUPDATE is to be used for the fields in the check structure (exception to this: key fields.)
Parameters EXTENSIONIN and EXTENSIONINX are used for transferring data to the method. Field STRUCTURE contains the name of the structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX). This names is used to identify the work area (for example, WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to which the data is transferred. The remaining fields in parameters EXTENSIONIN or EXTENSIONINX contain data for the key fields (for example, the material number) and the data for customer-specific fields. The number of characters reserved in both parameters for the contents of the customer-specific fields must match the number of characters for the relevant field in the work area. If the number of required characters is less, the remaining characters are left blank. Only when all characters have been filled can the contact for an additional field be transferred. Bear in mind that only data for which an appropriate indicator has been set in the work area can be updated to the database.
Regards,
Bhargava -
Problem with update of BLOB field in a table with compound primary key
Hi,
I've been developing an application in Application Express 3.1.2.00.02 that includes processing of BLOB data in one of the tables (ZPRAVA). Unfortunately, I've come across a strange behaviour when I tried to update value in a BLOB field for an existing record via a DML form process. Insert of a new record including the BLOB value is OK (the binary file uploads upon submiting the form without any problems). I haven't changed the DML process in any way. The form update process used to work perfectly before I'd included the BLOB field. Since than, I keep on getting this error when trying to update the BLOB field:
ORA-20505: Error in DML: p_rowid=3, p_alt_rowid=ID, p_rowid2=CZ000001, p_alt_rowid2=PR_ID. ORA-01008: not all variables bound
Unable to process row of table ZPRAVA.
OK
Some time ago, I've already created another application where I used similar form that operated on a BLOB field without problems. The only, but maybe very important, difference between both the cases is that the first sucessfull one is based on a table with a standard one-column primary key whereas the second (problematic one) uses a table with compound (composite) two-column PK (two varchar2 fields: ID, PR_ID).
In both cases, I've followed this tutorial: [http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm]).
Can anybody confirm my suspicion that Automatic Row Processing (DML) can be used for updating BLOB fields within tables with only single-column primary keys?
Thanks in advance.
ZdenekIs there a chance that the bug will be included in the next patch?No, this fix will be in the next full version, 3.2.
Scott -
Is it possible to write a result of query to a CLOB field in another table
Hi all,
I have a table with 50 columns which will ideally have around 250,000 rows. I want to select all the rows from this table and insert the result in to another
table's CLOB or BLOB column. ( I think CLOB is preferred for strings !!)
f.i
Table1 : SELECT ID, COL1||','||COL2||','||COL3||','||COL4||','||COL5 FROM TF_TEMPREP
ORDER BY COL1
will have the output
A001, 1,ABN LAYOUT,01-APR-11,30-APR-11,REMARK1
A001, 2,CTS ,01-APR-11,10-APR-11,REMARK2
A001, 3,BTS,01-APR-11,20-APR-11,REMARK3
A001, 4,CWWS,01-JAN-11,31-JAN-11,REMARK4
A001, 5,ZYNC,01-MAR-11,31-MAR-11,REMARK5
I would like to store these rows into another table (TF_TEMPREP_OUTPUT) CLOB/BLOB column ,
so the table TF_TEMPREP_OUTPUT will have one row with all the rows from TF_TEMPREP in the CLOB/BLOB column.
TF_TEMPREP_OUTPUT will have column OUTPUTID (VARCHAR2) , OUTPUTDATA (CLOB DATATYPE)
Will this be possible !!.
Thanks in advance
Regards
MuraliHi all
Thanks for your reply,
The reason we would like to store the data in a CLOB file is that,
Currently we are fetching the data from the table TF_TEMPREP and the recordset is passed into a function and writing the ouput to a CSV file in the local drive using the VB (front end application). once the process is completed, the temporary table will be deleted. this is used only for printing purpose.
we are using the VB function
Public Function RecordsetToCSV(rsData As ADODB.Recordset, pFileSeparator As String, Optional ShowColumnNames As Boolean = True, Optional NULLStr As String = "") As String
Dim k As Long
Dim RetStr As String
On Error GoTo Errh
If ShowColumnNames Then
For k = 0 To rsData.Fields.Count - 1
RetStr = RetStr & pFileSeparator & """" & rsData.Fields(k).Name & """"
Next k
RetStr = Mid(RetStr, 2) & vbNewLine
End If
rsData.MoveFirst
RetStr = RetStr & """" & rsData.GetString(adClipString, -1, """" & pFileSeparator & """", """" & vbNewLine & """", NULLStr)
RetStr = Left(RetStr, Len(RetStr) - 3)
RecordsetToCSV = RetStr
Exit Function
Errh:
RecordsetToCSV = ""
Exit Function
End Function
But in this operation, as the number of records is more the system often throws out with the message "Not enough storage is available to complete this operation.". The Local HD is having around 50GB of free space. when we have less number of records (say around 30-40K), the above process works perfectly.
Storing the File in the database server will be an issue, as the database server will be in a different location and it will not be possible/advisable to access the
local directory thru mapped directory in the database server.
our plan was if the data is available in a clob field, then we could try to read the clob and write to a file in the local directory thru our VB application itself. Not sure, will this also gives a same error as it was giving when reading from the table?.
Hope I have clarified what we are aiming at.
Regards
Murali -
Updation of 'Z' field in database table VBAP & AUFK
Hi,
In my report I wanted to update/modify value in a "Z" field in VBAP and a "Z" field in AUFK table.
Could anyone please suggest me how to update/modify this field value using a BAPI or FM?
Or any other method atleast..
Thanks in Advance,
Rohan.Hi,
When you want to change the Zfield in VBAP we can go for the BAPI function module-
BAPI_SALESORDER_CHANGE for the given Zfield get the header data and append it to BAPI header structure.
I think we may use the same FM for updating the AUFK also.
Reward points if useful.
Regards
Chandralekha -
Update Condition Category field in KONV table
hello Folks,
I have a requiremnt to update the Condition Category of KONV table .. I don't want to use direct table update
I have used the below Bapi's but nothing is working
1>BAPI_SALESORDER_CHANGE and got the message
Manual changes to condition type is not permitted
2>SD_SALES_CONDITION_MAINTAIN
3>SD_SALES_ITEM_COND_MAINTAIN
Please let me know if any FM is there to update the same.
Your help is highly appreciated.
Regards,
RajMake use of the following functionModule to add,delete and update
CALL FUNCTION 'KONV_UPDATE'
EXPORTING
PI_UPDKZ = PI_UPDKZ
TABLES
PI_T_KONV = WA_KONV .
PI_UPDKZ = 'D' (Delete) ,'I' (Insert) ,'U' (Update) -
Update Consumption posting field of MSEG table control
Hi,
We have free goods Sales order type(ZKFC) and reture(ZKFR). We post
the free goods delivery update G/L is correct in FI document of MM
movement(601). We post the return free goods delivery update G/L is
incorrect in FI docuemt of MM movement(653). We checked the MSEG table
found the Consumption posting field(MSEG-KZVBR) is empty for free goods
delivery post. The Consumption posting field is 'V' for return free
goods delivery post. The other order delivery post and return delivery
post is OK.We want to know where configuration can control the
Consumption posting field((MSEG-KZVBR)) update at MSEG table? Could you
pls help us check it.Thanks.
Movement type(601) FI docuemnt
Dr: Sales Promo. Mat.
Cr:F/G-Trading
Movement type(653) FI docuemnt
Dr: F/G-Trading
Cr:Std.Cost-Trading
We expected the 653 FI docuemtn
Dr: F/G-Trading
Cr:Sales Promo. Mat.
Best Regards
Park HanHi,
You can use tcode OMJJ to check for movement type 653, then look at the Account Grouping.
There you should be able to identify the line that meets the posting, and since the Consumption is 'V', the Acct. modif should be VAY.
Then to assign the correct G/L in tcode OBYC, look for combination of
-event GBB
-acct mod VAY
-valuation class of the material
But before you replace the G/L, confirm that the line is the correct one by matching the GL in MSEG and this line's GL.
Thanks -
Updation of blank field in internal table
Hi,
I want to update the blank businees area field with the header item of that particular business area belnr.
i am sending you the updation of business area code plz find out where rhe error and rectify please.
points given
REPORT zfir_vendorwise_grir_balances NO STANDARD PAGE HEADING
LINE-SIZE 142
LINE-COUNT 65.
TABLES: bsis,bkpf,bseg,ekko,lfa1.
TYPE-POOLS: slis.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
gs_layout TYPE slis_layout_alv ,
gs_print TYPE slis_print_alv,
gt_sort TYPE slis_t_sortinfo_alv ,
gt_filter TYPE slis_t_filter_alv,
gt_sp_group TYPE slis_t_sp_group_alv,
gt_alv_graphics TYPE dtc_t_tc,
gt_excluding TYPE slis_t_extab ,
gt_events TYPE slis_t_event .
DATA: g_repid LIKE sy-repid.
DATA: gt_list_top_of_page TYPE slis_t_listheader.
DATA: g_boxnam TYPE slis_fieldname VALUE 'BOX',
p_f2code LIKE sy-ucomm VALUE '&ETA',
p_lignam TYPE slis_fieldname VALUE 'LIGHTS',
g_save(1) TYPE c,
g_default(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant,
g_variant LIKE disvariant.
DATA : g_user_command(30) VALUE 'USER_COMMAND'.
DATA : g_status_set(30) VALUE 'PF_STATUS_SET'.
DATA: BEGIN OF it_final OCCURS 0,
awkey TYPE awkey,
grir(10) TYPE c,
bukrs LIKE bsis-bukrs,
hkont LIKE bsis-hkont,
gjahr LIKE bsis-gjahr,
belnr LIKE bsis-belnr,
budat LIKE bsis-budat,
waers LIKE bsis-waers,
xblnr LIKE bsis-xblnr,
blart LIKE bkpf-blart,
buzei like bseg-buzei,
bschl LIKE bseg-bschl,
shkzg LIKE bseg-shkzg,
gsber LIKE bseg-gsber,
dmbtr LIKE bseg-dmbtr,
wrbtr LIKE bsis-wrbtr,
sgtxt LIKE bseg-sgtxt,
ebeln LIKE bseg-ebeln,
lifnr LIKE ekko-lifnr,
ps_psp_pnr LIKE ekkn-ps_psp_pnr,
name1 LIKE addr1_data-name1,
END OF it_final.
DATA : it_po LIKE it_final OCCURS 0 WITH HEADER LINE.
DATA : it_ebeln LIKE it_final OCCURS 0 WITH HEADER LINE.
DATA : it_awkey LIKE it_final OCCURS 0 WITH HEADER LINE.
DATA : wa_final LIKE LINE OF it_final.
DATA : BEGIN OF it_lifnr OCCURS 0,
ebeln TYPE ebeln,
lifnr TYPE lifnr,
END OF it_lifnr.
DATA : BEGIN OF it_name1 OCCURS 0,
lifnr TYPE lifnr,
name1 TYPE name1,
END OF it_name1.
DATA : hmin TYPE bseg-hkont.
DATA : hmax TYPE bseg-hkont.
DATA: idx TYPE sy-tabix.
DATA: temp_gsber TYPE bseg-gsber.
DATA: temp_ebeln TYPE bseg-ebeln.
DATA : temp_gjahr TYPE bseg-gjahr.
DATA : temp_belnr TYPE bseg-belnr.
DATA : temp_lifnr TYPE bseg-lifnr.
*DEFINING THE SELECTION-CRITERIA.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs LIKE skb1-bukrs OBLIGATORY.
SELECT-OPTIONS: s_gsber FOR bseg-gsber OBLIGATORY.
SELECT-OPTIONS: s_hkont FOR bseg-hkont OBLIGATORY.
PARAMETERS: p_lifnr LIKE ekko-lifnr.
PARAMETERS: p_budat LIKE bkpf-budat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON s_hkont.
CHECK s_hkont-low LT 250301 OR s_hkont-high GT 250500.
MESSAGE e000(zm) WITH 'PLEASE SELECT A GRIR CLEARING ACCOUNT BETWEEN'
'250301 AND 250500'.
*INITIALIZATION.
INITIALIZATION.
g_repid = sy-repid.
*START-OF-SELECTION.
START-OF-SELECTION.
PERFORM select_data.
PERFORM display_data.
PERFORM list_display.
*& Form select_data
text
--> p1 text
<-- p2 text
FORM select_data .
*selecting open item details
SELECT bukrs hkont gjahr belnr buzei
budat waers xblnr blart
bschl shkzg gsber dmbtr
wrbtr sgtxt
FROM bsis
INTO CORRESPONDING FIELDS OF TABLE it_final
WHERE bukrs EQ p_bukrs
AND hkont BETWEEN '0000250301' AND '0000250500'
AND budat LE p_budat AND ( blart EQ 'WE' OR
blart EQ 'RE' OR
blart EQ 'SA' OR
blart EQ 'EI').
*selecting closed/cleared item details
SELECT bukrs hkont gjahr belnr buzei budat
waers xblnr blart bschl shkzg
gsber dmbtr wrbtr sgtxt
FROM bsas
APPENDING CORRESPONDING FIELDS OF TABLE it_final
WHERE bukrs EQ p_bukrs
AND hkont BETWEEN '0000250301' AND '0000250500'
AND budat LE p_budat
AND blart IN ('WE', 'RE','SA','EI')
AND augdt GE p_budat.
SORT it_final BY belnr gsber DESCENDING.
CLEAR: temp_belnr, temp_gsber.
update blank business areas
LOOP AT it_final .
IF temp_gsber IN s_gsber AND it_final-belnr = temp_belnr.
IF it_final-gsber = ' '.
it_final-gsber = temp_gsber.
ENDIF.
ENDIF.
if it_final-gsber eq space or it_final-gsber in s_gsber.
wa_final-gsber = it_final-gsber.
wa_final-belnr = it_final-belnr.
modify it_final from wa_final transporting gsber.
else.
wa_final-gsber = it_final-gsber.
wa_final-belnr = it_final-belnr.
modify it_final from wa_final transporting gsber.
endif.
*clear wa_final.
endloop.
LOOP AT it_final.
IF temp_gsber IN s_gsber AND it_final-belnr = temp_belnr.
IF it_final-gsber = ' '.
it_final-gsber = temp_gsber.
ENDIF.
IF it_final-lifnr = ' '.
it_final-lifnr = temp_lifnr.
ENDIF.
IF it_final-belnr = ' '.
it_final-belnr = temp_belnr.
ENDIF.
ENDIF.
IF it_final-gsber EQ space OR it_final-gsber IN s_gsber.
CLEAR: temp_belnr, temp_gsber,temp_lifnr.
temp_belnr = it_final-belnr.
temp_gsber = it_final-gsber.
temp_lifnr = it_final-lifnr.
ELSE.
CLEAR : temp_belnr, temp_gsber,temp_lifnr.
ENDIF.
MODIFY it_final TRANSPORTING gsber.
ENDLOOP.
sort it_final by belnr buzei.
loop at it_final.
on change of it_final-belnr.
clear temp_belnr.
clear temp_gsber.
clear temp_lifnr.
temp_belnr = it_final-belnr.
temp_gsber = it_final-gsber.
temp_lifnr = it_final-lifnr.
endon.
if it_final-gsber is initial.
it_final-gsber = temp_gsber.
*modify it_final transporting gsber.
endif.
if it_final-lifnr is initial.
it_final-lifnr = temp_lifnr.
*modify it_final transporting lifnr.
endif.
modify it_final transporting gsber lifnr where belnr = temp_belnr.
endloop.
*deleting entries which are not as per input parameter for business area
DELETE it_final WHERE gsber NOT IN s_gsber .
loop at it_final.
if s_gsber-low ne '' and s_gsber-high ne ''.
delete it_final where gsber not in s_gsber.
elseif s_gsber-low ne '' and s_gsber-high eq ''.
delete it_final where gsber ne s_gsber-low.
endif.
endloop.
*initialising internal tables
it_awkey[] = it_final[].
it_po[] = it_final[].
it_ebeln[] = it_final[].
IF it_final[] IS NOT INITIAL.
*selecting purchase doc details
SELECT bukrs hkont gjahr belnr
bschl shkzg gsber dmbtr
wrbtr sgtxt ebeln
FROM bseg INTO CORRESPONDING FIELDS OF TABLE it_ebeln
FOR ALL ENTRIES IN it_final
WHERE bukrs = p_bukrs
AND belnr = it_final-belnr
AND gjahr = it_final-gjahr
AND hkont = it_final-hkont.
*selecting the GR/IR number from BKPF
SELECT bukrs gjahr belnr
budat waers xblnr blart
awkey
FROM bkpf
INTO CORRESPONDING FIELDS OF TABLE it_awkey
FOR ALL ENTRIES IN it_final
WHERE bukrs EQ it_final-bukrs
AND gjahr EQ it_final-gjahr
AND belnr EQ it_final-belnr.
ENDIF.
IF it_ebeln[] IS NOT INITIAL.
*selecting WBS element
SELECT ebeln gsber
ps_psp_pnr
FROM ekkn
INTO CORRESPONDING FIELDS OF TABLE it_po
FOR ALL ENTRIES IN it_ebeln
WHERE ebeln = it_ebeln-ebeln.
*selecting vendor
SELECT bukrs ebeln lifnr
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE it_lifnr
FOR ALL ENTRIES IN it_ebeln
WHERE ebeln = it_ebeln-ebeln.
ENDIF.
IF it_lifnr[] IS NOT INITIAL.
*selecting vendor name
SELECT lifnr name1
FROM lfa1
INTO CORRESPONDING FIELDS OF TABLE it_name1
FOR ALL ENTRIES IN it_lifnr
WHERE lifnr EQ it_lifnr-lifnr.
ENDIF.
LOOP AT it_final.
idx = sy-tabix.
*retrieving purchase doc
READ TABLE it_ebeln WITH KEY belnr = it_final-belnr
gjahr = it_final-gjahr
hkont = it_final-hkont.
IF sy-subrc EQ 0.
READ TABLE it_final INDEX idx.
it_final-ebeln = it_ebeln-ebeln.
MODIFY it_final INDEX sy-tabix.
ENDIF.
*retrieving WBS element
READ TABLE it_po WITH KEY ebeln = it_final-ebeln.
IF sy-subrc EQ 0.
READ TABLE it_final INDEX idx.
it_final-ps_psp_pnr = it_po-ps_psp_pnr.
MODIFY it_final INDEX sy-tabix.
ENDIF.
calculating amount based on debit/credit
IF it_final-shkzg = 'H'.
it_final-dmbtr = 0 - it_final-dmbtr.
it_final-wrbtr = 0 - it_final-wrbtr.
ENDIF.
MODIFY it_final INDEX idx.
ENDLOOP.
CLEAR idx.
SORT it_final BY belnr ebeln DESCENDING.
*updating blank purchase doc numbers
CLEAR: temp_belnr, temp_ebeln,temp_gjahr.
DATA: w_idx LIKE sy-tabix.
LOOP AT it_final.
w_idx = sy-tabix.
*updating blank purchase docs
IF it_final-gjahr = temp_gjahr AND it_final-belnr = temp_belnr.
IF it_final-ebeln = ' '.
it_final-ebeln = temp_ebeln.
ENDIF.
ENDIF.
IF it_final-ebeln NE ' ' .
CLEAR: temp_belnr, temp_ebeln, temp_gjahr.
temp_belnr = it_final-belnr.
temp_ebeln = it_final-ebeln.
temp_gjahr = it_final-gjahr.
ELSE.
CLEAR : temp_belnr, temp_ebeln, temp_gjahr.
ENDIF.
MODIFY it_final TRANSPORTING ebeln.
*retrieving vendor
READ TABLE it_lifnr WITH KEY ebeln = it_final-ebeln.
IF sy-subrc EQ 0.
READ TABLE it_final INDEX w_idx.
it_final-lifnr = it_lifnr-lifnr.
MODIFY it_final INDEX sy-tabix.
ENDIF.
*retrieving GRIR number
READ TABLE it_awkey WITH KEY belnr = it_final-belnr
gjahr = it_final-gjahr
bukrs = it_final-bukrs.
IF sy-subrc EQ 0.
READ TABLE it_final INDEX w_idx.
it_final-awkey = it_awkey-awkey.
MODIFY it_final INDEX sy-tabix.
ENDIF.
*retrieving vendor name
READ TABLE it_name1 WITH KEY lifnr = it_final-lifnr.
IF sy-subrc EQ 0.
READ TABLE it_final INDEX w_idx.
it_final-name1 = it_name1-name1..
MODIFY it_final INDEX sy-tabix.
ENDIF.
ENDLOOP.
*deleting entries which are not per input parameters
DELETE it_final WHERE hkont NOT IN s_hkont.
IF p_lifnr NE ' '.
DELETE it_final WHERE lifnr NE p_lifnr.
ENDIF.
for selecting the grir number which is the first 10 digits of reference key and
selecting vendor name
LOOP AT it_final.
MOVE it_final-awkey+0(10) TO it_final-grir.
MODIFY it_final INDEX sy-tabix.
ENDLOOP.
SORT it_final BY hkont belnr.
deleting entries where purchase doc is blank.
DELETE it_final WHERE ebeln EQ ' '.
ENDFORM. " select_data
*& Form build_fieldcat
text
--> p1 text
<-- p2 text
FORM e01_fieldcat_init USING gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: gs_sort TYPE slis_sortinfo_alv.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'HKONT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '1'.
ls_fieldcat-seltext_l = 'ACCOUNT'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BSCHL'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '2'.
ls_fieldcat-seltext_l = 'POSTING KEY'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BLART'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '3'.
ls_fieldcat-seltext_l = 'DOC TYPE'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BELNR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '4'.
ls_fieldcat-seltext_l = 'DOC NUMBER'.
ls_fieldcat-hotspot(1) = 'X'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'BUDAT'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '5'.
ls_fieldcat-seltext_l = 'POSTING DATE'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'XBLNR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '6'.
ls_fieldcat-seltext_l = 'REF. DOC NO'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'EBELN'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '7'.
ls_fieldcat-seltext_l = 'PURCHASE DOC NO'.
ls_fieldcat-hotspot(1) = 'X'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'GSBER'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '8'.
ls_fieldcat-seltext_l = 'BUSINESS AREA'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'DMBTR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '9'.
ls_fieldcat-seltext_l = 'AMOUNT(LC)'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'WRBTR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '10'.
ls_fieldcat-seltext_l = 'AMOUNT(DC)'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'WAERS'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '11'.
ls_fieldcat-seltext_l = 'CURRENCY'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'GJAHR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '14'.
ls_fieldcat-seltext_l = 'Fiscal year'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'GRIR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '14'.
ls_fieldcat-seltext_l = 'GR/IR Number'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'LIFNR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '12'.
ls_fieldcat-seltext_l = 'VENDOR NO'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'PS_PSP_PNR'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '13'.
ls_fieldcat-seltext_l = 'WBS Element'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-tabname = 'IT_FINAL'.
ls_fieldcat-col_pos = '14'.
ls_fieldcat-seltext_l = 'VENDOR NAME'.
APPEND ls_fieldcat TO gt_fieldcat.
ENDFORM. " build_fieldcat
*& Form LIST_DISPLAY
text
--> p1 text
<-- p2 text
FORM list_display .
gs_layout-colwidth_optimize(1) = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'IT_FINAL'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_special_groups = gt_sp_group[]
it_sort = gt_sort[]
it_filter = gt_filter[]
i_save = g_save
is_variant = g_variant
it_events = gt_events[]
is_print = gs_print
it_alv_graphics = gt_alv_graphics[]
it_excluding = gt_excluding
TABLES
t_outtab = it_final.
ENDFORM. " LIST_DISPLAY
*& Form USER_COMMAND
FORM user_command USING i_ucomm LIKE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
CASE i_ucomm.
WHEN '&IC1'. " Pick(Double-click)
CASE is_selfield-fieldname.
WHEN 'BELNR'.
CLEAR it_final.
READ TABLE it_final INDEX is_selfield-tabindex.
IF sy-subrc EQ 0.
FI Document number
SET PARAMETER ID 'BLN' FIELD it_final-belnr.
Display Document
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
WHEN 'EBELN'.
CLEAR it_final.
READ TABLE it_final INDEX is_selfield-tabindex.
IF sy-subrc EQ 0.
PO number
IF it_final-ebeln NE ' '.
SET PARAMETER ID 'BES' FIELD it_final-ebeln.
Display Document
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
g_repid = sy-repid.
PERFORM e01_fieldcat_init USING gt_fieldcat[].
PERFORM eventtab_build CHANGING gt_events.
PERFORM e04_comment_build USING gt_list_top_of_page[].
ENDFORM. " display_data
*& Form eventtab_build
text
<--P_GT_EVENTS text
FORM eventtab_build CHANGING lt_events TYPE slis_t_event.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
ENDFORM. " eventtab_build
*& Form e04_comment_build
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
DATA : v_time(10) TYPE c.
DATA: ls_line TYPE slis_listheader.
DATA : v_text(50) TYPE c.
DATA : v_date_low(10) TYPE c,
v_date_high(10) TYPE c.
CONCATENATE 'GR/IR Report' ' '
INTO v_text SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = v_text.
APPEND ls_line TO e04_lt_top_of_page.
ENDFORM. " e04_comment_build
*& Form top_of_page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM . "TOP_OF_PAGE
regards,
Amit teja
Message was edited by: amit teja
Message was edited by: amit teja
Message was edited by: amit tejaHello,
<b>Sort it_final by belnr.</b>
loop at it_final.
on change of it_final-belnr.
clear temp_gsber.
clear temp_lifnr.
<b>temp_belnr = it_final-belnr.</b>
temp_gsber = it_final-gsber.
temp_lifnr = it_final-lifnr.
if it_final-gsber eq ' '.
it_final-gsber = temp_gsber.
endif.
if it_final-lifnr eq ' '.
it_final-lifnr = temp_lifnr.
endif.
modify it_final transporting gsber lifnr where <b>belnr = temp_belnr</b>.
<b>endon.</b>
endloop.
Regards,
Naimesh -
ME51N update MPN Material field in the table control
Hi Gurus,
My requirement is to update the field MPN Material in the table control of tcode ME51N as soon as i enter the material this field should get updated.
Please give me suggestions.
Regards,
Milindplease see the link ...in this the datefields also included in the table control of the
Screen program .... how the fields are populated in the table using wizard ..
<a href="http://">http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm</a>
reward points if it is usefull ....
Girish
Maybe you are looking for
-
Photoshop CS5 crashes during batch process
Hi, I got about 100 pictures. Trying to: resize+save for web... Photoshop converts few files and...crashes. I presume that's a configuration problem - neither scratch disk nor memory should not be the cause although here are some parameters: My mac:
-
HD QT Pixlet won't playback well on Intel based systems?
Hi all, I've been using Pixlet for a few years with no troubles on G5 computers at HD resolutions (1920x1080). I recently tried playback on our new Mac Pro and the playback is horrible. Is there something which prevents Intel based Macs from using Pi
-
i am getting one single pop up add over and over again like at least 5 times a minute. it is like... a cell phone horoscope problem i have reset safari several times and it has not fixed the problem. and block pop up IS selected help?
-
N8 Product Code(0599396) New Update 024.001
i m from Pakistan.yesterday i found new update 024.001 for my product code 0599396. successfully updated from 022.014 to 024.001. can anybody tell me what are changes in latest firmware ?
-
Select entries between two dates by converting Unix timestamp in Oracle Dat
Hi, I need to select the entries between two dates from an Oracle db. The Oracle db has a column with Unix timestamps. I use the following querry, but it doesnt seem to be working as desired. select count(*) from reporter_status where to_char(FIRSTOC