Tranfering data from alv display to a transaction with table control.
Hi all,
I am having some problem transfering data from my alv display to a trasaction which needs to display some values in a table control base on criterias which I have selected from my alv report.
When selecting an entry in my alv report.
1. The program should check whether there is an entry in a z table(already created), if so it retrieves data fro the z table base on the selected criteria.
2.otherwise it search from the data from other tables and then saves it in the z table and display the values in the tc.
my program is as follows.
FORM button_click USING p_ucomm TYPE sy-ucomm
p_selfield TYPE slis_selfield.
CASE p_ucomm.
WHEN 'SALES'.
READ TABLE gt_alvdisplay
INDEX p_selfield-tabindex
INTO gs_alvdisplay.
SET PARAMETER ID: *I dont know how to pass the para to the tc.....
CALL TRANSACTION 'ztrans_test".
ENDFORM.
Note: TC is already created and it retrieves data from the z table but am having prob just to pass the parameters.
Ill be very grateful to you all
Hello,
Yes you can create text field without using screen painter as follows:
PARAMETERS P1 TYPE CHAR12 MEMORY ID mid.
Here, this code will create text box with name P1 and parameter id "mid"
You can assign meaning text to p1 using menu link GO TO --> TEXT ELEMENTS --> SELECTION TEXTS.
So before call transaction which contains this field you can write below statement.
SET PARAMETER ID mid VALUE <value variable>.
* Here vlaue variable is the variable from which you want to pass value to parameter id mid.
Refer [SAP Help|http://help.sap.com/saphelp_nw70/helpdata/en/e7/deb237b9a9a968e10000009b38f8cf/frameset.htm] for more information.
Hope this helps!
Thanks,
Augustin.
Similar Messages
-
How to retive the data from ALV display when checkbox clicked
HI.....
suppose i have a ALV list with 3 fields and checkbox attached with it.Now if i click any of the checkbox i want to retrieve the data from a particular field from one of the 3 fields.How shal i do that....
Kind Regards.hi
use the field catalog property wa_fcat-hotspot = 'X' and then
in in list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = 'PFTEST'
i_callback_user_command = 'USER_COMMAND_ALV
is_layout = l_layout
it_fieldcat = it_fcat[]
TABLES
t_outtab = it_outtab[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
FORM user_command_alv USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: l_index LIKE sy-tabix.
DATA: l_belnr TYPE rbkp-belnr.
DATA: l_gjahr TYPE rbkp-gjahr.
DATA: l_awkey TYPE bkpf-awkey.
DATA: lwa_bkpf TYPE bkpf.
CLEAR g_flag.
IF r_ucomm EQ 'CREATESO'.
REFRESH it_outsel[].
LOOP AT it_outtab INTO wa_outtab.
IF wa_outtab-check = 'X'.
delete and put in new itab.
ENDIF.
CLEAR wa_outtab.
ENDLOOP.
shiva -
Leading Zeros Missing - When exporting data from ALV grid display to Excel
Hi,
Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
(eg) in ALV o/p - 0029.
in Excel - Only 29 is appearing.
As per the requiement i have to show the leading zeros in excel also.
Pls help on this issue.
Thanks in advance..Hi ,
Please set the property :
wa_fieldcat-lzero = 'X' .
when you are creating field catalog for display alv data .
your prob will solved .
Regards ,
Nilesh Jain -
hi all.
I have an issue regarding saving data from alv to data base table.
The problem is like this. I have an internal table consist of 10 column from three diferent tables.one primary key is there.
now i have displayed it in alv grid. there is a column of quantity. i made some changes in quantity of some rows. now i want to save it into the database table from which that quantity field fetched.
i used first check_changed_data method. if the flag is set it means data is changed.
wat shud i do to save that quantity column into data base.
Thanks In advance.
varuHi,
<b>To modify database or ztable from the ALV grid,you need to do the following:</b>
---You have to modify the field Catalog fields (fields that you want to make editable).Set the field <b>EDIT as 'X'</b>.For example if you want to make the field below editable:
ls_fcat-fieldname = 'CARRID'.
ls_fcat-edit = 'X'.
APPEND ls_fcat TO pt_fieldcat.
---Call the method below before you call the set_table_for_first_display.
CALL METHOD ALV_GRID_INSTANCE-><b>set_ready_for_input</b>
EXPORTING
i_ready_for_input = 0. ( For Display ) and ('1' for Edit )
After this put the set_table_for_first_display.
<b>Now if the ALV data has changed,and you want to change the database or ztable,then in your pf status give a function code for SAVE button in the GUI.
In the PAI of the screen,in user command module write the following:</b>
WHEN 'SAVE'.
<b>call method gr_alvgrid->check_changed_data</b>
importing e_valid = l_valid.
if l_valid = 'X'.
<b>MODIFY spfli FROM TABLE itab_spfli.</b>
endif.
<b>(l_valid is a flag.</b>
DATA:l_valid type c.
If you want to check if the user has entered any value on the grid, use the Method : CALL METHOD gr_alvgrid->check_changed_data.
This method returns a flag l_valid which can be checked to see if the data on the ALV grid has been changed or not.)
Regards,
Beejal
**Reward if this helps -
Exporting data from ALV Report...
Dear All,
While I am exporting data from ALV report to any other Format (Excel, Txt, HTML) it only export the data of last column, but the heading is comming properly and also the column heading is displaying properly.
So how to rectify it. (the report is Object Oriented).
Regards,
DahrmeshHi Davabap,
Refer this sample program "BCALV_GRID_VERIFY" . I hope it is problem with structure mismatching.
Otherwise can you paste your code ?
Regards,
Vicky
PS: Award points if helpful -
Facing a Problem while downloading the data from ALV Grid to Excel Sheet
Hi Friends,
Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
Can any one help me out in this case.hi...
if this problems happens dont display the same internal as u finally got.
just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
for eg.
ur final internal int table for disp,
data : begin of itab occur 0,
matnr like mara-matnr,
end of itab.
create new like this,
data : begin of itab occur 0,
matnr(12) type N,
end of itab. -
Transfer data from ALV to Z table
Hi,
I need to confirm the exact procedure to transfer data from ALV into z table.I am entering few values at runtime in the ALV & need to populate the z table with the same.
I created a z table,it has been assigned a internal table & work area.A loop is there on the internal table passed to fieldcatalog.
LOOP AT GIT_EKPO INTO GS_EKPO.
LS_ZPS005-EBELN = GS_EKPO-EBELN.
LS_ZPS005-EBELP = GS_EKPO-EBELP.
LS_ZPS005-ERECDAT = GS_EKPO-ERDAT. "this field is not passing value into z table
LS_ZPS005-LINEID = SY-TABIX.
LS_ZPS005-POQTY = GS_EKPO-POQTY.
LS_ZPS005-EREQTY = GS_EKPO-EREQTY. "this field is not passing value into z table
ENDLOOP.
INSERT INTO ZPS005 VALUES LS_ZPS005.
When I assign the values from Internal table into internal table of z table,the values in fields populated at runtime does not come.
Please help me with your suggestions on the same.
Thanks.Hi,
I tried the procedure,but do I need to include this before method set_table_for_first_display?
You can have a look at the whole code.Please let me know of a possible solution.Looking forward to an early reply.
Thanks.
TABLES: EKKO,
EKPO,
ZPS005.
INITIALIZATION.
PERFORM CREATE_FIELD_CATLOG.
Types Declaration *
*Structure for EKPO table
TYPES: BEGIN OF TYPE_EKPO,
EBELN TYPE EKPO-EBELN, "PURCHSE ORDER NUMBER
EBELP TYPE EKPO-EBELP, "Item Number of Purchasing Document
POQTY TYPE EKPO-MENGE, "Purchase Order Quantity
ERDAT TYPE SY-DATUM, "Date on Which Record Was Created
LINEID TYPE ZPS005-LINEID, "Unique identification of document line
EREQTY TYPE ZPS005-EREQTY, "Erection Quantity
END OF TYPE_EKPO.
Data *
Data Declaration for Internal Table & Work Area *
*INTERNAL TABLE FOR EKPO TABLE
DATA:LIT_EKPO TYPE TABLE OF EKPO,
LS_EKPO TYPE EKPO.
*SECOND INTERNAL TABLE FOR EKPO TABLE
DATA: GIT_EKPO TYPE TABLE OF TYPE_EKPO.
DATA: GS_EKPO TYPE TYPE_EKPO.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: LIT_FIELDCAT TYPE lvc_t_fcat,
LS_FIELDCAT LIKE LINE OF LIT_FIELDCAT. "WORK AREA FOR FIELD CATALOG
*INTERNAL TABLE FOR Z TABLE ZPS005
DATA: LIT_ZPS005 TYPE TABLE OF ZPS005,
LS_ZPS005 TYPE ZPS005.
ALV GRID Data Declaration *
DATA: V_CONTAINER TYPE REF TO cl_gui_custom_CONTAINER.
data: grid TYPE REF TO cl_gui_alv_grid.
data: ok_code type sy-ucomm.
DATA: V_LAYOUT TYPE lvc_s_layo. " FOR LAYOUT
DATA: V_LINE TYPE I,
LINEID TYPE I.
DATA: V_INDEX TYPE SY-TABIX.
PARAMETER *
parameter : p_ebeln like ekko-ebeln.
START OF SELECTION *
START-OF-SELECTION.
SELECTION OF DATA *
CALL FUNCTION 'ME_PURCHASE_DOCUMENT_DATA_READ'
EXPORTING
I_EBELN = P_EBELN
I_TCODE = 'ME23'
I_NO_COMMIT = ' '
I_TRTYP = 'A'
I_NO_MESSAGING =
I_NO_MESSAGE_REQ =
I_NO_AUTHORITY_CHECK =
I_VORGA =
IMPORTING
E_EKKO =
TABLES
T_EKPO = LIT_EKPO
T_EKET =
T_EKKN =
T_KOMV =
EXCEPTIONS
NO_EBLNR = 1
EBLNR_NOT_FOUND = 2
NO_TCODE = 3
TCODE_NOT_ALLOWED = 4
NO_TRTYP = 5
INVALID_CALL_OF_FB = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT LIT_EKPO INTO LS_EKPO.
MOVE : LS_EKPO-EBELN TO GS_EKPO-EBELN,
LS_EKPO-EBELP TO GS_EKPO-EBELP,
LS_EKPO-MENGE TO GS_EKPO-POQTY.
APPEND GS_EKPO TO GIT_EKPO.
ENDLOOP.
End-of-selection.
perform field_catalog.
call screen 100.
END-OF-SELECTION *
MODULES FOR ALV DISPLAY *
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'PF-STAT'.
SET TITLEBAR 'TITLE'.
ENDMODULE. " STATUS_0100 OUTPUT
**& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'SWITCH'.
PERFORM switch_edit_mode.
WHEN 'SAVE'.
PERFORM FILL_TABLE.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
**& Module layout_0100 OUTPUT
text
MODULE layout_0100 OUTPUT.
V_LAYOUT-grid_title = 'Purchase Order Erection Details'.
ENDMODULE. " layout_0100 OUTPUT
**& Module data_retrivaL OUTPUT
text
MODULE data_retrivaL OUTPUT.
IF V_CONTAINER IS INITIAL.
CREATE OBJECT V_CONTAINER
EXPORTING container_name = 'GRID'.
CREATE OBJECT grid
EXPORTING i_parent = V_CONTAINER.
ENDIF.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = V_LAYOUT
CHANGING
IT_OUTTAB = GIT_EKPO
IT_FIELDCATALOG = LIT_FIELDCAT
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " data_retrivaL OUTPUT
*& Module field_catalog OUTPUT
text
FORM field_catalog.
CLEAR LS_fieldcat.
LS_fieldcat-fieldname = 'EBELN'.
LS_fieldcat-ref_table = 'GIT_EKPO'.
LS_FIELDCAT-coltext = 'PURCHSE ORDER NUMBER'.
LS_FIELDCAT-col_pos = 0.
LS_FIELDCAT-EDIT = ' '.
ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
APPEND LS_fieldcat TO LIT_fieldcat.
CLEAR LS_fieldcat.
LS_fieldcat-fieldname = 'EBELP'.
LS_fieldcat-ref_table = 'GIT_EKPO'.
LS_FIELDCAT-coltext = 'ITEM NUMBER'.
LS_FIELDCAT-col_pos = 1.
LS_FIELDCAT-EDIT = ' '.
ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
APPEND LS_fieldcat TO LIT_fieldcat.
CLEAR LS_fieldcat.
LS_fieldcat-fieldname = 'POQTY'.
LS_fieldcat-ref_table = 'GIT_EKPO'.
LS_FIELDCAT-coltext = 'PURCHASE ORDER QUANTITY'.
LS_FIELDCAT-col_pos = 2.
LS_FIELDCAT-EDIT = ' '.
ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
APPEND LS_fieldcat TO LIT_fieldcat.
CLEAR LS_fieldcat.
LS_fieldcat-fieldname = 'ERDAT'.
LS_fieldcat-ref_table = 'GIT_EKPO'.
LS_FIELDCAT-coltext = 'DATE OF ERECTION'.
LS_FIELDCAT-col_pos = 3.
LS_FIELDCAT-EDIT = 'X'.
ls_fieldcat-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
APPEND LS_fieldcat TO LIT_fieldcat.
CLEAR LS_fieldcat.
LS_fieldcat-fieldname = 'EREQTY'.
LS_fieldcat-ref_table = 'GIT_EKPO'.
LS_FIELDCAT-coltext = 'ERECTION QUANTITY'.
LS_FIELDCAT-col_pos = 4.
LS_FIELDCAT-EDIT = 'X'.
ls_fieldcat-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
APPEND LS_fieldcat TO LIT_fieldcat.
ENDFORM. " field_catalog OUTPUT
*& Form SWITCH_EDIT_MODE
text
--> p1 text
<-- p2 text
*FORM switch_edit_mode.
IF GRID->is_ready_for_input( ) eq 0.
set edit enabled cells ready for input
CALL METHOD GRID->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
ELSE.
lock edit enabled cells against input
CALL METHOD GRID->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
ENDIF.
*ENDFORM. " SWITCH_EDIT_MODE
*& Form FILL_TABLE
text
--> p1 text
<-- p2 text
FORM FILL_TABLE .
LOOP AT GIT_EKPO INTO GS_EKPO.
LS_ZPS005-EBELN = GS_EKPO-EBELN.
LS_ZPS005-EBELP = GS_EKPO-EBELP.
LS_ZPS005-POQTY = GS_EKPO-POQTY.
LS_ZPS005-ERECDAT = GS_EKPO-ERDAT.
LS_ZPS005-EREQTY = GS_EKPO-EREQTY.
ENDLOOP.
MODIFY ZPS005 FROM LS_ZPS005.
ENDFORM. " FILL_TABLE -
Dear experts.
Can anyone help me to capture data from ALV grid to pass to a BAPI FM.
My ALV grid has the check box as first column and I want to capture only the rows in the grid with these checkboxes checked. I would prefer to do it without OO.
Regards
SatharLoop at the table used for ALV data where <checkbox-field> = 'X'.
Best,
Jim -
HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
HI,
HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
thanks,
samba.By selection screen, what do you mean? There is no selection screen in WDA as there was in classic dynpro. Do you mean you are using the Select-Options reusable component? Are you wanting to call a standard transaction via ITS - SAPGUI for HTML? Please provide more details to your question.
-
Download to excel from alv display
Hi,
How to download to excel from alv display.I am using object oriented abap for using alv.If i click export->spreadsheet i am getting fatal error and if i export->local file->spreadsheet i am getting only the column names and heading but no contents.Can anyone tell me how to overcome this problem.
Regards,
Sowmya.Hi Sowmya,
Just put break point near FM reuse_alv_grid_display and check if internal table which is used to display output is popullated or not.
Regards Sachin. -
Hi ,
I am facing a problem when ever i am going to donload data from ALV grid to excel file.I am getting CL_SALV_BS_TT_RESULT_TABLE====CP error in GET_CELL_VALUE. Could you please provide me is there any OSS note or any patch required to solve this issue.
Thanks in Advance,
Venkatarao.Hi,
Just refer to OSS note 1356898 for guidelines.
Regards,
Vasanth -
Passing Data from webclient to R/3 transaction through Transaction Launcher
Hi All,
We are implementing webclinet 5.0 for one our your client. We have configured Transaction Launcher for
calling some R/3 transaction. Now we want to pass some data from webclinet to R/3 transactions.We
have deployed custom BOR object in Transaction Launcher.
Can you please guide me what excatly code or logic need to be
written in 'IF_CRM_IC_ACTION_HANDLER~PREPARE_DATA_FLOW' method which is generated will
creating our custom class during configuration of Transaction Launcher.
Regards
gmdIf i understood your requirement, you want to send Dynamic parameter to Transaction iview from WD Application.
1) Create a Transaction iview with a application parameter with 'RF02k-LIFN='
2) Calling Transactional iview from Web Dynpro Application.
WDPortalNavigation.navigateAbsolute(
"ROLES://portal_content/com.accenture.hpb.HPBProject/com.accenture.iViews/com.accenture.hpb.FTDGUIConfirmation",
WDPortalNavigationMode.SHOW_EXTERNAL,
(String) null,
(String) null,
WDPortalNavigationHistoryMode.NO_DUPLICATIONS,
(String) null,
(String) null,
// get the dynamic value like valuewdContext.currentValueNodeElement().getVaContractDocumentNo()
write me back, if you are not clear with answer.
Regards,
Sridhar -
How to Downlaod Data from Alv List to Excel File
Hi,
I have a Requirement like While download data from ALV to Excel File .After Download data into Excel we will not allow user to edit the Excel data..
Plz help me to complete this scenario.
Thanks & Regards,
Kumaran Duraiswamy.hi,
try these following fm's
MS_EXCEL_OLE_STANDARD_DAT
EXCEL_OLE_STANDARD_DAT
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = 'Your Path' " enter your path to save the file.
CREATE_PIVOT = 0
* DATA_SHEET_NAME = ' '
* PIVOT_SHEET_NAME = ' '
* PASSWORD = ' '
* PASSWORD_OPTION = 0
VISIBLE = '0'
No_DIALOG = 'X'
TABLES
* PIVOT_FIELD_TAB =
DATA_TAB = t_deli_final
* FIELDNAMES =
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2nd fm
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'Your Path' "path to save your file
DATA_SHEET_NAME = V_SHEET_NAME
TABLES
DATA_TAB = TLX
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC NE 0.
WRITE:/ 'ERROR OPENING EXCEL'.
ENDIF.
ELSE.
WRITE:/ 'ERROR OR NO DATA'.
ENDIF. -
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 need to import data from a CSV file to an Oracle table
I need to import data from a CSV file to an Oracle table. I'd prefer to use either SQL Developer or SQL Plus code.
As an example, my target database is HH910TS2, server is ADDb0001, my dB login is em/em, the Oracle table is AE1 and the CSV file is AECSV.
Any ideas / help ?And just for clarity, it's good to get your head around some basic concepts...
user635625 wrote:
I need to import data from a CSV file to an Oracle table. I'd prefer to use either SQL Developer or SQL Plus code.SQL Developer is a GUI front end that submits code to the database and displays the results. It does not have any code of it's own (although it may have some "commands" that are SQL Developer specific)
SQL*Plus is another front end (character based rather than GUI) that submits code to the database and displays the results. It also does not have code of it's own although there are SQL*Plus commands for use only in the SQL*Plus environment.
The "code" that you are referring to is either SQL or PL/SQL, so you shouldn't limit yourself to thinking it has to be for SQL Developer or SQL*Plus. There are many front end tools that can all deal with the same SQL and/or PL/SQL code. Focus on the SQL and/or PL/SQL side of your coding and don't concern yourself with limitations of what tool you are using. We often see people on here who don't recognise these differences and then ask why their code isn't working when they've put SQL*Plus commands inside their PL/SQL code. ;)
Maybe you are looking for
-
Changing the titles of all frames in a running application
Hi All, I've got a 50+ frame application. I have realized that I need to update the frame titles for all the frames based upon some event that can be initiated by any of the frames. Each frame title will be different but will incorporate a bit of kno
-
How can I set a BPS's formula to be a remote process
Hi Masters Now i hava a copy formula in my BPS level. I want to know how can I set it to be a remote process and remote it in every day. Thanks & Regards.
-
I have created a chart in Keynote with a title. But the title is really close to the data, and I would like to increase the space between title and chart, but I don't know how. I cannot even cheat by adding a return and creating an empty second line
-
Disable GL Account Field for editing in the Shopping Cart SRM 7.0
Hi, We would like to disable the GL Account field for editing only on the Shopping Cart Approval Screen. I tried to implement this through configuration of Metadata Dynamic Class in SPRO->SRM Application Server ->Cross Application Basic Settings->E
-
Loading the JNDI Tree in a Cluster
Is there any special processing that occurs with a Startup class when it has been started via the cluster level properties file? We've got a class that loads the JNDI tree for various configuration for our appl