Why is the returned internal table contains same values?
Hi all,
I got a bapi that returned an internal table type MARC.
For testing in R/3, the internal table returns 3 material no. with different values,
but in vb.net, it returns 3 entries with same values,
(I've passed the internal table as ByRef in the vb)
what's wrong are there?
Thanks.
Please post your test code.
Similar Messages
-
Get the Common from Two Internal Tables with same structure
Hi ,
I need to get the Common data from Two Internal Tables with same structure with using the looping method.
For e.g.
I have two internal table say ITAB1 and ITAB2.
ITAB1 has values A,B,C,D,E,F
ITAB2 has values A,H,B,Y,O
Output at runtime should be : A,BHi mohit,
1. If u want to compare all fields,
for matching purpose,
then we can do like this.
2.
report abc.
data : a like t001 occurs 0 with header line.
data : b like t001 occurs 0 with header line.
loop at a.
LOOP AT B.
IF A = B.
WRITE :/ 'SAME'.
ENDIF.
endloop.
ENDLOOP.
regards,
amit m. -
how to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method. thanks
INSERT targetdb.dbo.tbl (col1, col2, col3, ...)
SELECT col1, col2, col3, ...
FROM sourcedb.dbo.tbl
Or what is your question really about? Since you talke about foreign keys etc, I suspect that you want to transfer the entire table definition, but you cannot do that with an INSERT statement.
Erland Sommarskog, SQL Server MVP, [email protected] -
Why using workarea for internal table is better in performance
Please tell me
why using workarea for internal table is better in performanceHi Vineet ,
Why would we choose to use an internal table without a header line when it is easier to code one with a header line?
it has following reason.
1)Separate Internal Table Work Area:
The work area (staging area) defined for the internal table is not limited to use with just one internal table.
take ex-
Suppose you want two internal tables for EMPLOYEE one to contain all records and one to contain only those records where country = USA. You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table. You would conditionally append the USA records from the same work area into the second internal table.
2) Performance Issues: Using an internal table without a header line is more efficient than one with a header line
3) Nested Internal Tables: If you want to include an internal table within a structure or another internal table, you must use one without a header line.
If this one is helpful ,then rewards me
Regards
Shambhu -
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 -
Problem in modifying the main internal table gt_data
Hello i have written code for modifying the main internal table. i have read data from ausp table and put into the internal table gt_ausp. now i want to modify my main table GT-DATA with gt_ausp. i am not able to do this.
LOOP AT gt_data INTO ls_list.
lt_temp-objek = ls_list-matnr.
APPEND lt_temp. " 특성값 발췌용도로 저장
APPEND ls_list TO lt_work. " 핵심작업용도로 저장
ENDLOOP.
DESCRIBE TABLE lt_temp.
IF sy-tfill EQ 0.
pv_flg = 'X'.
EXIT.
ENDIF.
Get 제품인증(플랜트별).....
DESCRIBE TABLE lt_cetino_tp.
플랜트 자재번호
카타로그-인증 코드그룹-인증 인증코드
Certi. No.
Get 자재별 특성값..........
오브젝트 특성이름 내부특성 내부카운터 특성값
SELECT aobjek batnam aatinn aatzhl a~atwrt
INTO CORRESPONDING FIELDS OF TABLE lt_ausp_tp
FROM ausp AS a INNER JOIN cabn AS b
ON aatinn = batinn
FOR ALL ENTRIES IN lt_temp
WHERE a~objek EQ lt_temp-objek " 오브젝트키(자재번호)
AND a~klart EQ '001' " 클래스유형
AND a~atzhl EQ '001' " 특성값카운터(최종건만 존재)
자재특성 변경시 변경됨
AND b~adzhl EQ '0000'.
IF sy-subrc EQ 0.
DELETE ADJACENT DUPLICATES FROM lt_ausp_tp.
lt_ausp[] = lt_ausp_tp[].
lt_ausp_tp2[] = lt_ausp_tp[].
DELETE ADJACENT DUPLICATES FROM lt_ausp_tp2.
Get 특성내역
내부특성 " 내부카운터
특성값 특성값내역
SELECT aatinn " aatzhl
aatwrt batwtb
INTO CORRESPONDING FIELDS OF TABLE lt_cawn
FROM cawn AS a INNER JOIN cawnt AS b
ON aatinn = batinn AND
aatzhl = batzhl AND
aadzhl = badzhl
FOR ALL ENTRIES IN lt_ausp_tp2
WHERE a~atinn EQ lt_ausp_tp2-atinn " 내부특성
AND b~spras EQ sy-langu.
ENDIF.
SORT lt_work BY matnr .
BREAK-POINT.
LOOP AT lt_work INTO ls_list.
특성내역
READ TABLE lt_ausp WITH TABLE KEY objek = ls_list-matnr
atnam = 'SECTION_WIDTH'.
수출자재가 아닌 것은 제외
LS_LIST-SECTION_WIDTH = LT_AUSP-ATWRT.
MODIFY TABLE GT_DATA FROM LS_LIST TRANSPORTING SECTION_WIDTH.Hi,
Question before: why dont you just use the std.API for reading the classification data?
e.g. "BAPI_OBJCL_GETDETAIL"
Second: a DELETE DELETE ADJACENT DUPLICATES works only only sorted tables.
Doing this after a select will only succeed randomly depending on the buffers of your data based below.
( 90% chance if it is an oracle system)
To your question:
Just replace your LOOP AT gt_data into ls_list
by a LOOP AT gt_data ASSIGNING <current_list_record>.
then you can access the fields directly:
<current_list_record>-SECTION_WIDTH = LT_AUSP-ATWRT.
Cause of your issue:
"MODIFY" needs a key to to find the record to be updated.
If your gt_data ist referencing a DDIC table type with a key or a local type with a key
it has no chance to do it.
Hope that helps.
br, -
It cannot reference the dynamic internal table in memory as an object.
Hi,
I am getting the syntax error in the second select. I guest it cannot reference the dynamic internal table in memory as an object.
The internal table contains different fields from multiple tables and it gets created OK. Then the first select within the loop executes OK allowing me to read the multiple tables in ITABLES.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
IMPORTING
ep_table = dy_table.
***OK, the dynamic tables is created here
assign dy_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
loop at ITABLES.
***OK, no syntax errors in this select here
select * appending corresponding fields of table <dyn_table>
from (ITABLES-TABNAME).
endloop.
data: ikonp like konp occurs 0 with header line.
***NOT OK, there is syntax errors
select * into table ikonp
from KONP for all entries in <dyn_table>
where knumh = <dyn_table>-knumh.
Some of the tables in ITABLES are pooled tables which does not allow me to use INNER JOINS. Therefore I need a second select in order to read the pricing table KONP.
Thanks in advance for any hint.Hi Abel,
You must be getting the syntax error that <dyn_table> does not contain the field knumh.
try putiing the entire where clause in a char type variable say wa_char and then use in ur query as
where (wa_char) .. it may work..
concatenate 'knumh' '=' '<dyn_table>-knumh' INTO wa_char SEPARATED BY SPACES.
SELECT ... from konp...
where (wa_char).
Revert if it doesnt work. -
Hi Guys,
I have two internal tables with same structure, ITAB1 is having 100 records and ITAB2 is having 150 records, i need to club two internal tables into ITAB3.
I hope, we can loop one internal table append record by record.
Is any other way, can we club two internal tables.
Thanks,
Gourisankar.Hi,
You can use INSERT LNES OF ITAB1 INTO ITAB3 and afterwards do the same with ITAB2.
Regards, Gerd Rother -
Getting the final internal table of a transaction VA05
Hi,
Can anyone help me in getting the final internal table of a transaction VA05 when called from a program. I need to use to this internal table for further processing.
Thanks in advance,
Vinay.Hi,
Not quite sure what you are after but the following may help.
For a start VA05 uses FM RV_SALES_DOCUMENT_VIEW_3 to select it's data. Your program could simply call this. However, if you are doing a CALL TRANSACTION from your program to VA05 and you want to get the results back then you could utilise some 'old style' userexits available in VA05.
Two choices here:
1. At the end of FM RV_SALES_DOCUMENT_VIEW_3 there is a form END_MODIFICATION or
2. When VA05 calls RV_SALES_DOCUMENT_VIEW_3 it performs a user sort MV75AFZ1(MV75AFZ1)
Both of these belong to package VMOD which means you can modify them by simply registering the object in OSS (these are 'old style' exits before SMOD/CMOD and are prevelant in SD)
From either of these you could EXPORT to memory for when control is returned back to your program.
Thanks,
Pete -
Reg : Joining the all internal table records into a single internal table
Hi all
I am having 5 internal tables and i want to put all these entries in a single intrnal table and my requirement is for each and every record it has to go through all the internal tables and if an entry is missing meand.it has to go through the other internal tables and for missing entries i should leave it as blank and rest of the contents i have to display can any please gimme some logic how to do this??
Thanks in advanceDon't have time or will to deliver turnkey solutions, but here is a frame:
LOOP AT itab1...
READ TABLE itab2 WITH TABLE KEY... (fields linking itab1 and itab2)
READ TABLE itab3 WITH TABLE KEY... (fields linking itab1 and itab3)
LOOP AT itab4 WHERE... (fields linking itab1 and itab4)
READ TABLE itab5 WITH TABLE KEY... (fields linking itab4 and itab5)
MOVE-CORRESPONDING... (all five work areas to target work area)
APPEND itabtarget...
ENDLOOP.
ENDLOOP.
so use READ when there is a 1:1 relationship (e.g. check table entry), and LOOP when there is a 1:N relationship (e.g. items for a header)
Thomas -
Problem in filling the final internal table
Hi,
I am working on a code in which i have to fill up the final internal table which will store the values coming form different internal tables.Here's the code which i am trying to do but it is not giving the execat functionality.In this code ITOUTPUT is the final itab which is storing the values of all other internal tables.
Here's the code:-
loop at itab1.
select single maktx into v_item from makt where matnr = itab1-matnr.
ITOUTPUT-banfn = ITab1-banfn.
ITOUTPUT-badat = ITab1-badat.
ITOUTPUT-meins = ITab1-meins.
ITOUTPUT-menge = ITab1-menge.
ITOUTPUT-lfdat = ITab1-lfdat.
IF ITAB1-MEINS = 'KG'.
V_TOTREQ = V_TOTREQ + ITAB1-MENGE.
ELSEIF ITAB1-MEINS = 'TO'.
V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE * 1000 ).
ELSEIF ITAB1-MEINS = 'G'.
V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE / 1000 ).
ENDIF.
v_tpo = 0.
v_por = 0.
LOOP AT ITPO WHERE BANFN = ITAB1-BANFN AND bnfpo = ITAB1-bnfpo.
if v_por <> '0'.
write : / ' '.
endif.
ITOUTPUT-ebeln = ITPO-ebeln.
ITOUTPUT-aedat = ITPO-aedat.
ITOUTPUT-lifnr = ITPO-lifnr.
ITOUTPUT-menge = ITPO-menge.
ITOUTPUT-EINDT = ITPO-EINDT.
IF ITAB1-MEINS = 'KG'.
V_TOTPO = V_TOTPO + ITPO-MENGE.
ELSEIF ITPO-MEINS = 'TO'.
V_TOTPO = V_TOTPO + ( ITPO-MENGE * 1000 ).
ELSEIF ITPO-MEINS = 'G'.
V_TOTPO = V_TOTPO + ( ITPO-MENGE / 1000 ).
ENDIF.
v_tpo = v_tpo + itpo-menge.
v_tgr = 0.
v_por = 1.
v_grr = 0.
loop at itmrn where ebeln = itpo-ebeln and ebelp = itpo-ebelp.
if v_grr <> '0'.
write : / ' '.
endif.
select single budat from mkpf into v_grdate where MBLNR = itmrn-MBLNR.
write: 143 Itmrn-menge,v_grdate .
itoutput-PMENGE = itmrn-menge.
v_tgr = v_tgr + itmrn-menge.
v_grr = 1.
endloop.
p_po = itpo-menge - v_tgr.
write: 173 p_po.
ENDLOOP.
p_req = itab1-menge - v_tpo.
write : 195 p_req.
endloop.
loop at itoutput.
write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
MODIFY itoutput.
endloop.Hi,
Ok,i ha d checked my code by using your logic and giving the run time error ......
i had debugged my code (orignal onementioned in above thread with little modification) in which i am able to see that finaloutput (intrenal table) is getting filled properly and the problem arises when the cursor comes to the write statement ... it is repeating some of the values when output is displayed where as before displaying output this iternal table is having the correct data. i am using the following code :-
append itoutput.
ENDLOOP.
p_req = itab1-menge - v_tpo.
write : 195 p_req.
append itoutput. ,<--- added this
clear itoutput. <--- added this
endloop.
loop at itoutput.
write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
MODIFY itoutput. <------ not removed
endloop. -
How to Organize the columns in the dynamic internal table?
Hello Folks!
How to Organize the columns in the dynamic internal table? i tried passing the parameter COL_POS to the fieldcatalog, Which is not working.Organize in What order ? What is your way to output ?
If you use ALV, you need to create fresh FIELD CATALOG for your dynamic table and then assign the column position.
Regards,
Diwakar -
Passing the Dynamic Internal Table as the Output Parameter of the FM...
Hi,
How can we pass the internal table as the output from the Function Module TABLES parameter.
SELECT * FROM TVRO BYPASSING BUFFER INTO TABLE <ltable>.
Now I need to pass the dynamic internal table <ltable> as the output in the function module.
Thanks!
Puneet.I can't use TVRO as the table type. The Table name is as the Input. This program will download the contents of the table and create an app server file. It can be for any database table.
so i want the output of this FM should be the data from that table. So what should be the TABLE type.
like in a program i will use:::
FIELD-SYMBOLS: <ltable> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
SELECT * FROM (p_table) BYPASSING BUFFER INTO TABLE <ltable>.
That is my requirement. -
Add field value to the existing internal table.
how to add a field value to the existing internal table.
DATA: BEGIN OF ITAB occurs 0,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
AEDAT TYPE EKPO-AEDAT,
amount(10) type c,
END OF ITAB.
select * from ekpo
into corresponding fields of table itab.
itab-amount = '2400'.
loop at itab where ebeln eq 70 .
write : / sy-tabix,itab-ebeln,itab-ebelp,itab-aedat,itab-amount.
endloop.
here output is not showing the amount field value.
please tell me how to solve this problem urgent
thanks in advance.Hi Sekhar,
First let me know wheather you are assigning some value to the amount field externally to all records? if this is wright means check the below code.
DATA: BEGIN OF ITAB occurs 0,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
AEDAT TYPE EKPO-AEDAT,
END OF ITAB.
select * from ekpo
into corresponding fields of table itab.
v_amount = '2400'.
loop at itab where ebeln eq 70 .
write : / sy-tabix,itab-ebeln,itab-ebelp,itab-aedat,v_amount.
endloop.
or if you want to modify perticular records in itab then use below code.
DATA: BEGIN OF ITAB occurs 0,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
AEDAT TYPE EKPO-AEDAT,
amount(10) type c,
END OF ITAB.
select * from ekpo
into corresponding fields of table itab.
loop at itab.
itab-amount = '2400'.
modify itab index sy-tabix (or perticular line number).
endloop.
loop at itab where ebeln eq 70 .
write : / sy-tabix,itab-ebeln,itab-ebelp,itab-aedat,itab-amount.
endloop.
Thanks,
Suma. -
How to get the final internal table after the ALV is modified?
Dear experts,
My WebDynpro application allows users to delete row, sort the column. After all this modification, I need to get the final internal table of ALV to generate a csv.file. Are there any methods to get the final interal table content of ALV?
Many thanks!
meerHi Friend ,
Please see this link for wiki of WDA Alv Hierarchy : [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f&overridelayout=true]
Regards,
Maybe you are looking for
-
I'm trying to install the Windows Phone 8.1 Preview for Devlopers but it won't install. I get x80188308. (I've tried 3 times) My Phone info: NOKIA Lumia 920 OS version 8.10.12400.899 Lumia Cyan RM-820_nam_canada_200, core build 3051.50009.1424.10362
-
Imac 24-Why does my airport signal keep changing??
my airport signal keeps changing?? right next to my imac i have my powerbook 17 and it's signal is full...where my IMac signal is not?? signal on my imac is 2 bars from full most of the time!! is this a IMAC thing or what??
-
WebDynpro Application Expires to soon
Hi All I have here a DepoScreen (WebDynpro)application that runs with no user interaction, it shows data from BW,R/3 and KM. Since there is no User interaction i get once a day WebDynpro Session expired and i need to refresh it. I tried the following
-
Moive clip in dataGrid cell.
I want to put a movie clip into datagrid cell and cell data will change the color of the movie clip. how could I do that? pls help
-
ME_GUI_PO_CUST for PR
Dear Gurus, Is there any badi like above for PR. I need to add 1 field customer refno for PR screen. Can I create additional customer enhancement screen since the existing one has been used by other developments. SAPLMEGUI 0014 S