Sort issue with an Internal table
Hi All,
I have an internal table with following format.
Invoice Item Amount
951 <Blank> 450.00
951 0010 1200.00
951 0020 1300.00
Now i need to display this internal table in such a way that,
Invoice Item Amount
951 0010 1200.00
951 0020 1300.00
951 <Blank> 450.00
How to sort for such requirements?
Basically, the item value is blank for Tax amount.
Hence in the report, the layout should show the details as above.... (Line item 1, 2...and at last Total Tax of all line items Amount).
Please Help me.....
Regards
Pavan
>
Pavan Sanganal wrote:
> Hi All,
>
> I have an internal table with following format.
>
> Invoice Item Amount
> 951 <Blank> 450.00
> 951 0010 1200.00
> 951 0020 1300.00
>
> Now i need to display this internal table in such a way that,
>
> Invoice Item Amount
> 951 0010 1200.00
> 951 0020 1300.00
> 951 <Blank> 450.00
>
>
> How to sort for such requirements?
>
> Basically, the item value is blank for Tax amount.
>
> Hence in the report, the layout should show the details as above.... (Line item 1, 2...and at last Total Tax of all line items Amount).
>
>
> Please Help me.....
>
> Regards
> Pavan
Add another column to the table, copy the item values into this column setting the tax line value to 9999, sort by this column.
Similar Messages
-
Issue with clearing internal table
Hi Gurus,
I am working on an issue, where when we run a std. report we see social number of the employee on the output screen, when I debugged the program I found that there are 2 internal tables where we are putting this SSN. I tried to clear the SSN at the both the places like:
loop at it_table.
clear it_table-SSN.
Endloop.
but still when I ran the report I am seeing social there. so can you please give me any idea of what I am doing wrong?
Thanks,
Rajeev GuptaHi rajeev,
even after ur clearing if the field is still populating it means again its filling the particular field in the later place.
1) keep ur code and while debuging just click on watchpoint and give ur field name go with f8 it will take u to the place the field is filling..
2) below that place clear that field and modify the table.. -
ABAP to XML with several internal tables
hi,
i have to make a XML file with this structure :
<Order>
<OrderHeader>
<i>...[fields of header]...</i>
</OrderHeader>
<OrderItem>
<i>...[fields of item 10]...</i>
</OrderItem>
<OrderItem>
<i>...[fields of item n]...</i>
</OrderItem>
</Order>
and that for several orders...
I don't know anything about XML, XLST and since 1 day just start to read doc, tutorial.. and i can't say i'm understanding everythings..
so, in a first step, i have tried to export several Order headers :
I have done a XSLT (thanks to another topic/replies in the forum) and call it with CALL TRANSFORMATION and it works good...
now,and here i need a little help, i would like to know :
1-is it possible to work with 2 internal tables and in this case, how to make XLST looping all item for each header?
2-or should i use only one internal table with deep structure?
Regards,
Christophe
The XSLT
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<Order>
<xsl:for-each select="//item">
<OrderHeader>
<OrderNo>
<xsl:value-of select="AUFNR"/>
</NoOT>
</OrderHeader>
</xsl:for-each>
</Order>
</xsl:template>
</xsl:transform>Hi,
Here is the sample code.
* Databases
TABLES:
makt, "Mat description
marc, "Material / plant
t001w, "plant name
bhdgd. "Batch heading
* Internal tables
DATA:
BEGIN OF gt_marc OCCURS 0,
werks LIKE marc-werks,
matnr LIKE marc-matnr,
END OF gt_marc,
* Table to be downloaded as xml. Each line stores start and end tags
* and the value
BEGIN OF gt_xml OCCURS 0,
line(120),
END OF gt_xml,
g_maktx(120).
* User-input
SELECT-OPTIONS:
s_werks FOR marc-werks,
s_matnr FOR marc-matnr.
START-OF-SELECTION.
* Extract all required data
PERFORM main_processing.
END-OF-SELECTION.
SORT gt_marc BY werks matnr.
LOOP AT gt_marc.
AT FIRST. "First tag must be root
CLEAR gt_xml.
gt_xml-line = '<LOCATIONS>'.
APPEND gt_xml.
CLEAR gt_xml.
ENDAT.
AT NEW werks. "At new plant
PERFORM read_plant.
FORMAT COLOR 4 ON.
SKIP 1.
WRITE :/ gt_marc-werks, t001w-name1.
FORMAT COLOR 4 OFF.
CLEAR gt_xml.
gt_xml-line = ' <PLANT>'.
APPEND gt_xml.
CLEAR gt_xml.
CONCATENATE ' <NUMBER>' gt_marc-werks '</NUMBER>'
INTO gt_xml-line.
APPEND gt_xml.
CLEAR gt_xml.
CONCATENATE ' <NAME>' t001w-name1 '</NAME>' INTO gt_xml-line.
APPEND gt_xml.
CLEAR gt_xml.
gt_xml-line = ' </PLANT>'.
APPEND gt_xml.
CLEAR gt_xml.
ENDAT.
PERFORM read_description.
CLEAR gt_xml.
gt_xml-line = ' <MATERIAL>'.
APPEND gt_xml.
CLEAR gt_xml.
CONCATENATE ' <NAME>' g_maktx '</NAME>'
INTO gt_xml-line.
APPEND gt_xml.
CLEAR gt_xml.
CONCATENATE ' <NUMBER>' gt_marc-matnr '</NUMBER>'
INTO gt_xml-line.
APPEND gt_xml.
CLEAR gt_xml.
gt_xml-line = ' </MATERIAL>'.
APPEND gt_xml.
CLEAR gt_xml.
* display data
FORMAT COLOR 2 ON.
WRITE :/ gt_marc-matnr, makt-maktx.
FORMAT COLOR 2 OFF.
ENDLOOP.
* The last tag must be the root closing tag --*
gt_xml-line = '</LOCATIONS>'.
APPEND gt_xml.
CLEAR gt_xml.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = 'C:PLANT1.XML'
filetype = 'ASC'
TABLES
data_tab = gt_xml.
TOP-OF-PAGE.
MOVE sy-title TO bhdgd-line1.
MOVE sy-repid TO bhdgd-repid.
MOVE sy-uname TO bhdgd-uname.
MOVE sy-datum TO bhdgd-datum.
MOVE '0' TO bhdgd-inifl.
MOVE '132' TO bhdgd-lines.
FORMAT INTENSIFIED ON COLOR COL_HEADING.
PERFORM batch-heading(rsbtchh0). "report header
* Form READ_PLANT
FORM read_plant.
* Get plant name
CLEAR t001w.
SELECT SINGLE name1
INTO t001w-name1
FROM t001w
WHERE werks EQ gt_marc-werks.
ENDFORM. " READ_PLANT
* Form MAIN_PROCESSING
FORM main_processing.
* Material and plant basic data
SELECT werks matnr
INTO TABLE gt_marc
FROM marc
WHERE werks IN s_werks
AND matnr IN s_matnr.
ENDFORM. " MAIN_PROCESSING
* Form READ_DESCRIPTION
FORM read_description.
* Material name
CLEAR g_maktx.
SELECT SINGLE maktx
INTO g_maktx
FROM makt
WHERE matnr EQ gt_marc-matnr
AND spras EQ 'E'.
* Replace special character
DO.
REPLACE '&' WITH '*ù%;' INTO g_maktx.
IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
ENDDO.
DO.
REPLACE '*ù%;' WITH '&' INTO g_maktx.
IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
ENDDO.
DO.
REPLACE '/' WITH '/' INTO g_maktx.
IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
ENDDO.
ENDFORM. " READ_DESCRIPTION
Hope this helps.If so,kindly reward points. -
Issue with Update of Table VARINUM
Hi,
I am getting waiting Issues with Update of table VARINUM. Has anybody faced such an issue.
I have a lot of Jobs which are running in background. I am submitting it through a report. what can be the issue.
Regards,
Abhishek jollyThisi is quite old, but not answered properly yet, so there you go:
SAP generates a new job and temporary variant on report RSDBSPJS, for each HTTP call,which creates database locks on table VARINUM .
This causes any heavyweight BSP application to hang and give timeout errors.
The problem is fixed applying OSS note 1791958, which is not included in any service pack. -
Issue with data dictionary -Table maintanance generator
Hi all,
I have an issue with Data dictionary, table maintenance generator. I have entered some records in a custom table (ZBCSECROLETOGRP) and changed the delivery class from C to A. When I create the table maintainance generator, I am encountered with the following errors:
1)Field ZBCSECROLETOGRP-PORTALGROUP shortened (new visible length: 000032)
2)0012 could not be generated
3)In TCTRL_ZBCSECROLETOGRP field LENGTH has the invalid value 01
My main motto is to create the table maintainace generator and transport to the furthur systems .
Please help.
ThnX in advance,
Vishal..HI,
Regenerate the table maintenance by selecting the checkbox of "Modified field structure" => new entry & then save.
Also ensure that the new changes are not affecting old data bcz of data type changes. If that is the case, then delete the old records, regenerate table maint. & re-enter those records which you had deleted.
Thanks,
Best regards,
Prashant -
Using where condition with dynamic internal table
Hi Friends.
How to use where condition with dynamic internal table ?
Regards,
Amit RautHai Amit
REPORT ZDYNAMIC_SELECT .
TABLES: VBAK.
DATA: CONDITION TYPE STRING.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
CONCATENATE 'VBELN' 'IN' 'S_VBELN.'
INTO CONDITION SEPARATED BY SPACE.
SELECT VBELN POSNR FROM VBAP INTO TABLE ITAB
WHERE (CONDITION).
LOOP AT ITAB.
WRITE 'hello'.
ENDLOOP.
Thanks & Regards
Sreenivasulu P -
Im trying to update db table in user exit, with the internal table
Im trying to update db table in user exit, with the internal table
my scenario:
loop at itekpo.
updating itekpo -
> at the end of user exit the db table ekpo have to be updated
endloop.
Im updating internal table, using
MODIFY itekpo TRANSPORTING INCO1 INCO2 WHERE ebeln = itekpo-ebeln
where itekpo is internal table, but it is not updating the db table 'ekpo'.
i also tried updating ekpo directly !
Thanks in advanceHi,
you can search in the forum itself,
Try this link for instance
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=tocreateaBADI&adv=false&sortby=cm_rnd_rankvalue
You can find a code for finding BADI as a report with the following Transaction
finding badis
How to find BADIs
Reward if helpful
Regards
Byju -
2 different tables in the main window with same internal table data
Hi All,
can we have 2 diffterent tables with same internal table data into its work area in the main window.Is it possible or we will get any run time error.?
is it like having 2 nested loop with same internal table ?
ex : loop at itab1 into wa_itab.
loop at itab1 into wa_itab.
endloop.
endloop.
can we use like this?Hi,
there will not be any error ...but what is the use of it...
do you need to have a controlled way of display ...of the data...
If so then you create another workarea in the global definitions of the same type and then use it...
Regards,
Ram -
CVC creation - Strange issue with Master data table of 9AMATNR
Hi Experts,
We have encountered a strange issue with Master data table (/BI0/9APMATNR) of info object 9AMATNR.
We have a BADI implemented for checking the valid Characteristic before creation of the CVC using transaction /SAPAPO/MC62. This BADI puts a select on master data tab of material /BI0/9APMATNR and returns no value. But the material actually exists in the table (checked through SE16).
Now we go inside the info object 9AMATNR and go to the Master data Tab. There we go inside the master table
/BI0/9APMATNR and activate that. After activating the table it is read by the select statement inside BADI (Strange) and allows the CVC to be created.
Ideally it should not allow us to activate the SAP standard table /BI0/9APMATNR. I observed that in technical settings of this table it has single record buffering as switched on. (But as per my knowledge buffer gets refreshed every 2 to 4 mins and not in 2 days or something).
Your expert comment is valuable to us. Thanks.
Best Regards,
Chandan DubeyHi Chandan,
Try to use a WAIT statment with 5 seconds before your select statment.
I'm not sure whether this will work. Anyway check it and let me know the result.
Regards,
Siva. -
Performance issue with joins on table VBAK, VBEP, VBKD and VBAP
hi all,
i have a report where there is a join on all 4 tables VBAK, VBEP, VBKD and VBAP.
the report is giving performance issues because of this join.
all the key fields are used for the joining of tables. but some of the non-key fields like vbap-vstel, vbap-abgru and vbep-wadat are also part of select query and are getting filled.
because of these there is a performance issue.
is there any way i can improve the performance of the join select query?
i am trying "for all entries" clause...
kindly provide any alternative if possible.
thanks.Hi,
Pls perform some of the below steps as applicable for the performance improvement:
a) Remove join on all the tables and put joins only on header and item (VBAK & VBAP).
b) code should have separate select for VBEP and VBKD.
c) remove the non key fields from the where clause. Once you retrieve data from the database into the internal table, sort the table and delete the entries which are not part of the non-key fields like vstel, abgru and wadat.
d) last option is you can create index in the VBAP & VBEP table with respect to the fields vstel, abgru & wadat ( not advisable)
e) buffering option on database tables also possible.
f) select only the fields into the internal table that are applicable for the processing logic and also the select query should contaian the field names in the same order as mentioned in the database table.
Hope this helps.
Regards
JLN -
ALV reprot With four internal tables
Hi all,
Could any one please tell what is function module we have to use for displaying four internal tables in a single ALV REPORT.
Thanks & regards
VardhanThis is the code for displaying ALV using containers.. u need to create 4 containers in one screen and need to display data...
I would suggest you to get all the data into one internal table and display.. for more clarity u can give diff colors for diff table data using field catalog..
*& Report ZTRPSD110 *
* TITLE: Statement of Export Report for Tata Tetley *
* PURPOSE:Statement of Export Report for Tata Tetley *
* A. Start-of-selection: *
* 1. In get_billing_data using the selection screen parameters get the *
* billing data from billing header(VBAK) and Item (VBAP) *
* 2. Get the SHIP-TO partner data from VBPA using Customer number as *
* one condition and store in it_vbpa_sh
* 9. Popultae the ALV display table
* B. End-of-selection:
* Call screen 9000 and display data in ALV
REPORT ztrps110 MESSAGE-ID zttl LINE-SIZE 130.
TABLES: vbrk.
* CONSTANTS
CONSTANTS :
c_x(1) TYPE c VALUE 'X',
c_zxto TYPE vbak-auart VALUE 'ZXTO',
c_e TYPE spras VALUE 'E',
c_000000 TYPE posnr VALUE '000000',
c_ship_to TYPE parvw VALUE 'WE'. "Ship To Party
* Table Types
TYPES: BEGIN OF ty_vbrk_vbrp,
vbeln TYPE vbrk-vbeln, "Billing doc
posnr TYPE vbrp-posnr, "Billing item
aubel TYPE vbrp-aubel, "Sales order
waerk TYPE vbrk-waerk, "Doc currency
mvgr1 TYPE vbrp-mvgr1, "Material group 1
mvgr3 TYPE vbrp-mvgr3, "Material group 3
mvgr4 TYPE vbrp-mvgr4, "Material group 4
matnr TYPE vbrp-matnr, "Material no
ntgew TYPE vbrp-ntgew, "Net wt
gewei TYPE vbrp-gewei, "Wt unit
kzwi1 TYPE vbrp-kzwi1, "Subtotal 1
kursk TYPE vbrp-kursk, "Exchange rate
END OF ty_vbrk_vbrp.
TYPES: BEGIN OF ty_data,
land1 TYPE vbpa-land1,
landx TYPE t005t-landx,
mvgr3 TYPE vbrp-mvgr3,
mvgr4 TYPE vbrp-mvgr4,
bezei3 TYPE tvm3t-bezei,
bezei4 TYPE tvm4t-bezei,
ntgew_tea_bag TYPE vbrp-ntgew,
ntgew_pkt_tea TYPE vbrp-ntgew,
ntgew_bulk_tea TYPE vbrp-ntgew,
kzwi1_tea_bag TYPE vbrp-kzwi1, "Subtotal 1 Tea Bag
kzwi1_pkt_tea TYPE vbrp-kzwi1, "Subtotal 1 Pkt Tea
kzwi1_bulk_tea TYPE vbrp-kzwi1, "Subtotal 1 Bulk Tea
ntgew_tot TYPE vbrp-ntgew,
kzwi1_tot TYPE vbrp-kzwi1,
line_color(4) TYPE c, "For line color
END OF ty_data.
TYPES: BEGIN OF ty_vbpa,
vbeln TYPE vbpa-vbeln,
land1 TYPE vbpa-land1,
END OF ty_vbpa.
TYPES: BEGIN OF ty_t005t,
land1 TYPE t005t-land1,
landx TYPE t005t-landx,
END OF ty_t005t.
TYPES: BEGIN OF ty_tvm3t,
mvgr3 TYPE tvm3-mvgr3,
bezei TYPE tvm3t-bezei,
END OF ty_tvm3t.
TYPES: BEGIN OF ty_tvm4t,
mvgr4 TYPE tvm4-mvgr4,
bezei TYPE tvm4t-bezei,
END OF ty_tvm4t.
DATA: it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp,
wa_vbrk_vbrp TYPE ty_vbrk_vbrp,
it_vbpa TYPE STANDARD TABLE OF ty_vbpa,
wa_vbpa TYPE ty_vbpa,
it_data TYPE STANDARD TABLE OF ty_data,
wa_data TYPE ty_data,
it_t005t TYPE STANDARD TABLE OF ty_t005t,
wa_t005t TYPE ty_t005t,
it_tvm3t TYPE STANDARD TABLE OF ty_tvm3t,
wa_tvm3t TYPE ty_tvm3t,
it_tvm4t TYPE STANDARD TABLE OF ty_tvm4t,
wa_tvm4t TYPE ty_tvm4t.
* Global data for grand total
DATA:
w_tot_ntgew_tea_bag TYPE vbrp-ntgew,
w_tot_ntgew_pkt_tea TYPE vbrp-ntgew,
w_tot_ntgew_bulk_tea TYPE vbrp-ntgew,
w_tot_ntgew_tot TYPE vbrp-ntgew,
w_tot_kzwi1_tea_bag TYPE vbrp-kzwi1,
w_tot_kzwi1_pkt_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_bulk_tea TYPE vbrp-kzwi1,
w_tot_kzwi1_tot TYPE vbrp-kzwi1.
* Global data definitions for ALV
DATA :
* ALV Grid container
w_alv_container TYPE REF TO cl_gui_custom_container,
* ALV Grid
w_alv_grid TYPE REF TO cl_gui_alv_grid,
w_layo TYPE lvc_s_layo, "For layout
wt_fieldcat TYPE lvc_t_fcat, "For field catalog
okcode TYPE okcode, "OK Code
w_to(2) TYPE c,
w_title TYPE string.
*-------------- START OF SELECTION SCREEN ----------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
* Billing Date
SELECT-OPTIONS: s_fkdat FOR vbrk-fkdat MEMORY ID vf OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN:SKIP 1.
SELECTION-SCREEN: END OF BLOCK b1.
*-------------- END OF SELECTION SCREEN ------------------------------*
*------------- EVENT START-OF-SELECTION -------------------------------*
START-OF-SELECTION.
* Get billing data from Delivery header(VBRK) and item (VBRP)
PERFORM get_billing_data.
* Get ship-to country
PERFORM get_ship_to_data.
* Get material group description 3
PERFORM get_material_group_3.
* Get material group description 4
PERFORM get_material_group_4.
* Form the ALV Grid title
PERFORM form_title.
* Process data
PERFORM process_data.
* Populate text descriptions
PERFORM populate_description.
*------------- EVENT END-OF-SELECTION -------------------------------*
END-OF-SELECTION.
* Set the text to when date high is there
IF NOT s_fkdat-high IS INITIAL.
w_to = 'to'(c16).
ENDIF.
* Call the scren 9000 for ALV Display
CALL SCREEN 9000.
*& Form get_billing_data
* Get billing data from Delivery header(VBRK) and item (VBRP)
* & store in internal table it_vbrk_vbrp
FORM get_billing_data .
REFRESH: it_vbrk_vbrp.
* Select Billing data by joining VBRK & VBRP and store in it_vbrk_vbrp
SELECT a~vbeln
b~posnr
b~aubel
a~waerk
b~mvgr1
b~mvgr3
b~mvgr4
b~matnr
b~ntgew
b~gewei
b~kzwi1
b~kursk
FROM vbrk AS a INNER JOIN vbrp AS b
ON a~vbeln = b~vbeln
INTO TABLE it_vbrk_vbrp
WHERE a~fkdat IN s_fkdat
* Consider only non-deleted document
AND fksto = space
* Billing doc type should be ZXTB
AND fkart = 'ZXTB'
AND pstyv = c_zxto.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'No data is there'(m06).
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " get_billing_data
*& Form get_ship_to_data
* Get Ship-To party data
FORM get_ship_to_data .
DATA: l_it_vbpa TYPE STANDARD TABLE OF ty_vbpa.
REFRESH: it_vbpa, it_t005t.
IF NOT it_vbrk_vbrp[] IS INITIAL.
SELECT vbeln
land1
FROM vbpa
INTO TABLE it_vbpa
FOR ALL ENTRIES IN it_vbrk_vbrp
WHERE vbeln = it_vbrk_vbrp-aubel
AND posnr = c_000000
AND parvw = c_ship_to.
IF sy-subrc <> 0.
MESSAGE i999(zttl) WITH 'Exporter country not maintained'(m02).
LEAVE LIST-PROCESSING.
ELSE.
SORT it_vbpa BY vbeln.
* Create an unique and sorted driver table
l_it_vbpa[] = it_vbpa[].
SORT l_it_vbpa BY land1.
DELETE ADJACENT DUPLICATES FROM l_it_vbpa COMPARING land1.
IF NOT l_it_vbpa[] IS INITIAL.
* Get the country description from T005t table
SELECT land1
landx
FROM t005t
INTO TABLE it_t005t
FOR ALL ENTRIES IN l_it_vbpa
WHERE spras = c_e
AND land1 = l_it_vbpa-land1.
IF sy-subrc = 0.
SORT it_t005t BY land1.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " get_ship_to_data
*& Form get_material_group_3
* Get material group 3
FORM get_material_group_3 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm3t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr3.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr3.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr3
bezei
FROM tvm3t
INTO TABLE it_tvm3t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr3 = l_it_vbrk_vbrp-mvgr3.
IF sy-subrc = 0.
SORT it_tvm3t BY mvgr3.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_3
*& Form get_material_group_4
* Get material group 4
FORM get_material_group_4 .
DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
REFRESH: it_tvm4t.
* Create an unique and sorted driver table
l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
SORT l_it_vbrk_vbrp BY mvgr4.
DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr4.
IF NOT l_it_vbrk_vbrp[] IS INITIAL.
SELECT mvgr4
bezei
FROM tvm4t
INTO TABLE it_tvm4t
FOR ALL ENTRIES IN l_it_vbrk_vbrp
WHERE mvgr4 = l_it_vbrk_vbrp-mvgr4.
IF sy-subrc = 0.
SORT it_tvm4t BY mvgr4.
ENDIF.
ENDIF.
ENDFORM. " get_material_group_4
*& Form process_data
* Process the data and do summation and populate final display table
FORM process_data .
LOOP AT it_vbrk_vbrp INTO wa_vbrk_vbrp.
CLEAR: wa_data, wa_vbpa.
READ TABLE it_vbpa INTO wa_vbpa WITH KEY
vbeln = wa_vbrk_vbrp-aubel
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-land1 = wa_vbpa-land1.
ENDIF.
wa_data-mvgr3 = wa_vbrk_vbrp-mvgr3.
wa_data-mvgr4 = wa_vbrk_vbrp-mvgr4.
* Do an unit conversion of the quamtity
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = wa_vbrk_vbrp-ntgew
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
unit_in = wa_vbrk_vbrp-gewei
unit_out = 'TO' "Metric tonn
IMPORTING
output = wa_vbrk_vbrp-ntgew
EXCEPTIONS
conversion_not_found = 1
division_by_zero = 2
input_invalid = 3
output_invalid = 4
overflow = 5
type_invalid = 6
units_missing = 7
unit_in_not_found = 8
unit_out_not_found = 9
OTHERS = 10.
IF sy-subrc <> 0.
wa_vbrk_vbrp-ntgew = wa_vbrk_vbrp-ntgew.
ENDIF.
* Convert the currency from Customer currency to local
* currency by multiplying with kursk
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 * wa_vbrk_vbrp-kursk.
* Convert the amount to Lacks by dividing with 100000
wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 / 100000. "DV1K905028
* When MVGR1 is between A to F use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'A' AND 'F'.
wa_data-ntgew_tea_bag = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_tea_bag = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 BETWEEN 'G' AND 'L'.
wa_data-ntgew_pkt_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_pkt_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
* When MVGR1 is between G to L use the amount as TEA_BAG
IF wa_vbrk_vbrp-mvgr1 = 'M'.
wa_data-ntgew_bulk_tea = wa_vbrk_vbrp-ntgew.
wa_data-kzwi1_bulk_tea = wa_vbrk_vbrp-kzwi1.
ENDIF.
COLLECT wa_data INTO it_data.
ENDLOOP.
ENDFORM. " process_data
*& Form populate_description
* Populate the description fields
FORM populate_description .
LOOP AT it_data INTO wa_data.
CLEAR: wa_t005t.
READ TABLE it_t005t INTO wa_t005t WITH KEY land1 = wa_data-land1
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-landx = wa_t005t-landx.
ENDIF.
* Read description of Material group 3
CLEAR wa_tvm3t.
READ TABLE it_tvm3t INTO wa_tvm3t WITH KEY
mvgr3 = wa_data-mvgr3
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei3 = wa_tvm3t-bezei.
ENDIF.
* Read description of Material group 4
CLEAR wa_tvm4t.
READ TABLE it_tvm4t INTO wa_tvm4t WITH KEY
mvgr4 = wa_data-mvgr4
BINARY SEARCH.
IF sy-subrc = 0.
wa_data-bezei4 = wa_tvm4t-bezei.
ENDIF.
* Get the grand totals
wa_data-ntgew_tot = wa_data-ntgew_tea_bag
+ wa_data-ntgew_pkt_tea
+ wa_data-ntgew_bulk_tea.
wa_data-kzwi1_tot = wa_data-kzwi1_tea_bag
+ wa_data-kzwi1_pkt_tea
+ wa_data-kzwi1_bulk_tea.
MODIFY it_data FROM wa_data TRANSPORTING landx
bezei3
bezei4
ntgew_tot
kzwi1_tot.
* Summattion of grand totals
w_tot_ntgew_tea_bag = w_tot_ntgew_tea_bag + wa_data-ntgew_tea_bag.
w_tot_ntgew_pkt_tea = w_tot_ntgew_pkt_tea + wa_data-ntgew_pkt_tea.
w_tot_ntgew_bulk_tea = w_tot_ntgew_bulk_tea + wa_data-ntgew_bulk_tea.
w_tot_ntgew_tot = w_tot_ntgew_tot + wa_data-ntgew_tot.
w_tot_kzwi1_tea_bag = w_tot_kzwi1_tea_bag + wa_data-kzwi1_tea_bag.
w_tot_kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea + wa_data-kzwi1_pkt_tea.
w_tot_kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea + wa_data-kzwi1_bulk_tea.
w_tot_kzwi1_tot = w_tot_kzwi1_tot + wa_data-kzwi1_tot.
ENDLOOP.
* Append a grand Total row at the end
CLEAR wa_data.
wa_data-landx = 'Grand Total:'.
wa_data-ntgew_tea_bag = w_tot_ntgew_tea_bag.
wa_data-ntgew_pkt_tea = w_tot_ntgew_pkt_tea.
wa_data-ntgew_bulk_tea = w_tot_ntgew_bulk_tea.
wa_data-ntgew_tot = w_tot_ntgew_tot.
wa_data-kzwi1_tea_bag = w_tot_kzwi1_tea_bag.
wa_data-kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea.
wa_data-kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea.
wa_data-kzwi1_tot = w_tot_kzwi1_tot.
wa_data-line_color = 'C310'.
APPEND wa_data TO it_data.
ENDFORM. " populate_description
*& Module STATUS_9000 OUTPUT
* Initialise PF-STATUS and title
MODULE status_9000 OUTPUT.
SET PF-STATUS 'MAIN9000'.
SET TITLEBAR 'TITLE_9000'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module initialize_9000 OUTPUT
* text
MODULE initialize_9000 OUTPUT.
* Call the ALV grid to display data
PERFORM display_alv_grid.
ENDMODULE. " initialize_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Module to handle User Command
MODULE user_command_9000 INPUT.
CASE okcode.
WHEN 'BACK'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'CANCEL'.
SET SCREEN 0.
CLEAR okcode.
LEAVE SCREEN.
WHEN 'EXIT'.
CLEAR okcode.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Form display_alv_grid
* Display the data in ALV Grid
FORM display_alv_grid .
IF w_alv_container IS INITIAL.
* Create the alv container object
CREATE OBJECT w_alv_container
EXPORTING
container_name = 'ALV_GRID'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* Create the ALV grid object. The parent is the ALV container
CREATE OBJECT w_alv_grid
EXPORTING
i_parent = w_alv_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH 'Problem in ALV display'(t04).
ENDIF.
* This subrotine creates the field catalog and
* store in internal table lt_fieldcat
PERFORM prepare_fieldcat CHANGING wt_fieldcat.
* Layout design
w_layo-no_toolbar = ''.
* Not to allow totaling feature
w_layo-no_totline = c_x.
* Report title
* w_layo-grid_title = text-004.
w_layo-grid_title = w_title.
w_layo-zebra = c_x. "Alternating line color (striped)
w_layo-cwidth_opt = c_x. "Optimize column width
w_layo-sel_mode = 'A'. "Selection Mode
* Name of the color field
w_layo-info_fname = 'LINE_COLOR'."For row color
* Call the method to display the data in ALV grid
CALL METHOD w_alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = w_layo
CHANGING
it_outtab = it_data[]
it_fieldcatalog = wt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ELSE.
* If the container & grid object is alreadt there reuse them
CALL METHOD w_alv_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e999(zttl) WITH text-t04.
ENDIF.
ENDIF.
IF okcode = 'CANCEL'.
EXIT.
ENDIF.
ENDFORM. " display_alv_grid
*& Form prepare_fieldcat
-
APDs with large internal tables
Hi Everyone!
I have a problem with APDs where we use several ABAP routine within. When exploding the data to the lowest level we get 10 million lines and there is not enough space to transfer the data between the different ABAP routine. There isn't space enough to extend the internal tables.
We have tried to have several APDs and several transactional ODSs but it will still not work.
Does anyone has an idea how we could solve this issue ?
Thanks a lot in advance.
BjörnHi Ronen!
Sounds like you run out of physical memory and swapping started. If parameters are still the same (allowed memory per session...), then higher system resource requirements of the new release might be the reason of less space for the sessions.
Check the memory situation (ST02?), maybe a serialization of the big programs can give them enough memory to perform in the old way.
Regards,
Christian -
Sorting by various keys internal table
Hi All ,
There is a small confusion i am having in my mind so wanted to clear it
In my internal table i have 4 fields
1. Material no.
2.material plant no.
3.sold to party
4.ship to party
I need to read this internal table different times in different places based on various keys as like
Read itab with key material no BINARY SEARCH.
Read itab with key material plant no. BINARY SEARCH.
Read itab with key sold to party BINARY SEARCH.
Read itab with key ship to party BINARY SEARCH.
So my questions is shld i sort the table by each key sepertly before reading it
like this
sort itab by material no
Read itab with key material no BINARY SEARCH.
sort itab by material plant no
Read itab with key material plant no. BINARY SEARCH.
sort itab by sold to party
Read itab with key sold to party BINARY SEARCH.
sort itab by ship to party
Read itab with key ship to party BINARY SEARCH.
Or i can once sort table by material no material plant no sold to party ship to party
Please explain me how best this can be done and why?
Regards
Bhanuyour task is a bit strange and I guess the reason was giving by you:
> WHEN 'PROGRAM ID 'ABC ON SELECTION SCREEN '
> READ ITAB BY MATERIAL NO.
This looks to me as if you have to use onyl one read type per execution, depending to the
selection.
So it should be enough to sort once also depending on the selection.
To be on the safe side, it would better to split the whole program in different branches, such that
only one branch is used in one execution. Inside the branch there is the sort, the loop and the
respective read binary search inside.
Otherwise, if you really have to read in one program execution with 4 different keys inside one loop.
Then you must prepare 4 identical tables and sort them outside of the loop and use for each
read binary search the respectivly sorted table.
=> and please update to the new Netweaver release. 7.0 EhP 2 as soon as possible, there you can define different secondary keys, which solves your problem.
Siegfried -
How to upload data with dynamic internal table
Hi,
I have to upload the basic , sales, purchasing view data by using bapi depend on check box selected for views.
i have filled fieldcatalog for selected views and pass the field catalog structure to dynamic int table and
import it into the field symbol <fs_data>. this field symbol assigned to <fs_1>.
then callED the 'GUI_UPLOAD ' and when i pass field symbo for function module i am getting first 10 rows 0f the file .
flat file has basic data,sales ,purchase fields data
ex: i was selected basicview and purchase view and execute i am getting basic,sales view data.
how can i get only basic and purchase data.hi ,
please find code.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0. "#EC NEEDED
ENDIF.
So <FS_1> now points to our dynamic internal table.
ASSIGN <fs_data>->* TO <fs_1>.
Next step is to create a work area for our dynamic internal table.
CREATE DATA new_line LIKE LINE OF <fs_1>.
A field-symbol to access that work area
ASSIGN new_line->* TO <fs_2>.
ASSIGN new_line->* TO <fs_3>.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_f
filetype = 'DAT'
TABLES
data_tab = <fs_1>
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
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
Hello, everyone.
I am having issues with running a DELETE statement on an Oracle 10g database.
DELETE
FROM tableA
WHERE ID in (1,2,3)
If there is only one ID for the IN clause, it works. But if more than one ID is supplied, I get an "SQL command not properly ended" error message. Here is the query as CF:
DELETE
FROM TRAINING
WHERE userID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(form.userID)#">
AND TRAINING_ID in <cfqueryparam value="#form.trainingIDs#" cfsqltype="CF_SQL_INTEGER" list="yes">
Anyone work with Oracle that can help me with this? I'm an experienced MS-SQL developer; Oracle is new to me.
Thanks,
^_^Nevermind.. a co-worker just told me that I still have to use parenthesis around the values for the IN clause.
Maybe you are looking for
-
Drill Down Report using Crystal reports in eclipse and jspviewer
Hi I want to understand how to write a drill down report since I have a requirement for my project, so I tried to run the sample drill down.rpt that is available with Crystal Reports 2008 Complete Reference book by George Peck. I can see the results
-
IPhone 6 Plus CPU(A8) can this 10bit 1080p support?
Hi can this iOS hardware 10bit playback 1080p with embedded subtiles full support??
-
Not printing name2 in address line
Hello All, I dont want to print the name2 in the shipper address. Is there any option in address window? If I change Number of Lines to be Used , then shall the name2 will not get printed? Or I need to take the text window and print there? rgds, Madh
-
Is WAAS 5 that much better than previous versions?
I have never used Cisco WAAS for wan op (I've used BlueCoat and Silverpeak) and have heard less than complimentary comments on its ease of deployment and overall functionality. I am currently looking to replace my aging Bluecoat environment and am cu
-
IiPad retina storage is disappearing after update to ios8.02. I had over 6.4 gig before the update. I now have less than 710 mb. There is no music or videos on the iPad. I have deleted almost all apps and most photos. Every time I use it, the st