Reading highest value out of internal table
Hi all,
It feels like a bit of a newbie question, but does anyone know an appropriate way to read the highest value of a field in an internal table? For instance simular to ..select max.. for DB selections?
I can of course sort the table on that field and do a read table with index = 1, but that doesn't look very pretty. A function module which does the trick would be most appreciated.
Kind regards,
Martijn de Jong.
Hi Jong,
<i>I can of course sort the table on that field and do a read table with index = 1, but that doesn't look very pretty.</i>
who said it doesn't look pretty.
that logic which you have is the way you should proceed.
There is no FM for this , try Putting the logic in side new FM and call it if you want.
Regards
vijay
Similar Messages
-
How To Read Field Values Form Dynamic Internal Table
Hi,
I Created a dynamic internal table using.
FIELD-SYMBOLS: <gt_table> TYPE STANDARD TABLE,
<wa_gt_table>,
<l_fvalue> TYPE ANY.
This Interanl table is working well, and all values are populated to an ALV.
Now I try to set a link
for that I am using below code
READ TABLE <gt_table> ASSIGNING <l_fvalue> index rs_selfield-tabindex.
IF sy-subrc EQ 0.
insplot = <l_fvalue>-prueflos.
Now it is showing a syntax error :
the data object <l_fvalue> has no structure and there for no component called prueflos
Regards
NausalHi,
Refere following code
Local Field Symbol
FIELD-SYMBOLS: <lf_any> TYPE ANY. "Changed data
LOOP AT <gf_dyna_table> ASSIGNING <gf_dyna>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <gf_dyna> TO <lf_any>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF ls_attach-line IS INITIAL.
ls_attach-line = <lf_any>.
ELSE.
CONCATENATE ls_attach-line <lf_any> INTO ls_attach-line
SEPARATED BY lc_tab.
ENDIF.
ENDDO.
CONCATENATE lc_cret ls_attach-line INTO ls_attach-line.
Append Changed Data to attachement table
APPEND ls_attach TO gt_attach.
Clear
CLEAR : ls_attach.
ENDLOOP.
Regards,
Prashant -
Distinct values from dynamic internal tabls
Hi All,
I have a dynamic internal tables like <dy_table> , i want to get distinct values from this internal tables,
how to do that, structure of dynamic internal tables is dynamic acc. to user conditions.
regards,
AnujHi Anuj
Just try this,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = tb_fields_for_it
IMPORTING
ep_table = gp_dyn_table.
ASSIGN gp_dyn_table->* TO <gt_table>.
ASSIGN LOCAL COPY OF INITIAL LINE OF <gt_table> TO <fs_table>.
LOOP AT tb_output.
*To assign value for serial number.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_table> TO <ls_field>.
<ls_field> = tb_output-sno.
UNASSIGN <ls_field>.
*To assign value for Sales Organization.
ASSIGN COMPONENT 2 OF STRUCTURE <fs_table> TO <ls_field>.
<ls_field> = tb_output-vkorg.
UNASSIGN <ls_field>.
*To assign Rate for its respective Condition type.
LOOP AT tb_konp WHERE knumh = tb_output-knumh.
READ TABLE tb_fieldcat1 WITH KEY fieldname = tb_output-kschl.
IF sy-subrc EQ 0.
lv_count = tb_fieldcat1-col_pos.
ASSIGN COMPONENT lv_count OF STRUCTURE <fs_table> TO <ls_field>.
IF tb_konp-konwa EQ '%'.
tb_konp-kbetr = tb_konp-kbetr / co_10.
<ls_field> = tb_konp-kbetr.
ELSE.
<ls_field> = tb_konp-kbetr.
ENDIF.
ENDIF.
ENDLOOP.
lv_count = lv_count + 1.
APPEND <fs_table> TO <gt_table>.
CLEAR <fs_table>.
ENDLOOP.
Hope this proves helpful to you. -
Selecting records from DB table with out using internal tables
hi,
i need to retrieve values from a database table based on few fields and date as well. however, i need to check whether the date is less or equal to the current date and along with that i should get the appropriate record. how can i do that with out using internal table.
field1-----date---
11111----
20070219
11111--20070214 <---
11111----
20070205
in the above scenario i should get the second record
Regards,
Kranthi.Try:
REPORT ztest MESSAGE-ID 00.
TABLES bkpf.
SELECT * FROM bkpf
UP TO 1 ROWS
WHERE budat <= sy-datum
ORDER BY budat DESCENDING.
ENDSELECT.
Rob -
Hi All,
I have written BDC, in which when i pass value for second screen "Description type field" it's passing '*************************' instead of internal table value.
It's picking correct value for first internal table value. Could anyone please give an idea why it's happening?
Please find the code:
LOOP AT it_record.
header data for BDC
AT NEW CLASS.
IF sy-tabix <> 1.
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
CALL TRANSACTION 'CLWM' USING bdcdata
MODE p_mode
UPDATE 'S'
MESSAGES INTO messtab.
clear : bdcdata[],bdcdata.
ENDIF.
perform bdc_dynpro using 'SAPLCLMO' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-CLASS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMCLM-CLASS'
it_record-class.
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-KLBEZ'.
perform bdc_field using 'RMCLM-KLBEZ'
it_record-klbez.
perform bdc_field using 'RMCLM-STATU'
'1'.
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'=MERK'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-KLBEZ'.
perform bdc_field using 'RMCLM-KLBEZ'
it_record-klbez.
perform bdc_field using 'RMCLM-STATU'
'1'.
MOVE 1 TO IDX.
ENDAT.
line item data for BDC
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-RELEV(02)'.
CONCATENATE 'RMCLM-MERKMA(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
it_record-merkma.
CONCATENATE 'RMCLM-RELEV(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
it_record-relev.
IDX = IDX + 1.
ENDLOOP.
Thanks,
UjjwalHi Ujjwal
The reason behind this is that you are using AT NEW.... ENDAT block in your coding.
When you use AT NEW field statements, the fields in the work area after the field get converted into ********.
Check values in your work area I_RECORD in debugging inside AT NEW statement and you will understand what I am saying.
In your case all the fields from header line of I_RECORDS which come after field CLASS are getting converted into *******,
hence the error.
Try using a temporary work area, say w_record. Pass value of I_record to w_record before AT NEW statement.
And use w_record-fields instead of I_record-fields. And your program should work. -
How to check a field value within an Internal table
Hi Friends,
My requirement is:
I have a line item of PO records, in that each line item of Plant field should not diffe with other line items. If it differs or say the records have different plant values line items, then I have to throw an error message.
Below example for better understanding.
lineitem Plant
010 ABC
020 ABC
030 XYZ
040 LKG
So, my report will throw an error like "All line items must be identical'.
How to do proceed it.Please advise.
Thanks & Regards
Sankar.Hi Sankar
first you need to fetch all the values in one internal table from your PO.
After that create an internal table with only plant field and move all the plan values in this table.
let assume ITAB is a table with all the values. and ITAB1 with plant only.
wa_itab is the work area for ITAB and wa_itab1 is WA for ITAB1.
ITAB has all the values and ITAB1 has all the values only for plant.
delete adjacent duplicate from itab1 compairing plant.
loop at itab1 into wa_itab1. " this will fetch all the plant values in workarea.
read table itab into wa_itab where wa_itab-plant = wa_itab1-plant. " this will fetch only the values matching to the table itab1
if su-subrc <> 0.
message 'plants are not similar' TYPE 'E'.
elseif sy-subrc = 0.
write your code*.
endif.
endloop.
hope this will help you.
Thanks
Lalit Gupta -
Transferring checkbox values on ALV to value in the internal table?
Hi,
I'm using an ALV grid (CL_GUI_ALV_GRID) to display an internal table. I want users to be able to select one or many rows and those checked lines to be marked as X in my internal table. I have a field, check(1), in my internal table displayed on the ALV, but when I tick one line on the ALV and debug, I don't see an X in the check field on that line in my internal table.
I've successfully written code to select and deselect all lines and those values copy back to my internal table so why don't the single lines?
CASE sy-ucomm.
WHEN 'SELECT_ALL'.
* select all lines
LOOP AT tbl_data INTO wa_data.
MOVE 'X' TO wa_data-check.
MODIFY tbl_data FROM wa_data.
ENDLOOP.
WHEN 'DESELECT'.
* deselect all lines
LOOP AT tbl_data INTO wa_data.
CLEAR wa_data-check.
MODIFY tbl_data FROM wa_data.
ENDLOOP.
ENDCASE.
Do I have to add some code in the PAI to transfer the values?
Any suggestions welcome,
GillYes, I have.
The checkbox is appearing on the screen and is populated/cleared when I click the select/deselect buttons (this transfers the values in my internal table to the screen). But when I just tick one line and then debug that line isn't showing as having X in the check field in my internal table.
Somehow I need to transfer the tick values on screen to my internal table. -
How to download values in an internal table into an excel file
is there any fn module to download the values in an internal table into an excel file..
hi
the function module "GUI_DOWNLOAD" downloads the data from
an internal table into a file (can be xl, dat ,doc etc) .
Plz follow the usage below ;
Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.
Data : lv_filename TYPE STRING.
lv_filename = pa_pfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = lv_filename
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = tb_download " table data to b downlaoded
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Pankaj -
Initializing values in an internal table
hi
how to initialize values in a internal table
according to my requirement i need to initialize (both character and currency) values present in the internal table based on certain conditions
vamsihi
As i understood you want to clear only selected fileds not the complet record..
create a Field symobl the loop at the table.. inside the loop check the condtion the just clear the filed.
example: you have itab type mara.
then
FIELD-SYMOBOLS <FS_WA_ITAB> TYPE MARA.
LOOP AT ITAB ASSIGNING <FS_WA_ITAB>.
IF X = XXX (YOUR CONDITION)
CLEAR: <FS_WA_ITAB>-FIELD2,
<FS_WA_ITAB>-FIELD3. (If u want to clear only filed2 and field3)
clear <FS_WA_ITAB>. (if you want to cleatr the complete record)
ENDIF.
ENDLOOP.
Why iam suggestin the filed-symobol is.. it is direcltly work on internal table body so u no need to update the table agian
Please Close this thread.. when u r problem is solved
Reward if Helpful
Regards
Naresh Reddy K -
Display data to edit based on fields and its value defined in internal tabl
I need to display data in a internal table for editing in a screen.
you have a internal table with field name , data types and its value. I need to display data in a screen ( sceen painter not in a report) row by row in vrtical format.
The internal table's structure not fix. you can have any number of fields in the internal table.
Can you please send me code if it is available with you or send me any senario in SAP if any ...so that i can debug to extract the code..
have to display data vertically as below in editable format,
for example,
Airline
Flight Number
Flight date
Flight price
Airline Currency
Plane Type
Maximum capacity
Occupied econ.
Total
No of fields will change.
also F4 help needs to be attached with each field.
I think it can be done through step loop. can anybody give sample code or tell me where to find in SAP or somewhere else?
it will be great help to me..
SanjeevHi
just check out this program DEMO_DYNPRO_STEP_LOOP. -
Reading XML file to ABAP internal table
Hi all,
Iam trying to convert a XLM file into abap internal table , am using XSLT transformation to parse the XML file and i am using "CALL METHOD cl_gui_frontend_services=>gui_upload" for reading the XML file.
below is the XML file.
===========================================================================
- <PIXBridge version="2.2" timestamp="2003-04-09T15:27:00">
- <PIX>
<TransactionType>605</TransactionType>
<TransactionCode>98</TransactionCode>
<TransactionNumber>6888965</TransactionNumber>
<SequenceNumber>40001</SequenceNumber>
- <SKUDefinition>
<Company>GZL</Company>
<Division>BMD</Division>
<Season />
<SeasonYear />
<Style>ORT002A</Style>
<StyleSuffix />
<Color>K13</Color>
<ColorSuffix />
<SecDimension />
<Quality />
<SizeRangeCode />
<SizeDesc>M</SizeDesc>
<SkuID>200140577</SkuID>
</SKUDefinition>
</PIX>
</PIXBridge>
=================================================================
and my Transformation code is as below
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IPIX>
<xsl:apply-templates select="//PIX"/>
</IPIX>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="PIX">
<item>
<TRANSACTIONTYPE>
<xsl:value-of select="TransactionType"/>
</TRANSACTIONTYPE>
<TRANSACTIONCODE>
<xsl:value-of select="TransactionCode"/>
</TRANSACTIONCODE>
<TRANSACTIONNUMBER>
<xsl:value-of select="TransactionNumber"/>
</TRANSACTIONNUMBER>
<SEQUENCENUMBER>
<xsl:value-of select="SequenceNumber"/>
</SEQUENCENUMBER>
<SKUDEFINITION>
<COMPANY>
<xsl:value-of select="Company"/>
</COMPANY>
<DIVISION>
<xsl:value-of select="Division"/>
</DIVISION>
<SEASON/>
<SEASONYEAR/>
<STYLE>
<xsl:value-of select="Style"/>
</STYLE>
<STYLESUFFIX/>
<COLOR>
<xsl:value-of select="Color"/>
</COLOR>
<COLORSUFFIX/>
<SECDIMENSION/>
<QUANTITY/>
<SIZERANGECODE/>
<SIZEDESC>
<xsl:value-of select="SizeDesc"/>
</SIZEDESC>
<SKUID>
<xsl:value-of select="SkuID"/>
</SKUID>
</SKUDEFINITION>
</item>
</xsl:template>
When i run my program i am getting the values only till the sequence number part and im not getting any values that is read in between <SKUDEFINITION> ..... </SKUDEFINITION>
I need help to sort this , kindly help me in this.
regs,
rajaI am not able to get a clue out of that, can Get Durairaj Athavan Raja in to loop for sorting this out.
I made changes to my transformation program , but still not getting the output of the components inside the
<SKUDefinition> , but when i debug the transformation i can able to see the output values for those components but when i get the values in the result table im not getting values of those components.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IPIX>
<xsl:apply-templates select="//PIX"/>
</IPIX>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="PIX">
<item>
<TRANSACTIONTYPE>
<xsl:value-of select="TransactionType"/>
</TRANSACTIONTYPE>
<TRANSACTIONCODE>
<xsl:value-of select="TransactionCode"/>
</TRANSACTIONCODE>
<TRANSACTIONNUMBER>
<xsl:value-of select="TransactionNumber"/>
</TRANSACTIONNUMBER>
<SEQUENCENUMBER>
<xsl:value-of select="SequenceNumber"/>
</SEQUENCENUMBER>
<xsl:for-each select="SKUDefinition">
<SKUDEFINITION>
<COMPANY>
<xsl:value-of select="Company"/>
</COMPANY>
<DIVISION>
<xsl:value-of select="Division"/>
</DIVISION>
<SEASON/>
<SEASONYEAR/>
<STYLE>
<xsl:value-of select="Style"/>
</STYLE>
<STYLESUFFIX/>
<COLOR>
<xsl:value-of select="Color"/>
</COLOR>
<COLORSUFFIX/>
<SECDIMENSION/>
<QUANTITY/>
<SIZERANGECODE/>
<SIZEDESC>
<xsl:value-of select="SizeDesc"/>
</SIZEDESC>
<SKUID>
<xsl:value-of select="SkuID"/>
</SKUID>
</SKUDEFINITION>
</xsl:for-each>
</item>
</xsl:template>
</xsl:transform>
==================
Below is my main program
===================
TYPE-POOLS abap.
CONSTANTS gs_file TYPE string VALUE 'C:\XMLABAP1.xml'.
This is the structure for the data from the XML file
TYPES: BEGIN OF ty_text,
TransactionType(3) type n,
TransactionCode(2) type n,
TransactionNumber(7) type n,
SequenceNumber(5) type n,
Company(3) type c,
Division(3) type c,
Season(3) type c,
SeasonYear(4) type c,
Style(8) type c,
Color(3) type c,
SecDimension(3) type c,
Quality(3) type n,
SizeRangeCode(2) type c,
SizeDesc(1) type c,
SkuID(10) type c,
END OF ty_text.
Table for the XML content
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
data: xmlstr TYPE XSTRING.
Table and work ares for the data from the XML file
DATA: gt_person TYPE STANDARD TABLE OF ty_text,
gs_person TYPE ty_text.
Result table that contains references
of the internal tables to be filled
DATA: gt_result_xml TYPE abap_trans_resbind_tab,
gs_result_xml TYPE abap_trans_resbind.
For error handling
DATA: gs_rif_ex TYPE REF TO cx_root,
gs_var_text TYPE string.
Get the XML file from your client
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab
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.
ENDIF.
Fill the result table with a reference to the data table.
Within the XSLT stylesheet, the data table can be accessed with
"IPERSON".
GET REFERENCE OF gt_person INTO gs_result_xml-value.
gs_result_xml-name = 'IPIX'.
APPEND gs_result_xml TO gt_result_xml.
Perform the XSLT stylesheet
TRY.
CALL TRANSFORMATION ZAUM_MANH_SYNC_RPT
SOURCE XML XMLSTR
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
Now let's see what we got from the file
LOOP AT gt_person INTO gs_person.
WRITE: / 'Transaction Type:', gs_person-TransactionType.
WRITE: / 'Transaction Code :', gs_person-TransactionCode.
WRITE: / 'Transaction Number :', gs_person-TransactionNumber.
WRITE: / 'SequenceNumber :', gs_person-SequenceNumber.
WRITE: / 'Company : ', gs_person-Company.
WRITE : /.
ENDLOOP. "gt_person. -
BRFplus: Problem updating values in an internal table in a loop expression
Hi
I'm looking into the loop expression type of BRFplus and I have come across a problem updating an internal table, I'm trying to create and populate the table using a loop, here is the functionality I'm trying to achieve:
In a rule set create an internal MONTH_TBL table containing 12 rows of two columns: MONTH_NUM containing values 1 through 12 and MONTH_VAL containing an amount (initially 0,00 EUR in all 12 rows).
After initializing the table traverse through SFLIGHT table and for each row add PRICE from the table to MONTH_VAL in the row of MONTH_TBL corresponding to the month of FLDATE field in SFLIGHT.
The initialization of MONTH_TBL works as intended, as does the traversal of and retrieval of values from SFLIGHT. The problem however is the update of the internal table MONTH_TBL (defined as result data object for the function). I don't get an error, but the tables does not get updated, and I cannot seem to find out what the problem is. I would have attached an XML extract of the function + ruleset for information, but it dosen't seem like that is possible, I could e-mail it on request (for SAP employees with access to system QU5 the function is LOOP_TEST in application Z_KLAUS_TEST).
I hope that this is sufficient information to understand the issue that I'm dealing with.
best regards
Klaus Stenbæk, KMDHi Klaus,
The Loop expression is part of NW 7.02 which is not yet released. When you experience the problem as part of a test you should have a contact at SAP for dealing with problems/errors. Usually SAP-internal messages are used for this purpose. Please clarify with your SAP contact how the model is.
BR,
Carsten -
How to search for a field and its value in an internal table
Hi,
I want to search for a field(which i dont know whether it exists or not) in an internal table and on finding that field, I have to update the value of that field. How do I do it? I think its similar to how SEARCH works but i wanted to know the internal table eqivalent of it.Hi Sujay,
this code will help ful to u, just gi through it,
TABLES : KNA1,VBAK,VBAP.
***********INTERNAL TABLE DECLARATIONS****************
DATA : IT_KNA1 TYPE TABLE OF KNA1,
WA_KNA1 TYPE KNA1.
DATA : IT_VBAK TYPE TABLE OF VBAK,
WA_VBAK TYPE VBAK.
DATA : IT_VBAP TYPE TABLE OF VBAP,
WA_VBAP TYPE VBAP.
START-OF-SELECTION.
SELECT * FROM KNA1
INTO TABLE IT_KNA1
WHERE KUNNR = P_CUST.
IF NOT IT_KNA1 IS INITIAL.
SELECT * FROM VBAK
INTO TABLE IT_VBAK
FOR ALL ENTRIES IN IT_KNA1
WHERE KUNNR = IT_KNA1-KUNNR.
IF NOT IT_VBAK IS INITIAL.
SELECT * FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
ELSE.
WRITE : / 'Customer',P_CUST,'does not exist ......'.
ENDIF.
ELSE.
WRITE: / 'sales order does not exist for',P_CUST.
ENDIF.
Rewards points plz if useful
Ganesh. -
Reading complex file in ABAP internal table.
I have a following XML file. and I want to read it in internal Table with deep structure.
<?xml version="1.0" encoding="utf-16" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
- <TAB>
- <item>
<CATALOGUEREQUESTIDID>5</CATALOGUEREQUESTIDID>
<MBRSH>Chemical Industry</MBRSH>
<MTART>Spare Parts</MTART>
<WERKS>Spare Parts Warehouse</WERKS>
<MAKTX>Lubricant,Oil Graphite></MAKTX>
<MEINS>Bottle</MEINS>
<MATKL>Spare parts - General</MATKL>
<BRGEW>10</BRGEW>
<GEWEI>G</GEWEI>
<NTGEW>9</NTGEW>
<VOLUM>1</VOLUM>
<VOLEH>L</VOLEH>
<EKGRP>Buyer 1</EKGRP>
<XCHPF>NO</XCHPF>
<EKWSL>-15, -10, -05</EKWSL>
<WEBAZ>2</WEBAZ>
<INSMK>NO</INSMK>
<KZKRI>NO</KZKRI>
<MFRPN>SHELL</MFRPN>
<MFRNR>WD-40</MFRNR>
- <DRGNUM>
<ZEINR>C-39166</ZEINR>
<ZEIAR>KKK</ZEIAR>
<ZEIVR>3</ZEIVR>
<BLATT>4</BLATT>
<AESZN>12</AESZN>
<ZEIFO>A3</ZEIFO>
<BLANZ>12</BLANZ>
</DRGNUM>
- <DRGNUM>
<ZEINR>C-39167</ZEINR>
<ZEIAR>KKK</ZEIAR>
<ZEIVR>3</ZEIVR>
<BLATT>4</BLATT>
<AESZN>12</AESZN>
<ZEIFO>A3</ZEIFO>
<BLANZ>12</BLANZ>
</DRGNUM>
- <DRGNUM>
<ZEINR>C-39168</ZEINR>
<ZEIAR>KKK</ZEIAR>
<ZEIVR>3</ZEIVR>
<BLATT>4</BLATT>
<AESZN>12</AESZN>
<ZEIFO>A3</ZEIFO>
<BLANZ>12</BLANZ>
</DRGNUM>
</item>
</TAB>
</asx:values>
</asx:abap>
+I for this I have created a internal table as; +
types : begin of DRGNUM,
ZEINR(10),
ZEIAR(5),
ZEIVR(5),
BLATT(5),
AESZN(5),
ZEIFO(5),
BLANZ(5),
end of DRGNUM.
data : begin of item occurs 0,
CATALOGUEREQUESTIDID,
MBRSH(20),
MTART(15),
WERKS(30),
MAKTX(40),
MEINS(10),
MATKL(30),
BRGEW(5),
GEWEI(2),
NTGEW(5),
VOLUM(5),
VOLEH(2),
EKGRP(10),
XCHPF(3),
EKWSL(15),
WEBAZ(2),
INSMK(2),
KZKRI(2),
MFRPN(5),
MFRNR(5).
data : DRGNUM type ZDRGNUM.
data: end of item.
*XML
call transformation ('ID')
source xml xmlupl
result tab = item[]
The problem is that for DRGNUM nodes in XML I can only manage to get last DRGNUM node data in the internal table.
How can I get all the 3 items for DRGNUM in the Internal table ?
Your help is appreciated.
Edited by: Hasan Bin Tariq on May 6, 2009 11:12 AMu need to create three files with 3 different data in DRGNUM.
i.e, in the 1st file give the 1st set of data for drgnum and
in the 2nd file, u will hve 2nd set of data for DRGNUM and the rest will data will be same without any change. simliarly do the 3rd file.
and try to get into the internal table now. -
LEFT OUTER with internal tables
hi all,
I have a query to execute,
SELECT SKATSAKNR SKATTXT20
SUM( GLT0~HSLVT ) AS HSLVT
INTO CORRESPONDING FIELDS OF TABLE ITAB_ZSTMGLRACC
FROM SKAT
LEFT OUTER JOIN GLT0 ON GLT0RACCT = SKATSAKNR
AND GLT0~RYEAR = I_GJAHR
AND GLT0~BUKRS = 'comp1'
WHERE SKAT~KTOPL = 'EICA'
GROUP BY SKATSAKNR SKATTXT20.
here i want to replace GLT0~BUKRS = 'comp1' with multiple values from Internal table ITAB_T001
since i used SUM ......FOR ALL ENTRIES IN ITAB_T001 cant be used .
any one have options??
thx
Josehi all,
I have a query to execute,
SELECT SKATSAKNR SKATTXT20
SUM( GLT0~HSLVT ) AS HSLVT
INTO CORRESPONDING FIELDS OF TABLE ITAB_ZSTMGLRACC
FROM SKAT
LEFT OUTER JOIN GLT0 ON GLT0RACCT = SKATSAKNR
AND GLT0~RYEAR = I_GJAHR
AND GLT0~BUKRS = 'comp1'
WHERE SKAT~KTOPL = 'EICA'
GROUP BY SKATSAKNR SKATTXT20.
here i want to replace GLT0~BUKRS = 'comp1' with multiple values from Internal table ITAB_T001
since i used SUM ......FOR ALL ENTRIES IN ITAB_T001 cant be used .
any one have options??
thx
Jose
Maybe you are looking for
-
Problem in downloading ALV output in excel
Dear Abapers, I am facing a problem while downloading alv output in spreadsheet. Report headers and data headings are coming in excle but contents are missing instead of that No Data is displaying on excel sheet. I have debug t
-
Why Apple/MAC does not offer server mounting application?
I am very disappointed to see that MAC /Apple does not offer simple server mounting application. It is a very basic facility provided in Linux. I am forced to use third party stuff like OSXFuse which still is not a permanent solution. Hope someone a
-
Nikon 300S. It is set to NEF(RAW) + JPEG fine. When I import to Lightroom I get message "There was an error working with the photo? Does anyone know why or how to correct?
-
This should not be happening. The code (further) below returns this: You have aquired teh clam: false You have not aquired teh clam: false You have aquired teh clam: true You have not aquired teh clam: false true false false true
-
IBook G4 no arranca se queda en la maznada y después se apaga
Quien me puede ayudar.....? Ya me he metido en comando+S y le he dado sbin/fsck -fy y no me arranca de todas formas... Me sale este error: :/ root# fsck ** /dev/rdisk0s10 ** Root file system ** Checking journaled HFS plus volume. ** Checking extents