Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

alv report

Former Member
0 Likes
695

hi gurus,

plz check this program that with variant cwm103*, plant , stloc....

that output i need get is cwm103* rest of the things should be hide.....

and append 14 fields i use to get only 4fields like 1 .slno

2. pmatnr

3. idnrk1

4. labst1

plz plz its urgent

plz plz its urgent

thanks

&----


*& Report ZPP_BOM_ITEM *

*& *

&----


*& *

*& *

&----


REPORT ZPP_BOM_ITEM .

type-pools: slis.

tables: mard,stpo,t001l,MARC.

TYPES: BEGIN OF ty_final,

labst TYPE mard-labst,

lgort TYPE mard-lgort,

matnr TYPE mard-matnr,

werks type mard-werks,

idnrk type stpo-idnrk,

pmatnr type mard-matnr,

IDNRK1 type STPO-IDNRK,

IDNRK2 type STPO-IDNRK,

IDNRK3 type STPO-IDNRK,

IDNRK4 type STPO-IDNRK,

IDNRK5 type STPO-IDNRK,

IDNRK6 type STPO-IDNRK,

IDNRK7 type STPO-IDNRK,

IDNRK8 type STPO-IDNRK,

labst1 type I,

labst2 type I,

labst3 type I,

labst4 type I,

labst5 type I,

labst6 type I,

labst7 type I,

labst8 type I,

slno type sy-cucol,

TABCOLOR type slis_t_specialcol_alv,

eND OF ty_final,

BEGIN OF ty_stloc,

matnr TYPE mard-matnr,

werks TYPE mard-werks,

lgort TYPE mard-lgort,

labst type mard-labst,

END OF ty_stloc,

BEGIN OF ty_stpo,

stlnr TYPE stpo-stlnr,

idnrk TYPE stpo-idnrk,

END OF ty_stpo,

BEGIN OF ty_parent,

matnr TYPE mard-matnr,

werks TYPE mard-werks,

fmatnr TYPE mard-matnr,

END OF ty_parent.

*************************************************************************

  • INTERNAL TABLE DECLARATION

************************************************************************

DATA: wa_final TYPE ty_final,

it_final TYPE TABLE OF ty_final,

it_stloc TYPE TABLE OF ty_stloc,

wa_stloc TYPE ty_stloc,

wa_stloc1 type ty_stloc,

wa_parent TYPE ty_parent,

it_parent TYPE TABLE OF ty_parent,

it_stpo TYPE TABLE OF ty_stpo,

wa_stpo TYPE ty_stpo.

DATA: W_PCHK.

&----


*& types-pools declartion *

&----


DATA: LAYOUT1 TYPE SLIS_LAYOUT_ALV,

FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

DATA: linecolor TYPE slis_specialcol_alv OCCURS 0 WITH HEADER LINE.

data: itopmat type cstmat ."occurs 0 with header line.

data: idstst type csdata-xfeld.

data: istb like table of stpox.

data: wa_istb type stpox." occurs 0 with header line .

data: imatcat type cscmat." occurs 0 with header line.

PARAMETERS: P_werks TYPE MARd-werks,

P_lgort TYPE MARd-lgort.

select-options: s_matnr for mard-matnr.

at selection-screen.

IF sy-ucomm = 'ONLI'.

perform inputcheck.

ENDIF.

start-of-selection.

perform fieldcat.

perform display_data.

&----


*& Form fetch_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fetch_data .

SELECT MATNR

WERKS

lgort

labst FROM MARd INTO TABLE iT_stloc WHERE MATNR IN S_matnr AND WERKS = P_werks AND lgort = P_lgort.

ENDFORM. " fetch_data

&----


*& Form fieldcat

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fieldcat .

Data: w_pos type sy-cucol.

clear fcat.

w_pos = w_pos + 1.

fcat-row_pos = 1.

FCAT-SELTEXT_L = 'SLNO'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'SLNO'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 7.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'PARENT'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'PMATNR'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 7.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Tube S/A'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK1'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Tube Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST1'.

FCAT-NO_ZERO = 'X'.

FCAT-FIX_COLUMN = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'P.Rod S/A'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK2'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'P.Rod S/A Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST2'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-NO_ZERO = 'X'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Port A/S'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK4'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Port Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST4'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Pipe'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK5'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Pipe Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST5'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Pipe S/A'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK6'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Pipe S/A Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST6'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'P.Rod'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK7'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'P.Rod Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST7'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Tube'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK8'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Tube Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST8'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Spare Seal Kit'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'IDNRK3'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 18.

APPEND FCAT.

CLEAR FCAT.

w_pos = w_pos + 1.

FCAT-SELTEXT_L = 'Pipe S/A Qty'.

FCAT-COL_POS = W_POS.

FCAT-FIELDNAME = 'LABST3'.

FCAT-NO_ZERO = 'X'.

FCAT-TABNAME = 'IT_FINAL'.

FCAT-outputlen = 10.

APPEND FCAT.

CLEAR FCAT.

ENDFORM. " fieldcat

&----


*& Form display_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_data .

layout1-coltab_fieldname = 'TABCOLOR'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-CPROG

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_CALLBACK_TOP_OF_PAGE = '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_title

  • I_GRID_SETTINGS =

IS_LAYOUT = LAYOUT1

IT_FIELDCAT = FCAT[]

  • 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_final.

  • 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 inputcheck

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM inputcheck .

IF P_werks IS initial.

set cursor field 'P_WERKS'.

message 'plz check PLANT' TYPE 'E'.

ELSE.

SELECT SINGLE WERKS FROM MARD INTO WA_FINAL-WERKS WHERE WERKS = P_WERKS.

IF SY-SUBRC NE 0.

SET CURSOR FIELD 'P_WERKS'.

MESSAGE 'PLZ CHECK PLANT NUMBER NOT MATCH' TYPE 'E'.

ENDIF.

ENDIF.

IF P_lgort IS initial.

set cursor field 'P_LGORT'.

message 'plz check STORAGE LOCATION' TYPE 'E'.

ELSE.

SELECT SINGLE LGORT FROM MARD INTO WA_FINAL-LGORT WHERE LGORT = P_LGORT.

IF SY-SUBRC NE 0.

SET CURSOR FIELD 'P_LGORT'.

MESSAGE 'PLZ CHECK STORAGE LOCATION NOT MATCH' TYPE 'E'.

ENDIF.

ENDIF.

IF s_MATNR IS initial.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM103*'.

APPEND S_MATNR.

CLEAR S_MATNR.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM102*'.

APPEND S_MATNR.

clear s_matnr.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'SSP*'.

APPEND S_MATNR.

clear s_matnr.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM002*'.

APPEND S_MATNR.

clear s_matnr.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM003*'.

APPEND S_MATNR.

clear s_matnr.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM037*'.

APPEND S_MATNR.

clear s_matnr.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM044*'.

APPEND S_MATNR.

clear s_matnr.

s_matnr-sign = 'I'.

s_matnr-option = 'CP'.

s_matnr-low = 'CWM144*'.

APPEND S_MATNR.

clear s_matnr.

ELSE.

SELECT SINGLE MATNR FROM MARD INTO WA_FINAL-MATNR WHERE MATNR IN S_MATNR.

IF SY-SUBRC NE 0.

SET CURSOR FIELD 'S_MATNR'.

MESSAGE 'PLZ CHECK MATRIAL NUMBER NOT MATCH' TYPE 'E'.

ENDIF.

ENDIF.

perform fetch_data.

perform format_data.

if it_final[] is initial.

message ' No Corresponding input found' type 'E'.

endif.

ENDFORM. " inputcheck

&----


*& Form format_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM format_data .

data w_slno type sy-cucol.

SORT: IT_STLOC BY MATNR,

IT_STLOC BY LGORT.

LOOP AT IT_STLOC INTO WA_STLOC.

REFRESH it_parent.

clear w_pchk.

PERFORM get_p_material_ref USING wa_stloc-matnr wa_stloc-werks w_pchk.

CLEAR WA_PARENT.

read table it_parent into wa_parent with key fmatnr+0(1) = 'P'.

wa_final-pmatnr = wa_parent-fmatnr.

PERFORM get_c_material_ref using wa_parent-fmatnr wa_parent-werks.

if wa_final-idnrk1 is initial

and wa_final-labst1 is initial

and wa_final-idnrk2 is initial

and wa_final-labst2 is initial

and wa_final-idnrk3 is initial

and wa_final-labst3 is initial

and wa_final-idnrk4 is initial

and wa_final-labst4 is initial

and wa_final-idnrk5 is initial

and wa_final-labst5 is initial

and wa_final-idnrk6 is initial

and wa_final-labst6 is initial

and wa_final-idnrk7 is initial

and wa_final-labst7 is initial

and wa_final-idnrk8 is initial

and wa_final-labst8 is initial.

continue.

endif.

if w_slno = '999999'.

clear w_slno.

endif.

w_slno = w_slno + 1.

WA_final-slno = w_slno.

wa_final-tabcolor[] = linecolor[].

APPEND WA_FINAL TO IT_FINAL.

CLEAR WA_FINAL.

CLEAR WA_PARENT.

ENDLOOP.

ENDFORM. " format_data

&----


*& Form get_p_material_ref

&----


  • text

----


  • -->P_WA_STLOC_MATNR text

  • -->P_WA_STLOC_WERKS text

  • -->P_W_PCHK text

----


FORM get_p_material_ref USING ap_matnr ap_werks ap_pchk.

if w_pchk = 'X'.

exit.

endif.

DATA: wa_ltb TYPE stpov,

it_ltb TYPE TABLE OF stpov,

wa_matcat TYPE cscmat,

it_matcat TYPE TABLE OF cscmat.

DATA: BEGIN OF equicat OCCURS 0.

INCLUDE STRUCTURE cscequi.

DATA: END OF equicat.

DATA: BEGIN OF kndcat OCCURS 0.

INCLUDE STRUCTURE cscknd.

DATA: END OF kndcat.

DATA: BEGIN OF stdcat OCCURS 0.

INCLUDE STRUCTURE cscstd.

DATA: END OF stdcat.

DATA: BEGIN OF tplcat OCCURS 0.

INCLUDE STRUCTURE csctpl.

DATA: END OF tplcat.

DATA: BEGIN OF prjcat OCCURS 0.

INCLUDE STRUCTURE cscprj.

DATA: END OF prjcat.

CALL FUNCTION 'CS_WHERE_USED_MAT'

EXPORTING

datub = sy-datum

datuv = sy-datum

matnr = ap_matnr

werks = ap_werks

stltp = 'M'

TABLES

wultb = it_ltb

equicat = equicat

kndcat = kndcat

matcat = it_matcat

stdcat = stdcat

tplcat = tplcat

prjcat = prjcat

EXCEPTIONS

call_invalid = 1

material_not_found = 2

no_where_used_rec_found = 3

no_where_used_rec_selected = 4

no_where_used_rec_valid = 5

OTHERS = 6.

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 it_ltb INTO wa_ltb.

wa_parent-matnr = wa_ltb-idnrk.

wa_parent-werks = wa_ltb-werks.

wa_parent-fmatnr = wa_ltb-matnr.

APPEND wa_parent TO it_parent.

if wa_parent-fmatnr+0(1) = 'P'.

ap_pchk = 'X'.

exit.

endif.

PERFORM get_p_material_ref USING wa_ltb-matnr wa_ltb-werks ap_pchk.

CLEAR: wa_parent.

ENDLOOP.

ENDFORM. " get_p_material_ref

&..........................................................................&

  • TOP_OF_PAGE *&

&..........................................................................&

FORM TOP-OF-PAGE.

*ALV Header declarations

DATA: T_HEADER TYPE SLIS_T_LISTHEADER,

WA_HEADER TYPE SLIS_LISTHEADER,

T_LINE LIKE WA_HEADER-INFO,

LD_LINES TYPE I,

LD_LINESC(10) TYPE C.

  • Title

WA_HEADER-TYP = 'H'.

WA_HEADER-INFO = 'Bill Of Material'.

APPEND WA_HEADER TO T_HEADER.

CLEAR WA_HEADER.

WA_HEADER-TYP = 'S'.

WA_HEADER-key = 'Material---->'.

wa_header-info = s_matnr-low.

APPEND WA_HEADER TO T_HEADER.

CLEAR WA_HEADER.

WA_HEADER-TYP = 'S'.

WA_HEADER-key = 'Plant---->'.

wa_header-info = p_werks.

APPEND WA_HEADER TO T_HEADER.

CLEAR WA_HEADER.

WA_HEADER-TYP = 'S'.

WA_HEADER-key = 'Stor.Location---->'.

wa_header-info = p_lgort.

APPEND WA_HEADER TO T_HEADER.

CLEAR WA_HEADER.

  • Date

WA_HEADER-TYP = 'S'.

WA_HEADER-KEY = 'Date----> '.

CONCATENATE SY-DATUM+6(2) '.'

SY-DATUM+4(2) '.'

SY-DATUM(4) INTO WA_HEADER-INFO. "todays date

APPEND WA_HEADER TO T_HEADER.

CLEAR: WA_HEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = T_HEADER.

ENDFORM. "top-of-page

&.................................................................................&

&......................CHILD DATA.................................................&

&.................................................................................&

&----


*& Form get_c_material_ref

&----


  • text

----


  • -->P_WA_STLOC_MATNR text

  • -->P_WA_STLOC_WERKS text

----


FORM get_c_material_ref USING wa_parent-fmatnr

wa_parent-WERKS.

clear istb.

  • if wa_parent-fmatnr is not initial.

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

  • AUFSW = ' '

  • AUMNG = 0

capid = 'PP01'

datuv = sy-datum

mktls = 'X'

mehrs = 'X'

mtnrv = wa_parent-fmatnr

svwvo = 'X'

werks = wa_stloc-WERKS

vrsvo = 'X'

IMPORTING

topmat = itopmat

dstst = idstst

TABLES

stb = istb

  • MATCAT = imatcat " chk this later

EXCEPTIONS

alt_not_found = 1

call_invalid = 2

material_not_found = 3

missing_authorization = 4

no_bom_found = 5

no_plant_data = 6

no_suitable_bom_found = 7

conversion_error = 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.

DATA: LS_CELLCOLOR TYPE LVC_S_SCOL.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM103' .

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk .

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wa_final-labst1 = wa_stloc-labst.

wA_final-idnrk1 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK1'.

linecolor-color-col = 1.

append linecolor.

linecolor-fieldname = 'LABST1'.

linecolor-color-col = 1.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM102' .

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wA_final-idnrk2 = WA_istb-idnrk.

wa_final-labst2 = wa_stloc-labst.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK2'.

linecolor-color-col = 2.

append linecolor.

linecolor-fieldname = 'LABST1'.

linecolor-color-col = 2.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(3) = 'SSP' werks = wa_stloc-werks .

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wa_final-labst3 = wa_stloc-labst.

wA_final-idnrk3 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK3'.

linecolor-color-col = 3.

append linecolor.

linecolor-fieldname = 'LABST3'.

linecolor-color-col = 3.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM037' werks = wa_stloc-werks .

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wa_final-labst4 = wa_stloc-labst.

wA_final-idnrk4 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK4'.

linecolor-color-col = 4.

append linecolor.

linecolor-fieldname = 'LABST4'.

linecolor-color-col = 4.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM044' werks = wa_stloc-werks.

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

wa_final-labst5 = wa_stloc-labst.

wA_final-idnrk5 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK5'.

linecolor-color-col = 5.

append linecolor.

linecolor-fieldname = 'LABST5'.

linecolor-color-col = 5.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM144' werks = wa_stloc-werks.

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wa_final-labst6 = wa_stloc-labst.

wA_final-idnrk6 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK6'.

linecolor-color-col = 6.

append linecolor.

linecolor-fieldname = 'LABST6'.

linecolor-color-col = 6.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM002' werks = wa_stloc-werks .

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wa_final-labst7 = wa_stloc-labst.

wA_final-idnrk7 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK7'.

linecolor-color-col = 7.

append linecolor.

linecolor-fieldname = 'LABST7'.

linecolor-color-col = 7.

append linecolor.

endif.

endif.

endif.

endif.

clear wa_istb.

READ TABLE ISTB INTO WA_ISTB WITH KEY IDNRK+0(6) = 'CWM003' werks = wa_stloc-werks.

if sy-subrc eq 0.

read table it_stloc into wa_stloc1 with key matnr = wa_istb-idnrk.

if sy-subrc eq 0.

clear wa_stloc.

read table it_Stloc into wa_stloc with key matnr = wa_istb-idnrk.

if wa_stloc-labst gt '0'.

if sy-subrc eq 0.

wa_final-labst8 = wa_stloc-labst.

wA_final-idnrk8 = WA_istb-idnrk.

delete it_stloc where matnr = wa_istb-idnrk.

linecolor-fieldname = 'IDNRK8'.

linecolor-color-col = 8.

append linecolor.

linecolor-fieldname = 'LABST8'.

linecolor-color-col = 8.

append linecolor.

endif.

endif.

endif.

endif.

ENDFORM.

Edited by: santosh jajur on Jul 21, 2008 3:35 PM

6 REPLIES 6
Read only

Former Member
0 Likes
663

Hi Santhosh,

You can directly display the ALV with all the fields and after lists gets displayed, you can design the layout the way you want.and you can save that combination of fields in a layout,whenver you want, you can display the required fields with the reequired layout.

Hope this helps.

Regards,

Sujatha

Read only

0 Likes
663

hi suj...,

i know that but i need it manually do it .....................

plz its urgent

Edited by: santosh jajur on Jul 21, 2008 3:45 PM

Read only

0 Likes
663

Hi Santhosh,

Can u explain ur requirement bit more?

Read only

0 Likes
663

hi suj,,,

You can directly display the ALV with all the fields and after lists gets displayed, you can design the layout the way you want.and you can save that combination of fields in a layout,whenver you want, you can display the required fields with the reequired layout.

this concept is correct after get the output we can change but i as to make it in the program

itself when i am passing in the fieldcatlog.

plz its urgent

Read only

0 Likes
663

Hi Santhosh,

You can add the only required fields into Fieldcatalog, thats such a simple.

Regards,

Sujatha

Read only

0 Likes
663

hi suj,

can send u r mail id .... its urgent