How to create the condition record by ABAP program

Hi Friends,
I want to create/change the condition record of PR00 by ABAP program. It seems that there have no such BAPI/standard function can help on this. Can any one of you point out a way to me?? Thanks in addvance.
Joe GR.

Joe,
  Check with below FM..
BAPI_PRICES_CONDITIONS.
Check this link:
Re: Sample code for  BAPI_PRICES_CONDITIONS
examples....
http://www.4ap.de/abap/bapi_prices_conditions.php
Two useful threads on Same topic
Re: Sample code for  BAPI_PRICES_CONDITIONS
Re: Problem with BAPI_PRICES_CONDITIONS
BAPI_PRICES_CONDITIONS
Please check this sample code from other thread.
wtable1-table_no = '306'.
wtable1-applicatio = 'V'.
wtable1-cond_type = 'ZPR0'.
wtable1-operation = '009'.
wtable1-varkey = '13001001USD 000000000050068946'.
wtable1-valid_to = '99991231'.
wtable1-valid_from = '20051101'.
wtable1-cond_no = '$000000001'.
APPEND wtable1 TO table1.
wtable2-operation = '009'.
wtable2-cond_no = '$000000001'.
wtable2-created_by = sy-uname.
wtable2-creat_date = '20051022'.
wtable2-cond_usage = 'A'.
wtable2-table_no = '110'.
wtable2-applicatio = 'V'.
wtable2-cond_type = 'ZPR0'.
wtable2-varkey = '13001001USD 000000000050068946'.
wtable2-valid_from = '20051101'.
wtable2-valid_to = '99991231'.
APPEND wtable2 TO table2.
wtable3-operation = '009'.
wtable3-cond_no = '$000000001'.
wtable3-cond_count = '01'.
wtable3-applicatio = 'V'.
wtable3-cond_type = 'ZPR0'.
wtable3-scaletype = 'A'.
wtable3-scalebasin = 'C'.
wtable3-scale_qty = '1'.
wtable3-cond_p_unt = '1'.
wtable3-cond_unit = 'EA'.
wtable3-calctypcon = 'C'.
wtable3-cond_value = '454'.
wtable3-condcurr = 'USD'.
APPEND wtable3 TO table3.
CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
EXPORTING
PI_initialmode = 'X'
PI_BLOCKNUMBER =
TABLES
ti_bapicondct = table1
ti_bapicondhd = table2
ti_bapicondit = table3
ti_bapicondqs = table4
ti_bapicondvs = table5
to_bapiret2 = table6
to_bapiknumhs = table7
to_mem_initial = table8
EXCEPTIONS
update_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
loop at table6 into ret.
write: / ret-type, ret-message, ret-id, RET-LOG_NO, RET-LOG_MSG_NO,
RET-MESSAGE_V1, RET-MESSAGE_V2, RET-MESSAGE_V3, RET-MESSAGE_V4,
RET-PARAMETER,RET-ROW,RET-FIELD.
endloop.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*EXPORTING
WAIT =
IMPORTING
return = ret
ENDIF.
Don't forget to reward if useful....

Similar Messages

  • How to find who has created the condition records

    hi all,
    in POF1 condition records were created.for material and plant.how to find who has created condition records for the material and plant.
    is there any way to find who has created please help me out.
    thanks
    sunny

    Hi,
    There are two ways of finding the who has created the ondition record.
    01. This is through the sales order-> Item details level-> condtion Tab----> Select the condition type and click on dispaly condition record below in the same creen. Then  Goto tab on the menu and select the overview of the condition record. After do so you will have the details of diffrenr tabs. In this you need to select the Administrative data for the person who had created the condition record.
    02. Goto T. Code VK13 and give your condition type for which you need to find the person created the record. Select the header details tab for the person who had created the record.
    Hope this is fine with you.
    Bye & Enjoy SAP.
    Koganti

  • How to Delete the condition record in CRM

    HI,
    Can you please help me how to delete the condition record from condition table in CRM.
    Please explain the usage of FM CRMXIF_CONDITION_SEL_DELETE with examples.
    I have also read the documention of the function module. How to use this FM for custom defined condition table.
    (this is the code given in Documentation)
    DATA-OBJECT_REPRESENTATION         = 'E'
    DATA-SEL_OPT-CT_APPLICATION              = 'CRM'
    DATA-SEL_OPT-OBJECT_TASK                    = 'D'
    DATA-SEL_OPT-RANGE-FIELDNAME        = 'PRODUCT_ID'
    DATA-SEL_OPT-RANGE-R_SIGN                  = 'I'    (Including)
    DATA-SEL_OPT-RANGE-R_OPTION           = 'EQ'
    DATA-SEL_OPT-RANGE-R_VALUE_LOW  = 'PROD_1'
    Thanks
    Shankar

    Hi Shankar,
    I am using the same CRMXIF_CONDITION_SEL_DELETE function module to delete condition record present in CRM.
    But it is giving me below error in the return table of the FM after i run the program. Can you please correct me if I am doing any thing wrong?
    Error in  lt_return: SMW3     CND_MAST_SEL_DEL_EXT_VALIDATE     CND_M_SD
    code:
    ls_range-fieldname = 'PRODUCT_ID''.
    ls_range-R_SIGN = 'I'.
    ls_range-R_OPTION = 'EQ'.
    ls_range-R_VALUE_LOW = '123456'.
    APPEND ls_range TO lt_range.
    MOVE lt_range TO ls_entry-SEL_OPT-range.
    ls_data-SEL_OPT-object_task = 'D'.
    ls_data-SEL_OPT-ct_application = 'CRM'.
    ls_data-object_representation = 'E'.
    CALL FUNCTION 'CRMXIF_CONDITION_SEL_DELETE'
      EXPORTING
        DATA          = ls_date
    IMPORTING
       RETURN        = lt_return
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      IMPORTING
        return = lt_ret.
    Edited by: Saravanaprasad Nadar on Jul 7, 2010 1:27 AM

  • How to translate the key words in ABAp program from lower case to upper cas

    How to translate the key words in ABAp program from lower case to upper case?

    Hi Kittu,
    You need to set the Pretty Printer settings to achieve key words in ABAP program from lower case to upper case.
    Utilities -> Settings -> Pretty Printer (tab) -> Select third radio button.
    Thats all.
    <b>Reward points if this helps.
    Manish</b>

  • How to create Inbound Idocs in a ABAP program? Any function Module?

    Hello Experts,
    My requirement is : I have sales order data which I extracted from third party system in my internal tables. In the same box I need to create inbound Idocs and then consequently create sales orders.
    I have used the function module IDOC_INBOUND_WRITE_TO_DB to create inbound Idocs from Sales Orders data in internal tables. I have populated all the data records with correct PSGNUM and HLEVEL values. My plan is to create inbound idocs with this function module and send those to IDOC_INPUT_ORDERS function module which creates Sales Orders.
    If a sales order in the internal table in ABAP program contains only one item, then I am getting correct idocs. But if more than one item exists for a sales order then the line item segments which got repeated in Idoc are having PSGNUM and HLEVEL values as zero when I checked in WE02. As a result the hierarchy from the second item segment is getting disturbed and getting the status 60.
    I populated T_EDIDD with data records from  IDOC_INBOUND_WRITE_TO_DB.
    To the function module IDOC_INPUT_ORDERS,  T_EDIDC and T_EDIDD are the input. I observed that in T_EDIDD also the PSGNUM and HLEVEL values are blank.
    I am getting Status 60 with message 'EDI: Syntax error in IDoc (segment cannot be identified)' for idocs which have more than one item.
    I need to extract sales data from third party and create inbound idocs and create sales orders in one ABAP program only. I need to display corresponding Idoc numbers for the corresponding third party sales order number in a listoutput.
    Can anybody please provide inputs?
    Regards.

    Hi Anjali,
    Thanks for the response.
    I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.
    for compatibility: clear administration data of data records
               perform data_records_wipe
                                      tables
                                          t_data_records.
    FORM DATA_RECORDS_WIPE
                      TABLES
                          T_DATA_RECORDS_IN  STRUCTURE EDIDD.
      LOOP AT  T_DATA_RECORDS_IN.
        CLEAR: T_DATA_RECORDS_IN-MANDT,
               T_DATA_RECORDS_IN-DOCNUM,
               T_DATA_RECORDS_IN-SEGNUM,
               T_DATA_RECORDS_IN-PSGNUM,
               T_DATA_RECORDS_IN-HLEVEL.
        modify t_data_records_in.
      ENDLOOP.
    ENDFORM.                               " DATA_RECORDS_WIPE
    This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.
    I need to create INBOUND Idocs with the data in ABAP program.
    Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?
    Regards

  • How to create Infosource with writing a ABAP program ?

    Hi,
    I want to create one program to create lot of infosources. Is there any Function module avilable for creating Infosource.
    It should be attachment of flat file, infosource and data source.
    Waiting for quick response.
    Best regards,
    BDP

    Hi Anjali,
    Thanks for the response.
    I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.
    for compatibility: clear administration data of data records
               perform data_records_wipe
                                      tables
                                          t_data_records.
    FORM DATA_RECORDS_WIPE
                      TABLES
                          T_DATA_RECORDS_IN  STRUCTURE EDIDD.
      LOOP AT  T_DATA_RECORDS_IN.
        CLEAR: T_DATA_RECORDS_IN-MANDT,
               T_DATA_RECORDS_IN-DOCNUM,
               T_DATA_RECORDS_IN-SEGNUM,
               T_DATA_RECORDS_IN-PSGNUM,
               T_DATA_RECORDS_IN-HLEVEL.
        modify t_data_records_in.
      ENDLOOP.
    ENDFORM.                               " DATA_RECORDS_WIPE
    This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.
    I need to create INBOUND Idocs with the data in ABAP program.
    Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?
    Regards

  • How to create STO Condition record for a condition Type ?

    I am doing config for STO.
    in MEK1 , it is asking for Vendor, but in my case I am doing STO by using delivery VL01 and receipt by MIGO.
    I want to know abt- How to create Condition Record for STO so that STO order will have Moving Average Price f Material.
    Sorry I m new to MM so pls help.

    Solved

  • How to create crystal reports from ecc abap program?

    Hi all,
    I am new to sap ecc to bo report!!
    I heard that abap program cannot be directly connected to crystal reports,
    So created a function module which is equivalent to the abap program!!
    And happened to connect the same in crystal !!
    Can anyone let me know how to proceed !!
    will be there any performance issue ?
    can anyone guide me how to do reporting from ecc function module to crystal reports directly?
    Thanks

    Hi Pooja,
    From what I know, not all ABAP programs can be accessed in Crystal Reports. The program should return rows and columns, otherwise, CR would not be able to report off it.
    I'm not sure if there are any performance issues if we follow your path. Do you experience any?
    And, do you need help in creating a report on the function module, I mean do you also have any design related queries?
    -Abhilash

  • How to get the decision key in abap program

    Hi guys.
    I have a user decision workflow that have two options: Accept or Reject. This options has some type of id, right? Like '0001', '0002', right?
    How i get this ids decisions through a abap program.
    I need to know this because i have to pass this id to a Z Function Model.
    Thanks!

    The result is found in the workitem container in the '_RESULT' or '_WI_RESULT' elements, you can use the SAP_WAPI_READ_CONTAINER function module to read the data (read the element from the simple container returned table).
    CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
      EXPORTING
        workitem_id                    = im_wi_id
      TABLES
        simple_container             = lt_container
    READ TABLE lt_container WITH KEY element = '_WI_RESULT' into ls_container.
    If you what to get the possible decisions description you can use the SAP_WAPI_DECISION_READ function module,
    CALL FUNCTION 'SAP_WAPI_DECISION_READ'
    EXPORTING
    workitem_id  = im_wi_id
    TABLES
    alternatives = lt_alts.

  • How to convert the Ranges statment in  ABAP program ?

    Dear All,
    I need to remove the ranges statements in my ABAP program. Becaz I found the Ranges statements are obsolete from SLIN results.
    thanks,
    Arunachalam S

    Hi Arun,
    Use SELECT-OPTIONS with the addition NO-DISPLAY , then you can use it same as RANGES.
    Refer to the sample code.
    REPORT  zztest_select.
    DATA : g_matnr TYPE  mara-matnr.
    *-- NO-DISPLAY makes SELECT-OPTION not to be dispalyed and
    *-- you can use the SELECT-OPTION as RANGES
    SELECT-OPTIONS : s_matnr FOR  g_matnr NO-DISPLAY.
    CLEAR : s_matnr,
            s_matnr[]
    s_matnr-sign   = 'I'.
    s_matnr-option = 'BT'.
    s_matnr-low    = 'MATERIAL10'.
    s_matnr-high   = 'MATERIAL99'.
    APPEND s_matnr.
    <b>AS</b>

  • How we can see when the condition records created.

    Hi,
    How we can see when the condition records created ( Valid from and Valid to ) ? And also how we can see the changes made in the Condition records?
    Regards,
    jyothi.

    Hello,
    you can display the condtion records in transaction VK13.
    Here you have the posibillity to display the changes of the condtion records.
    Please goto VK13
    > Enter your selection criteria
       > Enviroment
          > changes
    But you can also create a condtion list. and the you can display more than one condition record:
    Please have a look at the transation V/LD - Pricing Report
    For example: conditon list 14 for taxes.
    Here you get an overview of tax condtions.
    I hope that the information are helpful.
    Regards
    Claudia
    If you are satisfied with the answer, please give Reward Points.

  • How to create the sub type field in hr abap infotype

    hi ,
        how to create the sub type field in hr abap infotype.
    regards,
    venkat.

    Try like this also
    creating of infotype please follow these steps ...
    Step 1: Create Infotypes
    i. Goto Transaction PM01 – To create Infotypes:
    ii. Enter the Infotype Number and say create all.
    iii. The following message would display:
    i. PSnnnn Does not exist. How do you want to proceed?
    iv. Click
    v. A maintain Structure screen appears.
    Fill in the short text description and the PS structure of the Infotype.
    Since the fields Personnel No, Employee Begin Date, End Date, Sequential Number,Date of Last Change, Name of user who changed the object are available in the PAKEY and PSHD1 structure, define the PSnnnn structure with only the fields you required.
    vi. Once the PS Structure is created, save and activate the structure.
    vii. In the initial screen of PM01, now click on .
    Create a new entry for the infotype.
    Fill in the values as mentioned below and save.
    Infotype Characteristics:
    Infotype Name of the infotype_ Short Text: __Short Description________
    *General Attributes :
    Time constraint = 1
    Check Subtype Obligatory
    Display and Selection:
    Select w/ start = 3 “Valid record for entered data
    Select w/ end = 5 “Records with valid dates within the period entered
    Select w/o date = 6 “Read all records
    Screen header = 02 “Header ID
    Create w/o end = 1 “Default value is 31.12.9999
    Technical Data:
    Single screen = 2000
    List screen = 3000; List Entry Checked.
    viii. In the initial screen of PM01, now click on .
    Choose the infotype entry in the list.
    Fill in the values as mentioned below and save.
    Technical Attributes:
    In tab section,
    The following attribute values are given:
    Applicant DB Tab = PAnnnn “Infotype Name
    Subtype field = SUBTY
    Subtype table = T591A
    Subty.text tab. = T591S
    Time cnstr.tab. = T591A
    Prim. /Sec. = I Infotype
    Period/key date = I Interval
    and .
    ix. Infotype Screen Modification:
    Edit Screen 2000 from PM01 for the Infotype.
    ABAP Editor for the Infotype Program MPnnnn00 will be displayed.
    Click . Flow Logic will be displayed. There string coding of your own logic.
    Regards
    Pavan

  • How to update the condition price in sales order while creating the invoice

    Hi,
    How to update the condition price in the sales order to carry out the new price while creating the invoice?
    While creating the invoice it should update the condition price in sales order.
    Thanks,
    Balaram

    No, pricing is not there in delivery.
    I found an exit for VF01transaction where we can update the price in order.
    Can you please tell me how to update the price if I have the order, material numbers and conditions number?
    Thanks,
    Balaram

  • How to find the start condition of a ABAP program?

    Hello Gurus!,
    Could any one please explain how to find the start condition of a ABAP program?
    like its a event based or time based?and also how to find that event and time..
    Thanks in Advance...
    Dinakar

    Hi Dinkar,
    Go to Job Schedule, put Job Step parameter as your program and see scheduled Job.
    In Schedule Job double click to see start condition. and steps to see details and variant.
    Hope it helps.
    Thanks
    CK

  • How to maintain 2 condition record for the same message type

    Hi,
    My requirement is that I have got a PO output type NEU.Now when i release the PO 2 mesages  should get outputed.
    1) A print should go to the Printer ie:Option1 Print output
    2) A PDF should go to the vendor ie:Option 5 External send
    I have completed the config part but I am having a problem while maintaing the condition record for simultaneous output of message 1 & 5.
    In MN04 i tried to maintain 1 & 5 but it doesn't allow me to do so?Why
    How do I output  2 messages while releasing the PO
    KN

    Please check this answered link:
    Re: Two PO Outputs.
    Re: Emailing PO to Vendor, copy to buyer as well
    Edited by: Afshad Irani on Jun 16, 2010 12:05 PM

Maybe you are looking for

  • Importing from iMovie HD is not bringing any of my edits!

    According to the iMovie 09 help file: "When you import video from iMovie HD projects: - All clips from the clip viewer are added to a new Event. - All clips from the timeline are added to a new project." But when I import, ALL my work is lost. I get

  • How to open a SAP Transactiion Screen from a link in Email

    Hi Experts, Requirement: Lets say upon creation of sales order 6000001 in VA01, an email is triggered to a person. In the email there should be a hyperlink which should open the order 6000001 (VA02 screen) without asking for any authentication. How t

  • Cannot open mp3 file

    Hi, I got a mp3 file which i recorded recently. When i try to open it in soundtrack pro i get an error "Can't open file "xxxxx". When i open it with Quicktime Player it starts playing. I guess that during the recording there was an error at the end s

  • Open ERD file

    Hello, Is there a way to open an Entity-Relationship Diagram with SQL Developer or SQL Developer Data Modeler ? I've create this ERD file with Toad. Regards

  • Protecting a file

    I would like to protect a file. I would like to do this in the following manner: Accept the user's login and password Validate it with my web site If valid then invoke the reader plugin in C# with a password embedded in the program. In addition I wou