Adding field text values

Hi,
I am trying to add field text values to Nakisa i.e Personnel Area 01 but I want to display Personnel Area = England. I have found that the text values sit in a transparent table in SAP so I have downloaded it via the schema.
How do I add these values to the appresources??? I can't see how they replace the numeric values???
thanks

A table join is the most efficient way but seeing as you already have your table an update statement will work. Something like this example should work for both Oracle and SQL Server:
Update EmpDetailsCombined set EEGroupText = (select PTEXT from EEGroupTextTable where PERSG = EmpDetailsCombined.PERSG)
I hope that helps! If you need more you should google your database type and the type of statement (update) - there is a wealth of knowledge on this subject all over the internet.

Similar Messages

  • Adding fields/text on standard SAP transaction screens

    Hi,
    How do we add the fields on standard SAP transaction screens?
    For example, if I have to add field on transaction FB01 screen or change text of existing fields, how does it works?
    Please let me know.
    Thanks ,
    Yogita

    hi
    every standard sap transaction have enhancement options you can add fields there
    try this program to find the field-exits of the standard transaction.
    [https://wiki.sdn.sap.com/wiki/display/Snippets/howtogettheuser-exitsofa+transaction]
    regards
    sarves

  • Importing and adding to Taxonomy Text Values

    Hi MDM experts,
    I have loaded a taxonomy, attributes, attribute texts and linked the attributes to nodes in the taxonomy.  I also have products associated to the taxonomy nodes.
    I am now importing data to populate products with the values of the taxonomy attributes. Occasionally, there are new values for the taxonomy text of an attribute in the input file.
    When I import the taxonomy text for an existing attribute which already has several text values, the new value wipes out all the current values, replacing them with the new value for the import.
    For example, the attribute Primary Color has values red, green, yellow. I get a product which has a primary color of blue. When I map using the Taxonomy [Text Values], the only Text value I have left after importing is blue.
    I am using the Update all mapped fields option. I tried the Replace option and got the same results.
    Is there a way to import additional text values and have them add to the existing list of text values for an attribute? I am on MDM version 5.5.63.74.
    thanks,
    morgan

    Hi Sudhanshu,
    You are correct. There is no way to populate an attribute that doesn't exist.
    Here are my observations on importing product attribute data to MDM:
    Import Manager
    1. An input file that has an existing attribute that is not linked to the taxonomy node of the part will map but will not import. The error on import is 'One or more attribute values are invalid'.
    2. A non-existing attribute will not map so you can't import data as long as the new attribute is in your input file.
    Import Server
    1. If there is an exiting attribute in the input file that is not linked to the part's taxonomy node, the import will fail with the error 'One or more attribute values are invalid'.
    2. If there is a new attribute in the input file, the file will import. This tells me the import server just ignores the new attribute.
    Since MDM does not have the concept of a free-form text attribute, the data for that attribute always needs to be added to the list of values for the attribute. This is what I was having a problem with. I found that if you set the Multi-Valued Update option in the Destination pane to Append, the value in the input file will be appended to the existing list of values for the attribute and then it can be used to populate the attribute on the part. (This requires 2 separate imports to populate the part attribute -- unfortunately).
    Hope this helps,
    Morgan

  • Need help formatting text field default value

    Hello,
    I've received a customer request to put default text into the Value section of a text field. They're requesting that the default text include line breaks, bullets, etc. I added a Text Field object and added the default text to the Object tab > Value tab Default field but can't figure out how to add line breaks, etc.
    Thanks in advance,
    Saskia

    Hi,
    this is possible but not doable with the UI of Designer.
    The workaround is as follows:
    1. Create a text, enter your default text with all the formattings you need (text color, bold text, line breaks etc.)
    2. Create a text field and enter any word as default value. Let's say "Default".
    3. Select the text and the switch to the XML Source view.
    There you will find all the formatted text between the <value> tags such as:
    <value>
         <exData contentType="text/html">
              <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p style="letter-spacing:0in">This is<span style="xfa-spacerun:yes"> </span></p><p style="color:#ff0000;letter-spacing:0in">default Text</p><p style="letter-spacing:0in"><span style="xfa-spacerun:yes"> </span>• with<span style="xfa-spacerun:yes"> </span><span style="font-weight:bold">RichText</span> formatting.</p></body>
         </exData>
    </value>
    4. Select the whole code between the <value> tags and copy it to the clipboard (ctrl + c).
    5. Go to the Design View, select the text field, go back to the XML Source view.
    6. There you'll also find the value <tags> and your default value you entered before.
    <value>
         <text>Default</text>
    </value>
    7. Select this code section and paste the value copied before to the clipboard by pressing ctrl + v.
    8. That's it. When you now go back to the Design View your text field shows a formatted RichText as defaul text.

  • Calculated Field to return a text value

    I'm trying to create a calculated field that will hit on keywords in folder names and return a value based on the keyword found. Obviously the folder name is contained in the "Name" field on my sharepoint site but how do I write a formula that
    will look for a specific word or phrase and return an assigned text value?
    Example: Name field contains a list of folders (see the name list below). I want the formula to search for "AAA" and return value "XYZ", I want to search for "BBB" and return value "ABC",and I want to search
    for "CCC" and return a null field.
    Name
    Folder AAA Z
    Folder BBB Z
    Folder CCC Z
    So we're all clear what I'm up against; right now I have a total of 45 folders (soon to be more) that I want to cut down to 5 or 6 after grouping by the returned value generated by the calculated field. I have zero experience and I'm not a formula or a code
    guy. I've spent quite a few hours so far but I'm getting nowhere.

    Hi DKeller33
    I'm gladyou were able to get it working with content types but if the calculated column
    allows less hands-on maintenance I am guessing you'd probably prefer to use
    that solution. So I'd like to take one more stab at it if you will bear with me
    For your case, I created a new document library so I could test out the calculation.
    By default there were a number of columns created.
    One of them was the "Name" column which is also a hyperlink ( I beleive this is the column you are trying to use for the calculation)
    There is also by default a column named "Title"
    I used the "Title" column for my example because it is the same text as the folder's "Name" Column
    I created a calculated field called "Calculated Group"  and
    added the calculation
    =IF(ISNUMBER(FIND("AAA",Title)),"XYZ",IF(ISNUMBER(FIND("BBB",Title)),"ABC",IF(ISNUMBER(FIND("CCC",Title)),"","Next nested if")))
    The calculated column then returned the appropriate grouping as a string so you can group or filter by it.Please let me know if you get it to work or let me know that I'm just spinning my wheels and I will stop trying.
    Have a Great New Year! I hope SharePoint brings you good tidings!
    Alex

  • How to get key and text value of field "TNDRST" in VTTK from R/3 into BI

    There is one field call "TNDRST(Tender Status)" in SAP table VTTK in R/3. We can find  key value, but we are unable to find text for this field in VTTK. However we can see text value if we double click domain:TNDRST and go to value range.
    Questions, how to get key value and text of TNDRST together in BI. Do we need to create a master data source for TNDRST text information in R/3 and extracting into BI, if yes, how to? Are there any easy way to do it??
    Thanks,
    Sudree

    Hi Sudree,
    You need to create a generic Text Datasource to extract this information into BI System.
    1. Create a generic DS based on Table: DD07T
    2. The fields should be put in the extract structure.
              DOMNAME (Make this as Selection in the DS ) -
    Filter the Domain Name
              DOMVALUE_L -
    Key Value of Tender Status
              DDTEXT -
    Text / Description
              DDLANGUAGE -
    Language
    3. DD07T is the table with all the Domain names & their values, so in the Infopackage enter the Selection Value for DOMNAME as 'TNDRST' and then run it.
    Or you can create a view out of this table based on DOMNAME filter as 'TNDRST'.
    Regards,
    Chathia.

  • Field "Value field texts" is disabled to enter new values

    Hi there,
    I'm trying to enter new values on the field "Value field texts" from Depreciation Area, in Config Asset Value Display(Financial Accounting (New) > Asset Accounting > Information System > Configure Asset Value Display). The fields are disbled to enter new text values.
    I don't know what's happening. I've see the SAP Note 121433, but I don't intend to request the creation of a program to fill these fields. Does anyone know if there's another way to deal with this?
    Thanks in advance.

    Hi Srinivasa,
    Thanks for reply. I've checked the transaction ANSICHT following the steps said and the Master Data fields are with "No authorization" for all Depreciation areas.
    Do you know if there's another way of enable these fields? We cannot change the Authorization settings from one Depreciation Area to another.
    Thanks a lot.

  • How to create value request for screen field text box tt1

    How to create value request for screen field text box tt1
    i have a text box name tt1,
    i want f4 help for that .
    remember i am asking for screen i.e done from screen layout not selectio-screen.
    Thank you,
    Regards,
    Jagrut Bharatkumar Shukla,

    Hi,
    Create one Search Help in the SE11 for the particular Field that u want to display. In the Screen(Transaction SE51),For that Text Box in the Attributes,in Dict Tab ->Search Help Field give that Search Help Name.
    For Eg,
    If u want Purchase Order Numbers in that F4 Help.Create one <b>Search Help</b> by giving Table Name as <b>EKKO</b> & <b>Search Help Parameter</b> as <b>EBELN</b> with Lpos & Rpos as 0 & 1.Save & Activate it.
    Give this Search Help Name in Dict Tab ->Search Help Field of that Screen Attributes.
    Regards,
    Padmam.

  • Adding new constant value to an 'enum' used in a field causes an exception

    We are using the DPL. I added a new constant to an enum that is used as a field on an entity called Booking (this field is not a key). This seems to cause an exception during onForeignKeyDelete when we delete an object from a related entity. The constraint is a "NULLIFY" on a "MANY_TO_ONE" relationship, so the effect should be just to nullify the Booking foreign key, but for some reason the fields are being checked and causing this exception. Shouldn't it be possible to add a new constant value to an enum without having to do some sort of migration? The stack is below. Note that the two types mentioned in the exception message are in fact the same (this is the enum). For the moment we can truncate our database, because we are still in development, but this would present a problem in production.
    IllegalArgumentException: Not a subtype of the field's declared class com.chello.booking.model.BookingStatus: com.chello.booking.model.BookingStatus
    at com.sleepycat.persist.impl.RawAbstractInput.checkRawType(RawAbstractInput.java:142)
    at com.sleepycat.persist.impl.RecordOutput.writeObject(RecordOutput.java:75)
    at com.sleepycat.persist.impl.RawAccessor.writeField(RawAccessor.java:232)
    at com.sleepycat.persist.impl.RawAccessor.writeNonKeyFields(RawAccessor.java:148)
    at com.sleepycat.persist.impl.ComplexFormat.writeObject(ComplexFormat.java:528)
    at com.sleepycat.persist.impl.PersistEntityBinding.writeEntity(PersistEntityBinding.java:143)
    at com.sleepycat.persist.impl.PersistKeyCreator.nullifyForeignKeyInternal(PersistKeyCreator.java:170)
    at com.sleepycat.persist.impl.PersistKeyCreator.nullifyForeignKey(PersistKeyCreator.java:137)
    at com.sleepycat.je.SecondaryDatabase.onForeignKeyDelete(SecondaryDatabase.java:1082)
    at com.sleepycat.je.ForeignKeyTrigger.databaseUpdated(ForeignKeyTrigger.java:37)
    at com.sleepycat.je.Database.notifyTriggers(Database.java:2016)
    at com.sleepycat.je.Database.deleteInternal(Database.java:800)
    at com.sleepycat.je.Database.delete(Database.java:714)
    at com.sleepycat.persist.BasicIndex.delete(BasicIndex.java:133)
    at com.sleepycat.persist.PrimaryIndex.delete(PrimaryIndex.java:206)
    at com.sleepycat.persist.BasicIndex.delete(BasicIndex.java:124)
    at com.sleepycat.persist.PrimaryIndex.delete(PrimaryIndex.java:206)
    Kind regards
    James Brook

    James,
    I've started investigating this and at first look it does appear to be a DPL bug. Over the next few days I'll look more deeply and report back here with what I find. If it is indeed a bug, we'll fix this for the next JE 4.0.x release and I'll make the fix available to you.
    You are correct that adding enum values is allowed without a conversion of any kind. The only change you should have to make, other than adding the enum value, is to bump the version of the containing entity in the @Entity annotation. I'm suspect you've already done that, but if you hadn't, it wouldn't cause the problem you're seeing.
    We have tested the addition of enum values, but not in combination with foreign key deletion and the NULLIFY constraint, I'm afraid.
    If I'm correct about it, the bug is specific to adding enum values and deleting a secondary key with the NULLIFY constraint, prior to re-writing the entity in some other way. So if the entity is updated (written) before the secondary key is deleted, then the problem should not occur. Therefore, one workaround is to call EntityStore.evolve after adding the enum value, and before using the store in other ways.
    Thanks for reporting this, and I hope this is not blocking your development.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Invalid text value. A text field contains invalid data. Check the value and try again

    Hello,
    I am having a problem with the error mentioned in the title. I see alot of others have experienced the same problem, but I have quite a twist to it.
    I see the problem when I try to edit a list item, and then try to save the changes.
    Here what I see in the ULS log:
    System.Runtime.InteropServices.COMException: Invalid text value. A text field contains invalid data. Check the value and try again  
    at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId,
    Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter
    pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)   
    at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean
    bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback,
    ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
    I have 3 front end servers(fx wfe1, wfe2, wfe3).  And here is the twist.
    If I access the library directly through wfe1 and wfe2, I get the error. If I access the library via wfe3 if works just fine.
    So because of this, I think it is safe to assume that is has nothing to do with the character limit of 255. Nor does it have anything to do with the field type, since it is already set to mulitible lines of text.
    So. Any ideas?
    Regards,
    Michael
    mic

    Check if there is any change in web.config of these servers
    http://support.microsoft.com/kb/2880758
    To work around this issue, limit the length of the personal message in the invitation to 256 characters or less.
    This is a known issue. Microsoft is working to resolve this issue.
    http://social.msdn.microsoft.com/Forums/en-US/7bb16e51-e7cc-439e-a8b3-755683ccac1a/max-length-on-custom-field-types
    To solve the problem you may have to change the field's parent type to "note". To do that you have to open your fldtypes... file under Templates/xml and change the line to:
    "<Field Name="ParentType">Note</Field>" from "<Field Name="ParentType">Text</Field>"
    You might also have to add a sql type if your text needs to be longer than 255 characters
    <Field Name=”SQLType”>ntext</Field>
    and inherit from SPFieldMultiLineText instead of SPFieldText
    If this helped you resolve your issue, please mark it Answered

  • Auto Populating Text Fields Default Values

    I am using Acrobat X Pro.  I have a multiple page form and would like the "Legal Address" field entry/value after typed to auto-populate, or be the default value, of my "Mailing Address" field further down the form.  I can accomplish this if the fields are the same name, ***HOWEVER*** I just want it to pre-populate it and if the "Mailing Address" differs from "Legal Address" be able to type over that (Mailing Address) on the form entry without also changing the Legal Address.  If the fields are named the same, both will always be the same / updated together.
    Any help - or examples!

    Hi Michael,
    Thanks that was helpful and worked although I now appear to have another problem.
    When I enter data into current title (eg Manager, Finance) data in proposed title field (eg Manager Finance) is auto populated as expected - correct
    When I change the data that was auto populated in the proposed title field (eg Manager, FInance) to the new title (eg Director, Finance) is keeps the new tltle - correct
    When I select something from another field eg cost code, the data I manually keyed into the proposed title reverts back to what was entered into the current title (eg Manager FInance)
    Is there a way of committing the data that is entered automatically or manually so it remains in the field?
    Regards,
    Michael

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

  • Adding Field to the output of the Report

    Hello experts
    I have a program like following, I would like to add a field (Customer purchase order from order header)vbkd-bstkd to the output, I tried to add some code(check the highlightened portion) but it doesnt work(no values) can anyone help in correcting the code so that i can execute directly,
    Iam not full time ABAPer so could you please highlight the code you corrected(added),
    Thanks
    SP
    Global structure of list
    TYPE-POOLS: slis.
    TABLES: likp,
            lips,
            vbfa,
            kssk,
            klah,
            ausp,
            cabn,
            vbak,
            mara,
            vbrk,
            ser01,
            vbpa,
            vbrp,
            nast,
            zseri,
            ltap,
            pa0001,
            kna1,
            objk,
            viqmel,
            viqmma.
    TYPES:  BEGIN OF i_delivery,
                 vbeln LIKE likp-vbeln,
                 posnr  LIKE lips-posnr,
                 kunnr LIKE likp-kunnr,
                 kunag LIKE likp-kunag,
                 vkorg  LIKE vbak-vkorg,
                 matnr  LIKE lips-matnr,
                 lfart  LIKE likp-lfart,
                 arktx  LIKE vbap-arktx,
                 vgbel  LIKE lips-vgbel,
                 vgpos  LIKE lips-vgpos,
                 pstyv   LIKE lips-pstyv,
                 wadat TYPE likp-wadat_ist,
                 lfdat TYPE likp-lfdat,
                 prodh TYPE lips-prodh,
                 lfimg TYPE lips-lfimg,
                 vkbur TYPE lips-vkbur,
                 werks TYPE lips-werks,
                 vkgrp TYPE lips-vkgrp,
                 mvgr1 TYPE lips-mvgr1,
                 sernr LIKE equi-sernr,
                 sernp LIKE equi-sernr,
                 equnr LIKE equi-equnr,
                 kttxt LIKE qpct-kurztext,
                 fkimg LIKE vbrp-fkimg,
                 bstnk  LIKE vbak-bstnk,
                 vbelv  LIKE lips-vgbel,
                 posnv  LIKE lips-posnv,
                 uecha  LIKE lips-uecha,
                 ernam  LIKE vbak-ernam,
                 erdat LIKE vbak-erdat,
                 serail LIKE lips-serail,
                 anzsn LIKE lips-anzsn,
                 auart LIKE vbak-auart ,
                 netwr LIKE vbap-netwr,
                 fstno LIKE vbpa-pernr,
                 fstnm LIKE pa0001-ename,
                 ename LIKE pa0001-ename,
                 qname LIKE ltap-qname,
                 name1 LIKE kna1-name1,
                 name3 LIKE kna1-name2,
                 pernr LIKE vbpa-pernr,
                 aufnr LIKE viqmel-aufnr,
                 qmnum LIKE viqmel-qmnum,
                 mngrp LIKE viqmma-mngrp,
                 qmcod LIKE viqmel-qmcod,
                 qmcol LIKE viqmma-mncod,
                 cotxt(20),
                 invvalue LIKE vbrp-netwr,
                 posnn LIKE vbfa-posnn,
                 bstkd LIKE vbkd-bstkd,
             END OF i_delivery.
    Global structure of list
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
    SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.
    SELECT-OPTIONS: s_vbeln  FOR likp-vbeln,
                    s_lfart  FOR likp-lfart,
                    s_kunnr  FOR likp-kunnr,
                    s_erdat  FOR likp-erdat,
                    s_wadat  FOR likp-wadat_ist,
                    s_werks  FOR lips-werks,
                    s_matnr  FOR lips-matnr,
                    s_prodh  FOR lips-prodh,
                    s_qmnum FOR viqmel-qmnum.
    SELECTION-SCREEN END OF BLOCK block2.
    SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:  s_vbelv FOR vbak-vbeln,
                     s_auart FOR vbak-auart.
    SELECTION-SCREEN END OF BLOCK block4.
    PARAMETERS: p_vari LIKE disvariant-variant.
    RANGES: r_vbeln FOR likp-vbeln.
    DATA:   gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:   gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            i_nast TYPE nast OCCURS 0 WITH HEADER LINE,
            gt_list_top_of_page TYPE slis_t_listheader,
            gt_events   TYPE slis_t_event,
            gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA:   g_repid LIKE sy-repid,
             g_count LIKE sy-tabix.
    DATA: BEGIN OF i_serial OCCURS 0,
            obknr TYPE ser01-obknr,
            lief_nr TYPE ser01-lief_nr,
            posnr TYPE ser01-posnr,
            anzsn TYPE ser01-anzsn,
          END OF i_serial.
    DATA: BEGIN OF i_object_numbers OCCURS 0,
            obknr TYPE objk-obknr,
            obzae TYPE objk-obzae,
            sernr TYPE objk-sernr,
            equnr TYPE objk-equnr,
            matnr TYPE objk-matnr,
            taser TYPE objk-taser,
          END OF i_object_numbers.
    DATA:   g_save(1) TYPE c,
           g_default(1) TYPE c,
            g_exit(1) TYPE c,
            gx_variant LIKE disvariant,
            g_variant LIKE disvariant.
    DATA:  g_mnkat LIKE viqmma-mnkat,
           g_mngrp LIKE viqmma-mngrp,
           g_atinn LIKE ausp-atinn.
    DATA: gt_vbkd TYPE TABLE OF vbkd WITH HEADER LINE.
    Initialization fieldcatalog
    INITIALIZATION.
      g_repid = sy-repid.
      PERFORM fieldcat_init USING gt_fieldcat[].
      MOVE: 'I' TO  s_vkorg-sign,
            'EQ' TO  s_vkorg-option,
            '5090' TO s_vkorg-low.
      APPEND  s_vkorg.
      MOVE: 'I' TO  s_lfart-sign,
           'EQ' TO s_lfart-option,
           'LF' TO s_lfart-low.
      APPEND  s_lfart.
      g_save = 'A'.
      PERFORM variant_init.
    Get default variant
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = g_save
           CHANGING
                cs_variant = gx_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    Start of Selection
    START-OF-SELECTION.
      PERFORM e03_eventtab_build USING gt_events[].
      PERFORM select_data TABLES gt_outtab.
    Display list
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_background_id         = 'ALV_BACKGROUND'
                i_callback_user_command = 'USER_COMMAND'
                is_variant              = g_variant
                i_save                  = g_save
                i_callback_program      = g_repid
                it_fieldcat             = gt_fieldcat[]
           TABLES
                t_outtab                = gt_outtab.
       Forms
    Initialization fieldcatalog
    FORM fieldcat_init
          USING rt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: pos TYPE i VALUE 1.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELN'.
      ls_fieldcat-seltext_s     = 'Delivery'.
      ls_fieldcat-seltext_m     = 'Delivery'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'BSTKD'.
      ls_fieldcat-seltext_s     = 'PO Number'.
      ls_fieldcat-seltext_m     = 'PO Number'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'POSNR'.
      ls_fieldcat-key           = 'X'.
      ls_fieldcat-seltext_s     = 'Item'.
      ls_fieldcat-seltext_m     = 'Item'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LFART'.
      ls_fieldcat-seltext_s     = 'Del Type'.
      ls_fieldcat-seltext_m     = 'Delivery Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VGBEL'.
      ls_fieldcat-seltext_s     = 'Source Doc'.
      ls_fieldcat-seltext_m     = 'Source Doc'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'AUART'.
      ls_fieldcat-seltext_s     = 'Type'.
      ls_fieldcat-seltext_m     = 'Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KUNNR'.
      ls_fieldcat-seltext_s     = 'Customer'.
      ls_fieldcat-seltext_m     = 'Customer'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'NAME1'.
      ls_fieldcat-seltext_s     = 'Name'.
      ls_fieldcat-seltext_m     = 'Name1'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-seltext_s     = 'Plant'.
      ls_fieldcat-seltext_m     = 'Plant'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-seltext_s     = 'Material'.
      ls_fieldcat-seltext_m     = 'Material'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MVGR1'.
      ls_fieldcat-seltext_s     = 'Speciality'.
      ls_fieldcat-seltext_m     = 'Speciality'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'PRODH'.
      ls_fieldcat-seltext_s     = 'Hierarchy'.
      ls_fieldcat-seltext_m     = 'Prod Hierarchy'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ARKTX'.
      ls_fieldcat-seltext_s     = 'Description'.
      ls_fieldcat-seltext_m     = 'Description'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERNAM'.
      ls_fieldcat-seltext_s     = 'Created By'.
      ls_fieldcat-seltext_m     = 'Created By'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERDAT'.
      ls_fieldcat-seltext_s     = 'Created On'.
      ls_fieldcat-seltext_m     = 'Created On'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WADAT_IST'.
      ls_fieldcat-seltext_s     = 'GoodsMvt.Date'.
      ls_fieldcat-seltext_m     = 'Goods Mvt Date'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNR'.
      ls_fieldcat-seltext_s     = 'Serial Shipped'.
      ls_fieldcat-seltext_m     = 'Serial Shipped'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNP'.
      ls_fieldcat-seltext_s     = 'Old Serial'.
      ls_fieldcat-seltext_m     = 'Old Serial'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELV'.
      ls_fieldcat-seltext_s     = 'Invoice'.
      ls_fieldcat-seltext_m     = 'Invoice'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'INVVALUE'.
      ls_fieldcat-seltext_s     = 'Invoice Amt'.
      ls_fieldcat-seltext_m     = 'Invoice Value'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMNUM'.
      ls_fieldcat-seltext_s     = 'Notification'.
      ls_fieldcat-seltext_m     = 'Notification'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOD'.
      ls_fieldcat-seltext_s     = 'Rep LevKST'.
      ls_fieldcat-seltext_m     = 'Repair Level KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'COTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KST'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOL'.
      ls_fieldcat-seltext_s     = 'Rep LevKSE'.
      ls_fieldcat-seltext_m     = 'Repair Level KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KTTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KSE'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.   "fieldcat_init
    Data selection
    FORM select_data TABLES rt_outtab LIKE gt_outtab[].
      CLEAR: r_vbeln[].
    Read all Invoices for the Selection
      SELECT DISTINCT h~vbeln  h~kunnr h~kunag
                     d~posnr  d~matnr d~anzsn
                     d~serail d~vgbel d~vgpos
                     d~posnv  d~lfimg d~arktx
                     d~uecha  h~lfart h~erdat
                     h~ernam  h~lfdat d~prodh
                     h~vkorg  d~vkbur d~vkgrp
                     d~mvgr1  h~wadat_ist d~pstyv
                     d~werks
             INTO (rt_outtab-vbeln, rt_outtab-kunnr,
                    rt_outtab-kunag, rt_outtab-posnr,
                    rt_outtab-matnr, rt_outtab-anzsn,
                    rt_outtab-serail, rt_outtab-vgbel,
                    rt_outtab-vgpos,  rt_outtab-posnv,
                    rt_outtab-lfimg,  rt_outtab-arktx,
                    rt_outtab-uecha, rt_outtab-lfart,
                    rt_outtab-erdat, rt_outtab-ernam,
                    rt_outtab-lfdat, rt_outtab-prodh,
                    rt_outtab-vkorg, rt_outtab-vkbur,
                    rt_outtab-vkgrp, rt_outtab-mvgr1,
                    rt_outtab-wadat, rt_outtab-pstyv,
                    rt_outtab-werks)
            FROM likp AS h INNER JOIN lips AS d
                     ON h~vbeln = d~vbeln
                    WHERE h~vbeln IN s_vbeln
                    AND  h~vkorg IN s_vkorg
                    AND  h~lfart IN s_lfart
                     AND  h~kunnr IN s_kunnr
                     AND  h~wadat IN s_wadat
                     AND  d~matnr IN s_matnr
                     AND  d~werks IN s_werks
                     AND  d~prodh IN s_prodh
                     AND  d~vgbel IN s_vbelv
                     AND  d~matnr LIKE 'S%'.
        SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.
        IF: sy-subrc EQ 0.
          MOVE vbak-vbeln TO rt_outtab-vgbel.
          MOVE vbak-auart TO rt_outtab-auart.
        ENDIF.
        SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr
                                    AND  mtart EQ 'FERT'.
        CHECK sy-subrc EQ 0.
        IF NOT rt_outtab-posnv IS INITIAL.
          rt_outtab-vgpos = rt_outtab-posnv.
        ENDIF.
        CLEAR: vbfa.
        SELECT SINGLE vbeln posnn rfwrt INTO
        (rt_outtab-vbelv,  rt_outtab-posnn, rt_outtab-netwr)
        FROM vbfa  WHERE vbelv EQ rt_outtab-vbeln
                                  AND   posnv EQ rt_outtab-posnr
                                  AND   vbtyp_n EQ 'M'.
        CLEAR : rt_outtab-invvalue.
        SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv
          AND posnr = rt_outtab-posnn.
        rt_outtab-fkimg = vbrp-fkimg.
        IF rt_outtab-fkimg NE 0.
          rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.
        ENDIF.
        APPEND rt_outtab.
        IF NOT  r_vbeln-low IS INITIAL.
          IF r_vbeln-low GT rt_outtab-vbeln.
            r_vbeln-low =  rt_outtab-vbeln.
          ENDIF.
          IF r_vbeln-high LT rt_outtab-vbeln.
            r_vbeln-high =  rt_outtab-vbeln.
          ENDIF.
        ELSE.
          r_vbeln-low  =  rt_outtab-vbeln.
          r_vbeln-high =  rt_outtab-vbeln.
        ENDIF.
        CLEAR: rt_outtab.
      ENDSELECT.
    IF NOT rt_outtab[] IS INITIAL.
       SELECT vbeln posnr bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       FROM vbkd
         FOR ALL ENTRIES IN rt_outtab
         WHERE vbeln = rt_outtab-vgbel
         AND posnr = rt_outtab-vgpos.
       IF NOT gt_vbkd[] IS INITIAL.
         SORT gt_vbkd BY vbeln posnr.
         LOOP AT rt_outtab.
           READ TABLE gt_vbkd WITH KEY vbeln = rt_outtab-vgbel
           posnr = rt_outtab-vgpos
           BINARY SEARCH.
           IF sy-subrc = 0.
             rt_outtab-bstkd = gt_vbkd-bstkd.
             MODIFY rt_outtab.
           ENDIF.
         ENDLOOP.
       ENDIF.
    ENDIF.
    *select bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       from vbkd   where vbeln = gt_outtab-vbeln
                  and posnr = '000000'.
                 rt_outtab-bstkd = vbkd-bstkd .
       <i><b> select single bstkd into gt_vbkd
        from vbkd  where vbeln = rt_outtab-vbeln
                   and posnr = '000000'.
                   rt_outtab-bstkd = gt_vbkd-bstkd.
                  APPEND rt_outtab .</b></i>
      IF NOT r_vbeln IS INITIAL.
        MOVE: 'I' TO  r_vbeln-sign,
               'BT' TO  r_vbeln-option.
        APPEND r_vbeln.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial
                                  FROM   ser01 WHERE lief_nr IN r_vbeln.
      ENDIF.
      SORT i_serial.
      IF NOT i_serial[] IS INITIAL.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers
                                   FROM   objk
                                   FOR ALL ENTRIES IN i_serial
                                   WHERE obknr EQ i_serial-obknr
                                   AND  taser EQ 'SER01'.
      ENDIF.
      SORT i_object_numbers BY  obknr obzae.
      LOOP AT rt_outtab.
        CLEAR: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,
         rt_outtab-sernp, rt_outtab-kttxt.
    Read the Sold To Name
        SELECT SINGLE name1 INTO rt_outtab-name1
                          FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.
    Read Ship-to Customer
        CLEAR: objk.
        IF NOT rt_outtab-serail IS INITIAL.
          READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln
                                        posnr = rt_outtab-posnr.
          IF sy-subrc EQ 0.
            DO i_serial-anzsn TIMES.
              CLEAR: rt_outtab-sernr, rt_outtab-sernp.
              READ TABLE i_object_numbers  WITH KEY obknr = i_serial-obknr
                                                    matnr = rt_outtab-matnr
                                                BINARY SEARCH.
              IF sy-subrc EQ 0.
                rt_outtab-sernr = i_object_numbers-sernr.
                DELETE i_object_numbers INDEX sy-tabix.
                MOVE '1'   TO rt_outtab-lfimg.
                CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,
                         rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
                SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat
                                     INTO (rt_outtab-aufnr, rt_outtab-qmnum,
                        rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
                                 FROM viqmel  WHERE matnr = rt_outtab-matnr
                                        AND serialnr = rt_outtab-sernr
                                        AND qmart  EQ 'S4'
                                        AND qmnum IN s_qmnum.
                CLEAR: rt_outtab-cotxt.
                SELECT SINGLE kurztext INTO rt_outtab-cotxt
                                      FROM qpct WHERE katalogart EQ g_mnkat
                                         AND codegruppe EQ  g_mngrp
                                         AND code EQ rt_outtab-qmcod
                                         AND sprache EQ sy-langu.
    Read Serial Number from Name Plate Data.
                CLEAR: klah, kssk, ausp, cabn, g_atinn.
                SELECT SINGLE atinn INTO (g_atinn) FROM cabn
                                    WHERE atnam = 'SBANK_SERIAL_NUMBER'.
                SELECT SINGLE  atwrt
                      INTO  (rt_outtab-sernp)
                      FROM  ( klah AS a INNER JOIN kssk AS k
                               ON aclint = kclint )
                          JOIN ausp AS p
                                ON kobjek = pobjek
                                AND p~atinn = g_atinn
                                AND pklart = aklart
                      WHERE a~klart = '002'
                       AND  a~class = 'KSE_SN_ENDOSCOPES'
                        AND  k~objek = rt_outtab-equnr.
    *KSE Repair level (activity code text from KSE-SM07 code group)
                CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.
                CLEAR: rt_outtab-qmcol.
                CLEAR:   g_mnkat, g_mngrp.
                SELECT SINGLE mnkat mngrp mncod INTO
                                    (g_mnkat, g_mngrp, rt_outtab-qmcol)
                              FROM viqmma WHERE qmnum = rt_outtab-qmnum
                                    AND  mngrp EQ 'KSE-SM07'
                                    AND kzloesch EQ space.
                CLEAR: rt_outtab-kttxt.
                SELECT SINGLE kurztext INTO rt_outtab-kttxt
                             FROM qpct WHERE katalogart EQ g_mnkat
                                    AND codegruppe EQ  g_mngrp
                                    AND code EQ rt_outtab-qmcol
                                    AND sprache EQ sy-langu.
                rt_outtab1 = rt_outtab.
                APPEND rt_outtab1.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDIF.
      ENDLOOP.
      CLEAR: rt_outtab[].
      rt_outtab[] = rt_outtab1[].
      SORT rt_outtab BY vbeln posnr.
    ENDFORM.
          FORM get_repname                                              *
    -->  P_VBELN                                                       *
    -->  P_POSNR                                                       *
    -->  P_PERNR                                                       *
    -->  P_ENAME                                                       *
    FORM get_repname USING  p_vbeln
                              p_posnr
                     CHANGING  p_pernr
                              p_ename. "
      DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.
      CLEAR: i_vbpa[].
      CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'
           EXPORTING
                g_salesdocument = p_vbeln
                g_sales_item    = p_posnr
           TABLES
                st_vbpa         = i_vbpa.
      READ TABLE i_vbpa INDEX 1.
      IF sy-subrc = 0.
        p_pernr = i_vbpa-pernr.
        SELECT SINGLE ename INTO p_ename
          FROM pa0001
         WHERE pernr = i_vbpa-pernr.
      ENDIF.
    ENDFORM.                    " get_repname
          FORM E03_EVENTTAB_BUILD                                       *
    -->  E03_LT_EVENTS                                                 *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = e03_lt_events.
      READ TABLE e03_lt_events WITH KEY name =  slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO e03_lt_events.
      ENDIF.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    *&      Form  USER_COMMAND
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          PERFORM display_delivery USING r_ucomm
                                        rs_selfield.
      ENDCASE.
    ENDFORM.
    *&      Form  display_delivery
    FORM display_delivery
    USING r_ucomm LIKE sy-ucomm
                                 rs_selfield TYPE slis_selfield.
      CASE rs_selfield-sel_tab_field.
        WHEN '1-VBELN'.
          SET PARAMETER ID 'VL' FIELD rs_selfield-value.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        WHEN '1-VBELV'.
          SET PARAMETER ID 'VF' FIELD rs_selfield-value.
          CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    FORM variant_init.
      CLEAR g_variant.
      g_variant-report = g_repid.
    ENDFORM.                               " VARIANT_INIT
    *&      Form  F4_FOR_VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = g_variant
                i_save              = g_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = g_exit
                es_variant          = gx_variant
           EXCEPTIONS
                not_found = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF g_exit = space.
          p_vari = gx_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    FORM pai_of_selection_screen.
      IF NOT p_vari IS INITIAL.
        MOVE g_variant TO gx_variant.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = g_save
             CHANGING
                  cs_variant = gx_variant.
        g_variant = gx_variant.
      ELSE.
        PERFORM variant_init.
      ENDIF.
    ENDFORM.

    naren this is the program
    Global structure of list
    TYPE-POOLS: slis.
    TABLES: likp,
            lips,
            vbfa,
            kssk,
            klah,
            ausp,
            cabn,
            vbak,
            mara,
            vbrk,
            ser01,
            vbpa,
            vbrp,
            nast,
            zseri,
            ltap,
            pa0001,
            kna1,
            objk,
            viqmel,
            viqmma.
    TYPES:  BEGIN OF i_delivery,
                 vbeln LIKE likp-vbeln,
                 posnr  LIKE lips-posnr,
                 kunnr LIKE likp-kunnr,
                 kunag LIKE likp-kunag,
                 vkorg  LIKE vbak-vkorg,
                 matnr  LIKE lips-matnr,
                 lfart  LIKE likp-lfart,
                 arktx  LIKE vbap-arktx,
                 vgbel  LIKE lips-vgbel,
                 vgpos  LIKE lips-vgpos,
                 pstyv   LIKE lips-pstyv,
                 wadat TYPE likp-wadat_ist,
                 lfdat TYPE likp-lfdat,
                 prodh TYPE lips-prodh,
                 lfimg TYPE lips-lfimg,
                 vkbur TYPE lips-vkbur,
                 werks TYPE lips-werks,
                 vkgrp TYPE lips-vkgrp,
                 mvgr1 TYPE lips-mvgr1,
                 sernr LIKE equi-sernr,
                 sernp LIKE equi-sernr,
                 equnr LIKE equi-equnr,
                 kttxt LIKE qpct-kurztext,
                 fkimg LIKE vbrp-fkimg,
                 bstnk  LIKE vbak-bstnk,
                 vbelv  LIKE lips-vgbel,
                 posnv  LIKE lips-posnv,
                 uecha  LIKE lips-uecha,
                 ernam  LIKE vbak-ernam,
                 erdat LIKE vbak-erdat,
                 serail LIKE lips-serail,
                 anzsn LIKE lips-anzsn,
                 auart LIKE vbak-auart ,
                 netwr LIKE vbap-netwr,
                 fstno LIKE vbpa-pernr,
                 fstnm LIKE pa0001-ename,
                 ename LIKE pa0001-ename,
                 qname LIKE ltap-qname,
                 name1 LIKE kna1-name1,
                 name3 LIKE kna1-name2,
                 pernr LIKE vbpa-pernr,
                 aufnr LIKE viqmel-aufnr,
                 qmnum LIKE viqmel-qmnum,
                 mngrp LIKE viqmma-mngrp,
                 qmcod LIKE viqmel-qmcod,
                 qmcol LIKE viqmma-mncod,
                 cotxt(20),
                 invvalue LIKE vbrp-netwr,
                 posnn LIKE vbfa-posnn,
                 bstkd LIKE vbkd-bstkd,
             END OF i_delivery.
    Global structure of list
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
    SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.
    SELECT-OPTIONS: s_vbeln  FOR likp-vbeln,
                    s_lfart  FOR likp-lfart,
                    s_kunnr  FOR likp-kunnr,
                    s_erdat  FOR likp-erdat,
                    s_wadat  FOR likp-wadat_ist,
                    s_werks  FOR lips-werks,
                    s_matnr  FOR lips-matnr,
                    s_prodh  FOR lips-prodh,
                    s_qmnum FOR viqmel-qmnum.
    SELECTION-SCREEN END OF BLOCK block2.
    SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:  s_vbelv FOR vbak-vbeln,
                     s_auart FOR vbak-auart.
    SELECTION-SCREEN END OF BLOCK block4.
    PARAMETERS: p_vari LIKE disvariant-variant.
    RANGES: r_vbeln FOR likp-vbeln.
    DATA:   gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:   gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,
            i_nast TYPE nast OCCURS 0 WITH HEADER LINE,
            gt_list_top_of_page TYPE slis_t_listheader,
            gt_events   TYPE slis_t_event,
            gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA:   g_repid LIKE sy-repid,
             g_count LIKE sy-tabix.
    DATA: BEGIN OF i_serial OCCURS 0,
            obknr TYPE ser01-obknr,
            lief_nr TYPE ser01-lief_nr,
            posnr TYPE ser01-posnr,
            anzsn TYPE ser01-anzsn,
          END OF i_serial.
    DATA: BEGIN OF i_object_numbers OCCURS 0,
            obknr TYPE objk-obknr,
            obzae TYPE objk-obzae,
            sernr TYPE objk-sernr,
            equnr TYPE objk-equnr,
            matnr TYPE objk-matnr,
            taser TYPE objk-taser,
          END OF i_object_numbers.
    DATA:   g_save(1) TYPE c,
           g_default(1) TYPE c,
            g_exit(1) TYPE c,
            gx_variant LIKE disvariant,
            g_variant LIKE disvariant.
    DATA:  g_mnkat LIKE viqmma-mnkat,
           g_mngrp LIKE viqmma-mngrp,
           g_atinn LIKE ausp-atinn.
    DATA: gt_vbkd TYPE TABLE OF vbkd WITH HEADER LINE.
    Initialization fieldcatalog
    INITIALIZATION.
      g_repid = sy-repid.
      PERFORM fieldcat_init USING gt_fieldcat[].
      MOVE: 'I' TO  s_vkorg-sign,
            'EQ' TO  s_vkorg-option,
            '5090' TO s_vkorg-low.
      APPEND  s_vkorg.
      MOVE: 'I' TO  s_lfart-sign,
           'EQ' TO s_lfart-option,
           'LF' TO s_lfart-low.
      APPEND  s_lfart.
      g_save = 'A'.
      PERFORM variant_init.
    Get default variant
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = g_save
           CHANGING
                cs_variant = gx_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    Start of Selection
    START-OF-SELECTION.
      PERFORM e03_eventtab_build USING gt_events[].
      PERFORM select_data TABLES gt_outtab.
    Display list
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_background_id         = 'ALV_BACKGROUND'
                i_callback_user_command = 'USER_COMMAND'
                is_variant              = g_variant
                i_save                  = g_save
                i_callback_program      = g_repid
                it_fieldcat             = gt_fieldcat[]
           TABLES
                t_outtab                = gt_outtab.
       Forms
    Initialization fieldcatalog
    FORM fieldcat_init
          USING rt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      DATA: pos TYPE i VALUE 1.
      CLEAR ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELN'.
      ls_fieldcat-seltext_s     = 'Delivery'.
      ls_fieldcat-seltext_m     = 'Delivery'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'BSTKD'.
      ls_fieldcat-seltext_s     = 'PO Number'.
      ls_fieldcat-seltext_m     = 'PO Number'.
      ls_fieldcat-key           = 'X'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'POSNR'.
      ls_fieldcat-key           = 'X'.
      ls_fieldcat-seltext_s     = 'Item'.
      ls_fieldcat-seltext_m     = 'Item'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LFART'.
      ls_fieldcat-seltext_s     = 'Del Type'.
      ls_fieldcat-seltext_m     = 'Delivery Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VGBEL'.
      ls_fieldcat-seltext_s     = 'Source Doc'.
      ls_fieldcat-seltext_m     = 'Source Doc'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'AUART'.
      ls_fieldcat-seltext_s     = 'Type'.
      ls_fieldcat-seltext_m     = 'Type'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KUNNR'.
      ls_fieldcat-seltext_s     = 'Customer'.
      ls_fieldcat-seltext_m     = 'Customer'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'NAME1'.
      ls_fieldcat-seltext_s     = 'Name'.
      ls_fieldcat-seltext_m     = 'Name1'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-seltext_s     = 'Plant'.
      ls_fieldcat-seltext_m     = 'Plant'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-seltext_s     = 'Material'.
      ls_fieldcat-seltext_m     = 'Material'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MVGR1'.
      ls_fieldcat-seltext_s     = 'Speciality'.
      ls_fieldcat-seltext_m     = 'Speciality'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'PRODH'.
      ls_fieldcat-seltext_s     = 'Hierarchy'.
      ls_fieldcat-seltext_m     = 'Prod Hierarchy'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ARKTX'.
      ls_fieldcat-seltext_s     = 'Description'.
      ls_fieldcat-seltext_m     = 'Description'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERNAM'.
      ls_fieldcat-seltext_s     = 'Created By'.
      ls_fieldcat-seltext_m     = 'Created By'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERDAT'.
      ls_fieldcat-seltext_s     = 'Created On'.
      ls_fieldcat-seltext_m     = 'Created On'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WADAT_IST'.
      ls_fieldcat-seltext_s     = 'GoodsMvt.Date'.
      ls_fieldcat-seltext_m     = 'Goods Mvt Date'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNR'.
      ls_fieldcat-seltext_s     = 'Serial Shipped'.
      ls_fieldcat-seltext_m     = 'Serial Shipped'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNP'.
      ls_fieldcat-seltext_s     = 'Old Serial'.
      ls_fieldcat-seltext_m     = 'Old Serial'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELV'.
      ls_fieldcat-seltext_s     = 'Invoice'.
      ls_fieldcat-seltext_m     = 'Invoice'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'INVVALUE'.
      ls_fieldcat-seltext_s     = 'Invoice Amt'.
      ls_fieldcat-seltext_m     = 'Invoice Value'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMNUM'.
      ls_fieldcat-seltext_s     = 'Notification'.
      ls_fieldcat-seltext_m     = 'Notification'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOD'.
      ls_fieldcat-seltext_s     = 'Rep LevKST'.
      ls_fieldcat-seltext_m     = 'Repair Level KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'COTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KST'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KST'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOL'.
      ls_fieldcat-seltext_s     = 'Rep LevKSE'.
      ls_fieldcat-seltext_m     = 'Repair Level KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KTTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KSE'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KSE'.
      APPEND ls_fieldcat TO rt_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.   "fieldcat_init
    Data selection
    FORM select_data TABLES rt_outtab LIKE gt_outtab[].
      CLEAR: r_vbeln[].
    Read all Invoices for the Selection
      SELECT DISTINCT h~vbeln  h~kunnr h~kunag
                     d~posnr  d~matnr d~anzsn
                     d~serail d~vgbel d~vgpos
                     d~posnv  d~lfimg d~arktx
                     d~uecha  h~lfart h~erdat
                     h~ernam  h~lfdat d~prodh
                     h~vkorg  d~vkbur d~vkgrp
                     d~mvgr1  h~wadat_ist d~pstyv
                     d~werks
             INTO (rt_outtab-vbeln, rt_outtab-kunnr,
                    rt_outtab-kunag, rt_outtab-posnr,
                    rt_outtab-matnr, rt_outtab-anzsn,
                    rt_outtab-serail, rt_outtab-vgbel,
                    rt_outtab-vgpos,  rt_outtab-posnv,
                    rt_outtab-lfimg,  rt_outtab-arktx,
                    rt_outtab-uecha, rt_outtab-lfart,
                    rt_outtab-erdat, rt_outtab-ernam,
                    rt_outtab-lfdat, rt_outtab-prodh,
                    rt_outtab-vkorg, rt_outtab-vkbur,
                    rt_outtab-vkgrp, rt_outtab-mvgr1,
                    rt_outtab-wadat, rt_outtab-pstyv,
                    rt_outtab-werks)
            FROM likp AS h INNER JOIN lips AS d
                     ON h~vbeln = d~vbeln
                    WHERE h~vbeln IN s_vbeln
                    AND  h~vkorg IN s_vkorg
                    AND  h~lfart IN s_lfart
                     AND  h~kunnr IN s_kunnr
                     AND  h~wadat IN s_wadat
                     AND  d~matnr IN s_matnr
                     AND  d~werks IN s_werks
                     AND  d~prodh IN s_prodh
                     AND  d~vgbel IN s_vbelv
                     AND  d~matnr LIKE 'S%'.
        SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.
        IF: sy-subrc EQ 0.
          MOVE vbak-vbeln TO rt_outtab-vgbel.
          MOVE vbak-auart TO rt_outtab-auart.
        ENDIF.
        SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr
                                    AND  mtart EQ 'FERT'.
        CHECK sy-subrc EQ 0.
        IF NOT rt_outtab-posnv IS INITIAL.
          rt_outtab-vgpos = rt_outtab-posnv.
        ENDIF.
        CLEAR: vbfa.
        SELECT SINGLE vbeln posnn rfwrt INTO
        (rt_outtab-vbelv,  rt_outtab-posnn, rt_outtab-netwr)
        FROM vbfa  WHERE vbelv EQ rt_outtab-vbeln
                                  AND   posnv EQ rt_outtab-posnr
                                  AND   vbtyp_n EQ 'M'.
        CLEAR : rt_outtab-invvalue.
        SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv
          AND posnr = rt_outtab-posnn.
        rt_outtab-fkimg = vbrp-fkimg.
        IF rt_outtab-fkimg NE 0.
          rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.
        ENDIF.
        APPEND rt_outtab.
        IF NOT  r_vbeln-low IS INITIAL.
          IF r_vbeln-low GT rt_outtab-vbeln.
            r_vbeln-low =  rt_outtab-vbeln.
          ENDIF.
          IF r_vbeln-high LT rt_outtab-vbeln.
            r_vbeln-high =  rt_outtab-vbeln.
          ENDIF.
        ELSE.
          r_vbeln-low  =  rt_outtab-vbeln.
          r_vbeln-high =  rt_outtab-vbeln.
        ENDIF.
        CLEAR: rt_outtab.
      ENDSELECT.
    IF NOT rt_outtab[] IS INITIAL.
       SELECT vbeln posnr bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       FROM vbkd
         FOR ALL ENTRIES IN rt_outtab
         WHERE vbeln = rt_outtab-vgbel
         AND posnr = rt_outtab-vgpos.
       IF NOT gt_vbkd[] IS INITIAL.
         SORT gt_vbkd BY vbeln posnr.
         LOOP AT rt_outtab.
           READ TABLE gt_vbkd WITH KEY vbeln = rt_outtab-vgbel
           posnr = rt_outtab-vgpos
           BINARY SEARCH.
           IF sy-subrc = 0.
             rt_outtab-bstkd = gt_vbkd-bstkd.
             MODIFY rt_outtab.
           ENDIF.
         ENDLOOP.
       ENDIF.
    ENDIF.
    *select bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
       from vbkd   where vbeln = gt_outtab-vbeln
                  and posnr = '000000'.
                 rt_outtab-bstkd = vbkd-bstkd .
      SELECT single bstkd INTO CORRESPONDING FIELDS OF gt_vbkd
      FROM vbkd WHERE vbeln = gt_vbkd-vbeln
      AND posnr = '000000'.
      rt_outtab-bstkd = gt_vbkd-bstkd.
      APPEND rt_outtab.
      IF NOT r_vbeln IS INITIAL.
        MOVE: 'I' TO  r_vbeln-sign,
               'BT' TO  r_vbeln-option.
        APPEND r_vbeln.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial
                                  FROM   ser01 WHERE lief_nr IN r_vbeln.
      ENDIF.
      SORT i_serial.
      IF NOT i_serial[] IS INITIAL.
        SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers
                                   FROM   objk
                                   FOR ALL ENTRIES IN i_serial
                                   WHERE obknr EQ i_serial-obknr
                                   AND  taser EQ 'SER01'.
      ENDIF.
      SORT i_object_numbers BY  obknr obzae.
      LOOP AT rt_outtab.
        CLEAR: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,
         rt_outtab-sernp, rt_outtab-kttxt.
    Read the Sold To Name
        SELECT SINGLE name1 INTO rt_outtab-name1
                          FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.
    Read Ship-to Customer
        CLEAR: objk.
        IF NOT rt_outtab-serail IS INITIAL.
          READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln
                                        posnr = rt_outtab-posnr.
          IF sy-subrc EQ 0.
            DO i_serial-anzsn TIMES.
              CLEAR: rt_outtab-sernr, rt_outtab-sernp.
              READ TABLE i_object_numbers  WITH KEY obknr = i_serial-obknr
                                                    matnr = rt_outtab-matnr
                                                BINARY SEARCH.
              IF sy-subrc EQ 0.
                rt_outtab-sernr = i_object_numbers-sernr.
                DELETE i_object_numbers INDEX sy-tabix.
                MOVE '1'   TO rt_outtab-lfimg.
                CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,
                         rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
                SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat
                                     INTO (rt_outtab-aufnr, rt_outtab-qmnum,
                        rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
                                 FROM viqmel  WHERE matnr = rt_outtab-matnr
                                        AND serialnr = rt_outtab-sernr
                                        AND qmart  EQ 'S4'
                                        AND qmnum IN s_qmnum.
                CLEAR: rt_outtab-cotxt.
                SELECT SINGLE kurztext INTO rt_outtab-cotxt
                                      FROM qpct WHERE katalogart EQ g_mnkat
                                         AND codegruppe EQ  g_mngrp
                                         AND code EQ rt_outtab-qmcod
                                         AND sprache EQ sy-langu.
    Read Serial Number from Name Plate Data.
                CLEAR: klah, kssk, ausp, cabn, g_atinn.
                SELECT SINGLE atinn INTO (g_atinn) FROM cabn
                                    WHERE atnam = 'SBANK_SERIAL_NUMBER'.
                SELECT SINGLE  atwrt
                      INTO  (rt_outtab-sernp)
                      FROM  ( klah AS a INNER JOIN kssk AS k
                               ON aclint = kclint )
                          JOIN ausp AS p
                                ON kobjek = pobjek
                                AND p~atinn = g_atinn
                                AND pklart = aklart
                      WHERE a~klart = '002'
                       AND  a~class = 'KSE_SN_ENDOSCOPES'
                        AND  k~objek = rt_outtab-equnr.
    *KSE Repair level (activity code text from KSE-SM07 code group)
                CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.
                CLEAR: rt_outtab-qmcol.
                CLEAR:   g_mnkat, g_mngrp.
                SELECT SINGLE mnkat mngrp mncod INTO
                                    (g_mnkat, g_mngrp, rt_outtab-qmcol)
                              FROM viqmma WHERE qmnum = rt_outtab-qmnum
                                    AND  mngrp EQ 'KSE-SM07'
                                    AND kzloesch EQ space.
                CLEAR: rt_outtab-kttxt.
                SELECT SINGLE kurztext INTO rt_outtab-kttxt
                             FROM qpct WHERE katalogart EQ g_mnkat
                                    AND codegruppe EQ  g_mngrp
                                    AND code EQ rt_outtab-qmcol
                                    AND sprache EQ sy-langu.
                rt_outtab1 = rt_outtab.
                APPEND rt_outtab1.
              ENDIF.
            ENDDO.
          ENDIF.
        ENDIF.
      ENDLOOP.
      CLEAR: rt_outtab[].
      rt_outtab[] = rt_outtab1[].
      SORT rt_outtab BY vbeln posnr.
    ENDFORM.
          FORM get_repname                                              *
    -->  P_VBELN                                                       *
    -->  P_POSNR                                                       *
    -->  P_PERNR                                                       *
    -->  P_ENAME                                                       *
    FORM get_repname USING  p_vbeln
                              p_posnr
                     CHANGING  p_pernr
                              p_ename. "
      DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.
      CLEAR: i_vbpa[].
      CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'
           EXPORTING
                g_salesdocument = p_vbeln
                g_sales_item    = p_posnr
           TABLES
                st_vbpa         = i_vbpa.
      READ TABLE i_vbpa INDEX 1.
      IF sy-subrc = 0.
        p_pernr = i_vbpa-pernr.
        SELECT SINGLE ename INTO p_ename
          FROM pa0001
         WHERE pernr = i_vbpa-pernr.
      ENDIF.
    ENDFORM.                    " get_repname
          FORM E03_EVENTTAB_BUILD                                       *
    -->  E03_LT_EVENTS                                                 *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = e03_lt_events.
      READ TABLE e03_lt_events WITH KEY name =  slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO e03_lt_events.
      ENDIF.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    *&      Form  USER_COMMAND
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          PERFORM display_delivery USING r_ucomm
                                        rs_selfield.
      ENDCASE.
    ENDFORM.
    *&      Form  display_delivery
    FORM display_delivery
    USING r_ucomm LIKE sy-ucomm
                                 rs_selfield TYPE slis_selfield.
      CASE rs_selfield-sel_tab_field.
        WHEN '1-VBELN'.
          SET PARAMETER ID 'VL' FIELD rs_selfield-value.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        WHEN '1-VBELV'.
          SET PARAMETER ID 'VF' FIELD rs_selfield-value.
          CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    FORM variant_init.
      CLEAR g_variant.
      g_variant-report = g_repid.
    ENDFORM.                               " VARIANT_INIT
    *&      Form  F4_FOR_VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = g_variant
                i_save              = g_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = g_exit
                es_variant          = gx_variant
           EXCEPTIONS
                not_found = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF g_exit = space.
          p_vari = gx_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    FORM pai_of_selection_screen.
      IF NOT p_vari IS INITIAL.
        MOVE g_variant TO gx_variant.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = g_save
             CHANGING
                  cs_variant = gx_variant.
        g_variant = gx_variant.
      ELSE.
        PERFORM variant_init.
      ENDIF.
    ENDFORM.

  • Af:query component added field not removed when remove icon is clicked

    I have an af:query component on a popup dialog. In advanced mode when I add a field, the new field appears in the searchRegion followed by a red X remove icon. If I subsequently click that remove icon, the query refreshes, the red icon is gone, but the newly added field still remains. The query component is linked to a standard VO query executable in the bindings. There is no custom processing of the value, model, queryListener or the queryOperationListener. In all other respects the query component works fine. The only problem is a newly added field not being removed when the remove icon is clicked. Here's how the component is setup (an added wrinkle is that the query component is hosted in a Declarative Component, so that makes this code a little harder to decipher).
    Does anyone know where I should start looking for this? Hopefully I don't have to implement my own queryOperationListener.
    JDev version is Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
    --- snippet from the page fragment ------
    <af:popup id="frmsLstPU" contentDelivery="lazyUncached">
    <af:dialog id="d1" type="ok"
    styleClass="AFStretchWidth" resize="on"
    stretchChildren="first" contentWidth="840"
    contentHeight="480"
    title="#{UnifiedResourceBundle['FORMSLIST.DIALOG.TITLE']}">
    <idmkr_adf:Correspondence_Formslist_Query idmkr_query_model="#{bindings.FormVOFlatQueryCriteriaQuery}"
    idmkr_table_binding="#{viewScope.FormsListBacking}"
    idmkr_table_model="#{bindings.FormVOFlatQuery1}"
    idmkr_bindings="#{bindings}"
    idmkr_resourcebundle="#{preferences}"
    idmkr_printStreamBean="#{viewScope.FormsList}"
    id="cf1">
    </idmkr_adf:Correspondence_Formslist_Query>
    </af:dialog>
    </af:popup>
    -- snippet from the Correspondence_Formslist_Query declarative component ------
    <af:query id="qryId1"
    headerText="#{UnifiedResourceBundle['FORMSLIST.QUERY.SEARCH.TEXT']}"
    disclosed="true"
    value="#{attrs.idmkr_query_model.queryDescriptor}"
    model="#{attrs.idmkr_query_model.queryModel}"
    queryListener="#{attrs.idmkr_query_model.processQuery}"
    queryOperationListener="#{attrs.idmkr_query_model.processQueryOperation}"
    resultComponentId="::resId1" displayMode="default"
    styleClass="AFStretchWidth"
    rows="4" maxColumns="2"/>

    I have changed the contentDelivery from "lazyUncached" to "immediate" and the same problem occurs. Thank your for your suggestion.

  • Adding description text to the screen for a custom infotype.

    I have created a custom infotype through PM01 with 3 components.  The component types have domains with lists of values (value range).  How do I display the short description from the value range on the screen in PA20 or PA30?
    For example I want to display Continuous Self:
    Text                            Value     Description
    FML Absence Code     FMCS    Continuous Self
    I tried adding an I/O field to the screen referencing DD07V-DDTEXT (where the domain values are stored) but the description will not display in PA20 or PA30.  All three fields would have this same reference and that is not allowed either.
    Can anyone tell me how to do this? 
    Thank you.

    In PM01 for the custom infotype select Screen..Edit..Flow Logic.  Three input/Output fields were added to the screen layout.  Since all three fields were in the same table with the same field name, they all have to have unique names in the layout.
    Module 9009 was modified to add code to retrieve the text.
      SELECT SINGLE * FROM dd07v
                      WHERE domname = 'ZZHR_FML_ABSENCE_CODE'
                     AND ddlanguage = 'EN'
                     AND domvalue_l = p9009-zzfmlabccd.
    select single ddtext into w_fmlstatus from DD07V
                                where DOMNAME = 'ZZHR_FML_STATUS_CODE' AND
                                      DDLANGUAGE = 'E' AND
                                      DOMVALUE_L = p9009-zzfmlstatus.
    select single ddtext into w_fmlaleave from DD07V
                                where DOMNAME = 'ZZHR_LEAVE_TYPE' AND
                                      DDLANGUAGE = 'E' AND
                                      DOMVALUE_L = p9009-zzfml_leave_type.
    I hope this helps.

Maybe you are looking for