Check Boxes in ALV (parent-child relation)
Hi Friends...
I am trying to display some data in ALV using the parent child relationship. I require the first field of the parent record to be a check box which is input enabled.
Whatever i tried the check box is not comming as the first field, instead it comes second after the key field (the link btw the parent and the child).
If anyone of you knows how to tackle the issue please help..
Thanks,
Derek
Hi Friends...
I am trying to display some data in ALV using the parent child relationship. I require the first field of the parent record to be a check box which is input enabled.
Whatever i tried the check box is not comming as the first field, instead it comes second after the key field (the link btw the parent and the child).
If anyone of you knows how to tackle the issue please help..
Thanks,
Derek
Similar Messages
-
Representating Hierarchical (Parent-Child) relation graphically using Swing
Hi,
I have to represent a hierarchical data which is having Parent-Child relation using Swing. I am not able to upload the image overhere, so I am represnting the data in such a way so that one can understand this problem. If anyone knows how to upload image on Sun forum, please let me know it will be great help for me.
Parent Root - A
Child of A - B, C, D
Child of C - E, F, G
Child of F - H
Child of D - J, K
The data needs to be represented in two formats-
1. Tabular Format
I am able to represent data in this format using combination of JTree and JTable. The data is getting represented in tabular format and I am able to expand and collapse the parent nodes to see the childs. The tabular data will look like below structure,
A
I_B
I
I_C
I I_E
I I
I I_F
| I |_H
| I
I I_G
I
I_D
I
I_J
I
I_K
2. Graphical Format
This is the other way in which I need to represent the data. The above shown tabular data needs to represented in graphical form. The end result should look like,
I A I
____________________I__________________________
___I___ __I__ __I__
I B I I C I I D I
____________________I____________ ______I________
___I___ __I__ __I__ __I__ ___I__
I E I I F I I G I I J I I K I
__I___
I H I
Each box representing alphabates will be a component (like JPanel) which will have details about the item to be displayed. The parent and child should be connected with each other using line. This representation should be created at runtime using the hierarchical data. Also the parent and child relations should be expandable/collapsible as they are in JTree.
I am not able to find any component or any solution in Swing which can provide me this graphical representation. It will be great help if anyone can help me out in this.
Thanks in advance.Sorry for inconvinience for the data representaion in graphical form. I don't know how this get jumblled. Please try to figure out the tabular/graphical representation using pen and paper as forum is not providing any help to upload an image.
Sorry again for inconvinience.
Thanks
Manoj Rai -
Hi experts,
Please check it my code . in this procedure first cursor only inserted into t1 temp table not inserted second cursor please check it and modified the my code.
i want inserted parent child relation table like bellow
parent child
a b
a c
a d
b l
b m
b n
c d like that only inserted
PROCEDURE TEST_PARENTS_CHILD( p_TABLE VARCHAR2)
IS
CURSOR c(P_TABLE varchar2)
IS
SELECT p.table_name PARENT, c.table_name CHILD
FROM user_constraints p, user_constraints c
WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
AND c.constraint_type = 'R'
AND p.constraint_name = c.r_constraint_name
AND p.table_name = P_TABLE;
CURSOR C1(p_child varchar2) IS SELECT p.table_name PARENT_TABLE, c.table_name CHILD_TABLE
FROM user_constraints p, user_constraints c
WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
AND c.constraint_type = 'R'
AND p.constraint_name = c.r_constraint_name
AND p.table_name = P_CHILD;
type array
IS
TABLE OF T1%ROWTYPE INDEX BY PLS_INTEGER;
t_data ARRAY;
BEGIN
FOR I IN C(P_TABLE)
LOOP
FETCH C bulk collect INTO T_DATA limit 1000;
--- EXIT WHEN C%NOTFOUND;
FORALL I IN 1..T_DATA.last
INSERT INTO T1 VALUES T_DATA(I);
FOR J IN C1(i.CHILD)
LOOP
FETCH C1 BULK COLLECT INTO T_DATA LIMIT 1000;
--EXIT
--WHEN C1%NOTFOUND;
FORALL j IN 1..T_DATA.last
INSERT INTO T1 VALUES T_DATA(j);
end loop;
END LOOP;
END TEST_PARENTS_CHILD;
Regards,
VenkatYou've been asked before on your previous questions (all of which still appear to be unanswered) to read the FAQ: {message:id=9360002} and post correct details of your question, and use {noformat}{noformat} tags to preserve your code/data formatting on the forum.
But still you post a question lacking all the information and formatting. If you can't be bothered to help us understand your issue (and read your code), why do you expect others will be bothered to try and help you? -
Parent child relation in OBIEE -RPD Issue
Hi,
I created a star schema by taking two tables . Now i want to establish parent-child relation ship .
Now by clicking create logical dimension ----->Dimension with parent-child hierarchy ,the member key is not found.Pls correct me where i went wrong .
Thanks-BhaskarI know you said you have primary key defined already but just to make sure, can you follow these steps:
1) Double click on dimension table
2) go to tab 'Keys'. check if your primary key is defined there.
3) If not, in 'Key Name', type in the key name
4) select the primary key(column) in 'Columns'.
5) Click OK.
and then try to create hierarchy by following these steps:
1) Right Click on the dimension table
2) Create Logical Dimension -> Dimension with Parent-Child Hierarchy...
3) Click OK (if you are OK with default values) -
How to get check box in alv output
hi gurus
can anyone explian me how to get check box in alv output
it should not be a pop up window
i want to get in output itself
tahnk you
regards
kals.Hi
by using rs_selfield
ty to call dynamic subroutine..
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
read table rs-selfield with key cond = 'X'
endform.
see the below example
REPORT Z_GET_REFRESH no standard page heading.
type-pools : slis.
tables : makt,
mara.
data : i_fieldcat type slis_t_fieldcat_alv.
CONSTANTS :
gc_refresh TYPE syucomm VALUE '&REFRESH'.
data : begin of i_makt occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of i_makt.
data : v_repid like sy-repid,
g_user_command type slis_formname value 'USER_COMMAND',
g_status_set type slis_formname value 'SET_PF_STATUS',
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
DATA:LC_GLAY TYPE LVC_S_GLAY.
select-options s_matnr for mara-matnr .
start-of-selection.
select matnr maktx from makt into table i_makt
where matnr in s_matnr.
end-of-selection.
Fill the fieldcatlog
perform fill_field.
Call the FM
perform call_fm.
*& Form fill_field
text
--> p1 text
<-- p2 text
FORM fill_field.
data wa_fieldcat type slis_fieldcat_alv.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-outputlen = '18'.
wa_fieldcat-seltext_l = 'Material #'.
wa_fieldcat-col_pos = '1'.
append wa_fieldcat to i_fieldcat.
clear : wa_fieldcat.
wa_fieldcat-tabname = 'I_MAKT'.
wa_fieldcat-fieldname = 'MAKTX'.
wa_fieldcat-outputlen = '40'.
wa_fieldcat-seltext_l = 'Material Desc'.
wa_fieldcat-col_pos = '2'.
append wa_fieldcat to i_fieldcat.
ENDFORM. " fill_field
*& Form call_fm
text
--> p1 text
<-- p2 text
FORM call_fm.
v_repid = sy-repid.
LC_GLAY-EDT_CLL_CB = 'X'.
CLEAR ls_event_exit.
ls_event_exit-ucomm = gc_refresh. " Refresh
ls_event_exit-after = 'X'.
APPEND ls_event_exit TO lt_event_exit.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = g_status_set
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS = LC_GLAY
IS_LAYOUT =
IT_FIELDCAT = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT = lt_event_exit
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_makt
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.
ENDFORM. " call_fm
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
data i_RSPARAMS like RSPARAMS occurs 0.
CASE R_UCOMM.
WHEN '&IC1'.
read table i_makt index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
if not i_makt-matnr is initial.
call transaction 'MM02' and skip first screen.
endif.
when '&REFRESH'.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = v_repid
IMPORTING
SP =
TABLES
SELECTION_TABLE = i_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 2
OTHERS = 3
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
submit z_get_refresh with selection-table i_RSPARAMS.
rs_selfield-refresh = 'X'.
ENDCASE.
MOVE '&REFRESH' TO r_ucomm.
ENDFORM.
FORM set_pf_status *
FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
DELETE Rt_extab WHERE fcode = gc_refresh.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
EXCLUDING Rt_extab.
*SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. -
How to get check box in alv grid list output
hi gurus,
can anyone inform me
how to get check box in alv output it should not be a pop up window
thank you
regards
kals.or
hi go through the fallowing code.
code*&----
*& Report YGS_ALV_BOM *
REPORT YGS_ALV_BOM .
TABLES : MAST,STKO,STPO.
TYPE-POOLS: SLIS.
TYPES : BEGIN OF TY_MAST,
CHECK_BOX,
MATNR TYPE MAST-MATNR,
WERKS TYPE MAST-WERKS,
STLAN TYPE MAST-STLAN,
STLNR TYPE MAST-STLNR,
STLAL TYPE MAST-STLAL,
END OF TY_MAST.
TYPES : BEGIN OF TY_STKO,
STLTY TYPE STKO-STLTY,
STLNR TYPE STKO-STLNR,
STLAL TYPE STKO-STLAL,
STKOZ TYPE STKO-STKOZ,
BMENG TYPE STKO-BMENG,
BMEIN TYPE STKO-BMEIN,
END OF TY_STKO.
TYPES : BEGIN OF TY_STPO,
LIGHTS,
STLTY TYPE STPO-STLTY,
STLNR TYPE STPO-STLNR,
STLKN TYPE STPO-STLKN,
STPOZ TYPE STPO-STPOZ,
IDNRK TYPE STPO-IDNRK,
MENGE TYPE STPO-MENGE,
MEINS TYPE STPO-MEINS,
END OF TY_STPO.
DATA : IT_MAST TYPE TABLE OF TY_MAST,
WA_MAST TYPE TY_MAST,
IT_STKO TYPE TABLE OF TY_STKO,
WA_STKO TYPE TY_STKO,
IT_STPO TYPE TABLE OF TY_STPO,
WA_STPO TYPE TY_STPO.
DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_layout TYPE slis_layout_alv,
ls_event TYPE slis_alv_event,
lt_event TYPE slis_t_event,
it_sortinfo type slis_t_sortinfo_alv,
ls_header TYPE slis_listheader,
lt_header TYPE slis_t_listHEADER.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT.
END-OF-SELECTION.
PERFORM DISPLAY_DATA.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form GET_DATA .
REFRESH : IT_MAST.
SELECT MATNR
WERKS
STLAN
STLNR
FROM MAST
INTO CORRESPONDING FIELDS OF TABLE IT_MAST
WHERE MATNR IN S_MATNR.
endform. " GET_DATA
*& Form BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'MATNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'WERKS'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_MAST'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'MAST'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
--> p1 text
<-- p2 text
form BUILD_LAYOUT .
CLEAR LS_LAYOUT.
LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
form DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_MAST
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.
endform. " DISPLAY_DATA
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
EXCLUDING RT_EXTAB.
ENDFORM.
FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM.
WHEN '&NEXT'.
PERFORM GET_DATA_BOM .
PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
PERFORM BUILD_LAYOUT_BOM.
PERFORM DISPLAY_DATA_BOM.
ENDCASE.
ENDFORM.
*& Form GET_DATA_BOM
text
--> p1 text
<-- p2 text
form GET_DATA_BOM .
CLEAR : WA_STPO,
WA_MAST.
REFRESH : IT_STPO.
DATA : IT_CHECK TYPE TABLE OF TY_MAST.
LOOP AT IT_MAST INTO WA_MAST.
IF WA_MAST-CHECK_BOX EQ 'X'.
APPEND WA_MAST TO IT_CHECK.
ENDIF.
ENDLOOP.
SELECT STLTY
STLNR
STLKN
VGKNT
IDNRK
MENGE
MEINS
FROM STPO
INTO CORRESPONDING FIELDS OF TABLE IT_STPO
FOR ALL ENTRIES IN IT_CHECK
WHERE IDNRK EQ IT_CHECK-MATNR.
CLEAR WA_STPO.
LOOP AT IT_STPO INTO WA_STPO.
SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
IF SY-SUBRC = 0.
WA_STPO-LIGHTS = '2'.
ELSE.
WA_STPO-LIGHTS = '1'.
ENDIF.
MODIFY IT_STPO FROM WA_STPO.
ENDLOOP.
endform. " GET_DATA_BOM
*& Form BUILD_FIELDCAT_BOM
text
--> p1 text
<-- p2 text
form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
REFRESH : LT_FIELDCAT.
L_FIELDCAT-COL_POS = 1.
L_FIELDCAT-FIELDNAME = 'STLTY'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 2.
L_FIELDCAT-FIELDNAME = 'STLNR'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 3.
L_FIELDCAT-FIELDNAME = 'STLKN'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 4.
L_FIELDCAT-FIELDNAME = 'IDNRK'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
L_FIELDCAT-COL_POS = 5.
L_FIELDCAT-FIELDNAME = 'MENGE'.
L_FIELDCAT-TABNAME = 'IT_STPO'.
L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
L_FIELDCAT-REF_TABNAME = 'STPO'.
APPEND L_FIELDCAT TO LT_FIELDCAT.
endform. " BUILD_FIELDCAT_BOM
*& Form BUILD_LAYOUT_BOM
text
--> p1 text
*<-- p2 text
form BUILD_LAYOUT_BOM .
CLEAR : LS_LAYOUT.
LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
endform. " BUILD_LAYOUT_BOM
*& Form DISPLAY_DATA_BOM
text
--> p1 text
<-- p2 text
form DISPLAY_DATA_BOM .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_BOM'
I_CALLBACK_TOP_OF_PAGE = 'TOP9'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_STPO
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.
endform. " DISPLAY_DATA_BOM
FORM TOP9 .
CLEAR LS_HEADER.
REFRESH LT_HEADER.
LS_HEADER-TYP = 'H'.
LS_HEADER-INFO = 'BILL OF MATERIALS'.
APPEND LS_HEADER TO LT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LT_HEADER
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
ENDFORM.
FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
SEL_FIELD TYPE SLIS_SELFIELD.
CASE RF_UCOMM_BOM.
WHEN '&IC1'.
SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
ENDCASE.[/code] -
How to create check box in ALV Reports?
how to create check box in ALV Reports?
Hi
check the report BCALV_TEST_GRID_EDITABLE
or
check this report
REPORT ZRFC346_TST.
TABLES:SFLIGHT,RL034.
TYPE-POOLS:SLIS.
INCLUDE:<ICON>,<SYMBOL>.
DATA: G_REPID LIKE SY-REPID,
G_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
G_IT_SORT TYPE SLIS_T_SORTINFO_ALV,
G_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME,
G_KEYINFO TYPE SLIS_KEYINFO_ALV,
G_VARIANT LIKE DISVARIANT,
G_EXTAB TYPE SLIS_T_EXTAB,
I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
DATA: XEVENT TYPE SLIS_T_EVENT,
AEVENT TYPE SLIS_ALV_EVENT,
VARIANT LIKE DISVARIANT,
LAYOUT TYPE SLIS_LAYOUT_ALV,
ASP_GROUP TYPE SLIS_SP_GROUP_ALV,
GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
EXTAB TYPE SLIS_T_EXTAB WITH HEADER LINE,
XFIELD TYPE SLIS_T_FIELDCAT_ALV,
AFIELD TYPE SLIS_FIELDCAT_ALV,
G_SUCOMM LIKE SY-UCOMM,
G_SELFLD TYPE SLIS_SELFIELD.
DATA: SAV_SY_REPID LIKE SY-REPID.
CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
CON_DISPLAY_FULL TYPE I VALUE 3.
Data to be displayed
DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
INCLUDE STRUCTURE SFLIGHT.
DATA:ACTIVATE(1).
DATA: END OF GT_SFLIGHT.
INITIALIZATION.
*........Initialisierung...............................................
PERFORM INITIALIZATION_RL034.
*........Field cata....................................................
PERFORM FIELD_CAT.
*........SPECIAL GROUP.................................................
PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
START-OF-SELECTION.
Selection
SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
*........ALV CALL.......................................................
PERFORM ALV_CALL.
PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
FORM USER_COMMAND_LOCAL *
--> G_UCOMM *
--> G_SELFIELD *
FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
G_SELFIELD TYPE SLIS_SELFIELD.
CASE G_UCOMM.
WHEN 'ACT'.
ENDCASE.
ENDFORM.
FORM ALV_CALL *
FORM ALV_CALL.
Call ABAP List Viewer (ALV)
G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_BYPASSING_BUFFER = SPACE
I_BUFFER_ACTIVE = SPACE
I_CALLBACK_PROGRAM = SAV_SY_REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_LOCAL'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'SFLIGHT'
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = G_LAYOUT
IT_FIELDCAT = XFIELD[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
IT_SORT =
IT_FILTER =
IS_SEL_HIDE = 'X'
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = XEVENT
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = GT_SFLIGHT
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.
ENDFORM.
FORM status *
--> EXTAB *
FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STAT' EXCLUDING EXTAB.
ENDFORM. " STATUS
*& Form INITIALIZATION_RL034
text
--> p1 text
<-- p2 text
FORM INITIALIZATION_RL034.
SAV_SY_REPID = SY-REPID.
ENDFORM. " INITIALIZATION_RL034
*& Form DEFINE_EVENTS_RL034
text
--> p1 text
<-- p2 text
FORM DEFINE_EVENTS_RL034.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = XEVENT.
exceptions
list_type_wrong = 1
others = 2.
ENDFORM. " DEFINE_EVENTS_RL034
*& Form FIELD_CAT
text
--> p1 text
<-- p2 text
FORM FIELD_CAT.
DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
L_LIN TYPE I.
REFRESH XFIELD.
1. per Default eingeblendete Felder *
*........Ikone/Symbol..................................................
CLEAR AFIELD.
DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
L_LIN1 TYPE I.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = CON_SFLIGHT
I_BYPASSING_BUFFER = SPACE
I_BUFFER_ACTIVE = SPACE
CHANGING
CT_FIELDCAT = XFIELD
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
DESCRIBE TABLE XFIELD LINES L_LIN1.
ADD 1 TO L_LIN1.
CLEAR LS_FCAT.
LS1_FCAT-FIELDNAME = 'ACTIVATE'.
LS1_FCAT-CHECKBOX = 'X'.
LS1_FCAT-KEY = 'X'.
LS1_FCAT-INPUT = 'X'.
LS1_FCAT-EDIT = 'X'.
LS1_FCAT-INTTYPE = 'C'.
LS1_FCAT-DATATYPE = 'CHAR'.
LS1_FCAT-INTLEN = 1.
LS1_FCAT-COL_POS = L_LIN1.
LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
LS1_FCAT-SP_GROUP = 'A'.
APPEND LS1_FCAT TO XFIELD.
ADD 1 TO L_LIN.
ENDFORM. " FIELD_CAT
FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
CLEAR LS_SP_GROUP.
LS_SP_GROUP-SP_GROUP = 'A'.
LS_SP_GROUP-TEXT = 'SPECIAL'.
APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
ENDFORM.
Regards
Shiva -
Why in case of parent child relation iterator fetching one duplicate record
Hi,
JDev Ver : 11.1.1.2.0
Technology : JPA/TopLik Service Facade Data Control (Without using BC4J)
I have created JPA/TopLink service facade from DB Tables and on facades I have crated DataControl which I have draged and droped on my screen to create input text, table etc.
In my application, I have many tables having one to many relationships. (Primarykey foreign key).
When I add more then one child columns (foreign key columns) for any one parent column (primary key column), in db its getting inserted properly but in iterator after refreshing also it showing one duplicate entry instead of actual entry.
e.g.
For one Account Id 1234 (primary key) , I am adding 3 account holders name (abc, xyz, pqr) in this case in db its inserting proper 3 entries but in iterator its showing
1234 abc
1234 xyz
1234 abc
so instead of pqr its again showing abc.
To select account holders name I have used selectManyShuttle components.
I have also tried tried dciter.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED); to refresh iterator.
This is generic problem on most of the screen in my application where parent child relation comes.
regards,
devangHi,
Thanks for your reply. I just emailed the screen shot to your email . Please verify and let me know your comment.
Regards,
Kiran Konjeti -
How to delete parent child relation in Toplink
Hi All,
I have 3 tables A,B,C.
In Table A ,I am saving record.
Table B & C has parent child relation.
B-->Parent
C-->Child
So I want to save records in Table A.
And delete from child(C) 1st then from parent(B).
I m writing my code as,
em.getTransaction().begin();
em.persist(Table A);//save in Table A
em.remove(em.merge(Table B));//Remove from Parent
But how to delete records from child table then from parent table.
Thanks
SandipIf you have a @OneToOne relationship between two entities, the join column information is used to order the SQL when you remove two entities. For example, if I have:
@Entity
public class Employee implements Serializable {
@OneToOne
@JoinColumn(name="ADDR_ID")
private Address address;
...Then the following code runs regardless of the order of the remove calls.
em.getTransaction().begin();
Employee parent = new Employee();
Address child = new Address();
parent.setAddress(child);
em.persist(parent);
em.persist(child);
em.getTransaction().commit();
em.getTransaction().begin();
parent = em.merge(parent);
child = em.merge(child);
// order of next two statements unimportant
em.remove(parent);
em.remove(child);
em.getTransaction().commit();If I don't remove the parent and just the child I get the same error you do because of the FK from Employee to Address.
--Shaun -
Parent Child relation in one transaction throws error... (
In nutshell, I have a parent->child relation ship in DB and due to the UI requirement, I created view link as Child->parent, it is giving a hack a lot of problems.... (it sounds silly but looks like I am loosing my mind over this)
Let me explain my situation,
- I have a table A with col-a and col-b. I have another table B with col-a (primary key) and col-c. (This way table A is a parent table)
- ON UI side i created relationship like table B is parent and Table A is child using col-a
- I need to create parent-child (one record for each) record programatically.........
I tried following thing:
- from backing bean, as soon as i create Table-B row first, i get error saying too many objects with same key (which is understandable because of table design..... and associaion must be throwing that error)
- from EOImpl file, it doesn't even find the child record being created... so during commit I can't send the foreign key value from Table-a to Table-b
Any suggestion is greatly appreciated?
Thank you,
-Rajthat depends on how you implement the multiple selection of orders.. you have to pass the selectedValues to the backend or store the values in a map or list and pass it..
-
Changing into parent-child relation
Hi,
I have a table which has the following fields and the table gives the identifier for parent-child relation:
ID
PARENT ID
structure
parentkey_field
foreignkey_field
Fields[]
data[]
1.ID is the numbering like 1,2,3...
2.PARENT ID will give the relation like which structure is the child for which structure.
Example: I have two structures HEADER and ITEM.Then the IDs will be 1 and 2.The parent id for ITEM will be 1(ID OF HEADER).
3.Structure is the header/item structure names.
4.parentkey_field and foreignkey_field are defining the header-child relation identifier fields.
5.fields[] is the table with all the fields of header and item.
6.DATA[] is the table having the data of header/item fields.
Now my requirement is to flatten this table into one more table(with field structure_name,fieldname,value) with parent-child relation.
Can anyone suggest something.It would be better if you posted the code you tried first and then having others help you with what's wrong. Flattening a hierarchy is not that difficult; why don't you give it a shot first?
-
Add check box in ALV output List.
Hi
I want to add check box in alv out put list . i m trying but not getting succsses .
please tell me the process .
thanks
chandraHi Chandra,
Types: begin of ty_output,
u201C Included these two types in your output structure.
celltab TYPE lvc_t_styl,
checkbox TYPE c,
end of ty_output.
Data: it_output type standard table of ty_output,
wa_output type ty_output.
Loop at it_output into wa_output.
* Initially, set all checkbox cells editable.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT ls_celltab INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO TABLE wa_coupon-celltab.
MODIFY it_coupon FROM wa_coupon TRANSPORTING celltab.
Endloop.
Form build_field_catalog.
wa_fieldcat-fieldname = 'CHECKBOX'.
ADD 1 TO wf_pos.
wa_fieldcat-col_pos = wf_pos.
wa_fieldcat-datatype = 'C'.
wa_fieldcat-outputlen = '6'.
wa_fieldcat-reptext = 'Select'.
wa_fieldcat-coltext = 'Select'.
wa_fieldcat-seltext = 'Select'.
wa_fieldcat-tooltip = 'Select'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-key = ''.
wa_fieldcat-icon = ''.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
Endform.
Form display_alv.
ls_variant-report = sy-cprog..
gs_layout-stylefname = 'CELLTAB'. u201C Please do not forget to include this statement
gs_layout-zebra = 'X'.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fieldcat.
CLEAR gt_fieldcat.
Endform.
Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 4:31 PM -
Hi All,
I have developed ALV hierarchical report with check boxes for header and item records.
If i select header checkbox, the corresponding item records checkboxes should be selected automatically, here after selecting header checkbox i have to press some push button(like Refresh) then only item check boxes getting selected,
but here my req. is without clicking any button item checkboxes should be checked automatically if corresponding header check box is selected.
If anybody have an idea pls get back to me.
Regards,
AshwinHi,
Construct a field catalogue as follows:
DATA: z_fieldcat TYPE slis_fieldcat_alv
Then set the checkbox related fields fields like:
z_fieldcat-seltext_l = 'Checkbox'.
z_fieldcat-checkbox = 'X'. " Display this field as a checkbox
z_fieldcat-edit = 'X'. " This option ensures that you can
" edit the checkbox. Else it will
" be protected.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jan 30, 2008 5:35 PM -
Can any one please give me any test program for displaying checkboxes in the ALV Report Layout .
Points will be rewarded even for helpfull answers.
Thanks ,
Veerendranath Maddula.Hi Veerendranath,
below is the sample code for that,
TYPES:
BEGIN OF TY_VB_AKAP,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
POSNR TYPE POSNR_VA, "Item Number
MATNR TYPE MATNR, "Material Number
PMATN TYPE PMATN, "Pricing Reference Material/Newly Created Material
KWMENG TYPE KWMENG, "Cumulative Order Qty. in Sales Units
VRKME TYPE VRKME, "Sales Unit
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
VKAUS TYPE ABRVW, "Usage Indicator
WAERK TYPE WAERK, "SD Document Currency
END OF TY_VB_AKAP,
BEGIN OF TY_MARA,
MATNR TYPE MATNR, "Material Number
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
END OF TY_MARA,
BEGIN OF TY_MVKE,
MATNR TYPE MATNR, "Material Number
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KONDM TYPE KONDM, "Material Pricing Group
*--Begin of changes for the change request 2007096--26th July 2007--
VRKME TYPE VRKME, "Sales Unit according to the Material Master
*--End of changes for the change request 2007096--26th July 2007--
END OF TY_MVKE,
BEGIN OF TY_VBKD,
VBELN TYPE VBELN_VA, "Sales Document
POSNR TYPE POSNR_VA, "Item Number
BSTKD_E TYPE BSTKD_E, "Used to capture New Material Number
END OF TY_VBKD,
BEGIN OF TY_IHEADER,
SELECT(1) TYPE C, "Check Box
VBELN TYPE VBELN, "Sales Document
KUNNR TYPE KUNAG, "Sold-to Party
END OF TY_IHEADER,
BEGIN OF TY_MESSAGE1,
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KUNNR TYPE KUNAG, "Customer number
KONDM TYPE KONDM, "Material pricing group
ZCOUNT(2) TYPE N, "Zcount
MSGTYP(1) TYPE C, "Message type
TEXT TYPE STRING, "Message text
END OF TY_MESSAGE1,
*--Begin of changes for the change request 2007106--25th July 2007--
BEGIN OF TY_MESSAGE1_2,
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KUNNR TYPE KUNAG, "Customer number
KONDM TYPE KONDM, "Material pricin
MSGTYP(1) TYPE C, "Message type
TEXT TYPE STRING, "Message text
END OF TY_MESSAGE1_2,
*--End of changes for the change request 2007106--25th July 2007--
BEGIN OF TY_MESSAGE2,
VKORG TYPE VKORG, "Sales Organization
VTWEG TYPE VTWEG, "Distribution Channel
KUNNR TYPE KUNAG, "Customer number
MATNR TYPE MATNR, "Material Number
MSGTYP(1) TYPE C, "Message type
TEXT TYPE STRING, "Message text
END OF TY_MESSAGE2,
BEGIN OF TY_IFINAL,
VBELN TYPE VBELN_VA, "Sales Document
KWMENG TYPE KWMENG, "Cumulative Order Qty. in Sales Units
POSNR TYPE POSNR_VA, "Item Number
KUNNR TYPE KUNAG, "Sold-to party
MATNR TYPE MATNR, "Material Number
VRKME TYPE VRKME, "Sales Unit
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
VKAUS TYPE ABRVW, "Usage Indicator
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
PMATN TYPE PMATN, "Pricing Reference Material/Newly Created Material
KONDM TYPE KONDM, "Material Pricing Group
*--Begin of changes for the change request 2007096--26th July 2007--
WAERK TYPE WAERK, "SD Document Currency
*--End of changes for the change request 2007096--26th July 2007--
END OF TY_IFINAL,
BEGIN OF TY_ACC1,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
KONDM TYPE KONDM, "Material Pricing Group
ZCOUNT(2) TYPE N, "ZCount indicator
KSTBM TYPE KSTBM, "Quantity
VRKME TYPE VRKME, "Sales Unit
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
ERROR(1) TYPE N, "Error Field
*--Begin of changes for the change request 2007096--26th July 2007--
WAERK TYPE WAERK, "SD Document Currency
*--End of changes for the change request 2007096--26th July 2007--
END OF TY_ACC1,
Important Note : Earlier there were only three accesses and hence this below type was coded as TY_ACC2 depicting
the type for internal table as a holder of data for second access sequence, but later a new access sequence was
introduced and was introduced as the second access by itself and hence the sequence which was previously considered
as second access is going to be third access sequence in reality. The naming standards that are going to be followed
for the newly introduced access sequence would be XXX_1_2. (For Change request 2007106)
BEGIN OF TY_ACC2,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
MATNR TYPE MATNR, "Material Number
KSTBM TYPE KSTBM, "Cumulative Order Qty. in Sales Units
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
VRKME TYPE VRKME, "Sales Unit
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
ERROR(1) TYPE N, "Error field
*--Begin of changes for the change request 2007096--26th July 2007--
WAERK TYPE WAERK, "SD Document Currency
*--End of changes for the change request 2007096--26th July 2007--
END OF TY_ACC2,
*--Begin of changes for the change request 2007106--24th July 2007--
BEGIN OF TY_ACC1_2,
VBELN TYPE VBELN_VA, "Sales Document
KUNNR TYPE KUNAG, "Sold-to party
KONDM TYPE KONDM, "Material Pricing Group
KSTBM TYPE KSTBM, "Quantity
VRKME TYPE VRKME, "Sales Unit
ZZTECHSPEC TYPE ZTECHSPEC, "Technical Specification
KZWI1 TYPE KZWI1, "Sub Total 1 from pricing procedure for condition
ERROR(1) TYPE N, "Error field
*--Begin of changes for the change request 2007096--26th July 2007--
WAERK TYPE WAERK, "SD Document Currency
*--End of changes for the change request 2007096--26th July 2007--
END OF TY_ACC1_2,
*--End of changes for the change request 2007106--24th July 2007--
*--Begin of changes for the change request 2007096--26th July 2007--
BEGIN OF TY_T006,
MSEHI TYPE MSEHI, "Unit of Measurement
ZAEHL TYPE DZAEHL, "Numerator for conversion to SI unit
NENNR TYPE NENNR, "Denominator for conversion into SI unit
END OF TY_T006,
*--End of changes for the change request 2007096--26th July 2007--
*--Begin of changes for the change request xxx--2nd Aug 2007--
*Types of MARM table
BEGIN OF TY_MARM,
MATNR TYPE MATNR, " Material Number
MEINH TYPE LRMEI, " Alternative Unit of Measure
UMREZ TYPE UMREZ, " Numerator for Conversion to Base UOM
UMREN TYPE UMREN, " Denominator for Conversion to Base UOM
END OF TY_MARM.
*--End of changes for the change request xxx--2nd Aug 2007--
D A T A *
Internal Table Declarations
DATA: T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV, "Fieldcatalog IT
T_EVENTS TYPE SLIS_T_EVENT, "Event IT
T_HEADER TYPE SLIS_T_LISTHEADER, "Header IT
T_VB_AKAP TYPE STANDARD TABLE OF TY_VB_AKAP, "To hold records from VBAK & VBAP Table
T_MARA TYPE STANDARD TABLE OF TY_MARA, "To hold records from MARA Table
T_MVKE TYPE STANDARD TABLE OF TY_MVKE, "To hold records from MVKE Table
T_VBKD TYPE STANDARD TABLE OF TY_VBKD, "To hold records from VBKD Table
T_IHEADER TYPE STANDARD TABLE OF TY_IHEADER, "To hold records from VBAK Table
T_IFINAL TYPE STANDARD TABLE OF TY_IFINAL, "To hold cumulative data for ALV
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA, "IT for bdcdata
T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL, "IT for error messages
T_MESSAGE1 TYPE STANDARD TABLE OF TY_MESSAGE1, "IT for conditions1 messages
*--Begin of changes for the change request 2007106--25th July 2007--
T_MESSAGE1_2 TYPE STANDARD TABLE OF TY_MESSAGE1_2,"ITfor conditions1_2 messages
*--End of changes for the change request 2007106--25th July 2007--
T_MESSAGE2 TYPE STANDARD TABLE OF TY_MESSAGE2, "IT for conditions2 messages
T_ACC2 TYPE STANDARD TABLE OF TY_ACC2, "IT for holding data for Second Access Sequence Processing
T_ACC1 TYPE STANDARD TABLE OF TY_ACC1, "IT for holding data for First Access Sequence Processing
T_SELECT TYPE STANDARD TABLE OF RSPARAMS, "IT for holding data related to the selection screen
*--Begin of changes for the change request 2007106--24th July 2007--
T_ACC1_2 TYPE STANDARD TABLE OF TY_ACC1_2, "IT for holding data for new intermediate Access Sequence
*--End of changes for the change request 2007106--24th July 2007--
*--Begin of changes for the change request 2007096--26th July 2007--
T_T006 TYPE STANDARD TABLE OF TY_T006, "IT for holding T006 Entries
*--End of changes for the change request 2007096--26th July 2007--
*--Begin of changes for the change request xxx--2nd Aug 2007--
T_MARM TYPE STANDARD TABLE OF TY_MARM, "IT for holding entries from MARM
*--End of changes for the change request xxx--2nd Aug 2007--
Work area Declarations
W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV, "Fieldcatalog WA
W_EVENT TYPE SLIS_ALV_EVENT, "Event WA
W_HEADER TYPE SLIS_LISTHEADER, "Header WA
W_LAYOUT TYPE SLIS_LAYOUT_ALV, "Layout WA
W_KEYINFO TYPE SLIS_KEYINFO_ALV, "Key Information WA
W_VB_AKAP TYPE TY_VB_AKAP, "To hold records from T_VB_AKAP
W_MARA TYPE TY_MARA, "To hold records from T_MARA
W_MVKE TYPE TY_MVKE, "To hold records from T_MVKE
W_VBKD TYPE TY_VBKD, "To hold records from T_VBKD
W_IHEADER TYPE TY_IHEADER, "To hold records from T_IHEADER
W_IFINAL TYPE TY_IFINAL, "To hold records from T_IFINAL
W_PARAMS TYPE CTU_PARAMS, "CTU Params
W_BDCDATA TYPE BDCDATA, "Work Area for BDCDATA
W_BDCMSGCOLL TYPE BDCMSGCOLL, "Work Area to collect BDC Messages
W_MESSAGE1 TYPE TY_MESSAGE1, "WA for price conditions1 messages
*--Begin of changes for the change request 2007106--25th July 2007--
W_MESSAGE1_2 TYPE TY_MESSAGE1_2, "WA for price conditions1_2 messages
*--End of changes for the change request 2007106--25th July 2007--
W_MESSAGE2 TYPE TY_MESSAGE2, "WA for price conditions2 messages
W_ACC2 TYPE TY_ACC2, "WA for holding records from T_ACC2
W_ACC1 TYPE TY_ACC1, "WA for holding records from T_ACC1
*--Begin of changes for the change request 2007106--24th July 2007--
W_ACC1_2 TYPE TY_ACC1_2, "WA for holding records from T_ACC1_2
*--End of changes for the change request 2007106--24th July 2007--
*--Begin of changes for the change request 2007096--26th July 2007--
W_T006 TYPE TY_T006, "WA for holding T_T006 Entries
*--End of changes for the change request 2007096--26th July 2007--
*--Begin of changes for the change request xxx--2nd Aug 2007--
W_MARM TYPE TY_MARM, "WA for holding entries of T_MARM
*--End of changes for the change request xxx--2nd Aug 2007--
Variable declarations
G_VKORG TYPE VKORG, "Sales Organization
G_VTWEG TYPE VTWEG, "Distribution Channel
G_AUDAT TYPE AUDAT, "Document Date (Date Received/Sent)
G_VBELN TYPE VBELN_VA, "Sales Document
G_KUNNR TYPE KUNAG, "Sold-to party
G_MATNR TYPE MATNR, "Material Number
G_REPID TYPE SY-REPID, "Program Name
G_MESSAGE(73) TYPE C, "To Capture Message
G_FLAG1(1) TYPE C, "Flag
G_ANSWER(1) TYPE C, "Optional Button
*--Begin of changes for the change request 2007096--26th July 2007--
G_NUM_SOURCE TYPE DZAEHL, "Holds Numerator value for Source Unit of Measure
G_NUM_TARGET TYPE DZAEHL, "Holds Numerator value for Target Unit of Measure
G_DEN_SOURCE TYPE NENNR, "Holds Denominator value for Source Unit of Measure
G_DEN_TARGET TYPE NENNR. "Holds Denominator value for Target Unit of Measure
*--End of changes for the change request 2007096--26th July 2007--
Constant declarations
CONSTANTS:
C_A(1) TYPE C VALUE 'A', "Constant Value A
C_S(1) TYPE C VALUE 'S', "Constant Value S
C_U(1) TYPE C VALUE 'U', "Constant Value U
C_X(1) TYPE C VALUE 'X', "Constant Value X
C_E(1) TYPE C VALUE 'E', "Constant Value E
C_I(1) TYPE C VALUE 'I', "Constant Value I
C_R(1) TYPE C VALUE 'R', "Constant Value R
C_B(1) TYPE C VALUE 'B', "Document Category is Quotation
C_HTNAME(10) TYPE C VALUE 'T_IHEADER', "Internal table for Header Data
C_ITNAME(10) TYPE C VALUE 'T_IFINAL', "Internal Table with processed data
C_Q2(2) TYPE C VALUE 'Q2', "Constant Order Reason Q2
C_100(3) TYPE C VALUE '100', "Popup screen
C_25(2) TYPE C VALUE '25', "Popup screen
C_5(1) TYPE C VALUE '5', "Popup screen
C_1 TYPE I VALUE 1, "Value 1 for Error Denotion
C_2 TYPE I VALUE 2, "Value 2 for Error Denotion
C_3 TYPE I VALUE 3, "Value 3 for BDC Error Denotion
C_1000(4) TYPE N VALUE 1000, "Value 1000
C_01(2) TYPE N VALUE '01', "Value 01 for Zcount
C_VK11(4) TYPE C VALUE 'VK11', "Transaction VK11
C_DYNBEGIN(1) TYPE C VALUE 'X', "Indicator
C_UPDATE(1) TYPE C VALUE 'S', "Update
C_DISMODE(1) TYPE C VALUE 'N', "Display
C_Q3(2) TYPE C VALUE 'Q3', "Quotation Approved
C_ZBPR(4) TYPE C VALUE 'ZBPR', "Condition Type ZBPR
*--Begin of changes for the change request xxx--2nd Aug 2007--
C_ZBPN(4) TYPE C VALUE 'ZBPN', "Condition Type ZBPN
*--End of changes for the change request xxx--2nd Aug 2007--
C_ERROR(5) TYPE C VALUE 'ERROR'. "Error screen title
S E L E C T O P T I O N S & P A R A M E T E R S *
Selection-screen Block 1
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_VKORG TYPE VKORG OBLIGATORY, "Sales Organization
P_VTWEG TYPE VTWEG OBLIGATORY, "Distribution Channel
P_SPART TYPE SPART DEFAULT '00'. "Division
SELECTION-SCREEN END OF BLOCK BLK1.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: S_AUDAT FOR G_AUDAT, "Document Date (Date Received/Sent)
S_VBELN FOR G_VBELN, "Sales Document
S_KUNNR FOR G_KUNNR, "Sold-to party
S_MATNR FOR G_MATNR. "Material Number
PARAMETERS: P_VKAUS(2) TYPE N. "Usage Indicator
SELECTION-SCREEN END OF BLOCK BLK2.
I N I T I A L I Z A T I O N *
INITIALIZATION.
CLEAR : G_REPID. "Program Name
G_REPID = SY-REPID. "Program Name
A T S E L E C T I O N S C R E E N *
CLEAR: G_VKORG,
G_VTWEG.
AT SELECTION-SCREEN ON P_VKORG.
SELECT SINGLE VKORG INTO G_VKORG
FROM TVKO
WHERE VKORG EQ P_VKORG.
IF SY-SUBRC NE 0.
MESSAGE E000(ZS) WITH TEXT-021.
ENDIF.
AT SELECTION-SCREEN ON P_VTWEG.
SELECT SINGLE VTWEG INTO G_VTWEG
FROM TVKOV
WHERE VKORG EQ P_VKORG
AND VTWEG EQ P_VTWEG.
IF SY-SUBRC NE 0.
MESSAGE E000(ZS) WITH TEXT-022.
ENDIF.
CLEAR: G_VKORG,
G_VTWEG.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
Data Selection
PERFORM DATA_RETRIEVAL.
Build Field Catalog
PERFORM BUILD_FIELDCATALOG.
Bulid layout
PERFORM BUILD_LAYOUT.
Build Events
PERFORM BUILD_EVENTS.
Captures the Values of Selection Screen
PERFORM CAPTURE_SCREEN.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
Display List
PERFORM DISPLAY_ALV_REPORT.
F O R M S *
*& Form DATA_RETRIEVAL
Retrieves Data for ALV Display
*--Begin of changes for the change request 2007106--25th July 2007--
*--End of changes for the change request 2007106--25th July 2007--
FORM DATA_RETRIEVAL .
DATA : L_VKAUS TYPE VKAUS. "Variable to hold Usage Indicator
CLEAR L_VKAUS.
SELECT VBELN
KUNNR
INTO CORRESPONDING FIELDS OF TABLE T_IHEADER
FROM VBAK
WHERE VBELN IN S_VBELN
AND KUNNR IN S_KUNNR
AND VKORG EQ P_VKORG
AND AUDAT IN S_AUDAT
AND VTWEG EQ P_VTWEG
AND SPART EQ P_SPART
AND AUGRU EQ C_Q2
AND VBTYP EQ C_B.
IF NOT T_IHEADER IS INITIAL.
IF NOT P_VKAUS IS INITIAL.
*--Begin of changes for the change request 2007106--25th July 2007--COMMENTED FROM HERE---
IF P_VKAUS EQ C_1. "IF Zcount is given as 1 then quotation without zcount should be picked
"for whom Material Pricing Group should be given.
SELECT A~VBELN
A~KUNNR
B~POSNR
B~MATNR
B~PMATN
B~KWMENG
B~VRKME
B~KZWI1
B~VKAUS
INTO TABLE T_VB_AKAP
FROM VBAK AS A
JOIN VBAP AS B
ON AVBELN EQ BVBELN
FOR ALL ENTRIES IN T_IHEADER
WHERE A~VBELN EQ T_IHEADER-VBELN
AND B~MATNR IN S_MATNR.
ELSE.
*--End of changes for the change request 2007106--25th July 2007--COMMENTED TILL HERE---
CONCATENATE 'C' P_VKAUS INTO L_VKAUS.
SELECT A~VBELN
A~KUNNR
B~POSNR
B~MATNR
B~PMATN
B~KWMENG
B~VRKME
B~KZWI1
B~VKAUS
*--Begin of changes for the change request 2007096--26th July 2007--
A~WAERK
*--End of changes for the change request 2007096--26th July 2007--
INTO TABLE T_VB_AKAP
FROM VBAK AS A
JOIN VBAP AS B
ON AVBELN EQ BVBELN
FOR ALL ENTRIES IN T_IHEADER
WHERE A~VBELN EQ T_IHEADER-VBELN
AND B~MATNR IN S_MATNR
AND B~VKAUS EQ L_VKAUS.
ENDIF.
ELSE.
SELECT A~VBELN
A~KUNNR
B~POSNR
B~MATNR
B~PMATN
B~KWMENG
B~VRKME
B~KZWI1
B~VKAUS
*--Begin of changes for the change request 2007096--26th July 2007--
A~WAERK
*--End of changes for the change request 2007096--26th July 2007--
INTO TABLE T_VB_AKAP
FROM VBAK AS A
JOIN VBAP AS B
ON AVBELN EQ BVBELN
FOR ALL ENTRIES IN T_IHEADER
WHERE A~VBELN EQ T_IHEADER-VBELN
AND B~MATNR IN S_MATNR.
ENDIF.
IF NOT T_VB_AKAP IS INITIAL.
SELECT VBELN
POSNR
BSTKD_E
INTO TABLE T_VBKD
FROM VBKD
FOR ALL ENTRIES IN T_VB_AKAP
WHERE VBELN EQ T_VB_AKAP-VBELN
AND POSNR EQ T_VB_AKAP-POSNR.
ENDIF.
SORT T_VBKD BY VBELN POSNR.
CLEAR W_VB_AKAP.
After much of coding was completed, Usage of PMATN was dropped and
the first eighteen characters of the field BSTKD was proposed for usage
Hence PMATN is overwritten by BSTKD value in the below loop
LOOP AT T_VB_AKAP INTO W_VB_AKAP.
CLEAR: W_VBKD,
W_VB_AKAP-PMATN.
READ TABLE T_VBKD INTO W_VBKD
WITH KEY VBELN = W_VB_AKAP-VBELN
POSNR = W_VB_AKAP-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_VB_AKAP-PMATN = W_VBKD-BSTKD_E+0(18).
ENDIF.
MODIFY T_VB_AKAP FROM W_VB_AKAP TRANSPORTING PMATN.
CLEAR W_VB_AKAP.
ENDLOOP.
IF NOT T_VB_AKAP IS INITIAL.
Collecting all Material Numbers along with their Technical Spec data for all the materials available in T_VB_AKAP.
SELECT MATNR
ZZTECHSPEC
INTO TABLE T_MARA
FROM MARA
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-MATNR.
IF SY-SUBRC EQ 0.
SORT T_MARA BY MATNR.
ENDIF. "Checking SY-SUBRC for T_MARA
SELECT MATNR
ZZTECHSPEC
APPENDING TABLE T_MARA
FROM MARA
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-PMATN.
IF SY-SUBRC EQ 0.
SORT T_MARA BY MATNR.
ENDIF. "Checking SY-SUBRC for T_MARA
*--Begin of changes for the change request xxx--2nd Aug 2007--
Collecting information into T_MARM for all the available materials so that it could be used for conversion into Alternate UOM
SELECT MATNR " Material Number
MEINH " Alternate UOM
UMREZ " Numerator for conversion
UMREN " Denominator for conversion
FROM MARM
INTO TABLE T_MARM
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-MATNR.
IF SY-SUBRC = 0.
SORT T_MARM BY MATNR MEINH.
ENDIF. "Checking SY-SUBRC for T_MARM
SELECT MATNR " Material Number
MEINH " Alternate UOM
UMREZ " Numerator for conversion
UMREN " Denominator for conversion
FROM MARM
APPENDING TABLE T_MARM
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-PMATN.
IF SY-SUBRC = 0.
SORT T_MARM BY MATNR MEINH.
ENDIF. "Checking SY-SUBRC for T_MARM
*--End of changes for the change request xxx--2nd Aug 2007--
SELECT MATNR
VKORG
VTWEG
KONDM
*--Begin of changes for the change request 2007096--26th July 2007--
VRKME
*--End of changes for the change request 2007096--26th July 2007--
INTO TABLE T_MVKE
FROM MVKE
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-PMATN.
IF SY-SUBRC EQ 0.
SORT T_MVKE BY MATNR VKORG VTWEG.
ENDIF. "Checking SY-SUBRC for T_MVKE
SELECT MATNR
VKORG
VTWEG
KONDM
*--Begin of changes for the change request 2007096--26th July 2007--
VRKME
*--End of changes for the change request 2007096--26th July 2007--
APPENDING TABLE T_MVKE
FROM MVKE
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MATNR EQ T_VB_AKAP-MATNR.
IF SY-SUBRC EQ 0.
SORT T_MVKE BY MATNR VKORG VTWEG.
ENDIF. "Checking SY-SUBRC for T_MVKE
*--Begin of changes for the change request 2007096--26th July 2007--
SELECT MSEHI
ZAEHL
NENNR
INTO TABLE T_T006
FROM T006
FOR ALL ENTRIES IN T_VB_AKAP
WHERE MSEHI EQ T_VB_AKAP-VRKME.
IF SY-SUBRC EQ 0.
SORT T_T006 BY MSEHI.
ENDIF. "Checking SY-SUBRC for T_T006
IF NOT T_MVKE IS INITIAL.
SELECT MSEHI
ZAEHL
NENNR
APPENDING TABLE T_T006
FROM T006
FOR ALL ENTRIES IN T_MVKE
WHERE MSEHI EQ T_MVKE-VRKME.
IF SY-SUBRC EQ 0.
SORT T_T006 BY MSEHI.
ENDIF. "Checking SY-SUBRC for T_T006
ENDIF. "Checking for Initial status of internal table T_MVKE
*--End of changes for the change request 2007096--26th July 2007--
ENDIF. " FOR T_VB_AKAP NOT INITIAL.
ENDIF. " FOR T_IHEADER NOT INITIAL.
CLEAR: W_VB_AKAP,
W_IFINAL.
LOOP AT T_VB_AKAP INTO W_VB_AKAP.
W_IFINAL-VBELN = W_VB_AKAP-VBELN.
W_IFINAL-KUNNR = W_VB_AKAP-KUNNR.
W_IFINAL-POSNR = W_VB_AKAP-POSNR.
W_IFINAL-MATNR = W_VB_AKAP-MATNR.
W_IFINAL-PMATN = W_VB_AKAP-PMATN.
W_IFINAL-KWMENG = W_VB_AKAP-KWMENG.
W_IFINAL-VRKME = W_VB_AKAP-VRKME.
W_IFINAL-KZWI1 = ( W_VB_AKAP-KZWI1 / W_VB_AKAP-KWMENG ) * 1000.
W_IFINAL-VKAUS = W_VB_AKAP-VKAUS.
*--Begin of changes for the change request 2007096--26th July 2007--
W_IFINAL-WAERK = W_VB_AKAP-WAERK.
*--End of changes for the change request 2007096--26th July 2007--
Populating Material Pricing Group from New Material Group, if such Group doesn't exist
Population of Material Pricing Group from Material Number is tried.
Similar condition does suit for Tech Spec too.
SORT: T_MVKE BY MATNR VKORG VTWEG,
T_MARA BY MATNR.
IF NOT W_VB_AKAP-PMATN IS INITIAL.
CLEAR W_MVKE.
READ TABLE T_MVKE
INTO W_MVKE
WITH KEY MATNR = W_VB_AKAP-PMATN
VKORG = P_VKORG
VTWEG = P_VTWEG
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_IFINAL-KONDM = W_MVKE-KONDM.
*--Begin of changes for the change request 2007096--26th July 2007--
IF ( W_IFINAL-VRKME NE W_MVKE-VRKME ) AND ( NOT W_MVKE-VRKME IS INITIAL ).
*--Begin of changes for the change request xxx--2nd Aug 2007--
CLEAR: W_MARM,
G_NUM_SOURCE,
G_DEN_SOURCE,
G_NUM_TARGET,
G_DEN_TARGET.
READ TABLE T_MARM INTO W_MARM
WITH KEY MATNR = W_IFINAL-PMATN
MEINH = W_IFINAL-VRKME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
G_NUM_SOURCE = W_MARM-UMREZ.
G_DEN_SOURCE = W_MARM-UMREN.
CLEAR W_MARM.
READ TABLE T_MARM INTO W_MARM
WITH KEY MATNR = W_IFINAL-PMATN
MEINH = W_MVKE-VRKME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
G_NUM_TARGET = W_MARM-UMREZ.
G_DEN_TARGET = W_MARM-UMREN.
CLEAR W_MARM.
W_IFINAL-KWMENG = W_IFINAL-KWMENG * ( G_NUM_SOURCE / G_DEN_SOURCE ) * ( G_DEN_TARGET / G_NUM_TARGET ).
CLEAR W_IFINAL-KZWI1.
W_IFINAL-KZWI1 = ( W_VB_AKAP-KZWI1 / W_IFINAL-KWMENG ) * 1000.
W_IFINAL-VRKME = W_MVKE-VRKME.
ENDIF. "Check SY-SUBRC for W_MARM using W_MVKE-VRKME (Sales UOM)
ELSE.
*--End of changes for the change request xxx--2nd Aug 2007--
CLEAR: W_T006,
G_NUM_SOURCE,
G_DEN_SOURCE,
G_NUM_TARGET,
G_DEN_TARGET.
READ TABLE T_T006 INTO W_T006 WITH KEY MSEHI = W_IFINAL-VRKME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
G_NUM_SOURCE = W_T006-ZAEHL. "Numerator to convert specified UOM to SI UOM
G_DEN_SOURCE = W_T006-NENNR. "Denominator to convert specified UOM to SI UOM
CLEAR W_T006.
READ TABLE T_T006 INTO W_T006 WITH KEY MSEHI = W_MVKE-VRKME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
G_NUM_TARGET = W_T006-ZAEHL. "Numerator to convert specified UOM to SI UOM
G_DEN_TARGET = W_T006-NENNR. "Denominator to convert specified UOM to SI UOM
CLEAR W_T006.
W_IFINAL-KWMENG = W_IFINAL-KWMENG * ( G_NUM_SOURCE / G_DEN_SOURCE ) * ( G_DEN_TARGET / G_NUM_TARGET ).
CLEAR W_IFINAL-KZWI1.
W_IFINAL-KZWI1 = ( W_VB_AKAP-KZWI1 / W_IFINAL-KWMENG ) * 1000.
W_IFINAL-VRKME = W_MVKE-VRKME.
ENDIF. "Check for SY-SUBRC for READ TABLE T_T006 using W_MVKE-VRKME (Sales UOM)
ENDIF. "Check for SY-SUBRC for READ TABLE T_T006 using W_IFINAL-VRKME (Quotation UOM)
ENDIF. "Check SY-SUBRC for W_MARM using W_IFINAL-VRKME (Quotation UOM)
ENDIF. "Check for ( W_IFINAL-VRKME NE W_MVKE-VRKME ) AND ( NOT W_MVKE-VRKME IS INITIAL )
*--End of changes for the change request 2007096--26th July 2007--
ENDIF.
READ TABLE T_MARA
INTO W_MARA
WITH KEY MATNR = W_VB_AKAP-PMATN
BINARY SEARCH.
IF SY-SUBRC EQ 0.
W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
ENDIF. -
Check box in ALV grid gets unselected for new selection
Hi all,
This is my code :
TYPE-POOLS : slis.
Variable
DATA: g_repid LIKE sy-repid,
g_title TYPE lvc_title,
g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_layout TYPE slis_layout_alv,
g_print_alv TYPE slis_print_alv,
g_variant LIKE disvariant,
c_char_a(1) VALUE 'A',
c_char_x(1) VALUE 'X',
itab_alv_sort TYPE slis_t_sortinfo_alv,
itab_alv_fcat TYPE slis_t_fieldcat_alv,
fm_name type rs38l_fnam," Function Module Name
* l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
* l_sfoutopt LIKE ssfcompop,
pri_params LIKE pri_params,
c_x type c .
* Internal tables Begin with IT_ *
DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV, "---ALV
it_disp type table of ZLOI.
* Work Area for Internal tables Begin with WA_ *
data : wa_fcat TYPE slis_fieldcat_alv , "---ALV
wa_layout TYPE lvc_s_layo, "---ALV
wa_it_disp like line of it_disp.
* Objects *
DATA : cref TYPE REF TO cl_gui_custom_container, "---ALV
gref TYPE REF TO cl_gui_alv_grid. "---ALV
* Start-of-selection
Start-of-selection.
perform fetch_po_det.
perform build_fcat.
perform alv_display.
*& Form FETCH_PO_DET
* text
* --> p1 text
* <-- p2 text
FORM FETCH_PO_DET .
data : it_po type table of crmd_orderadm_h,
wa_po like line of it_po,
wa_header type BBP_PDS_PO_HEADER_D.
select guid
object_id
DESCRIPTION
POSTING_DATE
CREATED_BY
from crmd_orderadm_h
into corresponding fields of table it_po
where object_type = 'BUS2201'.
loop at it_po into wa_po.
move wa_po-object_id to wa_it_disp-ZZPONO.
move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
move wa_po-posting_date to wa_it_disp-ZZPODATE.
move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_OBJECT_ID = wa_it_disp-zzpono
IMPORTING
E_HEADER = wa_header.
move wa_header-total_value to wa_it_disp-ZZPOVAL.
move wa_header-currency to wa_it_disp-ZZPOCUR.
append wa_it_disp to it_disp.
endloop.
* write : wa_it_disp-zzpono.
ENDFORM. " FETCH_PO_DET
*& Form BUILD_FCAT
* text
* --> p1 text
* <-- p2 text
FORM BUILD_FCAT .
g_repid = sy-repid.
g_title = 'LOI details'.
g_print_alv-no_print_listinfos = 'X'.
g_variant-report = sy-repid.
g_variant-variant = sy-title.
CLEAR g_layout.
g_layout-f2code = ' '.
wa_layout-zebra = 'X'.
g_layout-flexible_key = 'X'.
g_layout-colwidth_optimize = 'X'.
g_layout-detail_initial_lines = 'X'.
g_layout-box_fieldname = 'ZZCHECK'.
*g_layout-box_tabname = 'ITAB_REPORT'.
*Check box
wa_fcat-fieldname = 'ZZCHECK'.
wa_fcat-checkbox = 'X'.
wa_fcat-outputlen = '1'.
wa_fcat-col_pos = '1'.
wa_fcat-edit = '1'.
wa_fcat-seltext_m = 'No'.
append wa_fcat to it_fcat.
*Po no
clear wa_fcat.
wa_fcat-fieldname = 'ZZPONO' .
wa_fcat-tabname = 'IT_DISP'.
* wa_fcat-seltext = 'Purchase Order'.
wa_fcat-seltext_m = 'Purchase Order'.
*wa_fcat-seltext_s = 'Purchase Order.
wa_fcat-icon = 'X'.
wa_fcat-col_pos = '2'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Desc
wa_fcat-fieldname = 'ZZPODESC' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Description'.
wa_fcat-seltext_m = 'Description'.
*wa_fcat-seltext_s = 'Description'.
wa_fcat-col_pos = '3'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Postign date
wa_fcat-fieldname = 'ZZPODATE' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_l = 'Posting Date'.
wa_fcat-seltext_m = 'Posting Date'.
*wa_fcat-seltext_s = 'Posting Date'.
wa_fcat-col_pos = '4'.
wa_fcat-outputlen = 8.
append wa_fcat to it_fcat.
*value
wa_fcat-fieldname = 'ZZPOVAL' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO value'.
wa_fcat-seltext_m = 'PO value'.
*wa_fcat-seltext_s = 'PO value'.
wa_fcat-col_pos = '5'.
wa_fcat-outputlen = 15.
append wa_fcat to it_fcat.
*Currency
wa_fcat-fieldname = 'ZZPOCUR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO Currency'.
wa_fcat-seltext_m = 'PO Currency'.
*wa_fcat-seltext_s = 'PO Currency'.
wa_fcat-col_pos = '6'.
wa_fcat-outputlen = 5.
append wa_fcat to it_fcat.
*Creator
wa_fcat-fieldname = 'ZZPOCREATOR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Buyer'.
wa_fcat-seltext_m = 'Buyer'.
*wa_fcat-seltext_s = 'Buyer'.
wa_fcat-col_pos = '7'.
wa_fcat-outputlen = 12.
append wa_fcat to it_fcat.
ENDFORM. " BUILD_FCAT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM ALV_DISPLAY .
sort it_disp by ZZPONO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = g_set_pf_stat
I_CALLBACK_USER_COMMAND = g_user_command
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = g_title
* I_GRID_SETTINGS =
IS_LAYOUT = g_layout
IT_FIELDCAT = it_fcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
IS_VARIANT = g_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
IS_PRINT = g_print_alv
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_disp[]
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.
ENDFORM. " ALV_DISPLAY
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
CASE R_UCOMM.
WHEN 'PRINT'.
READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
IF SY-SUBRC EQ 0.
loop at it_DISP INTO WA_IT_DISP.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = 'Print the LOI details?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'.
* IMPORTING
* ANSWER = w_answer.
IF SY-SUBRC 0.
ENDIF.
* PERFORM CALL_SF.
endloop.
ENDIF.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. "set_pf_status
Now in my ALV grid o/p i can see the check box but if i select one row and then try to slect another the first one gets deselected.
Can anybody tell me what is missing?Hi,
if you need just a check box for each line, try to get rid of this line from your layout.
g_layout-box_fieldname = 'ZZCHECK'.
SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
Cheers
Maybe you are looking for
-
Help! Has anyone else had this? Re: caller ID Issu...
Dear all, I would understand if you didn't have the time to read my extensive notes below so the short version is the following (if you wanted a good laugh at my expense and a diatribe on the perils of switching ISP then do read it). My caller ID doe
-
How to delete individual pages in a project?
How do you delete individual pages in the middle of a document without affecting the arrangement of photos and text elsewhere in the document?
-
Non iphone mobiles HELP!!
I am about to change my mobile and have had nothing but trouble trying to get my blackberry to talk to my mac, I am stuck with vodafone as the company pays the bill, can anyone suggest which phone would be more compatible, it only needs be fairly bas
-
ITunes Not working Properly/Not Syncing on Network properly
Hello there, For weeks and weeks now on my Computer iTunes will not see or recognize my iPhone 4S and my iPad 3. When I try to sync by opening iTunes on desktop and then wake up pho ad iPad it does not see it and will not show them in iTunes no matte
-
Not enough grunt left to burn movie!
I know nothing, OK? My hard drive ( Model Name: iMac Model Identifier: PowerMac6,1 Processor Name: PowerPC G4 (3.3) Processor Speed: 1 GHz Number Of CPUs: 1 L2 Cache (per CPU): 256 KB Memory: 1 GB Bus Speed: 133 MHz) is almost full. I bought a WD 1Tb