Selecting by CMYK value or Swatch Name

I am new at scripting so please forgive me. What I want my script to do is look in an open document for any items that are colored a certain swatch color or CMYK value.
I do have named swatches. For instance "032 (Red)". This swatch is a PANTONE swatch. The other CMYK values I need to search for are C:0, M:98, Y:82, K:0. What I would like the script to do is search the document for any items that have those CMYK values OR that swatch "032 (Red)" applied to it and then apply the "032 (Red)" swatch to it and then set the stroke properties to a line weight of 1.6, then a round join, and a dash of 6,4,6,4,30,4.
I know this may be asking a lot...and I am sorry that I don't even have a script to start with and edit. But being so new...I don't know where to start. I have the scripting guide but if someone could get me going on this I think I could make some headway.
Much appreciated!

Check out IColorData in SnpManipulateSwatch.cpp in the SDK examples.
The information you are looking for is obtained by calling GetColorData()
]PMReal _SafeColourElement(const PMReal &TheGivenColour)
] if (1.0 < TheGivenColour) return PMReal(1.0);
] else if (0.0 > TheGivenColour) return PMReal(0.0);
] else return TheGivenColour;
] ColorArray colorArray = iColorData->GetColorData();
]uint16 CyanComponent = ToUInt16(0x0ffff * _SafeColourElement(colorArray[0]));
]uint16 MagentaComponent = ToUInt16(0x0ffff * _SafeColourElement(colorArray[1]));
]uint16 YellowComponent = ToUInt16(0x0ffff * _SafeColourElement(colorArray[2]));
]uint16 BlackComponent = ToUInt16(0x0ffff * _SafeColourElement(colorArray[3]));

Similar Messages

  • Script to Change swatch CMYK values

    Are there any scripts available to change CMYK values of swatches for files in CS3?
    I have hundreds, probably thousands of Illustrator EPS files that use swatches all drawn from a total palette of maybe 50 colours.
    Each colour is named and has a corresponding CMYK value.
    I want to update the CMYK values for all ~50 colours that appears across all these documents. Is there some way I can simply change the CMYK spec of the swatches used by each of these documents by not having to manually open and change the colours etc?
    Even a script would be good that could batch process the files?
    For example:
    File contains a swatch as a named colour like:
    Fire Red spec'd as 0, 96, 99, 0
    I want to automate changing the CMYK values for all files containing Fire Red to, say, 0, 98, 99, 0
    Any ideas? I have searched Google for a couple of days.
    Edit: the flavour here is Illustrator for CS3 - both Win and Mac.

    I understand EXACTLY what you mean as it's the same thing I need to do, and will probably need to do on future occasions.
    Did you get anywhere with this problem?
    I have designed a scheme for a textbook I am illustrating (this is what I do for a living and have been doing so for well over a decade using Illustrator).
    All colours used in every illustration are based on 7 CMYK Global swatches, usually 100% tints but also 50% 75% and others when required.
    Anyway I have done 100 illustrations already based on my template when I realize I'm going to have to darken the green by +10% cyan.
    What I need is a script to change the definition of my global 'green' swatch in every document from 100Y 30C to 100Y 40C.
    Actions won't do it.
    Any suggestions?

  • Convert from spot color to custom CMYK value in Applescript

    I thought this would be very simple and it's not apparently. I am trying to convert a spot color into a custom CMYK value. Basically:
    tell application "Adobe Illustrator"
              set theList to every path item of current document
              repeat with k from 1 to count of theList
                        if fill color of item k of theList = {name:"Dark Green"} then
                                  set fill color of item k of theList to {cyan:0.0, magenta:100.0, yellow:0.0, black:0.0}
                        end if
              end repeat
    end tell
    But this script obviously doesn't work. From what I can tell, the fill color simply returns the tint of the item, not the name of it. I can't find anything that returns the name of a spot color so I can set the correct corresponding color. In the above example, I made the color obviously changed so I could visually see the result.
    Any advice would be greatly appreciated! I'm a first time poster here.
    Thanks!

    tell application "Adobe Illustrator"
              tell current document
                        set theList to every path item
                        set sw to every swatch
                        repeat with i from 1 to count of sw
                                  set swname to name of item i of sw
                                  if swname = "Dark Green" then
                                            set swco to color of item i of sw
                                            repeat with k from (count of theList) to 1 by -1
                                                      set co to fill color of item k of theList
                                                      if swco = co then
                                                                set fill color of item k of theList to {cyan:0.0, magenta:100.0, yellow:0.0, black:0.0}
                                                      end if
                                            end repeat
                                  end if
                        end repeat
              end tell
    end tell

  • [AS] Can't Find a CMYK Value Properly

    I can't get Apple Script to recognize a CMYK color on a stroke. I'm trying to write a script that will step through page items in an AI file and, if it comes across items with certain CMYK values, change the values of those items.
    But I'm coming across this weirdness:
    If I get properties of an item, I can see that the color of a given stroke is:
    stroke color:{class:CMYK color info, cyan:0.0, Zoom:100.0, yellow:100.0, black:0.0}
    However, this following script does not successfully find the very same colored stroke even though the stroke color is exactly the same as that found when I used get preoperties. What's going on here. Is it a syntax error on my part or a bug?
    tell
    application "Adobe Illustrator"
    tell
    current document
    tell
    layer 1
    set theList
    to
    every
    page item
    of
    it
    repeat
    with x
    from 1
    to
    count
    of
    items
    in theList
    repeat
    with k
    from 1
    to
    count
    of theList
    if
    stroke color
    of
    item k
    of theList = {
    class:
    CMYK color info,
    cyan:0.0,
    zoom:100.0,
    yellow:100.0,
    black:0.0}
    then
    display dialog "hey"
    end
    if
    end
    repeat
    end
    tell
    end
    tell
    end
    tell

    Thanks Simon and Larry. The problem was one of my OSAXs. I removed my scripting additions and restarted and the mysterious "Zoom" is gone. We're back to magenta in the magenta slot.
    Now the script works perfectly. Two follow-up questions though, if you have time:
    1. I want to make sure where Larry was going with his setting "selected of item k" to true. It sounds like the plan is to iterate though all objects, select those that meet the criteria and then change that criteria (in this case a color property) once. Is this faster than a script that would find an object and change its color property before moving on and finding the next object? Is one way better than the other for any other reasons?
    2. This one's tougher. I've noticed that if I create a CMYK swatch in AI and then apply that swatch to an object and then get properties of that object, the CMYK values of that object differ minutely from what I created. For example, if I create a C=10, M=20, Y=30, K=40 swatch and then get properties on an object I've applied it to, the color might actually be:
    stroke color:{class:CMYK color info, cyan:10.000002384186, magenta:19.999998807907, yellow:30.000001192093, black:39.999997615814}
    I guess this probably has something to do with color space or gamuts or something. But what I really want to know is can how I can test for a color that I think is 10/20/30/40 and find it even if it's really 10.000002384186/19.999998807907/30.000001192093/39.999997615814.
    Is the only way to do this to get the color info for an item into a list or record and then round them to nearest 2-digit number or is there an easier way to handle this?
    Thanks.

  • Add display of CMYK values for skin tone balancing

    Add a toggle to display CMYK values in lieu of RGB under the histogram, or some other method of displaying values. Checking that Y > M is one of the simplest and most reliable ways to verify that skintones appear typical and do not appear sunburned. Even with a calibrated monitor the numbers are worth a check. This is one of the more frequent reasons I fire up Photoshop on images that don't need actual editing.

    1. Place PDF in InDesign
    2. Make a new CMYK spot color, defined 100C 100M 100Y 100K
    3. In Ink Manager, find spot color of the PDF in the list.
    4. In the ink alias for this, pull down and select the spot color you created in step 2
    5. Still in the Ink Manager - beside the spot color you created in step 2, click once on the spot icon on the left to change it to process
    6. Output a new PDF from InDesign
    Once you have the InDesign file set up, all the work is done for any future PDF files you place. InDesign simply takes the spot color in the original PDF (ie Pantone 293 C) and maps it to your 100 CMYK spot. The 100 CMYK spot is in turn forced to process by the ink manager (the ink manager can be accessed in the flyout in the swatches panel)

  • Getting swatch names of each document item

    I'm trying to find a way to loop thru all items in an Illustrator document and get their stroke and fill color.  Sometimes items are spots, sometimes documents are set to RGB or CMYK, etc, so swatches can be a mixture of things.  Is there an easy way to get the swatch name for each item?
    For example, I can check if an item is a spot, and get it's color like so:
    var c = app.activeDocument.pageItems[0];
    if (c.strokeColor.typename === 'SpotColor') {
        var s = c.strokeColor.spot.name;
    But if I try to get the name from an item colored 'Black' (which is set to Process Color, CMYK), then I'll need to do something else like:
    var c = app.activeDocument.pageItems[0];
    if (c.strokeColor.typename === 'CMYKColor') {
        var s = c.strokeColor.name;  // This returns undefined - not sure what I'm doing!!!
    Is there an easier way to achieve this, other than getting the typename of each item, and then trying to figure out it's color name?  I was hoping something like this would work:
    var c = app.activeDocument.pageItems[0].strokeColor.name;
    Thanks!
    Jay

    Thank you Larry.  This is very helpful to know!
    I chatted with a friend, who knows much more about colors, printing, etc. and now I see that I can only get item swatch names when the item is set to a spot (or global I believe).  Process on the other hand will just return specific number values for each color (c, m, y, k).  So I think I have a better understanding now.
    Thanks.
    Jay

  • Select-option value is not getting captured in at selection-screen on value

    In Selection screen , we have Select-option and  a parameter.
    Based on the values given in Select-option, the values of Parameter should get populate.
    To achieve this functionality,
    I  used  At selection u2013screen  on value request  for <parameter>  EVENT and 'F4IF_INT_TABLE_VALUE_REQUEST' Function Module.
    But the Select-option values are not getting captured in this event,unless u press Enter key.
    Is there any other way to achieve this functionality.
    Please Guide me.

    When you call function 'F4IF_INT_TABLE_VALUE_REQUEST'. make sure you send it the name of the screen variable - the F4IF_INT_TABLE_VALUE_REQUEST function calls DYNP_VALUES_READ itself if you tell it the name of your report, screen number, and the variable name... snippet below.
    Jonathan
      data:
        l_repid             type syrepid.
      l_repid = sy-repid.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
        exporting
          dynpprog         = l_repid
          dynpnr           = '1000'
          dynprofield      = 'S_FIELD-LOW'  "Select options - low value
    * etc

  • Selection screen field value capturing

    Hi,
    I have developed a report for displaying amendment changes in a purchse order. The input are purchase order
    and plant. Now they have asked for an additional input of version field, which should also have F4 field-value help.
    For version field, default there is no F4 key. So, i have written code like after entering the PO number when we press the enter key, for the corresponding PO, it brings the version no in input field. But my problem is it is displaying the values for version field, but when i select some value it is not getting updated in selection-screen version field. I have attached my code below... please help me
    in the below code my problem is only between
    AT SELECTION-SCREEN on value-request for P_REVNO.
    and
    start-of-selection event...
    TABLES : ekko,
    ekpo,
    cdhdr,
    cdpos,
    MEPO1325,
    t001,
    t166c,
    t166t,
    adrc,
    komp, " net rate of header
    konv, " net value of purchase order
    zammendpodet.
    TYPES : BEGIN OF ts_cdpos,
    ebeln TYPE ekbe-ebeln,
    ebelp TYPE ekbe-ebelp,
    matnr type ekpo-matnr,
    maktx type makt-maktx,
    prdat type ekpo-prdat,
    belnr TYPE ekbe-belnr,
    budat TYPE ekbe-budat,
    tkey(70),
    txz01 TYPE ekpo-txz01,
    ctxnr TYPE t166c-ctxnr,
    desp(20) type C,
    MEINS LIKE MARA-MEINS,
    chtxt TYPE t166t-chtxt.
    INCLUDE STRUCTURE cdpos.
    TYPES : END OF ts_cdpos.
    data : begin of it_makt occurs 0,
    matnr like makt-matnr,
    maktx like makt-maktx,
    end of it_makt.
    data : begin of it_maRA occurs 0,
    matnr like maRA-matnr,
    mEINS like maRA-mEINS,
    end of it_maRA.
    *Internal table declartion
    DATA : it_erev TYPE TABLE OF erev WITH HEADER LINE,
    it_ekko1 type table of ekko with header line,
    it_konv2 type table of konv with header line,
    it_ekpo TYPE TABLE OF ekpo WITH HEADER LINE,
    it_ekpo1 TYPE TABLE OF ekpo WITH HEADER LINE,
    it_cdhdr TYPE TABLE OF cdhdr WITH HEADER LINE,
    it_t166c TYPE TABLE OF t166c WITH HEADER LINE,
    it_ekbe TYPE TABLE OF ekbe WITH HEADER LINE,
    IT_AMMEND TYPE TABLE OF ZAMMENDPODET WITH HEADER LINE,
    IT_AMMEND1 TYPE TABLE OF ZAMMENDPODET WITH HEADER LINE,
    it_komp TYPE TABLE OF KOMP WITH HEADER LINE,
    it_konv type table of konv with header line,
    it_konv1 type table of konv with header line,
    it_cdpos TYPE TABLE OF ts_cdpos WITH HEADER LINE.
    data : BEGIN OF it_erev1 occurs 0,
    revno TYPE erev-revno.
    data : end of it_erev1.
    data : begin of it_cdpos1 occurs 0.
    include structure cdpos.
    data : ebeln like ekko-ebeln,
    item like ekpo-ebelp,
    aedat like ekpo-aedat,
    matnr like ekpo-matnr,
    txz01 like ekpo-txz01,
    desp(20) type C,
    MEINS LIKE MARA-MEINS,
    item1 like ekpo-netpr.
    data : end of it_cdpos1.
    types : dy_temp TYPE lips-lgort.
    DATA : dyfields LIKE dynpread OCCURS 1 WITH HEADER LINE, dy_value TYPE dy_temp.
    DATA: progname TYPE sy-repid,
    dynnum TYPE sy-dynnr,
    dynpro_values TYPE TABLE OF dynpread,
    field_value LIKE LINE OF dynpro_values.
    *Work variable declaration
    DATA : v_revno TYPE erev-revno,
    revno1 type zammendpodet-revno,
    w_version TYPE erev-revno,
    w_erdat TYPE erev-erdat,
    w_eruhr TYPE erev-eruhr,
    wv_eruhr TYPE erev-eruhr,
    v_tabkey TYPE cdpos-tabkey,
    v_temp(5),
    v_olddate(8),
    v_newdate(8),
    v_value_old TYPE cdpos-value_old,
    V_OLD TYPE EKPO-BRTWR, " OLD VALUE FOR PURCHASE ORDER
    l_ind TYPE i,
    temp value 0 type i,
    temp1 type i,
    temp2 type i,
    temp3 type i,
    wa_cdpos like line of it_cdpos,
    wa_cdpos1 like line of it_cdpos1,
    v_tabkey1 TYPE cdpos-tabkey.
    PARAMETERS : p_ebeln TYPE ekko-ebeln,
    p_ebelp TYPE ekpo-ebelp.
    p_bukrs TYPE t001-bukrs,
    p_revno type erev-revno.
    INITIALIZATION.
    AT SELECTION-SCREEN on value-request for P_REVNO.
    CLEAR: dyfields[], dyfields.
    dyfields-fieldname = 'P_REVNO'.
    APPEND dyfields.
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    dyname = sy-cprog
    dynumb = sy-dynnr
    TABLES
    dynpfields = dyfields.
    READ TABLE dyfields INDEX 1.
    SELECT revno
    FROM erev
    INTO TABLE it_erev1 WHERE edokn = p_ebeln.
    IF sy-subrc = 0.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'REVNO'
    dynpprog = progname
    dynpnr = dynnum
    dynprofield = 'P_REVNO'
    value_org = 'S'
    TABLES
    value_tab = it_eREV1
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    OTHERS = 3.
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    START-OF-SELECTION.
    SELECT SINGLE *
    FROM t001
    WHERE bukrs EQ p_bukrs.
    IF sy-subrc EQ 0.
    SELECT SINGLE *
    FROM adrc
    WHERE addrnumber EQ t001-adrnr.
    ENDIF.
    SELECT SINGLE *
    FROM ekko
    WHERE ebeln
    EQ p_ebeln
    AND frgke = 2.
    select * from konv into corresponding fields of table it_konv where knumv eq ekko-knumv.
    useful informations will be rewarded.
    thanks and regards,
    subbu.,

    Hi ,
           Use this function module
        call function 'DYNP_VALUES_UPDATE'
          exporting
            dyname               = sy-repid
            dynumb               = sy-dynnr
          tables
            dynpfields           = t_dynpfields
          exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            undefind_error       = 7
            others               = 8.
    where t_dynpfields would contain name of field and value you want to update.
    Please reward if useful.

  • How can we pass selected combo box value to a jsp pag?

    Hi All,
    I want to pass selected combo box value to a same jsp page's variable.
    i am using javascript
    <select onchange="this.options[this.selectedIndex].text">
    </select>
    this selected value should be invoked for a jsp page's variable.
    Excepting for favorable reply
    Vansh

    select2.jsp
    <script>
    function x()
         alert(document.f.s.options[document.f.s.selectedIndex].text);
         document.f.submit();
    </script>
    <body>
    <form method="get" name="f" action="select2.jsp">
    <select name="s" onchange="x()">
    <option checked>--select--</option>
    <option value="1"> vijay </option>
    <option value="2"> kumar </option>
    </select>
    </form>
    </body>

  • Dynamic Select List Allowed Values

    Howdy Folks,
    I am trying to allow end users to select their username. The usernames are generated from a rule library, and displayed in a select form element. I am doing this by having the allowedValues call the rule that generates the possible names directly. The rule returns a list of valid names. The problem I am currently having, is that if the page reloads or refreshes, then the allowedValues calls the rule again. Some of the username choices involve random numbers, so it is possible (and very likely), that separate calls to the rule will generate different potential values. So what is now happening, is that when a user selects the value, the page reloads, and the end user sees an error that looks like this:
    ( ) - Warning: Selected value for field 'Select a Valid User Name' does not match any of the allowed values.
    The reason I am reloading the page, is that I am also trying to show the user what their email address will look like with the new value. So I have a different form element that is loading is value dynamically, and referencing the select form element. This mostly works, but the warning above is unacceptable.
    Is there a way I can load the dynamically created list only once, the first time the form is viewed, and not load it again every time the page refreshes?
    Another thing I tried to do (but didn't have luck with, so I sorta gave up on it) was to use the onChange of the select to change the value of email display field. This way the page never reloads and I don't have to deal with that issue. I'm thinking the onChange might actually work, but I would need to execute javascript or something, and not just use an express <set/> command to set the value of the field name that displays the email text.
    Does anyone have advice on how to make the values only load once? Or how to change the value on the onChange event?
    Thanks!
    Jim

    Mike,
    Thanks for the feedback. I actually did try that eventually. I created a variable in the form, and initialized that variable to the list of possible values. Then I referenced the variable in the 'allowedValues' of the select form item. At that point in time I still had the select box set as an action, so it would reload the page, hoping to reload the value in the email display field. This still did not work. Each time the action fired off, the variable was re-initializing itself. I eventually tried to put in a check, so it would not re-initialize itself if it had already been initialized. That caused a syslog error.
    I ended up solving the problem using javascript. I changed the field that reported the potential email address to an html element. Then for the html attribute I made a div with an ID. I then set a line of javascript into the onChange attribute of the select form element. This worked when ever the select form value changed. I then added the same line of javascript to the onLoad attribute of the jsp pages body element. This worked for loading the page.
    This solved the problem of the page reloading and the select getting new values. That still happens if you actually reload the page, but all the form elements work without the reload now.
    Thanks!
    Jim

  • Problem in at selection-screen on value request

    hi friends ,
          i want to display f4 help for a field in a popup. this i can do, but this popup comes based on values
    i entered in other screen fields . but these values are not updated to screen values when i trigger f4.

    Hi,
    DATA: T_DYNPRO TYPE TABLE OF DYNPREAD,
          WA_DYNPRO LIKE LINE OF T_DYNPRO,
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PARAM.
    WA_DYNPRO-FIELDNAME = 'Screen Field Name'.
    APPEND WA_DYNPRO TO T_DYNPRO.
    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        DYNAME                               = SY-REPID
        DYNUMB                               = SY-DYNNR
       TRANSLATE_TO_UPPER                   = 'X'
      TABLES
        DYNPFIELDS                           = T_DYNPRO
    EXCEPTIONS
       INVALID_ABAPWORKAREA                 = 1
       INVALID_DYNPROFIELD                  = 2
       INVALID_DYNPRONAME                   = 3
       INVALID_DYNPRONUMMER                 = 4
       INVALID_REQUEST                      = 5
       NO_FIELDDESCRIPTION                  = 6
       INVALID_PARAMETER                    = 7
       UNDEFIND_ERROR                       = 8
       DOUBLE_CONVERSION                    = 9
       STEPL_NOT_FOUND                      = 10
       OTHERS                               = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE T_DYNPRO INTO WA_DYNPRO WITH KEY FIELDNAME = 'Screen Field Name'.
    TEMP = WA_DYNPRO-FIELDVALUE.
    " Select the values based on Temp and populate your internal table for F4 help using the Screen value Temp
    "Call 'F4IF_INT_TABLE_VALUE_REQUEST' and display the pop up.

  • CMYK value "very" different look

    I hope somebody here has an answer for me in this matter, because i am close to getting crazy.
    I always use AdobeKULER for getting the values of RGB, CMYK and HEX for my logo designs made in AI.
    Usually, i design a Logo in RGB first and convert it then as well into CMYK colors, using the values i get with KULER.
    The CMYK color version of a design when viewed on my monitor normally look lighter (less dark) than the RGB version, but this time it is much darker.
    I am trying to figure out where the problem is, but till yet i found no solution.
    The RGB value in question is:   0  216  235
    The CMYK value KULER shows is:  100  8  0  8
    really hope, somebody can help me with this.
    Thanks in advance,
    Peter

    Hey Peter,
    Here are thoughts, so I created a new swatch in Illustrator CS5 with the RGB values of 0 216 235 in an RGB document and then converted that document to CMYK. The resulting CMYK values ended up being 61 0 13 0 versus the 100 8 0 8 which Kuler showed. So this tells me that the RGB conversions on the Kuler webpage use a different formula for doing the conversion versus what is done in Illustrator. Based on my experience, its not uncommon to see color shifts for colors which look slightly darker or washed out with this kind of conversion, because of the differences in gamuts between the two color spaces. For colors that fall outside of the gamut of one space, the closest equivilent in the other may vary based on the formula used. Different conversions aim for accuracy in different ways, closest match for tonal value, closest match for saturation, etc.
    see sRGB versus CMYK in the following image
    http://www.waleedsgallery.biz/_forumuploads/colorspaces.gif
    I guess the question I would have for you is what are you doing with the logos you create, are they used for webpages, commercial printing or both? I would probably start with the color space related related to your output and be aware that shifts with conversions are expected. If you are printing these yourself on a home printer just working in RGB and letting the printer driver do the conversion often gives good results as the driver knows the specifics of that piece of hardware and its capabilities.
    Hope that helps,
    -Dave

  • Selection screen field value

    Hi All,
    I am facing a problem with selection screen parameter.
    I have one file parameter p_fname TYPE rlgrap-filename OBLIGATORY.When I enter some file path and excute I will get the result and once again when I start to execute the program I expect the previous value(file path) should be available for this file parameter that has entered on the selection screen but I am not getting that.
    I dont find any parameter id for this field data element.
    Please let me know how to do this?
    Best Regards
    Ramesh

    Hi,
    You should have..
    DATA: FLNAME TYPE STRING.
    PARAMETERS: FILENAME TYPE RLGRAP-FILENAME.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
      CALL FUNCTION 'F4_FILENAME'
       IMPORTING
         FILE_NAME           = FILENAME.
    Find the demo code below, it uses the file :
    report ZDS_BDC_MM01_2
           no standard page heading line-size 255.
    *include bdcrecx1.
    *parameters: dataset(132) lower case.
    ***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
    *   If it is nessesary to change the data section use the rules:
    *   1.) Each definition of a field exists of two lines
    *   2.) The first line shows exactly the comment
    *       '* data element: ' followed with the data element
    *       which describes the field.
    *       If you don't have a data element use the
    *       comment without a data element name
    *   3.) The second line shows the fieldname of the
    *       structure, the fieldname must consist of
    *       a fieldname and optional the character '_' and
    *       three numbers and the field length in brackets
    *   4.) Each field must be type C.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record OCCURS 0,
    * data element: MATNR
            MATNR_001(018),
    * data element: MBRSH
            MBRSH_002(001),
    * data element: MTART
            MTART_003(004),
    * data element: XFELD
            KZSEL_01_004(001),
    * data element: MAKTX
            MAKTX_005(040),
    * data element: MEINS
            MEINS_006(003),
    * data element: MTPOS_MARA
            MTPOS_MARA_007(004),
          end of record.
    DATA: FLNAME TYPE STRING.
    *** End generated data section ***
    DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    *** MESSAGE******
    DATA: BEGIN OF MESSTAB OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.
            DATA: MATNR TYPE MARA-MATNR,
          END OF MESSTAB.
    ****END OF MESSAGE****
    PARAMETERS: FILENAME TYPE RLGRAP-FILENAME.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
      CALL FUNCTION 'F4_FILENAME'
       IMPORTING
         FILE_NAME           = FILENAME.
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    FLNAME = FILENAME.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FLNAME
        FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = record
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT record.
      DATA:
        CNT TYPE I.
        CNT = CNT + 1.
        REFRESH BDCDATA.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MTART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_004.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_005.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_006.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_007.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    *perform bdc_transaction using 'MM01'.
    CALL TRANSACTION 'MM01' USING BDCDATA
                            MODE 'N'
                            UPDATE 'A'
                            MESSAGES INTO MESSTAB.
    READ TABLE MESSTAB INTO MESSTAB INDEX CNT.
       IF MESSTAB-MSGTYP = 'E'.
         MESSTAB-MATNR = RECORD-MATNR_001.
         MODIFY MESSTAB INDEX CNT FROM MESSTAB. " TRANSPORTING MATNR.
       ENDIF.
    ENDLOOP.
    FORM OPEN_GROUP.
      CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = 'MM01'
                        USER     = SY-UNAME
                        KEEP     = 'X'.
    ENDFORM.
    FORM BDC_INSERT.
      CALL FUNCTION 'BDC_INSERT'
       EXPORTING
         TCODE                  = 'MM01'
    *     POST_LOCAL             = NOVBLOCAL
    *     PRINTING               = NOPRINT
    *     SIMUBATCH              = ' '
    *     CTUPARAMS              = ' '
        TABLES
          DYNPROTAB              = BDCDATA
       EXCEPTIONS
         INTERNAL_ERROR         = 1
         NOT_OPEN               = 2
         QUEUE_ERROR            = 3
         TCODE_INVALID          = 4
         PRINTING_INVALID       = 5
         POSTING_INVALID        = 6
         OTHERS                 = 7
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.
    END-OF-SELECTION.
    LOOP AT MESSTAB.
        IF MESSTAB-MSGTYP = 'E'.
          WRITE:/ 'ERROR OCCURED ON MATNR = ',MESSTAB-MATNR , 'MESSAGE : MATNR ALREADY EXISTS IN MARA!!!'.
        ENDIF.
      ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *&      Form  close_group
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM close_group .
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
       NOT_OPEN          = 1
       QUEUE_ERROR       = 2
       OTHERS            = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " close_group
    *&      Form  bdc_dynpro
    *       text
    *      -->P_0270   text
    *      -->P_0271   text
    FORM bdc_dynpro  USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
    *       text
    *      -->P_0275   text
    *      -->P_0276   text
    FORM bdc_field  USING  FNAM FVAL.
      IF FVAL <> ' '.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.                    " bdc_field
    HTH
    Regards,
    Dhruv Shah

  • Multiple selection of parameter values (BIP 10.1.3.2)

    Hi there,
    I'm working with BI Publisher 10.1.3.2 and I'd like to use parameters allowing multiple selection. I've tried it with both data templates and SQL queries ... but I'm not getting it work ...
    I've established a simple "Show me department name and id"-example according to my parameter selection (you can select multiple values e.g. Administration, Marketing, Sales ... and the "All"-option is activated as well), based on the HR/OE schema.
    Here's just a quick note, where I tested the way the Publisher Engine copes with parameter selection in general
    5.6.2
    single selection => e.g. Administration
    multiple selection => e.g. Administration,Marketing
    All => *
    10.1.3.2
    single selection => e.g. Administration
    multiple selection => e.g. 'Administration','Marketing'
    All => null
    So, in 10.1.3.2 there's been an improvement concerning single quotes - in the case of multiple selection only. I do not know why there are no single quotes for a single selection, but it seems like that's the way it is ...
    Well, I've created a simple SQL query as follows:
    CASE 1 *
    select DEPARTMENT_ID as ID, DEPARTMENT_NAME as NAME
    from DEPARTMENTS
    where DEPARTMENT_NAME IN (:myParameter)
    => All does not work
    => Single Selection is working
    => Multiple Selection is working
    sample output in the case of selecting "Marketing" (single selection):
    <TESTINGIN>
    <myParameter>Marketing</myParameter>
    <LIST_DEPTS>
    <DEPTS>
    <_MYPARAMETER>Marketing</_MYPARAMETER>
    <ID>20</ID>
    <NAME>Marketing</NAME>
    </DEPTS>
    </LIST_DEPTS>
    </TESTINGIN>
    ... and I've tried the same select statement using a data template instead, and then I got another result: both, All and Multiple Selection, do not work (I'm getting back an empty element)
    sample (error) output in the case of selecting both "Marketing" and "Administration" (multiple selection):
    <TESTINGIN>
    <myParameter>'Administration','Marketing'</myParameter>
    <LIST_DEPTS></LIST_DEPTS>
    </TESTINGIN>
    In order to cover the "All"-case ... I manipulated my select statement as follows and used it as SQL query:
    CASE 2 *
    select DEPARTMENT_ID as ID, DEPARTMENT_NAME as NAME
    from DEPARTMENTS
    where DEPARTMENT_NAME IN (nvl(:myParameter, DEPARTMENT_NAME))
    => All is working now
    => Singe selection is working
    => Multiple selection is not working any more (ORA-00909: Ungültige Anzahl von Argumenten / illegal amount of arguments)
    ... using the same select statement within a data template, Multiple Selection is still not working (empty element)
    Last, I've tried another select statement, based on an entry of the xml publisher forum:
    CASE 3 *
    select DEPARTMENT_ID as ID, DEPARTMENT_NAME as NAME
    from DEPARTMENTS
    where DEPARTMENT_NAME IN (:myParameter) or :myParameter IS NULL
    => All is working
    => Singe selection is working
    => Multiple selection is not working (ORA-00920: Ungültiger relationaler Operator / illegal relational operator)
    So, I couldn't find a way that all three possibilities are working ... and using data templates, multiple selection never worked. If I hardcoded the where clause in the data template,
    e.g. where DEPARTMENT_NAME IN ('Administration','Marketing'), it worked fine (no matter, whether I place the sql statement within an CDATA section, or not).
    Can anyone tell me, what I'm doing wrong here?
    While testing my problem, I figured out that there's a difference of generated parameter output ... I just put the parameter in the select list, and depending on whether you use SQL query or data template, you'll get different results:
    SQL statement
    => for each parameter value an own parameter
    <_MYPARAMETER>Administration</_MYPARAMETER> in the case of single selection
    <_MYPARAMETER8093>Administration</_MYPARAMETER8093>
    <_MYPARAMETER8094>Marketing</_MYPARAMETER8094> in the case of multiple selection
    data Template
    => list of parameter values
    <_MYPARAMETER>Administration</_MYPARAMETER> in the case of single selection
    <_MYPARAMETER>'Administration','Marketing'</_MYPARAMETER> in the case of multiple selection
    Maybe that's the problem? I don't know, this difference how the Publisher Engine copes with parameters just attracted attention to me ...
    Alright, I hope it was not too confusing. I would appreciate any help, since here @ the customer's site we need to use data templates inclduing multiple selection in order to establish a context for VPD.
    The problems in summary:
    - how to write a select statement to include all three possibilites of parameter selection (single selection, multiple selection, All option)
    - multiple selection never worked using data templates
    Can someone help me here?

    hi,
    i think you have to use lexical parameters and a package, like this:
    <dataTemplate name="departments" dataSourceRef="hr@demo" defaultPackage="bip_departments">
    <parameters>
    <parameter name="p_location_id" include_in_output="false" datatype="float"/>
    </parameters>
    <dataTrigger name="beforeReport" source="bip_departments.beforeReportTrigger"/>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[ select d.department_id, d.department_name, d.location_id
                      from departments d
                     &p_where_clause
                order by location_id, department_id]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="LOC" source="Q1">
    <element name="location_id" value="location_id"/>
    <group name="DEPT" source="Q1">
    <element name="department_id" value="department_id"/>
    <element name="department_name" value="department_name"/>
    </group>
    </group>
    </dataStructure>
    </dataTemplate>
    with package:
    create or replace package bip_departments
    as
    p_location_id long;
    p_where_clause long;
    function beforereporttrigger
    return boolean;
    end bip_departments;
    create or replace package body bip_departments
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    if (p_location_id is not null)
    then
    p_where_clause := 'where (d.location_id in (' || replace (p_location_id, '''') || '))';
    else
    p_where_clause := 'where 1=1';
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments;

  • Add selected table row value to PageFlowScope so I can access in taskflow

    Hi all,
    Running into a problem getting a value from a selected ADF table row to a taskflow that is displayed as an inline popup. Here's the scenario. I have a view which displays a table. When I click on an edit btn I display my taskflow as an inline popup. What I would like to do is take the currently selected table row, pull off lets say the row name value and pass it to my taskflow for display. I've tried settting this value inside a mbean when I click the edit btn using:
            AdfFacesContext.getCurrentInstance().getPageFlowScope().put("editTargetNameSource", targetName);
            String tmpClear = (String) AdfFacesContext.getCurrentInstance().getPageFlowScope().get("editTargetNameSource");Which seems to get set but when I attempt to grab this value using EL inside my taskflow jspx page it looks to not be set.
    <af:outputLabel value="Selected Row" id="ol1"/><af:outputText value="#{pageFlowScope.editTargetNameSource}"It seems like pageFlowScope for my popup taskflow != pageFlowScope for the page my table lives in. I've tried setting this as a input page param but I have a feeling I'm missing something. I'd like to be able to set this value inside my bean when a user clicks the edit btn and then display this value in my taskflow popup.
    Any help is appreciated,
    -Wraith

    Thanks for the links Timo. I still must be missing something here. In the vids you linked it looked like he was using regions to pass params from main page to a taskflow; setting a param on child taskflow (causes param to be required when dragging into main page). So I think I understand I add an expected param to my taskflow which somehow will be set by my main page. The part I'm missing is from my main page how can I get the selected table row value and set it in the expected pageflowscope param that my taskflow is expecting?
    I've tried several things:
    1) Using managed bean associated with my main page; setting param inside the bean on main page btn click and then try accessing this mbean param (couldn't access this value as different pageflowscope I believe)
    2) Programmatically setting PageFlowScope as I linked in previous post.
    3) using setPropertyListener I can set a static value setting value in pageflowscope.start and then inside adfc.config for the task set start value to another value expected by the taskflow page. This seemed to work but I can't figure out how to do the programmatic version of this using the currently selected row and its value.
    One who seems to be missing something,
    -Wraith

Maybe you are looking for