Internal table manual modification
I understand this is probably going to be the stupidest question ever posted here. But I wanted to know how to manually add values to an internal table without doing a select statement.
TYPES: BEGIN OF ty_ext,
param(32) type c,
row type i,
field(30) type c,
value(255) type c,
type(4) type c,
length(6) type n,
END OF ty_ext,
DATA: it_ext TYPE TABLE OF ty_ext.
I just want to fill it_ext with data without doing select, I have the data stored in variables.
Thanks,
Risad
TYPES: BEGIN OF ty_ext,
param(32) type c,
row type i,
field(30) type c,
value(255) type c,
type(4) type c,
length(6) type n,
END OF ty_ext,
DATA: it_ext TYPE TABLE OF ty_ext,
wa_ext type ty_ext.
wa_ext-param = '123'.
append wa_ext to it_text.
Similar Messages
-
Infocube Dimension tables manual modification
Hi all,
I have a curiosity: has anyone ever modified manually a dimension table associated with an infocube?
Supposing a situation where an infocube has the dimension ORDER ATTRIBUTES with the fields "Order type" and "Order reason". Dimension table is valorized with 3 tuples:
( TypeA, Reason1)
( TypeB, Reason2)
( TypeC, Reason3)
I should substitute the correspondence ( TypeC, Reason3) with the correspondence (TypeD, Reason1).
I know that it is not the right way to proceed, but I wanted to know if anyone ever faced this issue.
Thanks all,
Edited by: Gianluca Maresca on Feb 7, 2008 11:44 AMHi,
if I understod you correctly you don'T want to change the data model but the content of the dimension table itself. For this you should know that the dimension table is set up like dimid, order type sid, reason sid. The Fact table is jioned with the dimension table. So of course you could change the values of the table with an ABAP (but take care you have to look up the SIDs from the corresponding characterisitcs SID table). The disadvantage nobody knows what has happened and you can get possible errors if you try to reconsteuct the cube or want to rebook a request to the cube.
The standard and recommended way is to delete the cube content and reload data.
Regards,
Juergen -
In LSMW how to maintain Internal table?
Hiii
In lsmw data uploading.. it need to maintain internal table manually or it maintaind by SAP ?
Thanks & Regards
AryaHI
how to update the existing entry in Ztable through LSMW
/message/5906806#5906806 [original link is broken]
Regards
Pavan -
Regarding Internal Table Field Validation [Modification]
Hi All,
I have a small issue with formatting of a field.
The Field is POTX1 - it would get the value as 'New MT-EPPE0097-COMP02',
Means i have one internal table field as i_error-POTX1 in that some times we get value as 'New MT-EPPE0097-COMP02'.
Whenever i get 'New' literal in that internal table field i have to remove that literal from that internal table field. And Left Justify the remaining part of the field.
Ex: 'New MT-EPPE0097-COMP02'
should become 'MT-EPPE0097-COMP02'.
For this first i have to find wether 'New' Literal exists in the Internal table field or not then i have to remove it.
Can anybody tell me how can i solve this issue.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.Hi,
Take a look :
loop at i_error.
if i_error-potx1(3) = 'New'
w_potx1 = i_error-potx1.
i_error-potx1 = w_potx1+3(37).
MODIFY i_error.
endif.
ENDLOOP.
Regards,
Erwan.
Message was edited by: Erwan LE BRUN -
Reg Modification of a field in internal table.
Hi
i have requirement like this. I have a header and an items in a report. In header, i need to display the no. of . items(count). In my report i am displaying the records before moving to internal table(Direct write). Also i want to download that report into a CSV file.
Regards
Ravihi,
Check out this sample code
report ztest.
data: begin of itab occurs 0,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of itab.
data: begin of iout occurs 0,
rec(1000) type c,
end of iout.
parameters: p_file type localfile default 'C:\test.csv'.
data: file type string.
start-of-selection.
* Build the ITAB
itab-fld1 = 'A'.
itab-fld2 = 'B'.
itab-fld3 = 'C'.
append itab.
itab-fld1 = 'D'.
itab-fld2 = 'E'.
itab-fld3 = 'F'.
append itab.
itab-fld1 = 'G'.
itab-fld2 = 'H'.
itab-fld3 = 'I'.
append itab.
* Build the output internal table from ITAB
* Concatenate all fields into IOUT-REC
loop at itab.
concatenate itab-fld1 itab-fld2 itab-fld3 into iout-rec
separated by ','.
condense iout-rec no-gaps.
append iout.
endloop.
* Now Download
file = p_file.
call function 'GUI_DOWNLOAD'
exporting
filename = file
tables
data_tab = iout
exceptions
others = 22. -
hello gurus,
I got output of a report as bellow.
sl no date name state contry
1 10.10.2009 mtm
1 10.10.2009 A1
1 10.10.2009 abc
1 10.10.2009 b1
1 10.10.2009 c1
but my required output is.
sl no date name state contry
1 10.10.2009 A1 mtm ABC
1 10.10.2009 B1
1 10.10.2009 C1
can any body tell me how to change the format.
my internal table data contains as displayed output only.
so i need to do operations at internal table level to get the required output.
thanks,
padmaja.
Edited by: padmaja vaddi on Mar 9, 2009 5:09 AMHi Padmaja,
Please see the code below:
itab1[ ] = itab[ ].
sort itab1 comparing date name.
delete adjacent duplicates from itab1.-->itab1 will contain 3 records and itab will contain 5 records
loop at itab1 into wa_itab1.
clear: wa_itab2, wa_itab.
loop at itab into wa_itab where date = wa_itab1-date
name = ' '.
if wa_itab-state is not initial.
wa_itab2-state = wa_itab-state.
endif.
if wa_itab-country is not initial.
wa_itab2-country = wa_itab-country.
endif.
endloop.
wa_itab2-name = wa_itab1-name.
wa_itab2-date = wa_itab1-date.
wa_itab2-sl_no = wa_itab1-sl_no.
append wa_itab2 to itab2.
endloop.
And in the internal table itab2 , u will have the required output.
Keerthi. -
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 -
OO ALV displaying without Values despite Internal table contains
My below OO ALV displaying without Values despite Internal table contains the values ...
Help please ...
REPORT zsd_concession1 NO STANDARD PAGE HEADING
LINE-SIZE 285
LINE-COUNT 64
MESSAGE-ID zz.
Program Description ******************************
This report is to Calculate consession against Quotations
complying standards for enhanced Performance, Readability &
Maintenance.
Change Log *********************************
Remedy # / Who When Why / What
Transport #
CLASS lcl_event_handler DEFINITION DEFERRED.
*& Data Definitions .
DATA: BEGIN OF vbap_wa,
vbeln TYPE vbak-vbeln, "Quotation#
erdat TYPE vbak-erdat, "Quot date
knumv TYPE vbak-knumv, "Cond Rec#
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF vbap_wa,
BEGIN OF konv_wa,
knumv TYPE konv-knumv, "Cond#
kposn TYPE konv-kposn, "Cond Item#
kappl TYPE konv-kappl, "Applic
kschl TYPE konv-kschl, "Cond Typ
kbetr TYPE konv-kbetr, "Price ZBP1,ZNAA,ZNAX
END OF konv_wa,
BEGIN OF vbpa_wa,
vbeln TYPE vbpa-vbeln, "Quot#
posnr TYPE vbpa-posnr, "Item#
parvw TYPE vbpa-parvw, "Prt Fn
kunnr TYPE vbpa-kunnr, "Cust#
END OF vbpa_wa,
BEGIN OF result_wa,
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF result_wa.
DATA: ikonv LIKE STANDARD TABLE OF konv_wa,
ivbap LIKE STANDARD TABLE OF vbap_wa,
ivbpa LIKE STANDARD TABLE OF vbpa_wa,
iresult LIKE STANDARD TABLE OF result_wa.
*Work storage
DATA: BEGIN OF ws,
vbeln TYPE vbak-vbeln,
ok_code TYPE sy-ucomm,
alv_save TYPE c, "ALV save
alv_variant TYPE disvariant, "ALV Variant
alv_sort TYPE lvc_t_sort, "Sort table
END OF ws.
*Data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
l_smenu TYPE REF TO cl_ctmenu,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
e_dclick TYPE REF TO lcl_event_handler.
*Data declarations for ALV Interactive list
DATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
*Field-Symbols
FIELD-SYMBOLS:
<konv> LIKE konv_wa,
<vbap> LIKE vbap_wa.
*Constants
CONSTANTS:
c_end_row TYPE i VALUE 65000.
*CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
*CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: sec_wa LIKE LINE OF iresult.
*Reading the selected data into a variable
READ TABLE iresult INDEX e_row-index INTO sec_wa.
*Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*Calling the ALV containing the field values
CALL SCREEN 101.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vbeln FOR ws-vbeln DEFAULT '2002354788' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
PERFORM setup_screen_defaults.
START-OF-SELECTION.
PERFORM gather_report_data.
END-OF-SELECTION.
PERFORM create_output.
*& Form initialization
FORM setup_screen_defaults.
CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
REFRESH: ivbpa, ikonv, ivbap, iresult.
ENDFORM. " setup_screen_defaults
*& Form gather_report_data
FORM gather_report_data.
SELECT vbeln posnr parvw kunnr
INTO TABLE ivbpa
FROM vbpa
WHERE vbeln IN s_vbeln
AND ( parvw = 'SP' OR "SoldTO
parvw = 'WE' OR "ShipTo
parvw = 'ZT' ). "Top Parent
SELECT vkvbeln vkerdat vkknumv vpposnr vp~matnr
z1zansicat z1zansigrd z2~zcurrvaltnarea
z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
m1mstav vpkwmeng vp~netpr
INTO CORRESPONDING FIELDS OF TABLE ivbap
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vpvbeln = vkvbeln
INNER JOIN zmarall AS z1
ON z1matnr = vpmatnr
INNER JOIN zco002 AS z2
ON z2matnr = vpmatnr
INNER JOIN zglbprc AS zg
ON zgmatnr = vpmatnr
INNER JOIN mara AS m1
ON m1matnr = vpmatnr
WHERE vk~vbeln IN s_vbeln
AND vk~auart = 'AG'."AG = Quot
SORT ivbap BY posnr matnr.
SELECT kvknumv kvkposn kvkappl kvkschl kv~kbetr
INTO TABLE ikonv
FROM konv AS kv
FOR ALL ENTRIES IN ivbap
WHERE kv~knumv = ivbap-knumv
AND kv~kposn = ivbap-posnr
AND kv~kappl EQ 'V'
AND ( kv~kschl EQ 'ZBP1'
OR kv~kschl EQ 'ZNAX'
OR kv~kschl EQ 'ZNAA' ).
SORT ikonv BY knumv kposn.
LOOP AT ivbap ASSIGNING <vbap>.
CLEAR konv_wa.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZBP1'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-lprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAX'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAA'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
ENDLOOP.
SORT ivbap BY posnr matnr.
LOOP AT ivbap INTO vbap_wa.
MOVE-CORRESPONDING vbap_wa TO result_wa.
APPEND result_wa TO iresult.
CLEAR: vbap_wa, result_wa.
ENDLOOP.
ENDFORM. " gather_report_data
*& Form create_output
FORM create_output.
CALL SCREEN 100.
FREE: iresult.
ENDFORM. " create_output
*& Module PBO_0100 OUTPUT
text
MODULE pbo_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF c_cont1 IS INITIAL.
*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT1'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Alv layout
PERFORM alv_100_layout.
PERFORM save_alv_layout.
*Alv field catalogue
PERFORM alv_100_fieldcat.
*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
i_save = ws-alv_save
is_variant = ws-alv_variant
CHANGING
it_outtab = iresult[]
it_sort = ws-alv_sort
it_fieldcatalog = it_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Create object of the event class
*and setting handler for double click
CREATE OBJECT e_dclick.
SET HANDLER e_dclick->handle_double_click FOR c_alv1.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*& Module PAI_0100 INPUT
text
MODULE pai_0100 INPUT.
ws-ok_code = sy-ucomm.
CASE ws-ok_code.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
CLEAR ws-ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*& Form alv_100_layout
text
--> p1 text
<-- p2 text
FORM alv_100_layout.
ty_lay1-numc_total = 'X'. " Numc total line
ty_lay1-cwidth_opt = 'X'. " Optimal column width
ty_lay1-detailinit = 'X'. " Show values that are initial in
ty_lay1-sel_mode = 'A'. " Column selection mode
ty_lay1-no_merging = 'X'. " No merging while sorting columns
ty_lay1-keyhot = 'X'.
ty_lay1-grid_title = 'SD Concessions'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = ' '.
ENDFORM. " alv_100_layout
*& Form alv_100_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'zcurrcstusd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Cost $'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 7.
ty_fieldcat-fieldname = 'zzbrndnm'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Brand'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 8.
ty_fieldcat-fieldname = 'zqedscgrp'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'QE'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'mstav'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Status'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'kwmeng'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Qty'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 10.
ty_fieldcat-fieldname = 'lprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'List Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 11.
ty_fieldcat-fieldname = 'sprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Discount'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 12.
ty_fieldcat-fieldname = 'netpr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Quot Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 13.
ty_fieldcat-fieldname = 'mrgn'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Margin%'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_100_fieldcat
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.
*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CCONT2'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ALV layout
PERFORM alv_101_layout.
*ALV fieldcatalogue
PERFORM alv_101_fieldcat.
*Sorting the output by field position
SORT iresult BY posnr.
*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = iresult[]
it_fieldcatalog = it_fieldcat.
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.
ENDMODULE. " PBO_0101 OUTPUT
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
ENDMODULE. " PAI_0101 INPUT
*& Form alv_101_layout
text
--> p1 text
<-- p2 text
FORM alv_101_layout.
ty_lay2-grid_title = 'Line Details'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.
ENDFORM. " alv_101_layout
*& Form alv_101_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat.
REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_101_fieldcat
*& Form save_alv_layout
text
--> p1 text
<-- p2 text
form save_alv_layout.
ws-alv_save = 'A'.
ws-alv_variant-report = sy-repid.
endform. " save_alv_layoutHello
Creating fieldcatalogs manually is one of the major error sources in ALV programming.
There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
Regards
Uwe -
I am new to the bdc .
i have gone to SHDB and created a new recording for the some T-code .
After that i have created a prog (transfer from recording ) .
i got some values in the file in my presenation server.
i got default code generated .
I have to declare the internal table of some time .
may i know of which type should i declare my internal table ??
My code ****************************************************************
report ZRAJESH_BDC
no standard page heading line-size 255.
include bdcrecx1.
start-of-selection.
perform open_group.
*******loop
perform bdc_dynpro using 'SAPMF02K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-D0110'.
perform bdc_field using 'RF02K-LIFNR'
'12345'.
perform bdc_field using 'RF02K-D0110'
'X'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELF2'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-ANRED'
'Mr.'.
perform bdc_field using 'LFA1-NAME1'
'RAJESH'.
perform bdc_field using 'LFA1-SORTL'
'Q'.
perform bdc_field using 'LFA1-LAND1'
'US'.
perform bdc_field using 'LFA1-SPRAS'
'EN'.
perform bdc_field using 'LFA1-TELF2'
'9033558227'.
perform bdc_transaction using 'XK02'.
perform close_group.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.Hi,
I have one simple BDC Program .
Just you have to do recording by using SHDB Transaction Code.
and Copy that program and do some modification by following my Program and upload data to that perticular transaction.
before that u have to prepare data in Text file by using TAB Space .
Below is the Code(I have used MM01 transaction)
******************************************************************************************8
report ZBDCTEST no standard page heading line-size 255.
***DECLARING TABLES.
TABLES : MARA.
**DECLARING INTERNAL TABLE.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
Maktx like makt-maktx,
SPART LIKE MARA-SPART,
END OF ITAB.
DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = 'C:\TEST.TXT'
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
LOOP AT ITAB.
REFRESH BDCDATA.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1_REF-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
ITAB-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
'M'.
perform bdc_field using 'RMMG1-MTART'
'FOOD'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP02'.
perform bdc_field using 'MAKT-MAKTX'
'T1003'.
perform bdc_field using 'BDC_CURSOR'
'MARA-MATKL'.
perform bdc_field using 'MARA-MEINS'
'BOX'.
perform bdc_field using 'MARA-MATKL'
ITAB-MATKL.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
'T1003'.
*perform bdc_transaction using 'MM01'.
*perform close_group.
CALL TRANSACTION 'MM01' USING BDCDATA MODE 'A'. "A= all screens ,N= no screens
ENDLOOP.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> SPACE.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.
if you want further help let me know
Regards,
Jak -
ALV grid is not displaying few fields of final internal table of type DMBTR
hello frnds,
i am displaying 10 fields in ALV grid using field catalog.
among them five fields are currency fields on which i doing some arithematic operations. but all these fields are not getting displayed in alv grid.
here is my code....
declaring final strucutre to generate report
TYPES:BEGIN OF ty_final,
gjahr TYPE gjahr, " Year
wwert TYPE wwert_d, " Traslation date
bukrs TYPE bukrs, " company code
hkont TYPE hkont, " General ledger account
txt20 TYPE txt20_skat, " Account name
belnr TYPE belnr_d, " Purchase order number
shkzg TYPE shkzg, " Dt/Cr indicator
dmbtr1 TYPE dmbtr, " Ammount in local currency
v_alc TYPE dmbtr, " Ammount in local currency
wrbtr TYPE wrbtr, " Ammount in foreign currency
ebeln TYPE ebeln, " Purchase order number
ebelp TYPE ebelp, " Item number
matnr TYPE matnr, " Material number
menge TYPE menge_d, " Qunatity
meins TYPE meins, " Unit of measure
stprs TYPE stprs, " Std material master
v_iv TYPE dmbtr, " Invoice value
pswsl TYPE pswsl, " Currency
v_erc TYPE dmbtr, " Exchange rate calculated
v_op TYPE dmbtr, " Order price
v_uos TYPE dmbtr, " Unit order to stock
v_io TYPE dmbtr, " Invoice to order
v_uv TYPE dmbtr, " Unit value
v_t TYPE dmbtr, " Total
v_d TYPE dmbtr, " Differecne
netpr TYPE bprei, " Net price in purchasing document
v_total TYPE dmbtr, " Total
v_os TYPE dmbtr, " Order to stock
v_ito TYPE dmbtr, " Invoice to order
saknr TYPE saknr, " G/L account number
END OF ty_final.
FORM move_data.
IF NOT i_bseg[] IS INITIAL.
LOOP AT i_bseg INTO wa_bseg.
wa_final-gjahr = wa_bseg-gjahr.
wa_final-bukrs = wa_bseg-bukrs.
wa_final-hkont = wa_bseg-hkont.
wa_final-belnr = wa_bseg-belnr.
wa_final-shkzg = wa_bseg-shkzg.
wa_final-wrbtr = wa_bseg-wrbtr.
wa_final-ebeln = wa_bseg-ebeln.
wa_final-ebelp = wa_bseg-ebelp.
wa_final-matnr = wa_bseg-matnr.
wa_final-menge = wa_bseg-menge.
wa_final-meins = wa_bseg-meins.
wa_final-pswsl = wa_bseg-pswsl.
wa_final-dmbtr1 = wa_bseg-dmbtr.
wa_final-saknr = wa_bseg-saknr.
wa_final-v_total = wa_bseg-dmbtr.
READ TABLE i_bkpf INTO wa_bkpf WITH KEY bukrs = wa_bseg-bukrs.
IF sy-subrc = 0.
wa_final-wwert = wa_bkpf-wwert.
ENDIF.
CLEAR wa_bkpf.
READ TABLE i_mbew INTO wa_mbew WITH KEY matnr = wa_bseg-matnr.
IF sy-subrc = 0.
wa_final-stprs = wa_mbew-stprs.
ENDIF.
CLEAR wa_mbew.
READ TABLE i_ekpo INTO wa_ekpo WITH KEY ebeln = wa_bseg-ebeln.
IF sy-subrc = 0.
wa_final-netpr = wa_ekpo-netpr.
ENDIF.
CLEAR wa_ekpo.
READ TABLE i_skat INTO wa_skat WITH KEY saknr = wa_bseg-saknr.
IF sy-subrc = 0.
wa_final-txt20 = wa_skat-txt20.
ENDIF.
calculating output values
IF wa_bseg-shkzg = 'H'.
wa_final-v_alc = -1 * wa_bseg-dmbtr.
ELSEIF wa_bseg-shkzg = 'S'.
wa_final-v_alc = 1 * wa_bseg-dmbtr.
ENDIF.
DATA : l_c_v_alc TYPE p DECIMALS 2,
l_c_v_iv TYPE p DECIMALS 2.
l_c_v_alc = wa_final-v_alc.
IF wa_bseg-menge NE 0.
wa_final-v_iv = wa_bseg-dmbtr / wa_bseg-menge.
ENDIF.
IF wa_bseg-dmbtr NE 0.
wa_final-v_erc = wa_bseg-wrbtr / wa_final-dmbtr1.
ENDIF.
IF wa_final-v_erc NE 0.
wa_final-v_op = wa_ekpo-netpr / wa_final-v_erc.
ENDIF.
wa_final-v_uos = wa_mbew-stprs - wa_final-v_op.
wa_final-v_io = wa_final-v_iv + wa_final-v_uos.
wa_final-v_uv = wa_final-v_uos + wa_final-v_io.
wa_final-v_t = wa_final-v_uv + wa_bseg-menge.
wa_final-v_d = wa_final-v_t - wa_final-v_alc.
wa_final-v_os = wa_final-v_uos * wa_bseg-menge.
wa_final-v_ito = wa_final-v_io * wa_bseg-menge.
CLEAR wa_bseg.
APPEND wa_final TO i_final.
CLEAR wa_final.
ENDLOOP.
ENDIF.
ENDFORM. "data_retrieval
*& Form build_fieldcat
text
--> p1 text
<-- p2 text
FORM build_fieldcat.
CLEAR wa_fieldcat.
* TYPES : v_alc TYPE dmbtr. "curr. " decimal 2.
DATA: l_c_v_alc TYPE p DECIMALS 2,
l_c_v_iv TYPE p DECIMALS 2 .
l_c_v_alc = v_alc.
l_c_v_iv = v_iv.
Constant Declarations.
CONSTANTS:
l_c_gjahr(5) TYPE c VALUE 'GJAHR', " Year
l_c_wwert(5) TYPE c VALUE 'WWERT', " Traslation date
l_c_bukrs(5) TYPE c VALUE 'BUKRS', " company code
l_c_hkont(5) TYPE c VALUE 'HKONT', " General ledger account
l_c_txt20(10) TYPE c VALUE 'TXT20', " Account name
l_c_belnr(5) TYPE c VALUE 'BELNR', " Doc number
l_c_shkzg(5) TYPE c VALUE 'SHKZG', " Dt/Cr indicator
l_c_dmbtr(5) TYPE c VALUE 'DMBTR1', " Ammount in local currency
" l_c_v_alc TYPE c VALUE 'V_ALC', " Ammount in local currency
l_c_wrbtr(5) TYPE c VALUE 'WRBTR', " Ammount in foreign currency
l_c_ebeln(5) TYPE c VALUE 'EBELN', " Purchase order number
l_c_ebelp(5) TYPE c VALUE 'EBELP', " Item number
l_c_matnr(5) TYPE c VALUE 'MATNR', " Material number
l_c_menge(7) TYPE c VALUE 'MENGE', " Qunatity
l_c_meins(5) TYPE c VALUE 'MEINS', " Unit of measure
l_c_stprs(5) TYPE c VALUE 'STPRS', " Std material master
" l_c_v_iv(4) TYPE c VALUE 'V_IV', " Invoice value
l_c_pswsl(5) TYPE c VALUE 'PSWSL', " Currency
l_c_v_erc(5) TYPE c VALUE 'V_ERC', " Exchange rate calculated
l_c_v_op(4) TYPE c VALUE 'V_OP', " Order price
l_c_v_uos(5) TYPE c VALUE 'V_UOS', " Unit order to stock
l_c_v_io(4) TYPE c VALUE 'V_IO', " Invoice to order
l_c_v_uv(4) TYPE c VALUE 'V_UV', " Unit value
l_c_v_t(3) TYPE c VALUE 'V_T', " Total
l_c_v_d(3) TYPE c VALUE 'V_D', " Differecne
l_c_netpr(5) TYPE c VALUE 'NETPR', " Net price in purchasing document
l_c_v_total(7) TYPE c VALUE 'V_TOTAL', " Total
l_c_v_os(4) TYPE c VALUE 'V_OS', " Order to stock
l_c_v_ito(5) TYPE c VALUE 'V_ITO', " Invoice to order
l_c_saknr(5) TYPE c VALUE 'SAKNR', " G/L account number
l_c_i_final(7) TYPE c VALUE 'I_FINAL'. " Final internal table
Fieldcat for fiscal year
wa_fieldcat-col_pos = 1.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_gjahr.
wa_fieldcat-seltext_m = text-007.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Translation date
wa_fieldcat-col_pos = 2.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_wwert.
wa_fieldcat-seltext_m = text-008.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Company code
wa_fieldcat-col_pos = 3.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_bukrs.
wa_fieldcat-seltext_m = text-009.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for General ledger account
wa_fieldcat-col_pos = 4.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_hkont.
wa_fieldcat-seltext_m = text-010.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Account name
wa_fieldcat-col_pos = 5.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_txt20.
wa_fieldcat-seltext_m = text-011.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Doc number
wa_fieldcat-col_pos = 6.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_belnr.
wa_fieldcat-seltext_m = text-012.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Dt/Cr indicator
wa_fieldcat-col_pos = 7.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_shkzg.
wa_fieldcat-seltext_m = text-013.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Ammount in local currency
wa_fieldcat-col_pos = 8.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'DMBTR1'.
wa_fieldcat-seltext_m = text-014.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Ammount in local currency
wa_fieldcat-col_pos = 9.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'V_ALC'.
wa_fieldcat-seltext_m = text-015.
wa_fieldcat-ref_fieldname = 'DMBTR'.
wa_fieldcat-no_sign = 'X'.
wa_fieldcat-do_sum = c_x.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Ammount in foreign currency
wa_fieldcat-col_pos = 10.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_wrbtr.
wa_fieldcat-seltext_m = text-016.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Purchse order number
wa_fieldcat-col_pos = 11.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_ebeln.
wa_fieldcat-seltext_m = text-017.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Item No
wa_fieldcat-col_pos = 12.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_ebelp.
wa_fieldcat-seltext_m = text-018.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Material number
wa_fieldcat-col_pos = 13.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_matnr.
wa_fieldcat-seltext_m = text-019.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Qunatity
wa_fieldcat-col_pos = 14.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_menge.
wa_fieldcat-seltext_m = text-020.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Unit of measure
wa_fieldcat-col_pos = 15.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_meins.
wa_fieldcat-seltext_m = text-021.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Std material master
wa_fieldcat-col_pos = 16.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_stprs.
wa_fieldcat-seltext_m = text-022.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Invoice value,
wa_fieldcat-col_pos = 17.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'V_IV'.
wa_fieldcat-seltext_m = text-023.
wa_fieldcat-ref_fieldname = 'DMBTR'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Currency
wa_fieldcat-col_pos = 18.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_pswsl.
wa_fieldcat-seltext_m = text-024.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Exchange rate calculated
wa_fieldcat-col_pos = 19.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = 'V_ERC'.
wa_fieldcat-seltext_m = text-025.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Order price
wa_fieldcat-col_pos = 20.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_op.
wa_fieldcat-seltext_m = text-026.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Unit order to stock
wa_fieldcat-col_pos = 21.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_uos.
wa_fieldcat-seltext_m = text-027.
wa_fieldcat-do_sum = c_x.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Invoice to order
wa_fieldcat-col_pos = 22.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_io.
wa_fieldcat-seltext_m = text-028.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Unit value
wa_fieldcat-col_pos = 23.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_uv.
wa_fieldcat-seltext_m = text-029.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Total
wa_fieldcat-col_pos = 24.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_t.
wa_fieldcat-seltext_m = text-030.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Difference
wa_fieldcat-col_pos = 25.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_d.
wa_fieldcat-seltext_m = text-031.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Net Price in Purchasing Document
wa_fieldcat-col_pos = 26.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_netpr.
wa_fieldcat-seltext_m = text-032.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Total
wa_fieldcat-col_pos = 27.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_total.
wa_fieldcat-seltext_m = text-033.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Order to stock
wa_fieldcat-col_pos = 28.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_os.
wa_fieldcat-seltext_m = text-034.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Fieldcat for Invoice to order
wa_fieldcat-col_pos = 29.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_v_ito.
wa_fieldcat-seltext_m = text-035.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
fieldcat for invoice to order
wa_fieldcat-col_pos = 30.
wa_fieldcat-tabname = l_c_i_final.
wa_fieldcat-fieldname = l_c_saknr.
wa_fieldcat-seltext_m = text-035.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "build_fieldcatHi romanch,
defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
<alv_fieldcat>-cfieldname = 'HWAER'.
This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
Regards,
Clemens -
How to get selected records from an ALV Grid in some other internal table
I am using a standard SAP program (RFKKMA02) in a Z program. Now i want to select some rows in ALV and after doing some modification, i want to store those records in some other internal table. I am not using OO concept.
Thanks in advance.u create first internal table of structur of fields that u want to copy and then move taht values to internal table
-
ALV GRID Report is not showing all records which is in internal table
hi all,
have one doubt. please clarify me. ALV Report is working fine since long tiem. But suddenly this report is showing few records only for the given input. Example: it_main table have 50 records, but output is showing only 10 records only. (we have not made any modifications in this report).
temporarily i have given excel output file from it_main table. excel file is showing all records.
here it_main have all the records. but output is showing few records only. it is not showing any error. i have tested with REUSE_ALV_LIST_DISPLAY function also. but it also showing same results(few records only.)
please give me some idea.
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fcat
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
Best Regards,
Srinivashi
Please study this program and give me suggestions.
ALV Declaration
DATA : it_events TYPE slis_t_event, "ALV event
it_fcat TYPE slis_t_fieldcat_alv, "Field catalog
it_list_top_of_page TYPE slis_t_listheader,
c_tabname TYPE slis_tabname VALUE 'IT_MAIN'.
DATA : wa_layout TYPE slis_layout_alv,
wa_event TYPE slis_alv_event,
wa_fcat TYPE slis_fieldcat_alv,
wa_variant TYPE disvariant.
START-OF-SELECTION.
PERFORM material_pass.
PERFORM data_retrieval.
END-OF-SELECTION.
PERFORM sub_display_report.
FORM sub_display_report .
DATA status(1).
IF r1 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'SIZE2' 'SIZE2' '' '10' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mains
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ELSEIF r2 = 'X' OR r3 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'CUT1' 'CUT1' '' '11' '',
'22' 'SIZE2' 'SIZE2' '' '10' '',
'23' 'CUT2' 'CUT2' '' '11' '',
'24' 'SIZE3' 'SIZE3' '' '10' '',
'25' 'CUT3' 'CUT3' '' '11' '',
'26' 'SIZE4' 'SIZE4' '' '10' '',
'27' 'CUT4' 'CUT4' '' '11' '',
'28' 'SIZE5' 'SIZE5' '' '10' '',
'29' 'CUT5' 'CUT5' '' '11' '',
'30' 'SIZE6' 'SIZE6' '' '10' '',
'31' 'CUT6' 'CUT6' '' '11' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mainall
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ENDIF.
PERFORM build_layout.
PERFORM build_events.
PERFORM sub_comment_build USING it_list_top_of_page.
PERFORM sub_set_variant.
PERFORM display_alv_report.
IF status = 'S'.
MESSAGE 'Excel Output file Downloaded to Given Path' TYPE 'I'.
ELSE.
MESSAGE 'Download Not Possible' TYPE 'I'.
ENDIF.
ENDFORM. " SUB_DISPLAY_REPORT
FORM BUILD_FIELDCATALOG
FORM build_fieldcatalog USING p_col_pos
p_fieldname
p_text
p_datatype
p_outputlen
p_col_freez.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fieldname.
wa_fcat-tabname = c_tabname.
wa_fcat-reptext_ddic = p_text.
wa_fcat-datatype = p_datatype.
wa_fcat-ddic_outputlen = p_outputlen.
wa_fcat-key = p_col_freez.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
FORM build_layout.
CLEAR: wa_layout.
wa_layout-window_titlebar = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-totals_text = 'CUMULATIVE'.
ENDFORM. "BUILD_LAYOUT
*& Form BUILD_EVENTS
FORM build_events.
CLEAR wa_event.
REFRESH it_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE it_events INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
APPEND wa_event TO it_events.
CLEAR wa_event.
ENDIF.
ENDIF.
ENDFORM. "BUILD_EVENTS
-->P_IT_LIST_TOP_OF_PAGE text
FORM sub_comment_build USING it_top_of_page TYPE slis_t_listheader.
DATA ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = str1.
APPEND ls_line TO it_top_of_page.
CLEAR ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. " SUB_COMMENT_BUILD
*& Form SUB_SET_VARIANT
text
--> p1 text
<-- p2 text
FORM sub_set_variant .
CLEAR wa_variant.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = c_variant.
wa_variant-variant = p_layout.
ENDFORM. " SUB_SET_VARIANT
*& Form DISPLAY_ALV_REPORT
*Display Report Using ALV GRID
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort[]
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
*ALV Report Header
FORM top_of_page.
DATA : t_header TYPE slis_t_listheader WITH HEADER LINE,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
T_HEADER-INFO = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_header-info = str1.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. "TOP_OF_PAGE
here it_main internal table having all data. but output is showing few records only.
pl. give some idea.
Thanks & Regards
Srinivas. -
Importing internal table data from FM to eCATT test script
Hi all,
I am working on Workflow project where by i need to post invoices related to purchase orders sent as scanned imaages. Incase all the data in the incoming invoice(scanned) is correct then i am using BAPI_INCOMING_INVOICE_CREATE to post the invoice.
But when the data is wrong, i need to give the user MIRO transaction pre-populated with the invoice details so that he manually corrects them(after verification) and posts the invoice.
I understand MIRO is an ENJOY transaction hence BDC doesn't work properly(i have tried with all kinds of options on recording and the problem comes incase of multiple POs) hence i choose to use eCATT.
The recording worksfine but my real problem is the PO data (multiple PO details for same invoice) is in table form. In all my previous objects related to eCATT we used to upload the file, hence no problem of importing tables.
But now as i'll call this test script from a function module which has all the POs in the form of internal table, i need to import this into my test script.
Please any body tell me how to proceed in this case or please suggest me a better a way to record the MIRO.
Thank you,
Lakshmi Narayana.SHello Raj,
First of all thank you for your inputs.
Yes, I know about Parking an invoice. even i am using it in some scenarios.
If everything on the invoice matches with the values in SAP then i am posting it using BAPI invoice_create also.
But for some scenarios like if the PO on the invoice doesnot match with actual PO then i need to create a work item in the Accounts Payable user's inbox and he will change invoice data manually (after getting confirmation and correction) and post it using MIRO.
Here i need to pre-populate the MIRO with the invoice data so that he can correct and post it.
Hence i was trying to write a BDC and as MIRO is an Enjoy transaction i thought writing a BDC is not a good idea (i tried writing BDC but had problems) hence i am using eCATT.
Hope i am clear about my problem. Any inputs to solve this are welcome.
Thanks,
Lakshmi Narayana.S -
Customer exit variable - internal table in BEX
Hi,
i am running a report and using variables in it.
The report runs over a info cube. There are few challenges in it.
One of the variable is posting date, and when user enters posting date i need to negate it with current system date.
If the negated value is greater than 28 then i need to exclude documnet type 'YG' and display the query, else i need to include the dcumnet type 'YG' and document type ' '. The above logic can be well implemented via a customer exit variable(for posting date) using an internal table. We have internal tables like C_T_DATA which is used in data source enhancement, which help us to implement our own desired logic.
Do we have such kind of internal tables, based on which the report output (result set) is derived?
i know that we have l_t_range and e_t_range, but dont know their usage, some one can explain in detail about them?
Thanks in advance.Hi Selva & Lakshmin,
The code given by Selva is almost correct . If my understanding is clear , you also wanted to include document type ' ' when the negated value is less than 28 .
Modification in Selvas Code :
Variable 'V_DOCTYP' must be of type Multiple Single Values.
DATA : V_DATE LIKE SY-DATUM.
DATA : V_DAYS TYPE I.
if i_step = 2.
when 'V_DOCTYP'.
READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZV_PDATE''.
IF SY-SUBRC = 0.
V_DATE = loc_var_range-low.
ENDIF.
V_DAYS = SY-DATUM - V_DATE.
IF V_DAYS > 28.
l_s_range-low = 'YG'
l_s_range-sign = 'E'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ELSE.
l_s_range-low = 'YG'
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
clear l_s_range.
l_s_range-low = ' '.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.
Hope the above reply was helpful.
Kind Regards,
Ashutosh Singh -
Getting Issue while uploading CSV file into internal table
Hi,
CSV file Data format as below
a b c d e f
2.01E14 29-Sep-08 13:44:19 2.01E14 SELL T+1
actual values of column A is 201000000000000
and columen D is 201000000035690
I am uploading above said CSV file into internal table using
the below coding:
TYPES: BEGIN OF TY_INTERN.
INCLUDE STRUCTURE KCDE_CELLS.
TYPES: END OF TY_INTERN.
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
EXPORTING
I_FILENAME = P_FILE
I_SEPARATOR = ','
TABLES
E_INTERN = T_INTERN
EXCEPTIONS
UPLOAD_CSV = 1
UPLOAD_FILETYPE = 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.
am getting all columns data into internal table,
getting problem is columan A & D. am getting values into internal table for both; 2.01E+14. How to get actual values without modifying the csv file format.
waiting for your reply...
thanks & regards,
abhiHi Saurabh,
Thanks for your reply.
even i can't double click on those columns.
b'se the program needs be executed in background there can lot of csv file in one folder. No manual interaction on those csv files.
regards,
abhi
Maybe you are looking for
-
I have two versions of Pr, one is the latest 2014 and when trying to open a Pr2014 session, I get an error message saying the project was saved in a newer version and cannot be opened. Could there be an issue with an older Pr application on the compu
-
Video quality poor including titles
I purchased this product to try something different. I normally use another video editor. I love everything about the program except when it burns to DVD. When I burn it, the quality is horrible. And I've read the other forums regarding the size/reso
-
Redhat 6.2 / Oracle 8.1.6
I'm making a clean install of Oracle 8.1.6 (no previous Oracle, no ora* files in /etc) and having a problem I can't get around whenever I execute /mnt/cdrom/install/linux/runIstaller, I get the error message: "The Java RunTime Environment was not fou
-
Health care professional needs help
All I want to do is print out my calendar. Can anyone help? I don't have a computer, however I have access to one. I still have the cdrom and usb cable that came w/the Z22. Thanks... Post relates to: Palm Z22
-
Joining / Merging csv files into one
Hi, is there a way to join or merger a bunch of csv files into one file? regards Martin