How to add join conditions in ABAP Query.
Hi,
I need a help on "ABAP Query".
How to add join conditions in ABAP Query.
Thanks in advance.
Thanks & Regards,
Ramana
Hi,
See below code,
*& Report ZRNP_ALV_SO
REPORT zrnp_alv_so MESSAGE-ID z7rnp .
INCLUDE zrnp_include .
*SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004 .
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln ,
s_auart FOR v_auart ,
s_vkorg FOR v_vkorg ,
s_spart FOR v_spart ,
s_kunnr FOR v_kunnr ,
s_matnr FOR v_matnr .
SELECTION-SCREEN END OF BLOCK blk1 .
*AT SELECTION SCREEN *
AT SELECTION-SCREEN.
SELECT SINGLE vbeln
FROM vbak INTO vbak-vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE e202.
ENDIF.
*START OF SELECTION *
START-OF-SELECTION .
PERFORM data_select.
PERFORM t_sort USING i_sort .
PERFORM event_cat USING i_event .
PERFORM fld_cat USING i_fldcat[] .
PERFORM t_layout USING i_layout .
PERFORM fld_cat2 USING i_fldcat2[] .
PERFORM call_alv.
* DATA SELECT *
*& Form DATA_SELECT
* text
* --> p1 text
* <-- p2 text
FORM data_select .
REFRESH: it_vbfa, it_so1, it_del_ful ,it_del1 .
BREAK-POINT.
*SELECT*
*a~vbeln*
*a~auart*
*a~vkorg*
*a~spart*
*a~kunnr*
*b~posnr*
*b~matnr*
*c~maktx*
*b~kwmeng*
*b~vrkme*
*INTO TABLE it_so1 FROM vbak AS a*
*INNER JOIN vbap AS b ON b~vbeln = a~vbeln*
*INNER JOIN makt AS c ON c~matnr = b~matnr*
*AND c~spras = sy-langu*
*WHERE a~vbeln IN s_vbeln .*
IF sy-subrc = 0.
SORT it_so1 BY vbeln.
DELETE ADJACENT DUPLICATES FROM it_so1.
ENDIF.
* COLURING DISPLAY *
DATA: ld_color(1) TYPE c .
* LOOP AT it_so1 INTO wa_so.
* Populate color variable with colour properties
* Char 1 = C (This is a color property)
* Char 2 = 3 (Color codes: 1 - 7)
* Char 3 = Intensified on/off ( 1 or 0 )
* Char 4 = Inverse display on/off ( 1 or 0 )
* i.e. wa_ekko-line_color = 'C410'
* ld_color = ld_color + 1.
* Only 7 colours so need to reset color value
* IF ld_color = 8.
* ld_color = 1.
* ENDIF.
* CONCATENATE 'C' ld_color '10' INTO wa_so-line_color.
** wa_ekko-line_color = 'C410'.
* MODIFY it_so1 FROM wa_so.
* ENDLOOP .
* IF sy-subrc = 0.
IF NOT it_so1[] IS INITIAL.
SELECT vbelv
posnv
vbeln
posnn
vbtyp_n
INTO TABLE it_vbfa
FROM vbfa
FOR ALL ENTRIES IN it_so1
WHERE vbelv = it_so1-vbeln
AND posnn = it_so1-posnr
AND vbtyp_n ='J' .
IF sy-subrc = 0.
SELECT vbeln
posnr
matnr
werks
lgort
charg
lfimg
vrkme
FROM lips INTO TABLE it_del_ful
FOR ALL ENTRIES IN it_vbfa
WHERE vbeln = it_vbfa-vbeln
AND posnr = it_vbfa-posnn.
ENDIF.
ENDIF.
ENDFORM. " DATA_SELECT
**************** EVENT CATALOG ****************************************
*& Form EVENT_CAT
* text
* -->P_I_EVENT text
FORM event_cat USING p_i_event TYPE slis_t_event .
REFRESH p_i_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
* EXPORTING
* I_LIST_TYPE = 0
IMPORTING
et_events = p_i_event
* EXCEPTIONS
* LIST_TYPE_WRONG = 1
* OTHERS = 2
* IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
READ TABLE p_i_event WITH KEY name = slis_ev_top_of_page INTO t_event.
IF sy-subrc = 0.
MOVE 'TOP_OF_PAGE' TO t_event-form.
MODIFY p_i_event FROM t_event INDEX sy-tabix TRANSPORTING form.
ENDIF.
CLEAR t_event .
ENDFORM. " EVENT_CAT
**********FORM FOR EVENT TOP_OF_PAGE**********************************
FORM top_of_page .
REFRESH i_listheader.
DATA: t_header TYPE slis_listheader.
DATA: v_text(50).
WRITE sy-datum TO v_text.
CLEAR t_header.
t_header-typ = 'S'.
t_header-key = "Date".
t_header-info = v_text.
APPEND t_header TO i_listheader.
CLEAR t_header.
CLEAR v_text.
WRITE: 'SALES ORDER & DELIVERY DETAILS REPORT ' TO v_text .
t_header-typ = 'S'.
t_header-key = 'TITLE'.
t_header-info = v_text.
APPEND t_header TO i_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_listheader.
* I_LOGO = 'ALV_BACKGROUND'.
* I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
******** FIRST ALV GRID DISPLAY ***************************************
FORM call_alv .
* FORM TO MAKE THE CELL CONTENTS INVISIBLE.
* PERFORM INVISIBLE_CELL_CONTENTS. *
*EXCLUDE-DECLARATION.
CLEAR wa_exclude.
wa_exclude-fcode = '&VEXCEL'.
APPEND wa_exclude TO i_exclude.
*& Form CALL_ALV
* text
* --> p1 text
* <-- p2 text
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND1'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_background_id = 'ALV_BACKGROUND'
is_layout = i_layout
it_fieldcat = i_fldcat[]
it_excluding = i_exclude
it_sort = i_sort
it_events = i_event
TABLES
t_outtab = it_so1
* IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
ENDFORM. " CALL_ALV
************** FIRST FIELDCATALOG *************************************
*& Form FLD_CAT
* text
* -->P_I_FLDCAT[] text
FORM fld_cat USING p_i_fldcat TYPE slis_t_fieldcat_alv.
CLEAR i_fldcat.
i_fldcat-fieldname = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'."TABLE NAME
i_fldcat-seltext_m = 'SALES ORDER NO.'.
i_fldcat-col_pos = 1. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-hotspot = 'X'.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'AUART'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'."TABLE NAME
i_fldcat-seltext_m = 'SALES DOC. TYPE'.
i_fldcat-col_pos = 2. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'VKORG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SALES ORG.'.
i_fldcat-col_pos = 3. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 12. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'SPART'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'DIVISION'.
i_fldcat-col_pos = 4. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'KUNNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SOLD TO PARTY'.
i_fldcat-col_pos = 5. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SALES DOC. ITEM'.
i_fldcat-col_pos = 6. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 17. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'MATERIAL NO.'.
i_fldcat-col_pos = 7. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'MAKTX'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'DESCRIPTION'.
i_fldcat-col_pos = 8. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'KWMENG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'QUANTITY'.
i_fldcat-col_pos = 9. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 15. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-do_sum = 'X'. " For doing "SUM"
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat-tabname = 'IT_SO1'.
i_fldcat-seltext_m = 'SALES UNIT'.
i_fldcat-col_pos = 10. " POSITION OF THE COLUMN.
i_fldcat-outputlen = 10. " SET THE OUTPUT LENGTH.
i_fldcat-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat-just(1) = 'C'.
APPEND i_fldcat.
ENDFORM. " FLD_CAT
****************** ALV SORTING ***************************************
*& Form SORT
* text
* -->P_I_SORT text
FORM t_sort USING p_i_sort TYPE slis_t_sortinfo_alv .
DATA: i_sort TYPE slis_sortinfo_alv .
REFRESH p_i_sort .
CLEAR i_sort.
i_sort-spos = 1.
i_sort-tabname = 'IT_SO1'.
i_sort-fieldname = 'VBELN'.
i_sort-up = 'X'.
i_sort-subtot = 'X'.
i_sort-group = '*'.
APPEND i_sort TO p_i_sort.
ENDFORM. " SORT
*FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
* SET PF-STATUS 'ZSTANDARD'.
*ENDFORM. "Set_pf_status
***********FORM FOR EVENT USER_COMMAND1********************************
FORM user_command1 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
*CASE R_UCOMM .
* WHEN '&IC1' .
* IF rs_selfield-FIELDNAME = 'VBELN' .
* ENDIF .
* WHEN OTHERS .
* ENDCASE .
CLEAR wa_so.
REFRESH: it_del1 .
IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
rs_selfield-value IS NOT INITIAL.
READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = wa_so-vbeln
AND posnv = wa_so-posnr.
READ TABLE it_del_ful INTO wa_it_del_ful
WITH KEY vbeln = wa_vbfa-vbelv
posnr = wa_vbfa-posnn.
IF sy-subrc = 0.
CLEAR wa_del.
MOVE wa_it_del_ful TO wa_del.
APPEND wa_del TO it_del1.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
********* SECOND ALV GRID DISPLAY ***********************************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND2'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_background_id = 'ALV_BACKGROUND'
it_fieldcat = i_fldcat2[]
it_sort = i_sort
TABLES
t_outtab = it_del_ful
* IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
ENDFORM . "USER_COMMAND1
********** FORM FOR EVENT USER_COMMAND 2 ******************************
FORM user_command2 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CLEAR wa_so.
REFRESH: it_del1 .
IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
rs_selfield-value IS NOT INITIAL.
READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
* IF SY-SUBRC = 0.
* LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = WA_SO-vbeln
* AND posnv = WA_SO-posnr.
READ TABLE it_del_ful INTO wa_it_del_ful
WITH KEY vbeln = rs_selfield-value
" vbeln = wa_vbfa-vbeln
posnr = wa_vbfa-posnn.
IF rs_selfield-fieldname = 'VBELN'.
SET PARAMETER ID 'VL' FIELD wa_vbfa-vbeln .
CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.
ENDIF .
* ENDLOOP.
* ENDIF.
ENDIF.
ENDFORM . "USER_COMMAND2
********* SECOND FIELDCATALOG ******************************************
*& Form FLD_CAT2
* text
* -->P_I_FLDCAT2[] text
FORM fld_cat2 USING p_i_fldcat2 TYPE slis_t_fieldcat_alv .
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-tabname = 'IT_DEL_FUL'."TABLE NAME
i_fldcat2-seltext_m = 'DELIVERY NO.'.
i_fldcat2-col_pos = 1. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-hotspot = 'X'.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'DELIVERY ITEM'.
i_fldcat2-col_pos = 2. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'MATERIAL NO.'.
i_fldcat2-col_pos = 3. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'WERKS'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'PLANT.'.
i_fldcat2-col_pos = 4. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'LGORT'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'ST. LOCATION'.
i_fldcat2-col_pos = 5. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'CHARG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'BATCH NO.'.
i_fldcat2-col_pos = 6. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'LFIMG'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'ACT. DEL. QTY.'.
i_fldcat2-col_pos = 7. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
CLEAR i_fldcat2.
i_fldcat2-fieldname = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
i_fldcat2-seltext_m = 'SALES UNIT.'.
i_fldcat2-col_pos = 8. " POSITION OF THE COLUMN.
i_fldcat2-outputlen = 20. " SET THE OUTPUT LENGTH.
i_fldcat2-emphasize = 'X'. " COLOR OF THIS COLUMN.
i_fldcat2-key = 'X'. " SO THAT THIS FIELD IS NOT
"SCROLLABLE AND HIDDABLE.
i_fldcat2-just(1) = 'C'.
APPEND i_fldcat2.
ENDFORM. " FLD_CAT2
***************** ALV LAYOUT *******************************************
*& Form LAYOUT
* text
* -->P_I_LAYOUT text
FORM t_layout USING p_i_layout TYPE slis_layout_alv .
p_i_layout-zebra = 'X'.
p_i_layout-totals_text = 'GRAND TOTAL ='.
* p_i_layout-CONFIRMATION_PROMPT = 'X'.
* p_i_layout-DEF_STATUS = ' '.
p_i_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " LAYOUT
Similar Messages
-
Query: How to add new fields in ABAP query?
Hi All,
Can any one tell me how to add new fields in the ABAP query output?
We have to add the new fields using query design or we have
to add those in the background program(automatically generated behind query) by selecting new fields in the code?What kind of report? Usually, you have to add the field in the table declaration and then also in the SQL query. After that, include the field in what kind of report you are using.
-
How to influence join condition in Adhoc analysis
We have a subject area created that has *2 facts tables*. In one of the adhoc reports, the report query is taking the join from the second fact table instead of the first fact table for columns picked from common dimensions. Need to know how to influence join condition in Adhoc analysis, or OBIEE criteria with which the fact to make a join is chosen.
Requirement is to have a count of records in Dimension table, based on first fact - failure part, and then second fact - failure reason.Hi User,
Set an implicit fact column in presentation layer to force a join,
http://gerardnico.com/wiki/dat/obiee/implicit_fact_column
Regards,,
Dpka -
How to add a parameter to sql query in report
Hi
How to add a parameter to sql query in report.
Parameter is from Visual studio
example:
select * from tab1 where dl=parameter???
I have VS 2008 prof CR XI R2, mysqlHello,
If you have this API available then you can modify the record selection formulae in code to add filtering:
string recordSelectionFormula = "{T_INV_RPT_ADDR.IND_PROMUS} = {?P_PROMUS?} AND {T_INV_RPT_POINT.INVOICE_DATE} = DATE(2008, 05, 31) AND {T_INV_RPT_POINT.CHECKOUT_DATE} = date(2008, 04,29)";
CrystalDecisions.CrystalReports.Engine.ReportDocument.RecordSelectionFormula = recordSelectionFormula;
You have to format and follow the rules as in the Designer so not too much work to get this to work.
CR for .NET may not have the ability so you will need to upgrade to a Developer version of Crystal Reports.
Thank you
Don -
How to add System variable in a Query
Hi Experts,
In ref. to the below query.
(SELECT T0.[CardCode], T0.[CardName], T0.[DocNum],T0.[Installmnt], T0.[DocDate], T0.[DiscPrcnt], T0.[DiscSum], T0.[DocTotal] FROM [dbo].[OINV] T0 WHERE T0.[CardName] = [%0] )
Can you please let me know how to add a System Variabe (i.e., AR Invoice --> Total before discount field --> Variable : 85) to the above query.
Thanks in advance
Regards,
Rakesh NHi Rakesh......
Its definitely possible.
Try this one....
(SELECT T0.[CardCode], T0.[CardName], T0.[DocNum],T0.[Installmnt], T0.[DocDate], T0.[DiscPrcnt], T0.[DiscSum], T0.[DocTotal], Sum(T1.LineTotal) , T3.DocNum
FROM [dbo].[OINV] T0 Inner Join INV1 T1 On T0.DocEntry=T1.DocEntry Left Outer Join RIN1 T2 On T1.DocEntry=T2.BaseEntry Left Outer Join ORIN T3 On T3.DocEntry=T2.DocEntry
WHERE T0.[CardName] = [%0]
Group By T0.[CardCode], T0.[CardName], T0.[DocNum],T0.[Installmnt], T0.[DocDate], T0.[DiscPrcnt], T0.[DiscSum], T0.[DocTotal], T3.DocNum
Hope this will help you.......
Regards,
Rahul -
How to hide some fields in ABAP Query
Hi,
My ABAP Query has a long list of extracted fields. I wanted to set some of these output to "HIDE".
This allow User the flexibility to decide what fields to show.
How can I set the field to "HIDE" in my query?
Thanks
byeHi Tim,
You can do this by setting the Report layout variant in following steps:
1. First define the parameter on selection screent for report variant.
2. Data decelaration for variant.
3. Value request to get already present variants on report:
4. If doesn't choose the layout take out the default report layout.
5. Initialize the report variant.
6. Apply the variant to the REUSE_ALV_GRID_DISPLAY funtion module.
Here to generate report variant first to open report output and then as per according to user set the layout of report using the layout icon of ALV with summation on value fields (as required) and create layout name.
*Data Deceleration as below:
Data :g_save(1) TYPE c,
** g_default(1) TYPE c,
g_exit(1) TYPE c,
gx_variant TYPE disvariant,
g_variant TYPE disvariant.
*First Define the parameter to give layout of Report variant.
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE text-003.
PARAMETERS: p_vari TYPE disvariant-variant.
SELECTION-SCREEN END OF BLOCK 3.
* Process on value request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
* Selection-Screen Checking
AT SELECTION-SCREEN.
PERFORM pai_of_selection_screen.
INITIALIZATION.
w_repid = sy-repid.
PERFORM variant_init.
* Get default variant
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
FORM f4_for_variant .
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
** ELSE.
** IF g_exit = space.
** ENDIF.
ENDIF.
ENDFORM. " f4_for_variant
FORM pai_of_selection_screen .
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM. " pai_of_selection_screen
FORM variant_init .
CLEAR g_variant.
g_variant-report = w_repid.
ENDFORM. " variant_init
**While Showing report pass the variant :::
g_save = 'A'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_structure_name = 'IT_MAIN'
is_layout = i_layout
is_print = i_print
it_fieldcat = i_fieldcat[]
it_events = i_events[]
i_save = g_save
is_variant = g_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Many Thanks / Himanshu Gupta -
HOW TO ADD NEW COLUMN IN EXISTING QUERY
hi,
i m working on oracle reorts 10g. i have a multiple query based report. now i want to add a new column in query 1 and order by on that new column .
i added column in query but when i see that group i dont find that column in that group.wt do i need to do to visible that column in query1 group thats y the order by on that column is not working i think.
tell how to solve it ?
thanksHi,
The new column you have added might be in the least level group of that query.
Drag it to the desired group level, first postion and set the break order for that item in the property pallette..
(If still the item not coming, check whether you have put 'comma' in the select query after writing the column name)
Simply giving the column in the order-by clause will not work in report.
In Report, record display order is completely based on the break-order of the items given in query-groups
If you change accordingly it will work
Regards
Dora -
How to add new fields in SAP-Query
Hi,
Can any body tell how to add new fields to the existing query.
Thanks a lot,
Bhaskar.hi,
when we create internal tables like. in final table you can include the extra fields.
data : begin of itab_mara,
matnr like mara-matnr,
erdat like mara-erdat,
end of itab_mara.
data : begin of itab_marc,
matnr like marc-matnr,
werks like marc-werks,
end of itab_marc.
data : begin of itab_final,
matnr like mara-matnr,
erdat like mara-erdat,
werks like marc-werks,
date like sy-datum,
status(10) type c, * new fields
end of itab_final.
<select statement>.
Append all the fields to itab.
loop at itab_final.
write :/ itab_final.
endloop.
Reward with points if helpful.
Message was edited by:
Vinutha YV -
How to create a tcode for abap query
how to create a transaction code for abap query,
i used a single table , my requirment is as i enter the tcode i should get the selectioin screen of my query.Hi
Follow this
. Make a transaction with parameters transaction from se93 .
2. Put START_REPORT in the transaction
3. Check the skip intial screen checkbox
4. in the table control in the end of screen put these values
D_SREPOVARI-REPORTTYPE = AQ
D_SREPOVARI-REPORT = <USER GROUP in WHICH THE QUERY IS CREATED> G
(G stands for GLOBAL AREA:)(Entered after a space)(G should come after 9
chanracters(8 char for user group,one space and then G)
D_SREPOVARI-EXTDREPORT = <QUERY NAME>
refer this:
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/how-to-assign-a-tcode-to-a-sap-query-579623
Regards
Shiva -
How to sort the fields in ABAP query.
Hi all
I am not able to drag the fields in Sort tool box.
Please help me how to add the fields in Sort tool bar.
Regards
GangiIn SQ01, when we are creating a query, we can define the default sort sequence & Totals also.
This can be done when defining the basic list. -
How to insert 2 conditions in a Query
Hi ,
How can i apply 2 conditions to a query
First i need to apply a condition X to query and then i need to apply condition Y to the results which are based on condition X
How can i acheve thisHi
We can create multiple condition in one query
When ever u select condition on tab it shows two options Chenge condition and new condition
If we have 2 comndition in one query it works with AND function .
If we have all applicable condition in one condition then it works with OR functionality.
Assign points -
How to add factory calender in ABAP Selection Screen?
Hi,
Anyone can guide me, how to add the factory or Holiday calender in ABAP Selection screen?
Thanks in advance.
VJ.Use the below code and it should work.
AT SELECTION-SCREEN on VALUE-REQUEST FOR p_date. "p_date is your selection screen field.
CALL FUNCTION 'F4_DATE'
EXPORTING
DATE_FOR_FIRST_MONTH = SY-DATUM
DISPLAY = ' '
FACTORY_CALENDAR_ID = 'US'
HOLIDAY_CALENDAR_ID = 'US'
IMPORTING
SELECT_DATE = p_date
The thing to note above is DISPLAY should NOT be 'X'. -
How to add a dynamic filter in query panel
I want to display the data in recent week, is it possible to add a dynamic filter in query panel?
eg. filter--> actionDate >= CurrentDate - 7
BO version: BOX I 3.1We are still trying to get this filter to work. Can anybody give us an example of how it should look on the sensor?
The sensor filter that we would like to create should exclude any source IP, any source port to specific destination hosts on all destination ports (icmp has none) from capturing events and storing them in the event store on the sensor.
This is the filter that we have so far on the sensor. Whats the problem with it?
service event-action-rules rules0
filters edit icmp-w-echo-filter-sensor-sensor-0-D
signature-id-range 2100
subsignature-id-range 0-255
attacker-address-range 0.0.0.0-255.255.255.255
victim-address-range a.b.c.x,a.b.c.y
attacker-port-range 0-65535
victim-port-range 0-65535
risk-rating-range 0-100
no actions-to-remove
deny-attacker-percentage 100
filter-item-status Enabled
stop-on-match False
no user-comment
exit
filters move icmp-w-echo-filter-sensor-sensor-0-D begin
exit -
Add field dynamically in ABAP Query Report.
Hi All,
Can we add fields dynamically in the ABAP Query Report?
There is a field in my report which should occupy the line only if it has value. But if we drag-drop the filed in the report it automatically occupy the line though it doesn't have value.
Thanks in Advance!!!hi rohini,
we can add fields dynamically in the ABAP Query Report,in this way we can to,
first of all u create ur selection-screen with all the fields and make the field invisible i.e the one which u want to add dynamically. and based on ur requirement change that invisible to visible and use modify screen.
in this way we can solve.
search for invisible and modify screen in sdn u can get better information and u can understand what i am saying. -
CRM2007 How to add a Web Dynpro ABAP application to a CRM business role
I am investigating CRM2007 UI framework and I cannot seem to find a way to add a custom made Web Dynpro ABAP Application (created in CRM 4.0) to a business role, or how to add a custom transaction created in classic ABAP (transaction created via se93, progam created via se38). Whatever I do, I only see BSP components. I am using transaction BSP_WD_CMPWB.
Next to this it seems you can add/integrate Visual Composer applications to (there is an entry in spro called "integration of the visual composer in BI"). However, I presume we first have to meet the requirements for the portal integration in SAP CRM 2007 as described in spro. If somebody knows how this works, that would be great!
kind regards
Angelique HeutinckHello Angelique,
It should be possible to call web dynpro applications from the L-shape menu of CRM UI (check transaction CRMC_UI_NBLINKS). As for the old GUI transactions, you can embedd them also via transaction launcher using CRMC_UI_NBLINKS (search for "transaction launcher" in this forum, there is plenty of information on it).
Best Regards,
Yevgen
Edited by: Yevgen Trukhin on Jun 19, 2008 11:53 AM
Maybe you are looking for
-
I cannot find my partner portal
I have not logged in for months. I try to log in then it forced a password reset - ok I did that then it would not accept me new password so I reset the password again. Then it worked !!! When I login to the partner portal url, using the login link a
-
Hi Top Link supports FOR UPDATE NOWAIT with query hint query.setHint(TopLinkQueryHints.PESSIMISTIC_LOCK, PessimisticLock.LockNoWait); but this is proprietary to Oracle and is not supported with My Sql. I am interested to know how top link behaves whe
-
Window Handles Lost When Using Compiz-Fusion
Well, I decided to try using compiz-fusion with LXDE, and as soon as I started up fusion-icon, my window title bars are gone. Only way I can get them is by setting my window manager to OpenBox, but that means not being able to use compiz-fusion's ey
-
How do I validate the data that the user inputs through the prompts? Example: End date is not earlier than start date, or End Date - Start Date <= 12 months? Any direction is appreciated
-
Textboxes dependant on quantity dropdown
I want to be able to choose how many textboxes come up when I select a quantity from a dropdown select. currently I have a div which is hidden but holds all the textboxes. <script language="JavaScript"> function hideSomeControls(value){ var os0 = doc