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 LCC352 on Feb 15 at 9:02 PM
Lots of code! Let me ask you this: what field do you expect to show the result(s)of the phantom vs. non-phantom value(s)? Looking at the ALV code, I don't see where the phantom value you set will show up in the output.

I like to tell people to break things down, run the program in debug to see values, and not to jump to the ALV immediately. Sometimes a simple WRITE statement will quickly get you data to see. In this case, you might be flying a bit blind.

Have you tried debug? Look for the places in your code where a phantom value should show up. Does it? Where does it go after you see it? Those things will help you figure out where the code fails to do what you want/expect.


Lou

>

---------------Original Message---------------
From: VINOD RAAGHAV
Sent: Saturday, February 15, 2014 9:05 AM
Subject: Using Dynamic Field Catalog

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.

 
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
LCC352  

CEO, COO, CFO, CMO, Pres, GM
22 achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Community Achievements

_.____.__

0 comments:

Post a Comment

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