We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-abap] Using Dynamic Field Catalog

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from vinraag on Feb 15 at 9:04 AM
ya that's what I tried t....since I am pretty new to abap I am finding it very difficault to relate things.. Here is my code...I call this FM cs_bom_expl_mat_v2 and write this code after it

IF sy-subrc EQ 0.
IF wa_ZLEINIST1-zinqt2 > 0. ****************this field denote the daily plan of a material
WA_FINAL-MATNR = W_MAST-MATNR.
WA_FINAL-zinqt2 = wa_ZLEINIST1-zinqt2.
wa_final-maktx = wa_makt-MAKTX.

LOOP AT t_stpox INTO w_stpox.
PERFORM DISPLAY_PLAN.
IF W_STPOX-SOBSL = '50'.
WA_FINAL-IDNRK = W_STPOX-IDNRK.
wa_final-ojtxp = w_stpox-ojtxp.
WA_FINAL-MNGKO = W_STPOX-MNGKO.
WA_FINAL-MEINS = W_STPOX-MEINS.
WA_FINAL-STUFE = W_STPOX-STUFE.
WA_FINAL-PHANTOM = V_PHANTOM.
WA_FINAL-PLAN = V_PLAN.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.

ELSE.

WA_FINAL-IDNRK = W_STPOX-IDNRK.
wa_final-ojtxp = w_stpox-ojtxp.
WA_FINAL-MNGKO = W_STPOX-MNGKO.
WA_FINAL-MEINS = W_STPOX-MEINS.
WA_FINAL-STUFE = W_STPOX-STUFE.
WA_FINAL-LGPRO = W_STPOX-LGPRO.
WA_FINAL-PLAN = V_PLAN.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.


ENDLOOP.
ENDFORM. " GET_DATA



*& Form display_plan

* text

* --> p1 text
* <-- p2 text

FORM display_plan.
v_plan = wa_ZLEINIST1-zinqt2 * w_stpox-mngko - wa_ZLEINIST1-ZINQT *
w_stpox-mngko.

ENDFORM. " display_plan

*& Form LIST_DISPLAY

* text

* --> p1 text
* <-- p2 text

FORM LIST_DISPLAY.
PERFORM FIELD_CAT.
PERFORM BUILD_LAYOUT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZBOMCOMP'
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME =
* IS_LAYOUT = IT_COLOR
IT_FIELDCAT = IT_FCAT
* 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. " LIST_DISPLAY

*& Form FIELD_CAT

* text

* --> p1 text
* <-- p2 text

FORM FIELD_CAT.
data col_pos type c value '1'.
data ROW_POS type c value '0'.

WA_FCAT-COL_POS = COL_POS .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'MATERIAL NUMBER'.
WA_FCAT-OUTPUTLEN = 18.
WA_FCAT-EMPHASIZE = 'C40'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS = COL_POS + 1 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'MATERIAL DESCRIPTION'.
WA_FCAT-OUTPUTLEN = 40.
WA_FCAT-EMPHASIZE = 'C40'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.


WA_FCAT-COL_POS = COL_POS + 2 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'ZINQT2'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'SALES PLAN'.
WA_FCAT-OUTPUTLEN = 10.
WA_FCAT-EMPHASIZE = 'C50'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS = COL_POS + 3 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'IDNRK'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'COMPONENT'.
WA_FCAT-OUTPUTLEN = 18.
WA_FCAT-EMPHASIZE = 'C70'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS = COL_POS + 4 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'OJTXP'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'MATERIAL DESCRIPTION'.
WA_FCAT-OUTPUTLEN = 40.
WA_FCAT-EMPHASIZE = 'C40'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS = COL_POS + 5 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'MNGKO'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'USAGE'.
WA_FCAT-OUTPUTLEN = 10.
WA_FCAT-EMPHASIZE = 'C21'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS = COL_POS + 6 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'MEINS'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'UOM'.
WA_FCAT-OUTPUTLEN = 5.
WA_FCAT-EMPHASIZE = 'C21'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

WA_FCAT-COL_POS = COL_POS + 7 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'STUFE'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'BOM LEVEL'.
WA_FCAT-OUTPUTLEN = 10.
WA_FCAT-EMPHASIZE = 'C21'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.


WA_FCAT-COL_POS = COL_POS + 8 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'LGPRO'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'S.LOC'.
WA_FCAT-OUTPUTLEN = 10.
WA_FCAT-EMPHASIZE = 'C21'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.


WA_FCAT-COL_POS = COL_POS + 9 .
WA_FCAT-ROW_POS = ROW_POS .
WA_FCAT-FIELDNAME = 'PLAN'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-SELTEXT_L = 'COMPONENT PLAN'.
WA_FCAT-OUTPUTLEN = 18.
WA_FCAT-DO_SUM = 'X'.
WA_FCAT-EMPHASIZE = 'C60'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.


ENDFORM. " FIELD_CAT


to populate my alv list. To be very honest I tried if...else statement in my field catalog to fill my 9th column...I looped the table at 9th col then using if...else statement I tried to fill the field catalog..but all i got was this...9th column of my field catalog disappeared and it printed the last column.

---------------Original Message---------------
From: VINOD RAAGHAV
Sent: Friday, February 14, 2014 8:25 PM
Subject: Using Dynamic Field Catalog

I populate my field catalog to print storage location of the materials along with other few details in my alv_list_display... I need to handle it dynamically because for phantom materials we don't maintain storage location....for phantom materials we maintain this field 'SOBSL' as '50' in material master...so in this case if the storage location is maintained for the material it should fill the column with storage location else I need to fill the column as 'phantom assembly' which will have to be hard coded. Both these details has to be printed in the same column.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2014 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
vinraag  
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Have a technical question? Need to find IT solutions? Ask your peers in the Toolbox for IT community.

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language