ALV fields coem dynamicaly in header

Hi all,
I desperately need your help in making ALV report.
TYPE-POOLS: SLIS.
DATA: ls_fcat TYPE slis_fieldcat_alv,
      ls_layout   TYPE SLIS_LAYOUT_ALV,
      gt_fcat TYPE slis_t_fieldcat_alv.
data :    gt_fieldcat type slis_t_fieldcat_alv, "catalog for alv
            gt_heading type slis_t_listheader, "list for header1
            gt_sort type slis_t_sortinfo_alv, "Sorting of the
            gt_event type slis_t_event,
            gt_selfield type slis_selfield,
            gv_alv_event type slis_alv_event,
            gv_repname type sy-repid,
            gs_layout type slis_layout_alv,
            gv_save type c.
constants gc_forname_top_of_page type slis_formname value
'TOP-OF-PAGE'.
REFRESH gt_fcat.
TABLES: vbrk.
data: begin of it_vbrk occurs 10,
      vbeln type vbeln,
      end of it_vbrk.
data: begin of it_vbrp occurs 10,
      vbeln type vbeln,
      ntgew type vbrp-ntgew,
      matnr type vbrp-matnr,
      end of it_vbrp.
data: begin of it_final occurs 10,
      vbeln type vbeln,
      ntgew type vbrp-ntgew,
      matnr type vbrp-matnr,
      end of it_final.
SELECT-OPTIONS: PERIOD for VBRK-FKDAT  no-extension.
  SELECT VBELN
         FROM VBRK INTO CORRESPONDING FIELDS OF TABLE IT_VBRK
         WHERE FKDAT IN PERIOD.
SELECT  VBELN
          NTGEW  "Net weight
          MATNR
          FROM VBRP INTO CORRESPONDING FIELDS OF TABLE IT_VBRP
          FOR ALL ENTRIES IN IT_vbrk
          WHERE VBELN = IT_vbrk-VBELN.
loop at it_vbrp.
move it_vbrp-vbeln   to   it_final-vbeln  .
move it_vbrp-matnr   to   it_final-matnr  .
move it_vbrp-ntgew   to   it_final-ntgew  .
append it_final.
endloop.
ls_fcat-col_pos   = 1.
ls_fcat-fieldname = 'VBELN'.
ls_fcat-seltext_l = 'VBELN'.
ls_fcat-outputlen = 10 .
APPEND ls_fcat TO gt_fcat.
DATA: G_REPID TYPE SY-REPID.
g_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program       = g_repid
        I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
        i_callback_top_of_page   = 'TOP_OF_PAGE'
        IS_LAYOUT                = ls_LAYOUT
        it_fieldcat              = gt_fcat
        I_SAVE                   = 'X'
      TABLES
        t_outtab                 = IT_FINAL.
My problem is that i want material number in col_pos 2, 3,4... and so on..
and corresponding weight of that material number comes under that matnr.
Waiting for ur reply.
Thanx a ton,
Puneet

Try this
TYPE-POOLS: SLIS.
DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
LS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "catalog for alv
GT_HEADING TYPE SLIS_T_LISTHEADER, "list for header1
GT_SORT TYPE SLIS_T_SORTINFO_ALV, "Sorting of the
GT_EVENT TYPE SLIS_T_EVENT,
GT_SELFIELD TYPE SLIS_SELFIELD,
GV_ALV_EVENT TYPE SLIS_ALV_EVENT,
GV_REPNAME TYPE SY-REPID,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GV_SAVE TYPE C.
CONSTANTS GC_FORNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE
'TOP-OF-PAGE'.
REFRESH GT_FCAT.
TABLES: VBRK.
DATA: BEGIN OF IT_VBRK OCCURS 10,
VBELN TYPE VBELN,
END OF IT_VBRK.
DATA: BEGIN OF IT_VBRP OCCURS 10,
VBELN TYPE VBELN,
NTGEW TYPE VBRP-NTGEW,
MATNR TYPE VBRP-MATNR,
END OF IT_VBRP.
DATA: BEGIN OF IT_FINAL OCCURS 10,
VBELN TYPE VBELN,
NTGEW TYPE VBRP-NTGEW,
MATNR TYPE VBRP-MATNR,
END OF IT_FINAL.
SELECT-OPTIONS: PERIOD FOR VBRK-FKDAT NO-EXTENSION.
SELECT VBELN
FROM VBRK INTO CORRESPONDING FIELDS OF TABLE IT_VBRK
WHERE FKDAT IN PERIOD.
SELECT VBELN
NTGEW "Net weight
MATNR
FROM VBRP INTO CORRESPONDING FIELDS OF TABLE IT_VBRP
FOR ALL ENTRIES IN IT_VBRK
WHERE VBELN = IT_VBRK-VBELN.
LOOP AT IT_VBRP.
  MOVE IT_VBRP-VBELN TO IT_FINAL-VBELN .
  MOVE IT_VBRP-MATNR TO IT_FINAL-MATNR .
  MOVE IT_VBRP-NTGEW TO IT_FINAL-NTGEW .
  APPEND IT_FINAL.
ENDLOOP.
LS_FCAT-COL_POS = 1.
LS_FCAT-FIELDNAME = 'VBELN'.
LS_FCAT-SELTEXT_L = 'Billing Document'.
LS_FCAT-OUTPUTLEN = 10 .
APPEND LS_FCAT TO GT_FCAT.
LS_FCAT-COL_POS = 2.
LS_FCAT-FIELDNAME = 'MATNR'.
LS_FCAT-SELTEXT_L = 'Material No.'.
LS_FCAT-OUTPUTLEN = 10 .
APPEND LS_FCAT TO GT_FCAT.
LS_FCAT-COL_POS = 3.
LS_FCAT-FIELDNAME = 'NTGEW'.
LS_FCAT-SELTEXT_L = 'Weight'.
LS_FCAT-OUTPUTLEN = 10 .
APPEND LS_FCAT TO GT_FCAT.
DATA: G_REPID TYPE SY-REPID.
      G_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM       = G_REPID
    I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
    I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'
    IS_LAYOUT                = LS_LAYOUT
    IT_FIELDCAT              = GT_FCAT
    I_SAVE                   = 'X'
  TABLES
    T_OUTTAB                 = IT_FINAL.

Similar Messages

  • Error in ALV : Field Does not exists in Output table .

    Hi All,
    In my ALV report, program get dumped and showing error when i tried to put a col named Distribution channel ion the alv.
    I have put the Distribution cannel field in the IT_FInal table , but still getting folwong errors :
    Error : Field Symbol is not been assigned.
    As Instructed i have passed            I_INTERFACE_CHECK              = 'X'.
    By this i am getting detail error that :
    Field Distribution channel does not exists in Output table & Heading for List is missing .
    But i have maintained the distribition channel in IT_Final table
    Please suggest wheather we have to define dis channel in any other place.
    Thanks in advance.
    Can any one help me regrarding this.
    Thanks in advance.

    Hello,
    You have to populate the same in the fieldcatalog as well, i think you have not maintained this field there.
    BR,
    Suhas
    PS: Also make it a point to follow-up on your previous post: [Error in ALV : Field Symbol not been assigned.|Error in ALV : Field Symbol not been assigned.]

  • Alv field with f4 help without using class

    Hi,
    Can any one give me a program of "Alv field with f4 help without using class".
    Thanking you in advance.

    hi
    <b>Linking F4 Help to Fields</b>
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    &#1048766; Pass the fieldname to ‘FIELDNAME’
    &#1048766; Set ‘REGISTER’ to make the field registered,
    &#1048766; Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    &#1048766; Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    Preparing table for the fields to be registered to trigger F4 event
    METHOD handle_on_f4 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    ENDMETHOD .
    A sample “onf4” method implementation
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    regards
    Ravish
    <b>
    reward if useful</b>

  • Error in updating ALV field catalog in selection tool for Planning Book

    Hi ,
    I am Implementing BADI  '/SAPAPO/SDP_SELECTOR' to upload Custom Fields Data in Planning Book Selection Window under APO Location Product. These Custom Fields are maintained in Custom Table.So from Table whatever Custom Fields are availabe all the fields needs to be available in for selection. Once selection is done the same data to be uploaded into Planning Book.
    This BADI is working Fine upto 4 fields but if any extra fields are added in the table 'Error in updating ALV field catalog in selection tool' error Pop Up is coming. Here i am using Folloowing Methods
    1). INIT_OBJECT_LIST
    2). F4
    3). LOC_PROD_VALUE_LIST
    Please help on the same if u have any idea or clue.
    Thanks.

    Hi Srinivas!
    Where did you get your implementation from?
    It would be nice if you could debug your code!
    For the F4 method, have you seen this note?
    Note 544904 - Sample source code f.BAdI /SAPAPO/SDP_SELECTOR ('F4'method)
    Also check this note. It contains selection modifications in the BAdI:
    Note 376902 - SDP selector: Basis corrections for BADI
    I do not know your release and support package in your SCM, but you can find a lot of notes related to this BAdI.
    Thank you!
    Will
    SCM Support Consultant

  • Error in updating ALV field catalog in selection

    Dear all,
    I'm trying to use the standard transaction /SAPAPO/TSKEYFMAIN in order to check the TS values.
    After filling the selection variant, the system shows the following error:
    'Error in updating ALV field catalog in selection'
    Could you please provide me with further details about the error? What could be the possible solution to avoid it?
    Many thanks,
    SM

    Hi Marius,
    thanks for your answer.
    I would like to use the /SAPAPO/TSKEYFMAIN transaction to check massively the values in the time series KFs and not just the consistency of them.
    So do you know any other transaction to do it or do you have an idea about the error of /SAPAPO/TSKEYFMAIN?
    Thanks for your help!
    SM

  • How to Add Values in INVOICE SUB-TYPE field at the Invoice Header Forms

    Hello,
    Does any body knows how could I add/modify values in the INVOICE SUB-TYPE field at the Invoice Header Forms?. This values are related to the Globalization, in this case for the Chilean Localizations.
    Thanks,
    Alejandro R.

    It gives any error or just does nothing?
    Have you tried making another simple form with just one block and one or two items?
    You can do this type of testing in these conditions.
    Which version of forms are you using?

  • Decimal Value display in ALV Field display

    Hi Expert,
    I need to dispaly one ALV Field "Routine Work Hour" value up to 2 decimal place in ALV output i.e if value is 2.5 then it should display as 2.50.The field which refers to this is ISMNW and the database table is AFRU.Now if this value is maintained in MINUTE unit, then code converts into HOUR unit and correctly outputs to ALV output up to 2 decimal after i changed the field decimal lenght.But for the value which is mainatined in HOUR unit, it correctlty populated into the final internal table upto 2 decimal and this table data while passing into FM " REUSE_GRID_DISPLAY" it only outputs upto 2 deciamal value for the value which is maintained as MINUTE unit in database table AFRU in ALV output, but for other value(Which are maintained in HOUR unit in table AFRU)  it still shows 1 decimal length.But the internal table correctly populates these values up to 2 decimal for all unit of work(MINUTE/HOUR) while passing though this above FM.
    Please advise where i need to look into.
    Thanks

    hi,
    pass these parameters to fieldcatlog.
    e.g.
    Fcat-ref_fieldname = 'ISMNW'.
    fcat-ref_tabname  = 'AFRU'.
    fcat-decimalsout = 2.
    Hope this will help you.
    Regards,
    Vijay

  • 1000 CHARACTER TEXT IN ALV FIELD

    Hi Experts,
    I have a String type variable containing 1000 character text that I am passing in a field on ALV. But ALV field can display on 132 characters. So now my requirement is that when a user double clicks on that field... then a popup or a screen appears where the user can read the entire text of that field.
    I have tried some FMs (like POPUP_TO_CONFIRM, POPUP_TO_INFORM, POPUP_DISPLAY_TEXT etc...), but all have length restriction.
    Please suggest if there is any FM to get the entire 1000 character text on a popup....  OR if there is any other way to do this...
    Thanks in advance
    Regards,
    Ashish Goyal

    I am using this code provided by you, facing error : Field "OB_GUI_DIALOGBOX_CONTAINER" is unknown. It is neither in one of   the specified tables nor defined by a "DATA" statement. 
    Please take a look and suggest.
    Using REUSE ALV GRID to display ALV.
       TYPES: BEGIN OF tp_text_x .
    TYPES: tdname      TYPE thead-tdname ,
           tdobject    TYPE thead-tdobject ,
           tdid        TYPE thead-tdid ,
           tdspras     TYPE thead-tdspras ,
           tdtxtlines  TYPE thead-tdtxtlines .
    TYPES: tdline      TYPE tline-tdline ,
           it_tline    TYPE tline_tab .
    TYPES: END OF tp_text_x .
    CLASS cl_event_reciever DEFINITION DEFERRED.
    DATA v_event_reciever TYPE REF TO cl_event_reciever.
    CLASS cl_event_receiver DEFINITION .
      PRIVATE SECTION.
        METHODS: close
                 FOR EVENT close OF cl_gui_dialogbox_container
                 IMPORTING sender.
        METHODS: init_container .
        METHODS: display_textedit
                 IMPORTING value(st_text_x) TYPE tp_text_x .
    ENDCLASS .                    "cl_event_receiver DEFINITION
    CLASS cl_event_receiver IMPLEMENTATION.
      METHOD close .
        CALL METHOD sender->set_visible
          EXPORTING
            visible = abap_false.
      ENDMETHOD .                    "handle_close
      METHOD init_container .
    *    DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
        IF ob_gui_dialogbox_container IS NOT INITIAL .
    *    IF EDITOR_CONTAINER IS NOT INITIAL .
          me->close( EXPORTING sender =  ob_gui_dialogbox_container ) .   " EDITOR_CONTAINER ).
        ENDIF .
        CREATE OBJECT ob_gui_dialogbox_container
          EXPORTING
            parent   = cl_gui_container=>screen0
            top      = 40
            left     = 200
            lifetime = cntl_lifetime_dynpro
            width    = 600
            height   = 100.
      ENDMETHOD.                    "init_container
      METHOD display_textedit .
        me->init_container( ) .
        DATA: ob_gui_textedit TYPE REF TO cl_gui_textedit .
    *    DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
        CREATE OBJECT ob_gui_textedit
          EXPORTING
            parent = ob_gui_dialogbox_container.
        CALL METHOD ob_gui_textedit->set_readonly_mode
          EXPORTING
            readonly_mode = cl_gui_textedit=>true.
        DATA: it_tdline TYPE TABLE OF tdline .
        DATA: st_tdline LIKE LINE OF it_tdline .
        FIELD-SYMBOLS: <st_tline> LIKE LINE OF st_text_x-it_tline .
        LOOP AT st_text_x-it_tline ASSIGNING <st_tline> .
          APPEND <st_tline>-tdline TO it_tdline .
        ENDLOOP .
        CALL METHOD ob_gui_textedit->set_text_as_stream
          EXPORTING
            text = it_tdline.
      ENDMETHOD.                    "display_textedit
    ENDCLASS .                    "cl_event_receiver IMPLEMENTATION
    INITIALIZATION.
    CREATE OBJECT v_event_reciever.
    DATA: ob_gui_dialogbox_container TYPE REF TO cl_gui_dialogbox_container.
    CREATE OBJECT ob_gui_dialogbox_container.
    START-OF-SELECTION.
    v_event_reciever->display_textedit( EXPORTING st_text_x = <st_alv_data_1>-text_1 ) .

  • Hi, i have doubt in alv field cat log

    1)In alv field cat preparation (i dont want to display for one particular field in output screen) can u pls send me the code.
    2)in field cat for a particular field i want to display in different color for that can u send me code.
    3)code for (DOUBLE CLICK) event.
                for the can u send me a code
    Regards,
    Nagesh

    Hi Nagesh,
    I think you have posted your question in the wrong forum, this forum is for education related topics only.  Please review the existing forums and re-post it to the appropriate one.
    Regards,
    Simon

  • In ALV how to make column heading in two lines ?

    In ALV if one the column heading is say for example "Purchase Order", if i want to display it as "Purchase" and "Order" below the "Purchase". Is it possible? if so how?
    Thanks in advance.
    Sounder

    Hi Sounder,
         It is highly impossible... If u tell your requirement clearly... we will try for solution..
    thanks and regards
    sk
    Rewards if helpful

  • Adding field in ME21N po header

    Hi All,
    I have added field on ME21N on header level.
    I used below screen exit
    SAPMM06E 0101 CUSTSCR1 SAPLXM06 0101 Subscreen: PO header
    and added fields to structure CI_EKKODB. Field is created on ME21N but table is not updating.
    can you please let me know what and where should I write the code to update the table.

    Hi Atul,
    I have added below code as adviced by you.
    EXIT_SAPMM06E_008  ( include ZXM06U37)
      e_ci_ekko = ekko_ci.
    EXIT_SAPMM06E_006 (   INCLUDE ZXM06U36)
    ekko_ci      = i_ci_ekko.
    it still not updating ekko table for these fields.
    How can I put logic in PBO even of screen 101 for enabling this.
    Please help.

  • Assignment number Field in sales order header

    Hi All,
    Can anyone let me know the ORDERS05 IDoc segment that corresponds to the Assignment number field in sales order header Accounting tab?
    I need to specify the assignment number while creating a new order through IDoc.
    Thanks.
    Regards,
    Riyaz

    Hi,
    Use transaction we60 to find the relevant documentation for your idoc type.
    regards,
    Jakub

  • EEWB and adding additional fields to the IBASE header

    Hello,
    I have used the EEWB (Easy Enhancement WorkBench) to add additional fields to the IBASE header. The process ends with a success state and in all steps there are no logs. The objects are generated and visible in the database table of the IBASE header and activated.
    When I go to the IB53 transaction the systems starts compiling. After the compiling there are no additional fields visible?
    In the EEWB no more actions are possible and it seems only an append structure was created with the new fields (GENERIC_IC_TASK).
    How do I get the fields to be visible in the IBASE transaction?
    I am using CRM 5.0.

    Ramakanth/Kiran,
    For creating screen structures or additional fields on the IBase header screen you would need to manually append entries in Database Tables T371D.... through T371Z, it is a set of around12-14 tables depending on the scenario which would need updations.
    Once updated in the right sequence you can see the EEWB fields on the Ibase header screen.
    Hope this helps.
    Amit Sitlani

  • ALV field, max length?

    Hello all,
    When entering data on the screen into the ALV, field VALID will allow only 128 characters.  But the field has 255 characters.
    Is the max field lenth in an ALV 128 characters? 
    The fieldcat has these values for field VALID:
    DATATYPE        char
    INTLEN               255
    DD_OUTLEN     255  
    The Layout has just 2 fields populated, ZEBRA and GRID_TITLE.
    Here is the bits of code I'm using.
    DATA: w_container TYPE scrfname VALUE 'ZCONTAINER1',
          w_grid  TYPE REF TO cl_gui_alv_grid,
           w_custom_container TYPE REF TO cl_gui_custom_container.
    DATA: i_alv TYPE TABLE OF zalv_zfxxu004.  " ALV table - displayed
    DATA: w_outtab  TYPE zalv_zfxxu004.           " ALV table row
    *zalv_zfxxu004 is a structure with the following fields.
    *AUFNR CHAR     12
    *BUKRS CHAR     4
    *KTEXT CHAR     40
    *VALID CHAR     255
               Create an instance of the container displayed on screen 100
      CREATE OBJECT w_custom_container
             EXPORTING container_name = w_container.
               Create an instance of the grid displayed in the container
      CREATE OBJECT w_grid
             EXPORTING i_parent = w_custom_container.
      CALL METHOD w_grid->set_table_for_first_display
        EXPORTING
          i_bypassing_buffer   = 'X'
          is_layout            = l_layout
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = il_fieldcat
          it_outtab            = il_outtab.
    Any thoughts?
    Thanks
    Bruce

    Hello,
    Check SAP note 857823.
    This is the standard system behavior and cannot be changed.
    Regards,
    David

  • Error While Linking Formula field for Repetetive Area Header In PLD

    Hi All,
    I am having a problem in pld..Let me explain...!!!!
    I have a drop down field called Billing Type....My requirement is if the billing type in Time based then it should become number of Hours,if my billing type is Trip based then my Quantity column should become no of trips .I got the logic but when i am linking the formula field with the header in the repetetive area it is not working,but when i paste it some where else it is working,Please tell me any solution for this...!!!my version is 8.81 PL20
    Regards
    Cherry

    Hi Cherry,
    Any formula fields you use in your logic must be on the same area as the linked fields. In your case - as I understand you are trying to link row level fields to a formula based on a header level UDF. What you need to do is to move all your hidden fields used in the formula to the Repetitive Area - don't worry if the field used is actually header level, it still should be fine.
    I would advise not to hide any fields used in a formula until you are 100% sure it's working - as you can then check if all of them show the results you expect. For instance in this case you could see that the header UDF displayed in the Repetitive Area is repeated in every line and so any formulas based on this field will work well.
    I hope this helps.
    Regards,
    Nat

Maybe you are looking for

  • Configuring PHP on Windows 2012 r2 server - PHP won't work

    Hi I was asked to migrate all apps from a win 2003 server to a win 2012 r2.  From a clean install I made sure that all windows updates are done, made sure windows authentication is enabled then went through the web platform installer adding php 5.6. 

  • Why does my Apple TV keep disappearing from Itunes?

    Now this is frustrating. Recently, after months with no problem, my Apple TV is not appearing in my list of devices in itunes. I have switched it off, restarted the Mac etc. Then I reset the Apple TV, hey presto, it was back, until I reloaded the lat

  • -110 Error in Mail

    OK, I'm setting someone up with a mail account, they have all the details correct but when the try to collect from the pop box they get a -110 error. I've tried all the same settings on my mac and it works fine, I'm on a G5 and they are using a power

  • Connect as...

    Ok here is my setup: Main computer: iMac 3.06, 2GB, 500GB, 24" Networked SETI box: Mac Mini 1.25, 256MB, 40GB 1.4.11 Mini has no mouse/keyboard/monitor I am no longer able to use connect as(through finder.). But I am able to use share screen, and rem

  • Synchronization of deletions failed [80040115-514-80040115-130]

    Today we received a bunch ( thousands of email informing us that the are some synchronization issues. In the folder "synchronization problems" we constantly receive the following message. Do you have a solution for this? 10:33:26 Synchronisations of