Create Button  in Abap Program

Hi anybody,
  I want to use click event button inside abap programe.
how to use click events of button.
anybody tell me.
thanks
s.muthu

hiii
use following code.it will create button
START-OF-SELECTION.
  SET PF-STATUS 'STATUS'.
  PERFORM get_data_kna1.
END-OF-SELECTION.
Now write following code for performing task on clicking that button.
CASE sy-ucomm.
  WHEN 'CUSTOMER'.
   SELECT SINGLE kunnr
      FROM kna1
      INTO w_kna1
      WHERE kunnr = w_kunnr.
      IF sy-subrc <> 0.
         MESSAGE e015(zmsg9).
       ENDIF.
WHEN 'ORDER'.
           SELECT SINGLE vbeln
      FROM vbak
      INTO w_vbak
      WHERE vbeln = w_vbeln.
      IF sy-subrc <> 0.
       MESSAGE e015(zmsg9).
      ENDIF.
  ENDCASE.
reward if useful
thx
twinkal

Similar Messages

  • How to crete Button through ABAP programming

    Hello Friends,
    I am creating 2 selection screens through ABAP code and using them in my Tabstrip control also created through ABAP programming.
    Can I also create button on the selection screen through abap programming. If yes then how, and how to assign funtion code and capture the Function Code???
    Moderator Message: Read the below advice.
    Edited by: kishan P on Dec 30, 2010 7:44 PM

    Have a look at F1 help on SELECTION-SCREEN. There should be an example as well.

  • Creating IDOC from ABAP  Program

    Hi folks,
              Could any one tell me the procedure how to process IDOC form ABAP program. for example i want to send MATMAS idoc to other system. now we are able to send through Tcode BD10 to XI.  we jsut want to send through ABAP program. is it possible to do so..if so  could u pls let me know the procedure..thanks in advance.
                   santosh.

    Just check abap program RBDSEMAT.
    In short:
    - select the materials you want to send.
    - call following function module:
                    CALL FUNCTION 'MG_IDOC_CREATE_FULL_MAT'
                      EXPORTING
                        rcvpfc       = ' '
                        rcvprn       = receiver_prn
                        rcvprt       = receiver_prt
                        sndpfc       = ' '
                        sndprn       = ' '
                        sndprt       = ' '
                        message_type = mestyp
                      TABLES
                        marakey      = t_matkeypack
                      EXCEPTIONS
                        OTHERS       = 0.

  • How to create button in ABAP

    Plz tell me the syntax

    Go through this
    SELECTION-SCREEN - PUSHBUTTON
    Syntax
    SELECTION-SCREEN PUSHBUTTON [/][pos](len) button_text
                                USER-COMMAND fcode
                                [VISIBLE LENGTH vlen]
                                [MODIF ID modid]
                                [ldb_additions].
    Extras:
    1. ... [/][pos](len)
    2. ... USER-COMMAND fcode
    3. ... VISIBLE LENGTH vlen
    4. ... MODIF ID modid
    Effect
    This statement creates a pushbutton on the current selection screen. The text on the pushbutton is determined by the content of button_text. The rules that apply to text also apply to button_text when creating an output field.
    The additions ldb_additions can only be used in the selection include for a logical database.
    Notes
    You can use the function module ICON_CREATE to assign an icon, a quick info text and a corresponding text to a pushbutton. When you do this, you must specify an adequate length len for the pushbutton so that the icon can be displayed internally and adjust the visible length with VISIBLE LENGTH.
    Once the event block in AT SELECTION-SCREEN has been processed, the system usually returns to displaying the selection screen. To exit selection screen processing and continue executing the program, you can only choose Execute or Cancel. This means pushbuttons on selection screens are intended primarily for use for dynamic modifications to the selection screen rather than to control the program.
    Addition 1
    ... [/][pos](len)
    Effect
    You must specify the position of the output field using [/][pos](len). The syntax and meaning of [/][pos](len) are the same as when creating horizontal lines, although in this case, len defines the length of the pushbutton on the selection screen. If a pushbutton extends beyond position 83 or beyond the edge of a block with a frame, it is cut off at the right hand side.
    Addition 2
    ... USER-COMMAND fcode
    Effect
    If you specify the USER-COMMAND addition, the pushbutton must be assigned a function code fcode. The function code fcode must be specified directly and can only contain a maximum of 20 characters.
    Before you can work with the pushbutton, you must specify a TABLES statement to declare an interface work area for the structure SSCRFIELDS from the ABAP Dictionary.
    If the user selects the pushbutton on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and the function code fcode is transferred to the ucomm component in the interface work area sscrfields.
    Note
    If the function code of a pushbutton corresponds to a function code used in the GUI status of the selection screen, the selection screen processing is influenced accordingly.
    Addition 3
    ... VISIBLE LENGTH vlen
    Effect
    The VISIBLE LENGTH addition defines the visible length vlen of the pushbutton and your text. The syntax and meaning of this addition are the same as when creating output fields, although a pushbutton is never displayed as shorter than the text defined for it.
    Addition 4
    ... MODIF ID modid
    Effect
    The MODIF ID addition assigns the pushbutton to the modification group modid that is assigned to the column group1 on the system table screen. This means it can be modified using a MODIFY SCREEN statement before the selection screen is displayed.
    Example
    Define and access a stand-alone selection screen 500 with two pushbuttons in an executable program. An icon and a quick info text are created for the second pushbutton.
    TABLES sscrfields.
    TYPE-POOLS icon.
    SELECTION-SCREEN:
      BEGIN OF SCREEN 500 AS WINDOW TITLE title,
        PUSHBUTTON 2(10)  but1 USER-COMMAND cli1,
        PUSHBUTTON 12(30) but2 USER-COMMAND cli2
                               VISIBLE LENGTH 10,
      END OF SCREEN 500.
    AT SELECTION-SCREEN.
      CASE sscrfields.
        WHEN 'CLI1'.
        WHEN 'CLI2'.
      ENDCASE.
    START-OF-SELECTION.
      title  = 'Push button'.
      but1 = 'Button 1'.
      CALL FUNCTION 'ICON_CREATE'
        EXPORTING
          name   = icon_information
          text   = 'Button 2'
          info   = 'My Quickinfo'
        IMPORTING
          RESULT = but2
        EXCEPTIONS
          OTHERS = 0.
      CALL SELECTION-SCREEN '0500' STARTING AT 10 10.
    THnaks
    Ankur Sharma

  • How to create Spool through ABAP program

    How to create spool request for Smartforms through program. So I can go in TCODE SP01 and see the output of my smartforms.

    Include the below code in ur program .......
      DATA: PRINT_PARAMETERS TYPE PRI_PARAMS,
            VALID_FLAG       TYPE C LENGTH 1.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
      IMMEDIATELY = 'X' "C_IMMEDIATELY
    *LAYOUT = 'Z_48_144'
    *LINE_COUNT = '48'
      LINE_SIZE = '255'
    *NEW_LIST_ID = C_NEW_LIST_ID
      NO_DIALOG = 'X'
      RELEASE = 'X'
      IMPORTING
      OUT_PARAMETERS = PRINT_PARAMETERS
      VALID = VALID_FLAG
      EXCEPTIONS
      ARCHIVE_INFO_NOT_FOUND = 1
      INVALID_PRINT_PARAMS = 2
      INVALID_ARCHIVE_PARAMS = 3
      OTHERS = 4 .
      G_PDEST = PRINT_PARAMETERS-PDEST.
      NEW-PAGE PRINT ON PARAMETERS PRINT_PARAMETERS
                        NO DIALOG.
    List of write statements to be output.......
    NEW-PAGE PRINT OFF.
    Reward if useful..............

  • Creation of IDOC through abap program.

    hello all,
    I hav created idoc through abap program. I hav used FM 'Master_idoc _distrribute'.this program creates an idoc but giving status 30. can any one tell me how to get status 03. I hav already created port, Logical sys,partner no.,distribution model.
    My Program is as follows:
    ABLES : CRMD_ORDERADM_I,CRMD_ORDERADM_H,CRMD_SCHEDLIN.
    DATA : S_CTRL_REC LIKE EDIDC OCCURS 0 WITH HEADER LINE,"Idoc Control Record
           ORDER_NO TYPE CRMT_OBJECT_ID VALUE '5000000032'," SEGMENT ORDER DATA
           PRODUCT TYPE CRMT_ORDERED_PROD VALUE 'SRV_01',
           QUANTITY TYPE CRMT_SCHEDLIN_QUAN VALUE '1.000'.
    DATA : ZORDER LIKE ZORDER_NUM OCCURS 0 WITH HEADER LINE.
    DATA :  T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.     "Data Records
    DATA :  T_COMM_IDOC LIKE EDIDC OCCURS 0 WITH HEADER LINE. "Generated Communication IDOc
    CONSTANTS :
    C_ZRZSEG1 LIKE EDIDD-SEGNAM VALUE 'ZORDER_NUM'.
    PARAMETERS :  C_MESTYP LIKE EDIDC-MESTYP DEFAULT 'ZORDER_IDOC2', "Message Type
                  C_RCVPRT LIKE EDIDC-RCVPRT DEFAULT 'LS',          "Partner type of receiver
                  C_LOGSYS LIKE EDIDC-RCVPRN DEFAULT 'BSNL_OUT',
                  C_RCVPOR LIKE EDIDC-RCVPOR DEFAULT 'A000000006',
                  C_SNDPOR LIKE EDIDC-SNDPOR DEFAULT 'SAPBCD0000',
                  C_SNDPRN LIKE EDIDC-SNDPRN DEFAULT 'BCDCLNT100',
                  C_IDOCTP LIKE EDIDC-IDOCTP DEFAULT 'ZORDER2',
                  C_SNDPRT LIKE EDIDC-SNDPRT DEFAULT 'LS'.          "Destination System
    ***START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM GENERATE_CONTROL_RECORD.
      PERFORM SEND_IDOC.
    *&      Form  generate_control_record
    FORM GENERATE_CONTROL_RECORD .
      S_CTRL_REC-RCVPOR = C_RCVPOR. "Receiver Port
      S_CTRL_REC-MESTYP = C_MESTYP. "Message type
      S_CTRL_REC-IDOCTP = C_IDOCTP. "Basic IDOC type
      S_CTRL_REC-RCVPRT = C_RCVPRT. "Partner type of receiver
      S_CTRL_REC-SNDPOR = C_SNDPOR. "SENDER PORT
      S_CTRL_REC-RCVPRN = C_LOGSYS. "Partner number of receiver
      S_CTRL_REC-SNDPRT = C_SNDPRT. "Sender Partner type
      S_CTRL_REC-SNDPRN = C_SNDPRN. "Sender Partner Number
    APPEND S_CTRL_REC.
    ENDFORM.                    " generate_control_record
    *&      Form  send_idoc
    FORM SEND_IDOC.
    ZORDER-ORDER_NO = ORDER_NO.
    ZORDER-PRODUCT = PRODUCT.
    ZORDER-QUANTITY = QUANTITY.
    APPEND ZORDER.
    T_EDIDD-SEGNAM = C_ZRZSEG1.
    T_EDIDD-SDATA = ZORDER.
    APPEND T_EDIDD.
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          MASTER_IDOC_CONTROL            = S_CTRL_REC
        TABLES
          COMMUNICATION_IDOC_CONTROL     = T_COMM_IDOC
          MASTER_IDOC_DATA               = T_EDIDD
        EXCEPTIONS
          ERROR_IN_IDOC_CONTROL          = 1
          ERROR_WRITING_IDOC_STATUS      = 2
          ERROR_IN_IDOC_DATA             = 3
          SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
          OTHERS                         = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        COMMIT WORK.
        LOOP AT T_COMM_IDOC.
          WRITE:/ 'IDoc Generated - ', T_COMM_IDOC-DOCNUM.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " send_idoc
    I hav created segment , basic type,message typealso and release also .I also linked them.
    Plz help me.
    Hemlata

    Hi Hemalatha,
    Just call this Progream RSEOUT00 from your Zprogram and pass the basic parameters like IDOC number, Basic type,Partner number etc.
    You can check the parameters by executing the Program RSEOUT00.
    This Program will change the status of your IDOC 30 to 03.
    Thanks.
    Note:Reward Points if you find useful.

  • ABAP program to search for FM/User-Exit lookups

    Hi everyone,
    I have a need to find any and all Function Modules and User Exits that may have been written in BW that are used to do a lookup of data from one InfoProvider to another.   I have found the following program from Lijo John which works for Update Rules and Transfer Rules but I need the same type program that digs into Function Modules, DTP's and any other User-Exit type code where a lookup could be performed.   These are noted as the limitations in the program Lijo John created and I was hoping maybe someone has a solution for these as well.
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/bi/abapprogramtofindBIlookupsandcodePatterns
    If someone has a program that they could share that would do this it would be greatly appreciated.  
    Thank you,
    Dave

    Thank you Ashish.  This was somewhat helpful.   I guess if there isn't an ABAP program available like I need then the next best thing would be for me to know the BW table names that holds the actual Function Module and DTP source code so that I can then create my own ABAP program that would query them for the existence of the InfoProvider name anywhere in the code. 
    The goal with all of this is to find ANY lookup from ANYWHERE in BW for a specific InfoProvider so that we will know what will have to be "disconnected" if we decide to get ride of that specific InfoProvider. 
    So, if anyone can tell me the tables that contain the BW Function Module and DTP ABAP source code I would appreciate it.
    Thank you,
    Dave

  • Debug ABAP program

    Hello:
    I have a WebService and I followed the instructions in order to call it from the ABAP side. So now I have a proxy.
    I created a simple ABAP program to test this WS call but it seems it's not working quite well. For external debug purposes, on the WS side I write text files. Those logs indicate me that the WS is indeed being called and exited succesfully.
    The WS returns an array of Objects which I assume is translated as a table on ABAP.
    I also have some "write" statements on the ABAP program and they indicate me that no exceptions are being thrown. However, when I set the breakpoint just after the call, the table shows it has no "rows" in it, as if the WS retuned something empty.
    This is the code:
    *& Report  Z_WS_EXTERNAL_TES
    REPORT  Z_WS_EXTERNAL_TES.
    DATA: MDM_PROXY TYPE REF TO ZEXTERNALCO_MDMWEB_SERVICES_VI .
    TRY.
        CREATE OBJECT MDM_PROXY
      CATCH CX_AI_SYSTEM_FAULT .
    ENDTRY.
    data: OUTPUT type ZEXTERNALGET_CANDIDATES_OUT_DO .
    data: INPUT type ZEXTERNALGET_CANDIDATES_IN_DOC .
    TRY.
    write 'Step 1 '.
        CALL METHOD MDM_PROXY->GET_CANDIDATES
          EXPORTING
            INPUT  = input
          IMPORTING
            OUTPUT = output.
    write 'Step 11 '.
      CATCH CX_AI_SYSTEM_FAULT .
        write 'Step 2 '.
      CATCH CX_AI_APPLICATION_FAULT .
        write 'Step 3 '.
    write 'END'.
    ENDTRY.
    The outcome of the program prints:
    Step 1           Step 11          END
    The breakpoint is set on the line that Prints the string "Step 11". The debug stops there, I click on GLOBALS and the OUTPUT structure doesn't have anything inside..
    Any ideas?
    Thanks

    Hello
    Thanks for the answer. Right now the WS returns test data even if no parameters are provided (at least that what I get on the WebServices Navigator)
    Does it need any parameters for the WS proxy to be initialized?
    Thanks
    Alejandro

  • ABAP Program to Create TRs in SOLMAN

    Currently, we are creating TRs through SOLMAN_WORKCENTER transaction. It is being done manually by going to 'Change management' Tab in 'SOLMAN_WORKCENTER'->'PROJECTS'(QGATE Project not CHARM)-> TR is being created for a specific project using 'Create Transport Request' button.
    I was wondering, whether this process can be automated, so that developers can directly create a TR, through a web application or email. The frontend application will be creating TR in backend in SOLMAN after some validations.
    I'm trying to write an ABAP program to create TRs in backend in SOLMAN, following the same process, which is being followed now using SOLMAN_WORKCENTER. This program will be called by the frontend application. This way developers can create a TR, without having direct access to SOLMAN.
    I tried to use CL_CTS* classes, but it's not working. Kindly suggest some BAPIs or classes available for it.
    If anybody has already worked in development of a similar solution, kindly share the technical knowhow. Also, please let me know any solutions from SAP available for it.
    Thanks in advance for your help....

    Thanks a lot for responding Guilherme.....
    But, we wanted to add our own validations as per our standards like naming convention of TRs, project to be used etc...
    Otherwise, the TRs created by developers in an incorrect approach, will be very hard to manage.
    That's why I was looking for an ABAP code to create a TR in SOLMAN_WORKCENTER, so that we can add our own validations to it before creating the TR. If the validations fail, it should't create the TR.
    Using the webdynpro link for SOLMAN_WORKCENTER as suggested, some of the functionalities can be controlled by authorizations maybe. But, we'll not able able to add any extra validations required.

  • How to create a job thru ABAP program for calling a program with variant???

    Hello experts,
    can u give me step wise procedure to create jobs for  a program with a variant name thru ABAP???
    Also, can a transaction can be scheduled as a job to run in background with a variant name???
    Edited by: SAP USER on Jul 22, 2008 6:08 AM

    Hi,
    To create a job through ABAP program you can do the following.
    Go to Menu bar.
    In there, go to   SYTSTEM> SERVICES> JOBS--> DEFINE JOB.
    Then give the JOB NAME and CLASS in the screen that comes up.
    This is how we schedule a program.
    Now, to create a variant for a program -
    First activate your program in SE38. Then execute it .
    Now, click on SAVE button. It will open up  the variant creation screen. Give the details there like variant name and value for the fields. Save and come back.
    Hope this helps.
    Regards,
    Hari Kiran

  • Add Voting buttons in MS Outlook from SAP ABAP program

    I have a requirment where SAP ABAP program will send an email.
    I need to have the voting buttons (yes/no) in the email. It does not have to be in the content of the email but the typically voting buttons that we can add to the MS Outlook email.
    If there is someone who can give me the steps and documentations, greatly appreciate.
    The main critieria is that it has to be MS outlook.

    Hi,
    here is the solution i think.
    INCLUDE ole2incl .
    DATA: ole_outlook  TYPE ole2_object,
          ole_CItem    TYPE ole2_object,
          ole_body      TYPE string.
      CREATE OBJECT ole_outlook 'Outlook.Application'.
      CALL METHOD OF ole_outlook 'CreateItem' = ole_CItem
        EXPORTING #1 = 0.
      SET PROPERTY OF ole_CItem 'To' = 'receiver @ mail.com'.
      SET PROPERTY OF ole_CItem 'Subject' = 'E-mail Title'.
      CALL METHOD OF ole_CItem 'Display'.
      CONCATENATE ole_body
                  'Dear Sir/Madam,'
                  cl_abap_char_utilities=>newline
                  cl_abap_char_utilities=>newline
        INTO ole_body.
    SET PROPERTY OF ole_CItem 'Body' = ole_body.
    CALL METHOD OF ole_CItem 'ATTACHMENTS' = ATTS.
    CALL METHOD OF ATTS 'ADD'
    EXPORTING #1 = 'C:\File_Location\File_name.extension'.
    SET PROPERTY  OF ole_CItem 'VotingOptions' = 'Yes;No'.
    FREE OBJECT ole_outlook.
    *you can replace the voting option to what you want, for example 'Yes;No' or 'Approve;Reject'.

  • Create abap program

    i do not know why our ECC6.0 can't create abap program.we have had developer key.After i input obligatory fields,such as title,type,status and development class(package):$TMP,  then I push save button.At last,it tells me  Maximum Runtime Exceeded!
    Thanks.

    Hi,
    Please consult your basis guys and see if the roles are assigned correctly and also related to the issue.
    Regards,
    Nagaraj

  • 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....

  • 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

  • Error in executing ABAP program. Error occurred when creating dataset

    hi,
    when I use LKM SAP ERP to Oracle (SQLLDR) to extract data from SAP ERP server. I execute my interface, and it's stop at extract data step.
    This is message:
    java.lang.RuntimeException: Error occured in open tool execute method...Error in executing ABAP program...Error in executing ABAP program...Error occurred when creating dataset/abc/ZODI_13001_6001_GLOBAL.txt
    I tried others path name, tried slash or backslash. This is content in code tab
    OdiSAPAbapExecute "-UPLOAD=1" "-EXECUTE=1" "-EXECUTEBASE_RKM=0" "-ZRFC_RUN_INSTALL=1" "-ABAP_PROGRAM_NAME=ZODI_13001_6001" "-HOST=10.86.87.24" "-USER=sv_hoa" "-PASSWORD=<@=snpRef.getInfo("SRC_PASS") @>" "-SAP_CLIENT=800" "-SAP_LANGUAGE=EN" "-SAP_SYSTEM_NUMBER=02" "-SAP_FUNCTION_GROUP_NAME=ZODI_FGR_13001" "-CONNECTION_POOL_NAME=SAP_ODI_ERP_POOL_10.86.87.24" "-CONNECTION_POOL_SIZE=10" "-FILE_DELIMITER=<@=""+(char)8@>" "-FILE_NAME=ZODI_13001_6001_GLOBAL.txt" "-FTP_HOST=10.86.82.108" "-FTP_USER=anh" "-FTP_PASSWORD=<@=sFtpPassword@>" "-FTP_PASSIVE_MODE=1" "-FTP_TRANSFER_TIMEOUT=100000" "-ODI_VARIABLE_NAMES=" "-ODI_VARIABLE_VALUES=" "-USER_ABAP_PARAMETER_NAMES=IV_DELIMITER,CHAR3;IV_FILENAME,CHAR255;IV_USER,CHAR35;IV_PWD,CHAR35;IV_HOST,CHAR35;IV_HASHVALUE,CHAR35;IV_PATH,CHAR35;IV_MAX_ROW_CNT,SYTABIX;IV_FETCH_BATCH_SIZE,SYTABIX;" "-USER_ABAP_PARAMETER_VALUES=<Value>" "-USER_ABAP_PARAMETER_SEPARATOR=<Value>" "-ABAP_TABLE_PARAMETERS=RETURN,BAPIRETURN;ET_FILE_RETURN,BAPIRET2" "-ABAP_EXPORT_PARAMETERS=ERRORMESSAGE;SY-MSGV1" "-LOG_FILE_NAME=C:\Users\anh\AppData\Local\Temp\SapAbapExecuteOpenTool_13001.log" "-FTP_PATH=/abc/" "-DEV_CLASS=ZODI_DEVCLASS" "-MAX_ROW_COUNT=" "-FETCH_BATCH_SIZE=100000" "-HASH_VALUE_MARKER=HVM" "-ABAP_PROGRAM_BODY=
    *Final Type declarations
    TYPES : BEGIN OF ty_final,
    Y03HOCSINH_HOCSINH_ID TYPE
    Y03HOCSINH-HOCSINH_ID,
    Y03HOCSINH_MA_HOC_SINH TYPE
    Y03HOCSINH-MA_HOC_SINH,
    Y03HOCSINH_TEN_HOC_SINH TYPE
    Y03HOCSINH-TEN_HOC_SINH,
    Y03HOCSINH_GIOI_TINH TYPE
    Y03HOCSINH-GIOI_TINH,
    Y03HOCSINH_DIA_CHI TYPE
    Y03HOCSINH-DIA_CHI,
    Y03HOCSINH_GHI_CHU TYPE
    Y03HOCSINH-GHI_CHU,
    END OF ty_final.
    *Final Temp Type Declarations
    TYPES : BEGIN OF ty_final_tmp,
    Y03HOCSINH_HOCSINH_ID TYPE
    Y03HOCSINH-HOCSINH_ID ,
    Y03HOCSINH_MA_HOC_SINH TYPE
    Y03HOCSINH-MA_HOC_SINH ,
    Y03HOCSINH_TEN_HOC_SINH TYPE
    Y03HOCSINH-TEN_HOC_SINH ,
    Y03HOCSINH_GIOI_TINH TYPE
    Y03HOCSINH-GIOI_TINH ,
    Y03HOCSINH_DIA_CHI TYPE
    Y03HOCSINH-DIA_CHI ,
    Y03HOCSINH_GHI_CHU TYPE
    Y03HOCSINH-GHI_CHU ,
    END OF ty_final_tmp.
    *Final Target Type Declarations
    TYPES : BEGIN OF ty_final_target,
    C0_Y03HOCSINH_HOCSINH_ID TYPE
    Y03HOCSINH-HOCSINH_ID,
    C1_Y03HOCSINH_MA_HOC_SINH TYPE
    Y03HOCSINH-MA_HOC_SINH,
    C2_Y03HOCSINH_TEN_HOC_SINH TYPE
    Y03HOCSINH-TEN_HOC_SINH,
    C3_Y03HOCSINH_GIOI_TINH TYPE
    Y03HOCSINH-GIOI_TINH,
    C4_Y03HOCSINH_DIA_CHI TYPE
    Y03HOCSINH-DIA_CHI,
    C5_Y03HOCSINH_GHI_CHU TYPE
    Y03HOCSINH-GHI_CHU,
    END OF ty_final_target.
    * Table type for Y03HOCSINH
    TYPES : BEGIN OF ty_Y03HOCSINH,
    HOCSINH_ID TYPE
    Y03HOCSINH-HOCSINH_ID,
    MA_HOC_SINH TYPE
    Y03HOCSINH-MA_HOC_SINH,
    TEN_HOC_SINH TYPE
    Y03HOCSINH-TEN_HOC_SINH,
    GIOI_TINH TYPE
    Y03HOCSINH-GIOI_TINH,
    DIA_CHI TYPE
    Y03HOCSINH-DIA_CHI,
    GHI_CHU TYPE
    Y03HOCSINH-GHI_CHU,
    END OF ty_Y03HOCSINH.
    TYPES: BEGIN OF gs_text,
    line(843) TYPE c,
    END OF gs_text.
    *Structure Declarations
    DATA: wa_final_string TYPE string,
    wa_final TYPE ty_final,
    wa_final_target TYPE ty_final_target,
    wa_Y03HOCSINH TYPE ty_Y03HOCSINH,
    *Table Declarations
    tt_final TYPE STANDARD TABLE OF ty_final,
    tt_Y03HOCSINH TYPE STANDARD TABLE OF ty_Y03HOCSINH,
    tt_final_target TYPE STANDARD TABLE
    OF ty_final_target,
    tt_final_tmp TYPE STANDARD TABLE OF ty_final_tmp,
    tt_final_tmp1 TYPE STANDARD TABLE OF ty_final,
    gt_result TYPE STANDARD TABLE OF gs_text,
    *Variable Declarations
    lv_path TYPE string,
    lv_flag TYPE char1,
    C0_Y03HOCSINH_HOCSINH_ID TYPE
    STRING,
    C1_Y03HOCSINH_MA_HOC_SINH TYPE
    STRING,
    C2_Y03HOCSINH_TEN_HOC_SINH TYPE
    STRING,
    C3_Y03HOCSINH_GIOI_TINH TYPE
    STRING,
    C4_Y03HOCSINH_DIA_CHI TYPE
    STRING,
    C5_Y03HOCSINH_GHI_CHU TYPE
    STRING,
    wa_final_tmp TYPE ty_final_tmp,
    lv_file TYPE string,
    lv_datum TYPE sy-datum,
    lv_date TYPE char10,
    wa_result TYPE string,
    lv_delimiter type string,
    lv_cnt TYPE sytabix,
    *-Cursor Declaration
    lv_Y03HOCSINH_dbcur TYPE cursor,
    lv_tabix_frm TYPE sy-tabix.
    lv_delimiter = iv_delimiter.
    IF iv_hashvalue = 'HVM'.
    *Open/delete output file
    CONCATENATE iv_path iv_filename INTO lv_path.
    *Check for file existence, if found, delete it
    OPEN DATASET lv_path FOR INPUT
    IN TEXT MODE
    ENCODING DEFAULT.
    IF sy-subrc EQ 0.
    DELETE DATASET lv_path.
    ENDIF.
    *Open/create output file
    OPEN DATASET lv_path FOR APPENDING
    IN TEXT MODE
    ENCODING DEFAULT.
    IF sy-subrc EQ 0.
    *Batch Processing
    OPEN CURSOR WITH HOLD lv_Y03HOCSINH_dbcur FOR
    SELECT HOCSINH_ID
    MA_HOC_SINH
    TEN_HOC_SINH
    GIOI_TINH
    DIA_CHI
    GHI_CHU
    FROM Y03HOCSINH.
    DO.
    *Check for the counter, only for first batch
    *process new line is required...
    lv_cnt = lv_cnt + 1.
    REFRESH tt_Y03HOCSINH.
    FETCH NEXT CURSOR lv_Y03HOCSINH_dbcur
    APPENDING TABLE tt_Y03HOCSINH
    PACKAGE SIZE IV_FETCH_BATCH_SIZE.
    IF NOT tt_Y03HOCSINH IS INITIAL.
    ELSE.
    EXIT.
    ENDIF.
    LOOP AT tt_Y03HOCSINH INTO wa_Y03HOCSINH.
    MOVE wa_Y03HOCSINH-HOCSINH_ID
    TO wa_final_tmp-Y03HOCSINH_HOCSINH_ID.
    MOVE wa_Y03HOCSINH-MA_HOC_SINH
    TO wa_final_tmp-Y03HOCSINH_MA_HOC_SINH.
    MOVE wa_Y03HOCSINH-TEN_HOC_SINH
    TO wa_final_tmp-Y03HOCSINH_TEN_HOC_SINH.
    MOVE wa_Y03HOCSINH-GIOI_TINH
    TO wa_final_tmp-Y03HOCSINH_GIOI_TINH.
    MOVE wa_Y03HOCSINH-DIA_CHI
    TO wa_final_tmp-Y03HOCSINH_DIA_CHI.
    MOVE wa_Y03HOCSINH-GHI_CHU
    TO wa_final_tmp-Y03HOCSINH_GHI_CHU.
    APPEND wa_final_tmp TO tt_final_tmp.
    ENDLOOP.
    free : tt_Y03HOCSINH.
    LOOP AT tt_final_tmp INTO wa_final_tmp.
    MOVE wa_final_tmp-Y03HOCSINH_HOCSINH_ID
    TO wa_final_target-C0_Y03HOCSINH_HOCSINH_ID.
    MOVE wa_final_tmp-Y03HOCSINH_MA_HOC_SINH
    TO wa_final_target-C1_Y03HOCSINH_MA_HOC_SINH.
    MOVE wa_final_tmp-Y03HOCSINH_TEN_HOC_SINH
    TO wa_final_target-C2_Y03HOCSINH_TEN_HOC_SINH.
    MOVE wa_final_tmp-Y03HOCSINH_GIOI_TINH
    TO wa_final_target-C3_Y03HOCSINH_GIOI_TINH.
    MOVE wa_final_tmp-Y03HOCSINH_DIA_CHI
    TO wa_final_target-C4_Y03HOCSINH_DIA_CHI.
    MOVE wa_final_tmp-Y03HOCSINH_GHI_CHU
    TO wa_final_target-C5_Y03HOCSINH_GHI_CHU.
    Append wa_final_target to tt_final_target.
    ENDLOOP.
    free : tt_final_tmp.
    Clear wa_final_target.
    IF NOT iv_max_row_cnt IS INITIAL.
    Loop at tt_final_target into
    wa_final_target TO iv_max_row_cnt.
    MOVE wa_final_target-C0_Y03HOCSINH_HOCSINH_ID
    TO C0_Y03HOCSINH_HOCSINH_ID.
    MOVE wa_final_target-C1_Y03HOCSINH_MA_HOC_SINH
    TO C1_Y03HOCSINH_MA_HOC_SINH.
    MOVE wa_final_target-C2_Y03HOCSINH_TEN_HOC_SINH
    TO C2_Y03HOCSINH_TEN_HOC_SINH.
    MOVE wa_final_target-C3_Y03HOCSINH_GIOI_TINH
    TO C3_Y03HOCSINH_GIOI_TINH.
    MOVE wa_final_target-C4_Y03HOCSINH_DIA_CHI
    TO C4_Y03HOCSINH_DIA_CHI.
    MOVE wa_final_target-C5_Y03HOCSINH_GHI_CHU
    TO C5_Y03HOCSINH_GHI_CHU.
    CONCATENATE
    C0_Y03HOCSINH_HOCSINH_ID
    C1_Y03HOCSINH_MA_HOC_SINH
    C2_Y03HOCSINH_TEN_HOC_SINH
    C3_Y03HOCSINH_GIOI_TINH
    C4_Y03HOCSINH_DIA_CHI
    C5_Y03HOCSINH_GHI_CHU
    INTO wa_final_string
    SEPARATED BY lv_delimiter.
    IF sy-tabix EQ 1 AND lv_cnt EQ 1.
    CONCATENATE wa_final_string
    lv_delimiter INTO wa_final_string.
    ELSE.
    CONCATENATE '<@=""+(char)8@>' lv_delimiter wa_final_string
    lv_delimiter INTO wa_final_string.
    ENDIF.
    APPEND wa_final_string TO gt_result.
    CLEAR : C0_Y03HOCSINH_HOCSINH_ID,
    C1_Y03HOCSINH_MA_HOC_SINH,
    C2_Y03HOCSINH_TEN_HOC_SINH,
    C3_Y03HOCSINH_GIOI_TINH,
    C4_Y03HOCSINH_DIA_CHI,
    C5_Y03HOCSINH_GHI_CHU.
    ENDLOOP.
    ELSE.
    Loop at tt_final_target into wa_final_target.
    MOVE wa_final_target-C0_Y03HOCSINH_HOCSINH_ID
    TO C0_Y03HOCSINH_HOCSINH_ID.
    MOVE wa_final_target-C1_Y03HOCSINH_MA_HOC_SINH
    TO C1_Y03HOCSINH_MA_HOC_SINH.
    MOVE wa_final_target-C2_Y03HOCSINH_TEN_HOC_SINH
    TO C2_Y03HOCSINH_TEN_HOC_SINH.
    MOVE wa_final_target-C3_Y03HOCSINH_GIOI_TINH
    TO C3_Y03HOCSINH_GIOI_TINH.
    MOVE wa_final_target-C4_Y03HOCSINH_DIA_CHI
    TO C4_Y03HOCSINH_DIA_CHI.
    MOVE wa_final_target-C5_Y03HOCSINH_GHI_CHU
    TO C5_Y03HOCSINH_GHI_CHU.
    CONCATENATE
    C0_Y03HOCSINH_HOCSINH_ID
    C1_Y03HOCSINH_MA_HOC_SINH
    C2_Y03HOCSINH_TEN_HOC_SINH
    C3_Y03HOCSINH_GIOI_TINH
    C4_Y03HOCSINH_DIA_CHI
    C5_Y03HOCSINH_GHI_CHU
    INTO wa_final_string
    SEPARATED BY lv_delimiter.
    IF sy-tabix EQ 1 AND lv_cnt EQ 1.
    CONCATENATE wa_final_string
    lv_delimiter INTO wa_final_string.
    ELSE.
    CONCATENATE '<@=""+(char)8@>' lv_delimiter wa_final_string
    lv_delimiter INTO wa_final_string.
    ENDIF.
    APPEND wa_final_string TO gt_result.
    CLEAR : C0_Y03HOCSINH_HOCSINH_ID,
    C1_Y03HOCSINH_MA_HOC_SINH,
    C2_Y03HOCSINH_TEN_HOC_SINH,
    C3_Y03HOCSINH_GIOI_TINH,
    C4_Y03HOCSINH_DIA_CHI,
    C5_Y03HOCSINH_GHI_CHU.
    ENDLOOP.
    ENDIF.
    free : tt_final_target.
    IF NOT gt_result IS INITIAL.
    CLEAR wa_result.
    LOOP AT gt_result INTO wa_result.
    TRANSFER wa_result TO lv_path.
    ENDLOOP.
    ENDIF.
    REFRESH gt_result.
    *End of main loop for batching
    ENDDO.
    *Close dataset
    CLOSE DATASET lv_path.
    CLOSE CURSOR lv_Y03HOCSINH_dbcur.
    ELSE.
    DATA: lv_mesg TYPE string.
    CLEAR et_file_return.
    et_file_return-type = 'E'.
    CONCATENATE
    'Error occurred when creating dataset' lv_path
    INTO lv_mesg.
    et_file_return-message = lv_mesg.
    Append et_file_return.
    ENDIF.
    ELSE.
    CLEAR et_file_return.
    et_file_return-type = 'E'.
    et_file_return-message =
    'Installed ABAP program does not match interface definition'.
    APPEND et_file_return.
    ENDIF.
    Thanks for help

    r u able to figure it out..........i got the same error .......can someone help me fix this issue

Maybe you are looking for

  • Roll of servlet in JSP

    Hello Team, I am very new in Web Development. I start to develop site in JSP. And I am using JavaBeans directly in jsp page. And it is working good. Then I come to know about servlet. So can anyone guide that it is necessory to use servlet inbetween

  • Insert using parallel

    what does this last statement mean?  it is as though the query runs just like without any hints. oracle doc: Using Parallel Execution Examples of Distributed Transaction Parallelization This section contains several examples of distributed transactio

  • Who is eligible to use the Labview 8.0 Student Edition

    Who is eligible to use the Labview 8 student edition? Can an individual who is not in school or affiliated with a learning institution purchase and register it for the purpose of learning at home?

  • Database testing material

    I am looking for some help on database testing material. I am trying to do testing and want some hands on reading material about the various database validity, verification, writing test cases in database tests. could somebody help thanks a lot

  • Help for smugmug publish plugin on Mac OSX 10.9.4

    I cannot for the life of me find the smugmug zip file which is supposedly downloaded on my computer after installing the adobe add-on.  I made sure the creative cloud folder is correct however when I go to my finder, I can't find the plugin zip file.