Hangover in adding new DB record

Hi All,
Happy new year!!!
Just a quick one. We are trying to add a new record to a table, using a JavaBean. The table has 14 fields, and initially the user is required to enter data for only 8 fields.
So we try to add only these 8 fields by using the following SQL:
INSERT INTO MYTABLE VALUES (?, ?, ?, ?, ?, ?, ?, ?) and using a PreparedStatement ps
ps.setString(1, String1);
ps.setString(8, String8);
The jdbc InterClient driver (we are using InterBase) is complaining that Count of columns does not equal count of values, so I assume that I have to add ALL 14 fields. Is it true?
Another question. Few of these remaining fields are DATE type. Since I don't know the dates yet, what is the correspondent java compliant statement to add a null to a date field. I would prefer to have a null as opposed to the 0 milliseconds that correlates to 1/1/1970.
Thanks in advance for any assistance, and good recovery!!!!!!!!!!!
Cheers
Trajano Roberto

Hi & Happy New Year to you too, I'm recovering as fast as I can here... :)
You have to add the columns to the sql statement, like:
INSERT INTO MYTABLE (col1, col2, col3...etc.)VALUES (?, ?, ?, ?, ?, ?, ?, ?)
if the other columns that is not inserted here allows null, then they will get the value null when a row is inserted.
Hope this answers your questions?
/Nick

Similar Messages

  • Master detail refresh when adding new record

    Guys,
    Can't believe I need to ask this question ....but here we go
    when adding new master record --> I want to refresh the detail record..... in my case old detail records stays as it is until i click the save button
    for detail panelformlayout-->partial trigger--> i set the ids of master panelformlayout and newMasterrecord button..... but still it doesn't refresh the child record when new master record is being created.....
    any thought will be greatly appreciated

    In application module it works fine......
    Even on the page when i click next/previous button on masters it refreshes details information.
    but when i click the button "create" it doesn't refreshes details...... (but when i save the information, i certainly see the updated details)
    seems like there is some settings or binding i need to check but can't able to find one.....
    any help is greatly appreciated

  • Adding new record in user table via DI API

    Dear all,
    I created in SAP B1 two user tables (Master data and master data rows)
    I need to add a new header record in my master data user table by DI code.
    This is my source code...
    Dim sboDestTable As SAPbobsCOM.UserTable = oCompany.UserTables.Item("MY_HEAD_TABLE")
    sboDestTable.Code = newCode
    sboDestTable.ArchiveDate = Now
    sboDestTable.UserFields.Fields.Item("u_userfield1").Value = "new value 1"
    Dim ErrCode As Integer = sboDestTable.Add()
    but I have an exception error message on the Add() command: "SAP B1 Cannot add rows to a MasterData type UserTable"
    Can someone help me, please?
    How can I add a new record in a user master data table?
    Best regards
       Emanuele

    Hi,
    Try this :
    SAPbobsCOM.GeneralService oGeneralService;
    SAPbobsCOM.GeneralData oGeneralData;
    SAPbobsCOM.GeneralData oChild;
    SAPbobsCOM.GeneralDataCollection oChildren;
    SAPbobsCOM.GeneralDataParams oGeneralParams;
    oCompService = SBO_Company.GetCompanyService();
    SBO_Company.StartTransaction();
    oGeneralService = oCompService.GetGeneralService("UDOCODE");
    oGeneralData = (SAPbobsCOM.GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData);
    //Setting Data to Master Data Table Fields
    oGeneralData.SetProperty("Code", CodeHeader);
    oGeneralData.SetProperty("U_ProjectC", ProjectCodeHeader);
    oGeneralData.SetProperty("U_ProjectN", ProjectNameHeader);
    oGeneralData.SetProperty("U_StartDate", StartDateHeader);
    oGeneralData.SetProperty("U_EndDate", EndDateHeader);
    //Setting Data to Child Table Fields
    oChildren = oGeneralData.Child("DETAILTABLENAMEWITHOUT@");
    oChild = oChildren.Add();
    oChild.SetProperty("U_Code", ActivityCodeRow);
    oChild.SetProperty("U_Name", NameRow);
    oChild.SetProperty("U_DESC", DescriptionRow);
    oChild.SetProperty("U_Building", NumberOfBuildings);
    oChild.SetProperty("U_STDT1", StartDateRow);
    oChild.SetProperty("U_ENDT1", EndDateRow);
    oChild.SetProperty("U_ESTMTDY1", DaysFinal);
    //Attempt to Add the Record
    oGeneralService.Add(oGeneralData);
    if (SBO_Company.InTransaction)
    {                                                                 SBO_Company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
    Hope it helps.
    Thanks & Regards
    Ankit Chauhan

  • Added new fields in vendor master in xk01 but data is not getting saved

    Hi experts,
    To add new fields in vendor master i have followed the following steps :
    1.) Appended a structure ZRTGS in LFA1 table with required fields and activated
    2.) Added new button in xk01( vendor master ) using spro -> logistics-general -> business partner -> vendors ->
    control ->adoption of customer's owaster data fields -> prepare modification free-enhancement of vendor master record
    Created a screen group ZR and defined label tab pages with function code ZRTGS and saved entries
    3.) Created a implementation for BADIs VENDOR_ADD_DATA and VENDOR_ADD_DATA_CS.
    4.) Created a program with my own subscreen for the required fields
    The button is getting displayed in XK01, XK02 and XK03 respectively. Whenever the button is clicked the subscreen with
    the fields is also displayed. But whenever i try to save the data in either XK01 or XK02 it is not getting saved in to the
    database table LFA1.
    Request your help in this regard.
    Thanks in Advance.

    Hi,
    You may need to check this include .
    EXIT_SAPMM06E_008  -->Import Data from Customer Subscreen for Purchasing Document
    Thanks,
    vamshi

  • Adding new date field to already loaded data target.

    Hi,
        we have a cube containing date feild such as 0CALMONTH. the data is being loaded to the cube. now they have added new date feild (0FISCYEAR). how to get data to this feild. there is no data coming from source system for this feild. please can any one tell me how to include this feild and load data into it.
    with regards,
    sreekanth.

    Sreekanth,
       If Record creation date is the right field for deriving fiscal year, Why cant you derive the year from the date...by using automatioc time conversion...?? In update rules...??
      For exising data, you can do loop back to populate the data. see the below doc, for more info:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f421c86c-0801-0010-e88c-a07ccdc69601
    Hope it Helps
    Srini
    Message was edited by: Srini

  • Added new parameter but it doesn't worl properly.

    here is the code that i used.
    added new parameter date_where, but after that the mark_all and clear_all is not working.
    someone please help me.
    /* PROJECT DATE INITIALS DESCRIPTION */
    /* W_O_9130 07/11/2006 FJK ADDED A PARAMETER P_ORDER_DATE */
    PACKAGE BODY SignAgenda IS
    /* Marks all the records in the ORDERS_VIEW_LIST datablock. Marking the records allows only */
    /* the marked records to be printed from the list. */
    PROCEDURE MarkAll IS
    MarkLoop BOOLEAN := TRUE;
    BEGIN
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');
    IF (:SYSTEM.CURSOR_BLOCK != 'ORDERS_VIEW_LIST') THEN
    GO_BLOCK('ORDERS_VIEW_LIST');
    END IF;
    FIRST_RECORD;
    WHILE (MarkLoop) LOOP
    :ORDERS_VIEW_LIST.G_PICK_FIELD := 'x';
    IF (:SYSTEM.LAST_RECORD = 'TRUE') THEN
    MarkLoop := FALSE;
    ELSE
    NEXT_RECORD;
    END IF;
    END LOOP;
    FIRST_RECORD;
    IsMarked := TRUE;
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    END;
    /* UnMarks all the records in the ORDERS_VIEW_LIST datablock. */
    PROCEDURE ClearAll IS
    MarkLoop BOOLEAN := TRUE;
    BEGIN
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');
    IF (:SYSTEM.CURSOR_BLOCK != 'ORDERS_VIEW_LIST') THEN
    GO_BLOCK('ORDERS_VIEW_LIST');
    END IF;
    FIRST_RECORD;
    WHILE (MarkLoop) LOOP
    :ORDERS_VIEW_LIST.G_PICK_FIELD := NULL;
    IF (:SYSTEM.LAST_RECORD = 'TRUE') THEN
    MarkLoop := FALSE;
    ELSE
    NEXT_RECORD;
    END IF;
    END LOOP;
    FIRST_RECORD;
    IsMarked := FALSE;
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    END;
    /* Prints the regular and 24 hour signing agendas. */
    PROCEDURE PrintReport(ReportName IN VARCHAR2) IS
    MaxSize NUMBER(5) := 2000;
    Where1 VARCHAR2(2000):=NULL;
    Where2 VARCHAR2(2000):=NULL;
    Where3 VARCHAR2(2000):=NULL;
    DefWhere VARCHAR2(32767):=NULL;
    DefWhere2 VARCHAR2(2000):=NULL;
    RecsMarked BOOLEAN;
    MarkLoop BOOLEAN := TRUE;
    DblQuote VARCHAR2(1) := '"';
    RepParam PARAMLIST;
    TooMany EXCEPTION;
    AlId ALERT;
    AlBtn NUMBER(10);
    ExcMsg VARCHAR2(130);
    Report_Id REPORT_OBJECT;
    Report_Status VARCHAR2(30);
    /*** W_O_9130 07/11/2006 FJK START *** */
    date_where varchar2(30);
    /*** W_O_9130 07/11/2006 FJK END *** */
    BEGIN
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');
    RepParam := BuildParamList;
    /*** W_O_9130 07/11/2006 FJK START *** */
    date_where := replace(:ORDERS_VIEW_QUERY.dd_order_date,':',' to ');
    /*** W_O_9130 07/11/2006 FJK END *** */
    DefWhere := GET_BLOCK_PROPERTY('ORDERS_VIEW_LIST', DEFAULT_WHERE);
    IF (LENGTH(DefWhere) <= 2000) THEN
    DefWhere2 := DblQuote || DefWhere || DblQuote;
    ELSE
    DefWhere2 := 'DD_ORDER_DATE IS NOT NULL';
    END IF;
    IF NOT(IsMarked) THEN
    Where1 := DblQuote || DefWhere || DblQuote;
    ADD_PARAMETER(RepParam, 'P_WHERE', TEXT_PARAMETER, Where1);
    ADD_PARAMETER(RepParam, 'P_DEF_WHERE', TEXT_PARAMETER, DefWhere2);
    /*** W_O_9130 07/11/2006 FJK START *** */
    ADD_PARAMETER(RepParam, 'P_order_date', TEXT_PARAMETER, Date_Where);
    /*** W_O_9130 07/11/2006 FJK END *** */
    ELSE
    IsMarked := FALSE;
    GO_BLOCK('ORDERS_VIEW_LIST');
    FIRST_RECORD;
    WHILE (MarkLoop) LOOP
    IF (:ORDERS_VIEW_LIST.G_PICK_FIELD IS NOT NULL) THEN
    :ORDERS_VIEW_LIST.G_PICK_FIELD := NULL;
    ELSIF
         (Where1 IS NULL) THEN
    Where1 := 'DD_ORDER_RSN IN (''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (LENGTH(Where1) + LENGTH(:ORDERS_VIEW_LIST.DD_ORDER_RSN) + 5 <= MaxSize) THEN
    Where1 := Where1 || ', ''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (Where2 IS NULL) THEN
    Where2 := 'DD_ORDER_RSN IN (''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (LENGTH(Where2) + LENGTH(:ORDERS_VIEW_LIST.DD_ORDER_RSN) + 5 <= MaxSize) THEN
    Where2 := Where2 || ', ''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (Where3 IS NULL) THEN
    Where3 := 'DD_ORDER_RSN IN (''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (LENGTH(Where3) + LENGTH(:ORDERS_VIEW_LIST.DD_ORDER_RSN) + 5 <= MaxSize) THEN
    Where3 := Where3 || ', ''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSE
    RAISE TooMany;
    END IF;
    IF (:SYSTEM.LAST_RECORD = 'TRUE') THEN
    MarkLoop := FALSE;
    ELSE
    NEXT_RECORD;
    END IF;
    MarkLoop := false ;
    END LOOP;
    FIRST_RECORD;
    Where1 := Where1 || ')';
    IF (LENGTH(Where2) > 0) THEN
    Where2 := Where2 || ')';
    ELSE
    Where2 := 'DD_ORDER_RSN IS NULL';
    END IF;
    IF (LENGTH(Where3) > 0) THEN
    Where3 := Where3 || ')';
    ELSE
    Where3 := 'DD_ORDER_RSN IS NULL';
    END IF;
    ADD_PARAMETER(RepParam, 'P_WHERE', TEXT_PARAMETER, Where1);
    ADD_PARAMETER(RepParam, 'P_WHERE2', TEXT_PARAMETER, Where2);
    ADD_PARAMETER(RepParam, 'P_WHERE3', TEXT_PARAMETER, Where3);
    ADD_PARAMETER(RepParam, 'P_DEF_WHERE', TEXT_PARAMETER, DefWhere2);
    /*** W_O_9130 07/11/2006 FJK START *** */
    add_parameter(RepParam, 'P_order_date', TEXT_PARAMETER, Date_Where);
    /*** W_O_9130 07/11/2006 FJK END *** */
    END IF;
    HOST('..\..\STANDARD\VBExe\SetLegal', NO_SCREEN);
    Report_Id := FIND_REPORT_OBJECT(ReportName);
    Report_Status := RUN_REPORT_OBJECT(Report_Id, RepParam);
    HOST('..\..\STANDARD\VBExe\ResetOrigPaper', NO_SCREEN);
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    EXCEPTION
    WHEN TooMany THEN
    AlId := FIND_ALERT('ERR_ALERT');
    IF ID_NULL(AlId) THEN
    ExcMsg := 'Error occurred in the SignAgenda.PrintReport package';
    ExcMsg := ExcMsg || ' - ERR_ALERT doesn' || '''' || 't exist.';
    :LIST__SIGN_AGENDA.G_MESSAGE_FIELD := ExcMsg;
    MESSAGE(ExcMsg);
    RAISE FORM_TRIGGER_FAILURE;
    ELSE
    ExcMsg := 'The maximum number of records that can be selected has been exceeded.';
    ExcMsg := ExcMsg || CHR(10) || 'Please select a smaller number of records.';
    SET_ALERT_PROPERTY(AlId, ALERT_MESSAGE_TEXT, ExcMsg);
    SET_ALERT_PROPERTY(AlId, TITLE, 'Unable to complete the requested task!');
    AlBtn := SHOW_ALERT(AlId);
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    END;
    /* Creates and returns a parameter list. This is used by the PrintReport procedure. */
    FUNCTION BuildParamList RETURN PARAMLIST IS
    RepParam PARAMLIST;
    BEGIN
    IF ID_NULL(GET_PARAMETER_LIST('SIGNING_AGENDA')) THEN
    RepParam := CREATE_PARAMETER_LIST('SIGNING_AGENDA');
    ELSE
    DESTROY_PARAMETER_LIST('SIGNING_AGENDA');
    RepParam := CREATE_PARAMETER_LIST('SIGNING_AGENDA');
    END IF;
    RETURN RepParam;
    END;
    END;

    i have problem some where here.please help out.
    BEGIN
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');
    RepParam := BuildParamList;
    /*** W_O_9130 07/11/2006 FJK START *** */
    date_where := replace(:ORDERS_VIEW_QUERY.dd_order_date,':',' to ');
    /*** W_O_9130 07/11/2006 FJK END *** */
    DefWhere := GET_BLOCK_PROPERTY('ORDERS_VIEW_LIST', DEFAULT_WHERE);
    IF (LENGTH(DefWhere) <= 2000) THEN
    DefWhere2 := DblQuote || DefWhere || DblQuote;
    ELSE
    DefWhere2 := 'DD_ORDER_DATE IS NOT NULL';
    END IF;
    IF NOT(IsMarked) THEN
    Where1 := DblQuote || DefWhere || DblQuote;
    ADD_PARAMETER(RepParam, 'P_WHERE', TEXT_PARAMETER, Where1);
    ADD_PARAMETER(RepParam, 'P_DEF_WHERE', TEXT_PARAMETER, DefWhere2);
    /*** W_O_9130 07/11/2006 FJK START *** */
    ADD_PARAMETER(RepParam, 'P_order_date', TEXT_PARAMETER, Date_Where);
    /*** W_O_9130 07/11/2006 FJK END *** */
    ELSE
    IsMarked := FALSE;
    GO_BLOCK('ORDERS_VIEW_LIST');
    FIRST_RECORD;
    WHILE (MarkLoop) LOOP
    IF (:ORDERS_VIEW_LIST.G_PICK_FIELD IS NOT NULL) THEN
    :ORDERS_VIEW_LIST.G_PICK_FIELD := NULL;
    ELSIF
    (Where1 IS NULL) THEN
    Where1 := 'DD_ORDER_RSN IN (''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (LENGTH(Where1) + LENGTH(:ORDERS_VIEW_LIST.DD_ORDER_RSN) + 5 <= MaxSize) THEN
    Where1 := Where1 || ', ''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (Where2 IS NULL) THEN
    Where2 := 'DD_ORDER_RSN IN (''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (LENGTH(Where2) + LENGTH(:ORDERS_VIEW_LIST.DD_ORDER_RSN) + 5 <= MaxSize) THEN
    Where2 := Where2 || ', ''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (Where3 IS NULL) THEN
    Where3 := 'DD_ORDER_RSN IN (''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSIF (LENGTH(Where3) + LENGTH(:ORDERS_VIEW_LIST.DD_ORDER_RSN) + 5 <= MaxSize) THEN
    Where3 := Where3 || ', ''' || :ORDERS_VIEW_LIST.DD_ORDER_RSN || '''';
    ELSE
    RAISE TooMany;
    END IF;
    IF (:SYSTEM.LAST_RECORD = 'TRUE') THEN
    MarkLoop := FALSE;
    ELSE
    NEXT_RECORD;
    END IF;
    MarkLoop := false ;
    END LOOP;
    FIRST_RECORD;
    Where1 := Where1 || ')';
    IF (LENGTH(Where2) > 0) THEN
    Where2 := Where2 || ')';
    ELSE
    Where2 := 'DD_ORDER_RSN IS NULL';
    END IF;
    IF (LENGTH(Where3) > 0) THEN
    Where3 := Where3 || ')';
    ELSE
    Where3 := 'DD_ORDER_RSN IS NULL';
    END IF;

  • Batch Input for VA31 and adding new partner

    Dear All,
    I have a already well running program, which is creating new scheduling agreement via transaction VA31 in batch input mode.
    Now, there is a new requirement to add one partner in the header. I made a recording and saw that there is a subcreen SAPLV09C. I extended the program, but doesn't matter I'm doing I always get the message:
    No batch input data for screen SAPMV45A 4002
    Does anyone has experience with adding new partners in the header and can explain me how to make the right development.
    Thanks in advance.
    Klaus

    Hi Klaus,
    If you get the error No Batch input data for screen proceed as follows:
    1. In the Installation Assistant mark the foreground checkbox (in the column FG of the Installation Assistant project view) of this specific eCATT.
    2. Activate the project again.
    3. Run the eCATT in foreground
    seee this links
    ftp://ftp.software.ibm.com/software/websphere/integration/wbiadapters/library/doc/pdf/mysap4/mysap4_60.pdf
    www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm - 9k -
    thanks
    karthik
    reward me if usefull

  • Issue when changing a PO: it creates a new output record automatically

    Hello,
    The goal is to prevent that a new output record is automatically attached to a purchase order after a change has occurred.
    Current situation:
    Create a PO for holding and an output record is created for output type ZHP1.
    Release PO.
    Print the PO in ME9F.
    Change the condition record in MN05 and change the language of the print to a different language than the one of the supplier.
    Change the PO by adding some header text, the system adds a second output on the purchase order in the language of the cond record.
    This should not happen.
    Any idea how to achieve this goal rather via customizing than new implementation/changing the SAP standard code!
    Thank you in advance.
    Aydin

    Hi, I'm working with Aydin on this issue.
    It creates the second message on the PO and if processed via ME9F then it prints.
    But we dont want even that the second output gets created.
    We do not work with version management so changes to PO do not create second message.
    This second message comes up because language code has been changed in MN05 (one time change) after the first print.
    System sees that first message on PO is with language A and now condition record is with lang B.
    So If I change any little thing on the PO just to trigger message redetermination, it attaches a second output in the lang B. 
    If I dont change language code in MN05 and I still do my little change on PO, then it does not attach a second output message (which is good for us)
    I thought the only way out is to write a requirement program that would check that if a message already exists on the PO for that output type then dont create a second one. What do you think?
    Marc
    Edited by: mmlafe on Jan 3, 2012 5:02 PM

  • Adding new column to production database

    I have to add a new timestamp column, that defaults to the current date/time, to an existing production database. The table is large - 150M records. I am trying to understand the ramifications of adding a new column to a table this large that gets hit often, mostly with inserts and reads. The column does allow null values and I am not going back and populating existing records with a value. Basically, I am looking for some best practice guidelines - how to prepare, what to expect, what other processes should be followed along with this schema update.

    Radiators wrote:
    Thanks, I have not found any %TYPE or %ROWTYPE dependencies on the table I am altering. But at the same time I do not understand how these types of dependencies would invalidate packages. I wouldn't be breaking any %TYPE dependency because I am not dropping columns, only adding a new one. And according to documentation for %ROWTYPE - "If columns are later added to or dropped from the table, your code can keep working without changes." Can you point me to Oracle documentation that describes your concern in detail? Thanks.you can test it yourself
    SQL> CREATE TABLE abc (c1 NUMBER);
    Table created.
    SQL> INSERT INTO abc
      2       VALUES (99);
    1 row created.
    SQL> CREATE OR REPLACE PROCEDURE test_proc
      2  AS
      3     v   abc%ROWTYPE;
      4  BEGIN
      5     SELECT c1
      6       INTO v
      7       FROM abc
      8       WHERE ROWNUM = 1;
      9  END;
    10  /
    Procedure created.
    SQL> SELECT object_name, status
      2    FROM user_objects
      3   WHERE object_name = 'TEST_PROC';
    OBJECT_NAME                STATUS
    TEST_PROC                    VALID
    SQL> ALTER TABLE abc ADD (c2 VARCHAR2(10));
    Table altered.
    SQL> SELECT object_name, status
      2    FROM user_objects
      3   WHERE object_name = 'TEST_PROC';
    OBJECT_NAME                 STATUS
    TEST_PROC                     INVALID
    SQL> you should also consider the chance that some where if people are using "select * into" using this table, which will fail since you added new column. i don't see any unusual performance bottlenecks by adding a new column. in case of the backups, yes the earlier backups will not have the column. if you restore it, you will see earlier table structure itself. i have one specific question. why are you not attempting this in development/test environment first? even if it is a simple insert, it's always important to do it in test environments before attempting on production db. one thing for sure i know is, after adding column, you will have to recompile all the invalid dependencies. i think, it's better if you attempt it in test db and come up with any issues you see rather than asking a general question where problematic scenarios are plenty and rarely unknown before hand.

  • Question regarding adding new field to an infoset.

    Hi all!
    Actually i am not a programmer but HR functional, but i need to add an additional field to my infoset.
    I wanted to do it myself without ABAPers help.
    I have already added new field to an infoset and included a code:
    TABLES HRP1000.
    SELECT SINGLE short INTO ORG_UNIT_SHORT
           FROM hrp1000 WHERE objid = p0001-orgeh.
    And it almost works. The thing is, when on the report (sap query) a person have value '00000000' in the p0001-orgeh the report enters value into ORG_UNIT_SHORT from the previous record (of another employee).
    How to avoid this? i suppose i have to assign this field an initial value at the begining of the code (how?).. or?? as i said i just try to make first steps in abap programming...

    Ok, i have found a solution (clear statement)

  • Adding new segment in IDOC

    Hi,
           i have a requirement where based on a condition i need to add a new segment dynamically in Inbound IDOC.
    I have written the code in the user exit of the inbound FM. Its adding new segments and process it perfectly.
    But when i see the IDOC in we02 or we19, i am not able to see the newly added segment.
    Will the newly added segment in FM appear in the We02?
    PS: i have changed the idoc_control-maxsegnum.
    Regards,
    Niyaz

    Hi Niyaz,
    Check out the below program ....Similar to your requirement
    IDoc creation from inbound file
    REPORT ZS7BM000006 message-id ZS7.
    */ Program Name: Creation of DESADV & INVOIC IDocs from file E021
    */ Description : This program reads in external file E021 containing
    *                shipping and invoice data from internal vendors and
    *                creates one DESADV and one INVOIC IDoc per invoice.
    */ Transaction : n/a - run from job Z_ccc_S7B_Annnnn, where
    *                'ccc' = 3-digit client and 'nnnnn' = zero-filled
    *                sequence number matching the scheduled job for E020.
    tables:  lfa1,
             lfm1,
             ekpo,
             eine,
             e1edk01,
             e1edk02,
             e1edk07,
             e1edk08,
             e1edk06,
             e1edk03,
             e1edka1,
             e1edka2,
             e1edp07,
             e1edp09,
             e1edp19,
             e1edp01,
             e1edp02,
             e1edp26,
             e1edp04,
             e1eds01,
             e1eds02,
             zst7f_ty_vendors.
    parameters:  p_path like PATH-PATHEXTERN
                       default '/ftp/atac/in/'.
    data:  INFILE LIKE PATH-PATHEXTERN,
           back_path(7) type c value 'backup/',
           offset like sy-fdpos,
           p07_ctr like sy-index,
           invoice_total type p decimals 3,
           d_seg_num like sy-index,
           i_seg_num like sy-index.
    data:  OUTFILE LIKE PATH-PATHEXTERN,
           today(8)     type c.
    data:  begin of uty_vendors occurs 10,
              lifnr like lfa1-lifnr,
              waers like lfm1-waers,
              name_abbr like zst7f_ty_vendors-name_abbr,
              ship_days like zst7f_ty_vendors-ship_days,
           end of uty_vendors.
    data:  iZSS7B21 like ZSS7B21.
    data:  desadvdata like edi_dd occurs 5 with header line.
    data:  invoicdata like edi_dd occurs 5 with header line.
    data:  dedidc like edi_dc occurs 1 with header line.
    data:  iedidc like edi_dc occurs 1 with header line.
    data:  begin of ie021 occurs 10,
            lifnr            like lfa1-lifnr,
            ship_days        like zst7f_ty_vendors-ship_days,
            invoice_no       like e1edk08-vbeln,
            stat             like e1edk01-action,
            po_number(10)    type n,
            po_lineno(5)     type n,
            slip_number      like e1edp09-vbeln,
            shipto_id        like e1edka1-partn,
            vendor_id        like e1edka1-partn,
            endcust_name     like e1edka1-name1,
            cust_partno      like e1edp09-kdmat,  "char 35
            vendor_partno    like e1edp09-matnr,  "char 35
            invoice_qty      like e1edp09-lfimg,
            qty_uom          like e1edp01-menee,
            unit_price       like e1edp01-vprei,
            price_uom        like e1edp01-pmene,
            price_qty        like e1edp01-peinh,
            line_amount      like e1edp26-betrg,
            currency         like e1edk01-curcy,
            etd              like e1edk06-datum, "ship date
            eta              like e1edk06-datum, "delivery date
            ship_id          like e1edk08-traid,
            ship_method      like e1edk08-traty,
            create_date      like e1edk03-datum,
            plant            like ekpo-werks,
           end of ie021.
    data: save_po like ie021-po_number,
          save_line like ie021-po_lineno,
          save_stat like ie021-stat,
          save_invoice like ie021-invoice_no.
    constants: hun_thou type p decimals 5 value '100000',
               thou type p decimals 3 value '1000'.
    *&      DEFINITION:  append_idoc_rec
    *       add a data record to the IDoc internal table
    define append_idoc_rec.
    &1-tabnam = &1-segnam.
    &2_seg_num = &2_seg_num + 1.
    &1-segnum = &2_seg_num.
    shift &1-segnum left deleting leading space.
    append &1.
    clear &1.
    end-of-definition.       " append_idoc_rec
    * MAIN PROCESSING LOOP
    START-OF-SELECTION.
    today = sy-datum.
    * find all internal vendors
    select a~lifnr
           b~waers
           c~name_abbr  c~ship_days
       into corresponding fields of table uty_vendors
         from lfa1 as a
              inner join lfm1 as b
                 on a~lifnr = b~lifnr
              inner join zst7f_ty_vendors as c
                 on a~lifnr = c~lifnr
         where a~ktokk = 'ZZTY' and
               b~ekorg = '7100' and
               c~ship_code = ' '.
    perform init_desadv.
    perform init_invoic.
    concatenate 'SAP' sy-sysid(3) into: iedidc-sndpor, dedidc-sndpor.
    loop at uty_vendors.
      clear ie021. refresh ie021.
      if not uty_vendors-name_abbr is initial.
    * datafiles are received with naming convention:
    * E020_<customer name abbreviation>_UTY
        concatenate p_path 'E021_' uty_vendors-name_abbr '_UTY'
            into infile.
        if not sy-subrc is initial.  "pathname too long
    * Filename too long: &
          message i016 with infile.
          continue.
        endif.
        condense infile.
        OPEN DATASET INFILE FOR INPUT IN TEXT MODE.
        if not sy-subrc is initial.
    *'Cannot open dataset & on &'
          message i013 with infile sy-datum.
          continue.
        else.
          concatenate p_path back_path 'E021_'
              uty_vendors-name_abbr '_UTY' today
                    into outfile.
          if not sy-subrc is initial.  "pathname too long
    * Filename too long: &
            message i016 with outfile.
            continue.
          endif.
          condense outfile.
          OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE.
    * if the datestamped file cannot be created, do not process the
    * input file, because the input file is deleted after processing,
    * and there would be no record of the data.
          if not sy-subrc is initial.
    *'ERROR opening file & for output'
            close dataset infile.
            message i033 with outfile.
            continue.  "process next vendor's file
          endif.
          do.
            read dataset infile into izss7b21.
            case sy-subrc.
              when 0.
                transfer izss7b21 to outfile.
                if izss7b21-datacode = 'T'. "trailer rec
                  perform process_one_vendor using infile.
                  exit.  "process next vendor's file
                endif.
                check: izss7b21-datacode = 'A'. "data rec
                case izss7b21-status.
                  when ' '.  "new
                    ie021-stat = '000'.
                  when 'M'.  "modification
                    ie021-stat = '002'.
                  when 'D'.  "deletion
                    ie021-stat = '003'.
                endcase.
                move-corresponding uty_vendors to ie021.
                move-corresponding izss7b21 to ie021.
                perform convert_po_no using izss7b21-pono_poline
                                   changing ie021-po_number
                                            ie021-po_lineno.
                perform convert_dates using ie021-lifnr
                                            izss7b21-etd
                                            izss7b21-eta
                                            izss7b21-ship_method
                                            izss7b21-create_date
                                   changing ie021-eta
                                            ie021-ship_days.
                perform quantity_conversion
                                    using izss7b21-qty_uom
                                          izss7b21-invoice_qty
                                          izss7b21-unit_price
                                    changing ie021-qty_uom
                                             ie021-invoice_qty
                                          izss7b21-line_amount.
                perform money_conversion
                                    using izss7b21-currency
                                          izss7b21-unit_price
                                          izss7b21-price_uom
                                          izss7b21-line_amount
                                    changing ie021-currency
                                             ie021-price_uom
                                             ie021-price_qty
                                             ie021-unit_price
                                             ie021-line_amount.
                perform SAP_vendor_partno
                                    changing ie021-cust_partno.
                append ie021.
              when 4.  "EOF
                perform process_one_vendor using infile.
                exit.  "process next vendor's file
              when others.
    *ERROR reading dataset & - &
                message i015 with infile sy-datum.
                exit.
            endcase.
          enddo.
          close dataset: infile, outfile.
          delete dataset infile.
        endif.
      endif.
    endloop. "UTY_VENDORS
    *&      Form  process_one_vendor
    *       Pre-processed records from one vendor file are now in the
    *       internal table ie021 - ready to create IDocs
    FORM process_one_vendor using value(infile).
      sort ie021 by invoice_no stat po_number po_lineno.
      loop at ie021.
        if ( ie021-invoice_no <> save_invoice or
             ie021-stat <> save_stat ).
          if sy-tabix > 1.
            perform post_idocs using ie021-stat.
          endif.
          perform idoc_header_segs using ie021-stat.
        endif.
        if ( ie021-stat <> save_stat or
             ie021-po_number <> save_po or
             ie021-po_lineno <> save_line or
             ie021-invoice_no <> save_invoice ).
          if ( sy-tabix > 1 and
               ie021-stat = '000' ).
            perform idoc_poheader_segs.
          endif.
        endif.
        perform idoc_item_segs using ie021-stat.
        save_po = ie021-po_number.
        save_line = ie021-po_lineno.
        save_invoice = ie021-invoice_no.
        save_stat = ie021-stat.
      endloop.
      perform post_idocs using ie021-stat.
    * File successfully processed: &
      message s035 with infile.
    ENDFORM.                    " process_one_vendor
    *&      Form  convert_po_no
    *       Break the PO number & line field into separate fields
    FORM convert_po_no using value(infield)
                       changing po_number like ie021-po_number
                                po_line like ie021-po_lineno.
    data:  cpos like sy-fdpos,
           lpos like sy-fdpos,
           cline(6) type c.
    * if the infield contains a hyphen, assume that the preceding characters
    * represent the po number, if they are numeric. The po line number is
    * assumed to be all numeric characters after the hyphen.
      if infield ca '-'.
        if infield(sy-fdpos) co ' 0123456789'.  "numeric
          po_number = infield(sy-fdpos).
          cpos = sy-fdpos + 1.
        endif.
      else.  "no hyphen - PTY
        if infield(2) = '71'.  "SAP number range
          cpos = 10.
        else.                  "SyteLine number
          cpos = 6.
        endif.
        if infield(cpos) co ' 0123456789'.  "numeric
          po_number = infield(cpos).
        endif.
      endif.
      if not po_number is initial.
        while infield+cpos(1) co '0123456789'.
          cline+lpos(1) = infield+cpos(1).
          lpos = lpos + 1.
          cpos = cpos + 1.
        endwhile.
        shift cline left deleting leading '0'.
        if not cline is initial.
          po_line = cline.
        endif.
      endif.
    * Put out a warning in the job log, but create the IDoc to save the data
      if ( po_number is initial or
           po_line is initial ).
    * PO number - line item conversion failed: &
        message i034 with infield.
      endif.
    ENDFORM.                    " convert_po_no
    *&      Form  convert_dates
    *       Convert ship date to delivery date, if necessary
    FORM convert_dates using value(vendor_no)
                             value(i_ship_date)
                             value(i_delivery_date)
                             value(i_ship_code)
                             value(i_create_date)
                    changing o_delivery_date
                             ship_days.
    data:  ship_date type d.
    * if delivery date not sent, calculate it from ship date plus
    * ship days.
    * Note that this logic could leave delivery date blank,
    * if ship date is not numeric.
      if ( i_delivery_date is initial or
           i_delivery_date co ' 0' ).  "no delivery date sent
        if ( i_ship_date co ' 0123456789' and
             i_ship_date cn ' 0' ).    "ship date sent
    * move the ship date into a date field to add days
          ship_date = i_ship_date.
        elseif ( i_create_date co ' 0123456789' and
                 i_create_date cn ' 0' ).
          ship_date = i_create_date.
        endif.
        if not i_ship_code is initial.
          select single ship_days from zst7f_ty_vendors
                   into ship_days
                  where lifnr = vendor_no
                    and ship_code = i_ship_code.
        endif.
        if not ship_date is initial.
          if ship_days > 0.
            ship_date = ship_date + ship_days.
            o_delivery_date = ship_date.
            shift o_delivery_date left deleting leading ' '.
          endif.
        endif.
      else.  "delivery date sent
        o_delivery_date = i_delivery_date.
      endif.
    ENDFORM.                    " convert_dates
    *&      Form  quantity_conversion
    *       The quantities in the input file are implied 3-decimal,
    *       so need to be converted into a "real" number.
    *       Also, the unit of measure may be 'KP' indicating that the qty
    *       is given in thousands.
    FORM quantity_conversion USING    value(i_UOM)
                                      value(i_invoice_qty)
                                      value(i_unit_price)
                        CHANGING o_uom like iE021-qty_UOM
                                 o_invoice_qty like IE021-INVOICE_QTY
                                 c_LINE_AMOUNT like izss7b21-line_amount.
    data:  f_invoice_qty type f.
    data:  n_invoice_qty like lips-kcmeng.
    data:  f_unit_price type f.
    data:  f_line_amt type f.
    data:  n_line_amt0 type p decimals 0.
      if ( i_invoice_qty co ' 0123456789' and
           i_invoice_qty cn ' 0' ).
        f_invoice_qty = i_invoice_qty.
    * if no extended price is sent, calculate it
        if c_line_amount is initial.
    * the qty is implied 3-dec, the price is still implied
    * 5-dec, and line amount should be implied 3-dec.
          f_unit_price = i_unit_price.
          f_line_amt = ( f_invoice_qty * f_unit_price ) / 100000.
          n_line_amt0 = f_line_amt.
          c_line_amount = n_line_amt0.
          shift c_line_amount left deleting leading space.
        endif.
    * if the invoice qty is per 1000, the implied 3-dec times 1000 equals
    * the unconverted value. Otherwise, divide by 1000 to get the PCE qty
        if i_uom = 'KP'.
          n_invoice_qty = f_invoice_qty.
        else.
          n_invoice_qty = f_invoice_qty / thou.
        endif.
      endif.
      o_uom = 'PCE'.
      if not n_invoice_qty is initial.
        o_invoice_qty = n_invoice_qty.
        shift o_invoice_qty left deleting leading space.
      else.
        clear o_invoice_qty.
      endif.
    ENDFORM.                    " quantity_conversion
    *&      Form  money_conversion
    *       Add the implied decimals and store price-per qty, if
    *       price per 1,000 is sent.
    FORM money_conversion USING    value(I_CURR)
                                   value(i_UNIT_PRICE)
                                   value(i_UOM)
                                   value(i_LINE_AMOUNT)
                          CHANGING o_CURRENCY like ie021-currency
                                   o_PRICE_UOM like ie021-price_uom
                                   o_PRICE_QTY like ie021-price_qty
                                   o_UNIT_PRICE like ie021-unit_price
                                   o_LINE_AMOUNT like ie021-line_amount.
    data:  n_unit_price type p decimals 5,
           n_line_amount type p decimals 3.
    * not all of the vendors send the currency code, so use the vendor
    * master default
      case i_curr(2).
        when 'US'.
          o_currency = 'USD'.
        when 'JP'.
          o_currency = 'JPY'.
        when others.
          o_currency = uty_vendors-waers.
      endcase.
    * unit price is implied 5-dec
      if ( i_unit_price cn ' 0' and
           i_unit_price co ' 0123456789' ).
        n_unit_price = i_unit_price.
        n_unit_price = n_unit_price / hun_thou.
      endif.
    * line price is implied 3-dec
      if ( i_line_amount co ' 0123456789' and
           i_line_amount cn ' 0' ).
        n_line_amount = i_line_amount.
        n_line_amount = n_line_amount / thou.
      endif.
    * 'KP' = price per thousand
      if i_uom = 'KP'.
        o_price_qty = '1000'.
      else.
        o_price_qty = '1'.
      endif.
      o_price_uom = 'PCE'.
      if not n_unit_price is initial.
        o_unit_price = n_unit_price.
        shift o_unit_price left deleting leading space.
      else.
        clear o_unit_price.
      endif.
      if not n_line_amount is initial.
        o_line_amount = n_line_amount.
        shift o_line_amount left deleting leading space.
      else.
        clear o_line_amount.
      endif.
    ENDFORM.                    " money_conversion
    *&      Form  SAP_vendor_partno
    *       replace UTY part number sent by vendor with SAP material no.
    *       from PO line item.
    FORM SAP_vendor_partno changing cust_partno like ie021-cust_partno.
    tables: makt.
    data: partno_sent like makt-maktx.
      partno_sent = cust_partno.
      clear: makt, cust_partno.
      select single matnr from ekpo into cust_partno
             where ebeln = ie021-po_number and
                   ebelp = ie021-po_lineno.
      if sy-subrc is initial.
    *compare material description to part number sent by vendor
        select single maktx from makt into makt-maktx
            where matnr = cust_partno.
        if partno_sent <> makt-maktx.
    * 'Part No. Mismatch: PO & - &, Part sent &, SAP mat.no. &'
          message i031 with ie021-po_number ie021-po_lineno
                            partno_sent makt-maktx.
        endif.
      else.  "PO line not found
    *try to find SAP material number using 20-char catalog no. sent
        select single matnr from makt into cust_partno
            where maktx = partno_sent.
        if not sy-subrc is initial.
    * 'SAP material no. not found for & - PO & - &'
          message i032 with partno_sent ie021-po_number ie021-po_lineno.
        endif.
      endif.
    *if not found, IDoc will go to workflow for missing material no.
    ENDFORM.                    " SAP_vendor_partno
    *&      Form  idoc_header_segs
    *       create internal table entries for header segments.
    *  DESADV:
    *          E1EDK07
    *          E1EDKA1
    *          E1EDK03
    *          E1EDK08
    *          E1EDKA2
    *          E1EDK06
    *  INVOIC:
    *          E1EDK01
    *          E1EDKA1(s)
    *          E1EDK02
    *          E1EDK03(s)
    FORM idoc_header_segs using value(desadv_ok).
    * INVOIC
      clear i_seg_num.
      invoicdata-segnam = 'E1EDK01'.
      e1edk01-action = ie021-stat.
      if ie021-currency(2) = 'US'.
        e1edk01-curcy = 'USD'.
      else.
        e1edk01-curcy = 'JPY'.
      endif.
      invoicdata-sdata = e1edk01.
      append_idoc_rec invoicdata i.
      clear e1edka1.
      invoicdata-segnam = 'E1EDKA1'.
      e1edka1-parvw = 'RE'.
      e1edka1-partn = ie021-shipto_id.
      invoicdata-sdata = e1edka1.
      append_idoc_rec invoicdata i.
      clear e1edka1.
      invoicdata-segnam = 'E1EDKA1'.
      e1edka1-parvw = 'LF'.
      e1edka1-partn = ie021-lifnr.
      e1edka1-lifnr = ie021-shipto_id.
      invoicdata-sdata = e1edka1.
      append_idoc_rec invoicdata i.
      if not ie021-endcust_name is initial.
        clear e1edka1.
        invoicdata-segnam = 'E1EDKA1'.
        e1edka1-parvw = 'WE'.
        e1edka1-name1 = ie021-endcust_name.
        invoicdata-sdata = e1edka1.
        append_idoc_rec invoicdata i.
      endif.
      clear e1edk02.
      invoicdata-segnam = 'E1EDK02'.
      e1edk02-qualf = '009'.
      e1edk02-belnr = ie021-invoice_no.
      invoicdata-sdata = e1edk02.
      append_idoc_rec invoicdata i.
      clear e1edk03.
      invoicdata-segnam = 'E1EDK03'.
      e1edk03-iddat = '012'.
      e1edk03-datum = ie021-create_date.
      invoicdata-sdata = e1edk03.
      append_idoc_rec invoicdata i.
      invoicdata-segnam = 'E1EDK03'.
      e1edk03-iddat = '024'.
      invoicdata-sdata = e1edk03.
      append_idoc_rec invoicdata i.
      check desadv_ok = '000'.
    * DESADV
      clear d_seg_num.
      desadvdata-segnam = 'E1EDK07'.
      e1edk07-action = ie021-stat.
      e1edk07-bolnr = ie021-invoice_no.
      desadvdata-sdata = e1edk07.
      append_idoc_rec desadvdata d.
      clear e1edka1.
      desadvdata-segnam = 'E1EDKA1'.
      desadvdata-sdata = e1edka1.
      append_idoc_rec desadvdata d.
      clear e1edk03.
      desadvdata-segnam = 'E1EDK03'.
      desadvdata-sdata = e1edk03.
      append_idoc_rec desadvdata d.
      clear e1edk08.
      desadvdata-segnam = 'E1EDK08'.
      e1edk08-vbeln = ie021-invoice_no.
      e1edk08-traid = ie021-ship_id.
      e1edk08-traty = ie021-ship_method.
      desadvdata-sdata = e1edk08.
      append_idoc_rec desadvdata d.
      clear e1edka2.
      desadvdata-segnam = 'E1EDKA2'.
      desadvdata-sdata = e1edka2.
      append_idoc_rec desadvdata d.
      clear e1edk06.
      desadvdata-segnam = 'E1EDK06'.
      e1edk06-iddat = '025'.  "document date
      e1edk06-datum = ie021-create_date.
      desadvdata-sdata = e1edk06.
      append_idoc_rec desadvdata d.
      if not ie021-eta is initial.
        clear e1edk06.
        desadvdata-segnam = 'E1EDK06'.
        e1edk06-iddat = '001'.  "delivery date
        e1edk06-datum = ie021-eta.
        desadvdata-sdata = e1edk06.
        append_idoc_rec desadvdata d.
      endif.
      if not ie021-etd is initial.
        clear e1edk06.
        desadvdata-segnam = 'E1EDK06'.
        e1edk06-iddat = '010'.  "ship date
        e1edk06-datum = ie021-etd.
        desadvdata-sdata = e1edk06.
        append_idoc_rec desadvdata d.
      endif.
    ENDFORM.                    " idoc_header_segs
    *&      Form  idoc_poheader_segs
    *       create internal table entries for DESADV PO/item segments
    *          E1EDP07
    FORM idoc_poheader_segs.
    *DESADV
      clear e1edp07.
      desadvdata-segnam = 'E1EDP07'.
      e1edp07-bstnk = ie021-po_number.
      e1edp07-posex = ie021-po_lineno.
      desadvdata-sdata = e1edp07.
      append_idoc_rec desadvdata d.
      p07_ctr = p07_ctr + 1.
    ENDFORM.                    " idoc_poheader_segs
    *&      Form  idoc_item_segs
    *       create internal table entries for PO item segments:
    *          DESADV:   E1EDP09
    *          INVOIC:   E1EDP01        Qtys
    *                    E1EDP02        ref nos. (PO number / line)
    *                    E1EDP19        part numbers
    *                    E1EDP26        amounts
    *                    E1EDP04        taxes
    FORM idoc_item_segs using value(desadv_ok).
    data:  n_line_amt  type p decimals 3.
    *INVOIC
      clear e1edp01.
      invoicdata-segnam = 'E1EDP01'.
      e1edp01-menee = ie021-qty_uom.
      e1edp01-menge = ie021-invoice_qty.
      e1edp01-vprei = ie021-unit_price.
      e1edp01-pmene = ie021-price_uom.
      e1edp01-peinh = ie021-price_qty.
      e1edp01-netwr = ie021-line_amount.
      invoicdata-sdata = e1edp01.
      append_idoc_rec invoicdata i.
      clear e1edp02.
      invoicdata-segnam = 'E1EDP02'.
      e1edp02-qualf = '001'.
      e1edp02-belnr = ie021-po_number.
      e1edp02-zeile = ie021-po_lineno.
      invoicdata-sdata = e1edp02.
      append_idoc_rec invoicdata i.
      clear e1edp19.
      invoicdata-segnam = 'E1EDP19'.
      e1edp19-qualf = '001'.
      e1edp19-idtnr = ie021-cust_partno.
      invoicdata-sdata = e1edp19.
      append_idoc_rec invoicdata i.
      clear e1edp19.
      invoicdata-segnam = 'E1EDP19'.
      e1edp19-qualf = '002'.
      e1edp19-idtnr = ie021-vendor_partno.
      invoicdata-sdata = e1edp19.
      append_idoc_rec invoicdata i.
      clear e1edp26.
      invoicdata-segnam = 'E1EDP26'.
      e1edp26-qualf = '003'.
      e1edp26-betrg = ie021-line_amount.
      invoicdata-sdata = e1edp26.
      append_idoc_rec invoicdata i.
    * dummy tax seg
      clear e1edp04.
      invoicdata-segnam = 'E1EDP04'.
      e1edp04-msatz = '0.00'.
      invoicdata-sdata = e1edp04.
      append_idoc_rec invoicdata i.
      n_line_amt = ie021-line_amount.
      invoice_total = invoice_total + n_line_amt.
      check desadv_ok = '000'.
    *DESADV
      clear e1edp09.
      desadvdata-segnam = 'E1EDP09'.
      e1edp09-vbeln = ie021-slip_number.
      e1edp09-matnr = ie021-vendor_partno.
      e1edp09-vrkme = ie021-qty_uom.
      e1edp09-lfimg = ie021-invoice_qty.
      desadvdata-sdata = e1edp09.
      append_idoc_rec desadvdata d.
    ENDFORM.                    " idoc_item_segs
    *&    Form  post_idocs
    *     create database IDocs from the idocdata tables and clear tables.
    FORM post_idocs using value(desadv_ok).
    *INVOIC
      clear e1eds01.
      invoicdata-segnam = 'E1EDS01'.
      e1eds01-sumid = '010'.
      e1eds01-summe = invoice_total.
      e1eds01-waerq = ie021-currency.
      shift e1eds01-summe left deleting leading space.
      invoicdata-sdata = e1eds01.
      append_idoc_rec invoicdata i.
      CALL FUNCTION 'INBOUND_IDOC_PROCESS'
        TABLES
          IDOC_CONTROL       =  iedidc
          IDOC_DATA          =  invoicdata.
      commit work.
    *DESADV
      if desadv_ok = '000'.
        clear e1eds02.
        desadvdata-segnam = 'E1EDS02'.
        e1eds02-sumid = '001'.
        e1eds02-summe = p07_ctr.
        shift e1eds02-summe left deleting leading space.
        desadvdata-sdata = e1eds02.
        append_idoc_rec desadvdata d.
        CALL FUNCTION 'INBOUND_IDOC_PROCESS'
          TABLES
            IDOC_CONTROL       =  dedidc
            IDOC_DATA          =  desadvdata.
        commit work.
      endif.
      refresh: desadvdata,
               invoicdata.
      clear:
        desadvdata,
        invoicdata,
        p07_ctr,
        invoice_total,
        save_stat,
        save_po,
        save_line,
        save_invoice.
    ENDFORM.                    " post_idocs
    *&      Form  init_desadv
    *       add a DESDAV control record and initialize fields
    FORM init_desadv.
    clear dedidc. refresh dedidc.
    * initialize control record:
    move:  '2'        to  dedidc-direct,
          'DESADV01'  to  dedidc-doctyp,
          'DESADV'    to  dedidc-mestyp,
          'F'         to  dedidc-std,
          'E021'      to  dedidc-stdmes,
          'LS'        to  dedidc-sndprt,
          'TY_VENDORS' to dedidc-sndprn,
          sy-datlo    to  dedidc-credat,
          sy-timlo    to  dedidc-cretim.
    append dedidc.
    ENDFORM.              " init_desadv
    *&      Form  init_invoic
    *       add a INVOIC control record and initialize fields
    FORM init_invoic.
    clear iedidc. refresh iedidc.
    * initialize control record:
    move:  '2'        to  iedidc-direct,
          'INVOIC01'  to  iedidc-doctyp,
          'INVOIC'    to  iedidc-mestyp,
          'MM'        to  iedidc-mescod,
          'F'         to  iedidc-std,
          'E021'      to  iedidc-stdmes,
          'LS'        to  iedidc-sndprt,
          'TY_VENDORS' to iedidc-sndprn,
          sy-datlo    to  iedidc-credat,
          sy-timlo    to  iedidc-cretim.
    append iedidc.
    ENDFORM.              " init_invoic
    REWARD POINTS IF HELPFUL
    Lakshmiraj.A

  • Adding New Org Units to Existing Organization Structure

    Hi,
    There is a change in the Org Structure, i.e we are adding new Org Units(Personnel Sub areas) to the existing Structure and creating postions to the newly created Org Units using PP01. Now my question is what are all things need to be configured with respect to Payroll, for the newly created PSA.
    Rgds
    Ram

    Hi Ramakrishna,
    Please be more clearer. PSAs are not org units. PSA belong to enterprise structure, whereas Org Unit belong to Org Structure. When you create new positions under the Org Units tht have been assigned to a PSA, PA, Company Code, Cost Center and Controlling area combination, you would have to set the following.
    Group your PSA for,
    Primary Wage Types
    Premium
    Work Schedule
    Time Recording
    Absence Attendence Type.
    Assign Tax Area to a PSA(If it is US Payroll).
    Any more suggestions from experts?
    K

  • Error whille adding new mapping into FDM

    Hi,
    When i am trying to add new account mapping into account(The account already having 4000 mappings already) in FDM am getting error like, "Error: Error adding new record.
    Detail: An invalid value was entered for the dimension (Customer)" .
    What should I correct for this situation?
    Thanks so much!!!

    Loading a target system member that does not exist in the target application is only going to cause you an error when loading to the target system. I would not recommend this approach. Either update the maps to a valid member or add the member to the target application.

  • A New Worlds Record

    Hello,
    I've hit a new world record – Eight Windows Security Shields blinking on my taskbar asking to update Flash.
    This is my fourth thread concerning this problem. You can view the other threads here:
    http://forums.adobe.com/message/4714633#4714633
    http://forums.adobe.com/message/4583350#4583350
    http://forums.adobe.com/message/4563117#4563117
    Basically, I had to revert to Flash version 10.3 because version 11 breaks Dragon Naturally Speaking – this is a well-documented problem. I've turned off all the "do not ask for upgrade" options in Flash, but that makes no difference. Several times I have used the Adobe utility to do a clean uninstall. I'm constantly being bothered to upgrade Flash. Sometimes Windows "User Account Control" opens, interrupting whatever I'm doing, and forcing me to respond before I can continue.
    The solution to this problem should be absolutely trivial, but I'm afraid the solution will be to just get rid of Flash. There must be some mechanism that Flash uses or other applications use to request Flash to check for updates. Delete this mechanism – problem solved. Problem is, I don't know what that mechanism is.
    I have been asking about this problem for months, since June or July. It should not be this complicated.
    Barry.

    Hi,
    Copy the URL from the contact create link and pass the values like Account Name etc by adding it to the URL, use & to separate the values.
    hope it helps,
    Mayank

  • Added new field to cube but data not passed from DSO

    Hope someone can help.
    (BI 7.0) We added new fields into a cube. The fields already existed in the DSO. When we ran the process chain in development for the first time after making this change, we notice that the 'historical' data for these fields is populated in the cube. When we do this in our quality system only new data passed to the cube is updated. In development in the sub-chain DTP request we see all previous requests listed under selections. In quality it is only the latest request. The only difference is that the DeltaInit flag in the DTP request in development is ticked (extraction mode) - but not in quality. Does anyone know whyb this is?

    hi peter,
    Adding fields to cube doesn't affect delta status...The delta DTP should be able to handle delta requests automatically.
    I guess in you quality system, the cube already got all requests updated from ODS before you importing the change request. And in develop system none of the requests in ODS were updated before the change.
    Regards,
    Frank

Maybe you are looking for

  • Report to exclude entries where on id could have multiple statuses.

    Hi , I have a table where it keeps record of a status number and a corresponding r_number(report number) where one r_number could have multiple amount of statuses. As shown below. id     r_number     Sta      date     setupby 1     1111     2     11/

  • How to use a div id as a php var

    Hello,   I have a form that is generated from a database with unique links that users can click and edit details about various vehicles. Now these links are each in their own div that has an id that i would like to use for insertion back into the dat

  • Weird blank space above fixed navigation bar. help!?

    Dear all, Im a real no no in building websites, so this is already my fifth post in a week And i have an issue again.... on my website: http://vinddit.nl/ you can see i made a fixed navigationbar. but you will see a blank space above it when you scol

  • Display Package version number in HTML?

    Hi, My customer wants to display the version number of the apps/xx package in the HTML. I'm just wondering if this is a good idea, i.e. the actual package contents could be overwritten, but the package doesn't change. Also - how could that be achieve

  • My ipad wont work. it ran out of batteries and now its stuck on the apple logo

    i just got my ipad less than two weeks ago, and i went to sleep with it on 27% charged. when i woke up it was out of batterie so i plugged it in, but it got stuck on the apple logo with the swirly thing and when i plug it in again, it just keeps maki