Multiple internal table display
Hi All,
I have query regarding the internal tables,
Is it possible to display more than one internal table in ABAP List view
one beneath another......in the same page.....?
thanks in advance.....
Hi,
Yes, in classical do like this
loop at itab.
write:/
endloop.
loop at itab1.
write:/
endloop.
and in alv refer this code.
*& Form sub_alv_display *
This form displays the output using REUSE_ALV_GRID_DISPLAY *
function module *
FORM sub_alv_display .
*--Local Variables
DATA : lv_index LIKE sy-tabix.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid.
wa_layout1-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout1
it_fieldcat = it_fieldcat[]
i_tabname = 'it_final'
it_events = it_events
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
LOOP AT it_fieldcat INTO wa_fieldcat.
lv_index = sy-tabix.
IF wa_fieldcat-fieldname = 'ERDAT'.
wa_fieldcat-fieldname = 'TITLE'.
wa_fieldcat-seltext_m = text-026.
wa_fieldcat-outputlen = 10.
ENDIF.
MODIFY it_fieldcat FROM wa_fieldcat INDEX lv_index TRANSPORTING
fieldname seltext_m outputlen.
CLEAR : wa_fieldcat.
ENDLOOP.
wa_layout2-no_colhead = 'X'.
wa_layout2-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout2
it_fieldcat = it_fieldcat[]
i_tabname = 'it_total'
it_events = it_event1
TABLES
t_outtab = it_total
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
wa_layout3-no_colhead = 'X'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout3
it_fieldcat = it_fieldcat2[]
i_tabname = 'it_ship'
it_events = it_event2
TABLES
t_outtab = it_ship
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 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.
IF NOT it_final IS INITIAL OR
NOT it_total IS INITIAL OR
NOT it_ship IS INITIAL.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. "sub_alv_display
Regards,
Prashant
Similar Messages
-
Collect data from a dynamic XML file into multiple internal tables
I need to convert the XML file into multiple internal tables. I tried many links and posts in SDN but still was facing difficulty in achieving this. Can some one tell me where I am going wrong.
My XML file is of the following type.It is very complex and the dynamice.
The following tags occur more than once in the XML file. The "I" and "L" tags and its child tags can occur ones or more than once for each XML file and it is not constant. i.e in one file they can occur 1 time and in another they can occur 100 times.
"I" and "L" are child tags of <C>
<I>
<J>10</J>
<K>EN</K>
</I>
<L>
<J>20</J>
<N>BB</N>
</L>
Tags <C> and <F> occur only ones for each XML file. <C> is the child tag of "A" and "F" is the child tag of <C>.
I need to collect <D>, <E> in one internal table ITAB.
I need to collect <G>, <H> in one internal table JTAB.
I need to collect <J>, <K> in one internal table KTAB.
I need to collect <J>, <N> in one internal table PTAB.
Below is the complete XML file.
?xml version="1.0" encoding="iso-8859-1" ?>
<A>
<B/>
<C>
<D>RED</D>
<E>999</E>
<F>
<G>TRACK</G>
<H>PACK</H>
</F>
<I>
<J>10</J>
<K>EN</K>
</I>
<I>
<J>20</J>
<K>TN</K>
</I>
<I>
<J>30</J>
<K>KN</K>
</I>
<L>
<J>10</J>
<N>AA</N>
</L>
<L>
<J>20</J>
<N>BB</N>
</L>
<L>
<J>30</J>
<N>CC</N>
</L>
</C>
</A>
With the help of SDN I am able to gather the values of <D> <E> in one internal table.
Now if I need to gather
<G>, <H> in one internal table JTAB.
<J>, <K> in one internal table KTAB.
<J>, <N> in one internal table PTAB.
I am unable to do. I am following XSLT transformation method. If some one has some suggestions. Please help.
Here is my ABAP program
TYPE-POOLS abap.
CONSTANTS gs_file TYPE string VALUE 'C:\TEMP\ABCD.xml'.
* This is the structure for the data from the XML file
TYPES: BEGIN OF ITAB,
D(10) TYPE C,
E(10) TYPE C,
END OF ITAB.
* Table for the XML content
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
* Table and work ares for the data from the XML file
DATA: gt_ITAB TYPE STANDARD TABLE OF ts_ITAB,
gs_ITAB TYPE ts_ITAB.
* 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_itab1
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
* "IITAB".
GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
gs_result_xml-name = 'IITAB'.
APPEND gs_result_xml TO gt_result_xml.
* Perform the XSLT stylesheet
TRY.
CALL TRANSFORMATION zxslt
SOURCE XML gt_itab1
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_ITAB INTO gs_ITAB.
WRITE: / 'D:', gs_ITAB-D.
WRITE: / 'E :', gs_ITAB-E.
ENDLOOP.
Transformation
<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>
<IITAB>
<xsl:apply-templates select="//C"/>
</IITAB>
</asx:values>
</asx:abap>
</xsl:template>
<item>
<D>
<xsl:value-of select="D"/>
</D>
<E>
<xsl:value-of select="E"/>
</E>
</item>
</xsl:template>
</xsl:transform>
Now the above pgm and transformation work well and I am able to extract data into the ITAB. Now what changes should I make in transformation and in pgm to collect
<G>, <H> in one internal table JTAB.
<J>, <K> in one internal table KTAB.
<J>, <N> in one internal table PTAB.
Please help..i am really tring hard to figure this out. I am found lot of threads addressing this issue but not my problem.
Kindly help.
Regards,
VSHi Rammohan,
Thanks for the effort!
But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields. I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
Moreover I have about 10 such work areas. so the effort would be ten times the above effort! I want to avoid this! Please help!
I would be very grateful if you could provide an alternative solution.
Thanks once again,
Best Regards,
Vinod.V -
Split a string into multiple internal tables
Hi all,
I need to split a string based internal table into multiple internal tables based on some sub strings in that string based internal table...
High priority help me out...
eg...
a | jhkhjk | kljdskj |lkjdlj |
b | kjhdkjh | kldjkj |
c | jndojkok |
d |
this data which is in the application server file is brought into a internal table as a text. Now i need to send 'a' to one internal table, 'b' to one internal table, so on... help me
<Priority downgraded>
Edited by: Suhas Saha on Oct 12, 2011 12:24 PMHi pradeep,
eg...
a | jhkhjk | kljdskj |lkjdlj |
b | kjhdkjh | kldjkj |
c | jndojkok |
d |
As per your statement "Now i need to send 'a' to one internal table, 'b' to one internal table"
Do you want only a to one internal table and b to one internal table
OR
Do you want the whole row of the internal table i mean
a | jhkhjk | kljdskj |lkjdlj | to 1 internal table
Having the case of an internal table which is of type string,
1) Loop through the internal table. LOOP AT lt_tab INTO lwa_tab.
2) Ge the work area contents and get the first char wa_tab-string+0(1)
3) FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
w_tabname = p_table.
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
Follow the link
http://www.sap-img.com/ab030.htm
http://www.sapdev.co.uk/tips/dynamic-structure.htm
and then based on the sy-tabix values you will get that many number of internal table
<FS> = wa_tab-string+0(1)
append <FS>
OR
USE SPLIT statement at the relevant seperator
revert for further clarification
Thanks
Sri
Edited by: SRIKANTH P on Oct 12, 2011 12:36 PM -
Moving the data from multiple internal tables into a single one
Hello everyone,
I am creating a classical report which uses the following tables.
tables : ekko, ekpo, mara, makt,lfa1.
my input parameter is
Select-options Purchase Order number
Following fields are getting used.
Doc no EKKO-EBELN
Material EKPO-MATNR
Item number EKPO-EBELP
Quantity EKPO-MENGE
Material Group MARA-MATKL
Vendor EKKO-LIFNR
Old Material code MARA-BISMT
Material Desc. MAKT-MAKTX
Vendor name LFA1-NAME1
Now i need to do the following task.
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
3 Find out Old Material code of each and every material from Material master.
4 Find out Material description for each and every material from MAKT.
5 Sort record on Vendor, Purchase Order number and Material.
I have defined seperate internal tables for these operation.
Once i have fetched records into these individual internal tables from the corresponding DB tables i need to move these values into a new internal tables which has all the above fields mentioned
I need to move these values into a new internal table because to display the values on the report.
Any idea for the above ? Plz help with a sample example or some relevant.
Regards,
Ranjith NambiarHi
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
Use inner join and retrive data into one internal table.for Ex ITAB1
3 Find out Old Material code of each and every material from Material master.
Use ITAB1 with for allentries in MARA table to get the onl materil number populate in to one table.
4 Find out Material description for each and every material from MAKT.
Get the Material desc with the same manner as above,
5 Sort record on Vendor, Purchase Order number and Material.
now sort the ITAB1 as you req.
now Loop on the ITAB1.
and read above 2 tables for old matnr and matner deac and append into another table as you want.
Hope this will help.
Regards,
Hiren Patel -
Multiple Internal tables in separate result sets in ALV report
Hi All
I need to create a program to display the 3 different Internal Tables in different boxes using ALV
For example, say i am having the values in my internal table say ITAB1, ITAB2 & ITAB3 if you call the "REUSE_ALV_LIST_DISPLAY" by passing the "ITAB1" it will show you the output in 1 box,
but we can't then display the ITAB2 and ITAB3 data.
so i want to confirm 3 separate internal tables are displayed in separate boxes using ALV.
Is it possible in ALV ?Hi Amol Sonaikar
<b>1</b>.
Displaying different ITABs one by one using ALV called BLOCKED ALV reports.
<b>2</b>.
For this we use 3 FMs
<b>REUSE_ALV_BLOCK_LIST_INIT
REUSE_ALV_BLOCK_LIST_APPEND
REUSE_ALV_BLOCK_LIST_APPEND</b>
<b>3</b>.
Have a look at this Example .
Just create and Execute .It displays 2 outputs.
If u want display another one call REUSE_ALV_BLOCK_LIST_APPEND FM and pass ur ITAB .
REPORT zvenkat_head1.
DATA: BEGIN OF i_mard OCCURS 0,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
matnr TYPE mard-matnr,
insme TYPE mard-insme,
einme TYPE mard-einme,
speme TYPE mard-speme,
END OF i_mard.
DATA: BEGIN OF i_makt OCCURS 0,
matnr TYPE makt-matnr,
maktx TYPE makt-maktx,
maktg TYPE makt-maktg,
END OF i_makt.
*& ALV Variables
TYPE-POOLS :slis.
DATA :i_field TYPE slis_t_fieldcat_alv,
w_field LIKE LINE OF i_field,
w_layout TYPE slis_layout_alv,
i_events TYPE slis_t_event,
w_events LIKE LINE OF i_events.
DATA :i_field1 TYPE slis_t_fieldcat_alv,
w_field1 LIKE LINE OF i_field1,
w_layout1 TYPE slis_layout_alv,
i_events1 TYPE slis_t_event,
w_events1 LIKE LINE OF i_events1.
*& START-OF-SELECTION
START-OF-SELECTION.
PERFORM get_data_from_database .
*& END-OF-SELECTION
END-OF-SELECTION.
PERFORM build_fieldcatalog.
PERFORM build_events.
PERFORM display_data.
*& Form build_fieldcatalog
FORM build_fieldcatalog .
CLEAR :
w_field,
i_field[].
CLEAR :
w_field1,
i_field1[].
Fieldcatalog 1
w_field-fieldname = 'WERKS' .
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Plant'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'LGORT' .
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'S.Location'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'MATNR'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Mat No'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'INSME' .
w_field-do_sum = 'X'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'quality Stock'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'EINME'.
w_field-do_sum = 'X'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Total Stock'.
APPEND w_field TO i_field.
CLEAR w_field.
w_field-fieldname = 'SPEME'.
w_field-do_sum = 'X'.
w_field-tabname = 'I_MARD'.
w_field-seltext_m = 'Blocked stock'.
APPEND w_field TO i_field.
CLEAR w_field.
Fieldcatalog 2
w_field1-fieldname = 'MATNR'.
w_field1-tabname = 'I_MAKT'.
w_field1-seltext_m = 'MATNR'.
APPEND w_field1 TO i_field1.
CLEAR w_field1.
w_field1-fieldname = 'MAKTX'.
w_field1-tabname = 'I_MAKT'.
w_field1-seltext_m = 'MAKTX'.
APPEND w_field1 TO i_field1.
CLEAR w_field1.
w_field1-fieldname = 'MAKTG'.
w_field1-tabname = 'I_MAKT'.
w_field1-seltext_m = 'MAKTG'.
APPEND w_field1 TO i_field1.
CLEAR w_field1.
ENDFORM. " build_fieldcatalog
*& Form build_events
FORM build_events .
CLEAR:
w_events,
i_events[],
w_events1,
i_events1[].
w_events-name = 'TOP_OF_PAGE' .
w_events-form = 'TOP_OF_PAGE' .
APPEND w_events TO i_events.
CLEAR w_events.
w_events1-name = 'TOP_OF_PAGE' .
w_events1-form = 'TOP_OF_PAGE' .
APPEND w_events1 TO i_events1.
CLEAR w_events1.
ENDFORM. " build_events
*& Form display_data
FORM display_data .
DATA :program LIKE sy-repid VALUE sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = program
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = w_layout
it_fieldcat = i_field
i_tabname = 'I_MARD'
it_events = i_events
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = i_mard
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = w_layout
it_fieldcat = i_field1
i_tabname = 'I_MAKT'
it_events = i_events1
IT_SORT =
I_TEXT = ' '
TABLES
t_outtab = i_makt
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_data
*& Form get_data_from_database
text
FORM get_data_from_database .
SELECT werks lgort matnr insme einme speme
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
UP TO 20 ROWS
WHERE werks = 'WF01'.
SELECT matnr
maktx
maktg
FROM makt
INTO TABLE i_makt
UP TO 20 ROWS.
ENDFORM. " get_data_from_database
*& Form top_of_page
text
FORM top_of_page.
DATA: inc_colnum TYPE i.
ULINE .
inc_colnum = sy-linsz - 60.
WRITE: / 'Report: ', sy-repid(18).
WRITE AT 30(inc_colnum) sy-title CENTERED.
inc_colnum = sy-linsz - 20.
WRITE: AT inc_colnum 'Page: ', (11) sy-pagno RIGHT-JUSTIFIED.
WRITE: / 'Client: ', sy-mandt.
inc_colnum = sy-linsz - 20.
WRITE: AT inc_colnum 'Date: ', sy-datum.
WRITE: / 'User : ', sy-uname.
inc_colnum = sy-linsz - 60.
WRITE AT 30(inc_colnum) 'Blocked ALV' CENTERED.
inc_colnum = sy-linsz - 20.
WRITE: AT inc_colnum 'Time: ', (10) sy-uzeit RIGHT-JUSTIFIED.
ULINE .
ENDFORM. "top_of_page
I think that example will solve ur problem.
<b>Thanks,
Venkat.O</b> -
Exporting Multiple Internal table data to Single Excel file.
Hello Expert,
I want to export more than one internal table data from Web Dynpro Application to single Excel file but in such a way that
each table's data to be get exported to different tabs in (Multiple sheets) that single excel file.
So help me in this matter.
Thank You.
Varun
Moderator message: wrong forum, please post again in "Web Dynpro ABAP".
Edited by: Thomas Zloch on Oct 29, 2010 1:39 PMEach table having different sheet in same CSV file .
A CSV file is a flat file and don't have "Sheets"; you would have to Export to an Excel file, which supports several Sheets in one file.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Creating XML transformation using multiple internal tables
<b>Hi everyone,</b><br />
<br />
<b>I'm trying to transforme 3 internal tables (from customer master data) into a single XML document.</b><br />
<p />
DATA: BEGIN OF wtab OCCURS 0 ,<br />
kunnr LIKE kna1-kunnr, "Customer ID<br />
ktokd LIKE kna1-ktokd, <br />
land1 LIKE kna1-land1, <br />
name1 LIKE kna1-name1, <br />
ort01 LIKE kna1-ort01, <br />
pstlz LIKE kna1-pstlz, <br />
spras_iso LIKE kna1-spras, <br />
smtp_addr LIKE adr6-smtp_addr, <br />
stras LIKE kna1-stras, <br />
END OF wtab.<br />
<br />
DATA: BEGIN OF wtab_o OCCURS 0 ,<br />
kunnr LIKE knvv-kunnr, "Customer ID<br />
vkorg LIKE knvv-vkorg, "Sales organisation<br />
waers LIKE knvv-waers, <br />
END OF wtab_o.<br />
<br />
DATA: BEGIN OF wtab_p OCCURS 0 ,<br />
kunnr LIKE knvp-kunnr, "Customer ID<br />
vkorg LIKE knvp-vkorg, "Sales organisation<br />
parvw LIKE knvp-parvw, <br />
kunn2 LIKE knvp-kunnr,<br />
END OF wtab_p.<br />
<p />
<b>The internal tables are related to each other as follows:*</b><br />
<br />
wtab-kunnr = wtab_o-kunnr<br />
<br />
AND<br />
<br />
wtab_o-vkorg = wtab_p-vkorg<br />
wtab_o-kunnr = wtab_p-kunnr<br />
<br />
<b>I couldn't figure out how to declare this relationship when calling the transformation. Is it possible?</b><br />
<p />
ABAP<br />
<br />
<br />
REFRESH : gt_source_itab.<br />
CLEAR : g_rxml.<br />
<br />
GET REFERENCE OF wtab INTO gs_source_wa-value.<br />
gs_source_wa-name = 'DEBMAS04'.<br />
APPEND gs_source_wa TO gt_source_itab.<br />
<br />
GET REFERENCE OF wtab_o INTO gs_source_wa-value.<br />
gs_source_wa-name = 'E1KNVVM'.<br />
APPEND gs_source_wa TO gt_source_itab.<br />
<br />
GET REFERENCE OF wtab_p INTO gs_source_wa-value.<br />
gs_source_wa-name = 'E1KNVPM'.<br />
APPEND gs_source_wa TO gt_source_itab.<br />
<br />
TRY.<br />
CALL TRANSFORMATION Z_XSLT_CLIENT<br />
SOURCE (gt_source_itab)<br />
RESULT XML g_rxml<br />
OPTIONS xml_header = 'without_encoding'.<br />
CATCH cx_root INTO gs_rif_ex.<br />
<br />
gs_var_text = gs_rif_ex->get_text( ).<br />
MESSAGE gs_var_text TYPE 'E'.<br />
ENDTRY.<br />
<br />
<br />
Transformation Z_XSLT_CLIENT:<br />
<br />
<br />
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl"><br />
<xsl:output indent="yes" encoding="UTF-16" method="xml" version="1.0"/><br />
<xsl:strip-space elements="*"/><br />
<xsl:template match="/"><br />
<DEBMAS04><br />
<xsl:apply-templates select="//DEBMAS04/item"/><br />
</DEBMAS04><br />
</xsl:template><br />
<xsl:template match="DEBMAS04/item"><br />
<IDOC><br />
<xsl:attribute name="BEGIN">1</xsl:attribute><br />
<E1KNA1M><br />
<xsl:attribute name="SEGMENT">1</xsl:attribute><br />
<KUNNR><br />
<xsl:value-of select="KUNNR"/><br />
</KUNNR><br />
<KTOKD><br />
<xsl:value-of select="KTOKD"/><br />
</KTOKD><br />
<LAND1><br />
<xsl:value-of select="LAND1"/><br />
</LAND1><br />
<NAME1><br />
<xsl:value-of select="NAME1"/><br />
</NAME1><br />
<ORT01><br />
<xsl:value-of select="ORT01"/><br />
</ORT01><br />
<PSTLZ><br />
<xsl:value-of select="PSTLZ"/><br />
</PSTLZ><br />
<SPRAS_ISO><br />
<xsl:value-of select="SPRAS_ISO"/><br />
</SPRAS_ISO><br />
<SMTP_ADDR><br />
<xsl:value-of select="SMTP_ADDR"/><br />
</SMTP_ADDR><br />
<STRAS><br />
<xsl:value-of select="STRAS"/><br />
</STRAS><br />
<xsl:apply-templates select="//E1KNVVM/item"/><br />
</E1KNA1M><br />
</IDOC><br />
</xsl:template><br />
<xsl:template match="E1KNVVM/item"><br />
<E1KNVVM><br />
<xsl:attribute name="SEGMENT">1</xsl:attribute><br />
<VKORG><br />
<xsl:value-of select="VKORG"/><br />
</VKORG><br />
<WAERS><br />
<xsl:value-of select="WAERS"/><br />
</WAERS><br />
<xsl:apply-templates select="//E1KNVPM/item"/><br />
</E1KNVVM><br />
</xsl:template><br />
<xsl:template match="E1KNVPM/item"><br />
<E1KNVPM><br />
<xsl:attribute name="SEGMENT">1</xsl:attribute><br />
<PARVW><br />
<xsl:value-of select="PARVW"/><br />
</PARVW><br />
<KUNN2><br />
<xsl:value-of select="KUNN2"/><br />
</KUNN2><br />
</E1KNVPM><br />
</xsl:template><br />
</xsl:transform><br />
<br />
<b>The way the call transformation is now, for each line in table wtab (DEBMAS04) I'm getting all the lines in table wtab_o (E1KNVVM) and table wtab_p (E1KNVPM)</b><br />
<p />
<br />
Thank you for your help,<br />
<br />
Giselle<br />
<p />Hi Giselle,
I think it's possible (using xsl:if for instance), but an easier way is to nest your internal tables declarations (wtab_o inside wtab, kunnr becomes useless, and wtab_p inside wtab_o), and use the SAP standard "ID" transformation (no need for a custom XSL transformation). You'll get a slightly different result, but I don't think you want something very sophisticated.
Sandra -
Possible to join multiple internal tables ?
Is it possible to join internal tables like this:
itab1:
fields are matnr f1 f2
itab2:
fields are matnr f3 f4
itab3:
fields are matnr f5 f6
required final-itab:
fields are - matnr f1 f2 f3 f4 f5 f6
(which are joined by matnr)
Thanks.Ok, then we need to take all three ITABs and get all of the MATNRs into another internal table, then loop at this internal table and read the records for ITAB1, ITAB2, and ITAB3.
data: begin of imatnr occurs 0,
matnr type mara-matnr,
end of imatnr.
loop at itab1.
imatnr-matnr = itab1-matnr.
collect imatnr.
endloop.
loop at itab2.
imatnr-matnr = itab2-matnr.
collect imatnr.
endloop.
loop at itab3.
imatnr-matnr = itab3-matnr.
collect imatnr.
endloop.
Loop at imatnr.
clear final_itab.
final_itab-matnr = imatnr-matnr.
clear itab1.
read table itab1 with key matnr = imatnr-matnr.
if sy-subrc = 0.
final_itab-f1 = itab1-f1.
final_itab-f2 = itab1-f2.
endif.
clear itab2.
read table itab2 with key matnr = imatnr-matnr.
if sy-subrc = 0.
final_itab-f3 = itab2-f3.
final_itab-f4 = itab2-f4.
endif.
clear itab3.
read table itab3 with key matnr = imatnr-matnr.
if sy-subrc = 0.
final_itab-f5 = itab3-f5.
final_itab-f6 = itab3-f6.
endif.
append final_itab.
endloop.
REgards,
Rich Heilman -
Display internal table as per value entered in selection screen
hi experts,
i need help on this issue. I have an internal table like this.
f1 f2 f3
a 2 5
b 3 4
c 4 3
d 5 2
e 2 6
totf2 =16 totf3= 20
i am getting this sum displayed using AT END OF.
Now there is a provision to enter a value for totf2, totf3 in selection screen. so based on this value entered for eg. if totf2 = 9 and totf3 = 13, is entered, then my internal table display shd b like:
f1 f2 f3
a 2 5
b 3 4
c 4 3
totf2 = 9, tot f3= 12.
someone plz help quick.
thanks.Hi,
Try this..
DATA: v_totf2 TYPE I.
DATA: v_totf3 TYPE I.
* Create a internal table similar to your internal table.
DATA: ITAB_FINAL LIKE TABLE OF itab.
LOOP AT itab INTO wa.
* Sum up the total for fields 2 and 3
v_totf2 = v_totf2 + wa-f2.
v_totf3 = v_totf3 + wa-f3.
* If total exceeds for the field 2 and 3 than given in the selection screen.Then exit.
IF v_totf2 >= p_totf2. " p_totf2 - selection screen value
OR
v_totf3 >= p_totf3. " p_totf3 - selection screen value
EXIT. " Exit out of the loop.
ENDIF.
* Move the values to the final internal table.
APPEND wa to ITAB_FINAL.
ENDLOOP.
* ITAB_FINAL will have the final values.
Thanks
Naren -
Loop at internal Table inside Script
Hi
I am filling a table in a subroutine in a program and calling it through 'Perform' from my Script,now the main issue is , How to display the table in my script ?
I want to loop through an internal table & display its content on my script , but i can't make changes in the calling program by any means.Hi Ajitabh ,
With PERFORM inside SAPSCRIPT you can only pass individual fields and also get back individual fields .
Check This
http://help.sap.com//saphelp_470/helpdata/EN/d1/802fd3454211d189710000e8322d00/frameset.htm
Only "USING" and CHANGING" options are allowed and that too only symbols available / defined in sapscript can be passed .
Even if you populate an internal table in the program you are calling with "PERFORM" there is no way to pass this internal table back to sapscript , also in SAPSCRIPT there is no way to loop .
If you are sure about the no of lines you are going to populate and all lines have only one column ( only one field ) you can try something like this .
/: PERFORM GET_VALUE IN PROGRAM <ZNAME>
/: USING &VAR1&
/: USING &VAR2&
/: CHANGING &ITAB1&
/: CHANGING &ITAB2&
/: CHANGING &ITAB3&
/: CHANGING &ITAB4&
/: ENDPERFORM
Anothe way is to loop in the main print program and call WRITE_FORM . But I guess your main print program is a SAP std program which you dont want to copy and change.
Cheers. -
Longest length of a data type in an internal table in abap
Hi everyone,
I have a requirement for a client in which i want to read a standard text from SO10 which can be up to 5000 words, store that into an internal table & display it in an excel sheet in a single column in a single field.
I have tried declaring my field as:
field(65535) TYPE c,
edidd-sdata,
char1024,
/SDF/CCM_XSTRING, etc. But the field does not store morre than 128 characters.
Im attaching a screen shot of my final requirement.
can anybody help in this regard??Hi Vinnet,
Declare field with string type and use below sample code to display in a single row or colum.
CONSTANTS: "Char
lc_char1 TYPE char2 VALUE '"' ,
AT NEW esnum. "#EC AT_LOOP_WH
CONCATENATE lc_char1 l_string
INTO l_string
SEPARATED BY space.
ENDAT.
CONCATENATE l_string <field_name>
INTO l_string
SEPARATED BY space.
* Check for last line item to get payment note
AT END OF esnum. "#EC AT_LOOP_WH
CONCATENATE l_string lc_char1
INTO l_string
SEPARATED BY space.
ENDAT.
reward if it helpfull. -
Internal table modification in ABAP object event
Hi Gurus
I have an internal table displayed using ALV - OOPS concept. THe internal table has 15 rows in my test program but it can go up depending on user inpout.
I am able to display it . on the screen . One of the fields is editable . It is required that it take input from user and on pressing enter , the value entered in that cell should be subtracted from a total amout displayed in the cell next to it.
I have used the following code . There are no errors , but nothing happens when I edit it. The screen remains as it is.
Any help will be very useful
DATA : ITAB type ITABT occurs 0.
DATA : itab_w like line of itab.
CLASS LCL_EVENTS_D0100 IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi.
DATA : L_PLANETYPE TYPE ITABT-SEL_QUANT.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
check if column PLANETYPE of this row was changed
WHEN 'SEL_QUANT'.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = l_planetype.
ENDCASE.
LOOP AT ITAB INTO ITAB_W .
read table itab into itab_w WITH KEY FINDEX = LS_GOOD-ROW_ID .
itab_w-f_balquant = itab_w-f_balquant - l_planetype.
modify itab FROM itab_w .
endloop.
ENDLOOP.
ENDMETHOD.
ENDCLASS.Hi,
Hi,
AND also use
* Module Pai INPUT *
* PAI module *
module pai input.
save_ok = ok_code.
clear ok_code.
call method grid1->check_changed_data
importing
e_valid = v_valid.
" After this system will automatically update your changed data into
" internal table t_zthlog
case save_ok.
when 'EXIT'.
perform f_exit_program.
when 'CANC'.
perform f_exit_program.
when 'BACK'.
perform f_exit_program.
when 'SAVE'.
perform f_save_data.
endcase.
endmodule. " Pai INPUT
aRs -
Adobe form - Split internal table data & dis on the right and left corner
HI ,
I have a form where i am populating the data via an Internal Table.
The concern i have is i have 100 rows in the table and i want to print the first 10 rows on the right hand side of the page and the next 10 rows on the Left hand side of the page. I want to do this dynamically on multiple pages during run time based on the volume of data in the internal table.
I am sure i cannot dynamically change the interface of the form to allow multiple internal table , Please suggest if there is any other solution.
Thanks in advance
Tk
Edited by: tarunk on Jan 16, 2012 5:56 PMHi,
Thank you very much for the input, But my concern is
I have a table with 120 records.
i have three columns which i have it on the right side as well as on the Left side of the page.
EX:
Right Side Left Side
Col1 col2 col3 col1 col2 col3.
Now what i want to do is the first ten rows of the internal table data i want to print it on the Right Side and the Next 10 rows on the Left Side in the same page .
I want to do this on Multiple pages.
please suggest.
Thanks,
Tk -
ALV GRID update internal table
Hi all,
I have an internal table display in a ALV GRID. Only one column is editable. When I change the field value, ALV GRID display the change, but when I click on refresh return the old value.
I've checked in DEBUG mode and when I click on refresh (in the PAI module), the internal table haven't data modified.
For example: the field qta have value 15. I change it in 18 and then press Refresh. In debug, the field qta still have the value 15.
What I have to do?Hi
The Example prg is using Classes, then you need to use the same approach in the way i mentioned below...
You need to Update the ITAB with the Modifeid values.
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Handler to Check the Data Change
HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER.
ENDCLASS. "lcl_event_handler
DEFINITION
**Handle Data Change
METHOD HANDLE_DATA_CHANGED.
DATA: X_CHANGE TYPE LVC_S_MODI,
X_FINAL TYPE T_FINAL,
X_OCRC TYPE ZSD_OC_HOLD,
L_FLAG.
LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
IF X_CHANGE-FIELDNAME = 'ZZOCHOLDRC'.
READ TABLE IT_FINAL INTO X_FINAL INDEX X_CHANGE-ROW_ID.
IF SY-SUBRC = 0.
READ TABLE IT_OCRC INTO X_OCRC WITH KEY
ZZOCHOLDRC = X_CHANGE-VALUE
TRANSPORTING ZZRCDESC.
IF SY-SUBRC = 0.
X_FINAL-ZZRCDESC = X_OCRC-ZZRCDESC.
MODIFY IT_FINAL FROM X_FINAL INDEX X_CHANGE-ROW_ID
TRANSPORTING ZZRCDESC.
L_FLAG = 'X'.
ENDIF.
ENDIF.
ENDIF.
IF X_CHANGE-FIELDNAME = 'ZZPROMDT'.
READ TABLE IT_FINAL INTO X_FINAL INDEX X_CHANGE-ROW_ID.
IF SY-SUBRC = 0.
X_FINAL-ZZPROMDT = X_CHANGE-VALUE.
MODIFY IT_FINAL FROM X_FINAL INDEX X_CHANGE-ROW_ID
TRANSPORTING ZZPROMDT.
L_FLAG = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
IF L_FLAG = 'X'.
CLEAR V_DATA_CHANGE.
V_DATA_CHANGE = 'X'.
ENDIF.
ENDMETHOD. "data_changed
**you need to SET the HANDLER after the method first display.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
try this
vijay -
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.
Maybe you are looking for
-
i just switched from pc/excel to mac/Numbers, and i can't figure out how to (a) change my preferences so that the cursor doesn't move down a cell after i press return and (b) edit in cell. in excel and lotus, you pressed f2 to edit in cell (and to sw
-
How do you keep macbook pro running quickly
I always thought that using a MAC would eliminate the need to re-image a machine like you have to do with Windows. However, my recently purchased MacBook Pro 13" retina display with 8Gb RAM, 3Ghz i7 processor is already beginning to slow down - just
-
hii experts.. i am trying to create a new sort key throught OB16 but the systems shows me error ficore405...my client wants that the number should be visible in the assignment field... please help me... Regards, Abhay
-
Ampkit as a bypass into mac book GB
I was thinking of getting some sort of guitar input to use for the ipad and iphone GB app. Can I also use this as an input to go into GB in my Mac Book Pro? Thanks.
-
I ordered something, and cant track it
When i go to track it, i get nothing, it says, " the phone number doesnt match the order number, blah blah blah". Yet, that can not be the case because they texted me the code, and emailed it. How can i get this fixed, I want to track it.