Using multiple lines of query in sqlcmd using -q switch

Hello
I am trying to use sqlcmd to run a set of sql statements. If I use -i switch and input a file with sql statements, it is working fine, but I am trying to use the sql statements using -q to avoid the creation of the input file. But I am not having luck with
-q, can someone let me know if putting multiple lines of code is possible in -q switch like below?
A simple restore command like below. If I use the whole restore command in single line it works fine like below:
sqlcmd -E -S servername -d master -Q "restore database bestst_test from disk='E:\Backup\test\bestst\bestst_20101222.bak' with move 'BESMgmt415_data' to 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\bestst_test.mdf',move 'BESMgmt415_log'
to 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\bestst_test_log.ldf' "
but if I split the restore command into 3 lines like below, it fails, can someone let me know how to use the multiple line feature in sqlcmd -q switch?
sqlcmd -E -S servername -d master -Q "restore database bestst_test from disk='E:\Backup\test\bestst\bestst_20101222.bak'
with move 'BESMgmt415_data' to 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\bestst_test.mdf',
move 'BESMgmt415_log' to 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\bestst_test_log.ldf' "

Well actually there is a way, in command prompt you can you the carat character (^) to indicate that there is more lines. So in your restore case:
sqlcmd -E -S servername -d master -Q ^
"restore database bestst_test from disk='E:\Backup\test\bestst\bestst_20101222.bak' ^
with move 'BESMgmt415_data' to 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\bestst_test.mdf', ^
move 'BESMgmt415_log' to 'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\bestst_test_log.ldf' "
I must say, it is abit of a hassle (since there are several restrictions to how you need to break the line), and you actually better off using the input file for this.
Thank you
Lucas

Similar Messages

  • Reg: fetch the data by using item_id which is retuned by In line View Query

    Hi all,
    create table xxc_transactions(type_id number,trx_line_id number ,item_id number,org_id number);
    insert into xxc_transactions values(null,null,null,null);
    create table xxc_items1(item_id number,org_id number,item_no varchar2(10));
    insert into xxc_items1 values(123,12,'book');
    create table xxc_headers(header_id number,order_id number);
    insert into xxc_headers values(null,null);
    create table xxc_lines(header_id number,item_id number,line_id number);
    insert into xxc_lines values(null,null,null);
    create table xxc_types_tl(transaction_id number,NAME varchar2(10));
    insert into xxc_types_tl values(106,'abc');
    create table xxc_quantity(item_id number);
    insert into xxc_quantity values (123);
    create table xxc_quantity_1(item_id number);
    insert into xxc_quantity_1 values (123);
    SELECT union_id.item_id,
           b.org_id,
           e.name,
           fun1(union_id.item_id) item_no
    FROM   xxc_transactions a,
           xxc_items1 b,
           xxc_headers c,
           xxc_lines d,
           xxc_types_tl e,
           (SELECT item_id
            FROM   xxc_quantity
            WHERE  item_id = 123
            UNION
            SELECT item_id
            FROM   xxc_quantity_1
            WHERE  item_id = 123
            UNION
            SELECT item_id
            FROM   xxc_transactions
            WHERE  item_id = 123) union_id
    WHERE  a.type_id = 6
           AND a.item_id  = b.item_id
           AND union_id.item_id = b.item_id
           AND a.org_id = b.org_id
           AND c.header_id = d.header_id
           AND d.line_id = a.trx_line_id
           AND d.item_id = b.item_id
           AND c.order_id = e.transaction_id
           AND b.org_id = 12
    GROUP  BY union_id.item_id,
              b.org_id,
              e.name
    ORDER  BY union_id.item_id;
    create or replace function fun1(v_item in number)
    return varchar2
    is
    v_item_no
    Begin
       select item_no from xxc_items1
       where item_id=v_item;
       return v_item_no ;
        Exception
         When Others Then
          v_item_no := null;
          return v_item_no;
    END fun1;
    I  need  fetch the data by using item_id which is retuned by In line View Query(UNION)
    item_id  org_id  name    item_no
    123        12        abc       book
    Version: 11.1.0.7.0  and 11.2.0.1.0
    Message was edited by: Rajesh123 Added test cases script
    Message was edited by: Rajesh123 changed Question as fetch the data by using item_id which is retuned by In line View Query(UNION)

    Hi Master , sorry for the late reply and can you please help on this?
    create table xxc_transactions(type_id number,trx_line_id number ,item_id number,org_id number);
    insert into xxc_transactions values(null,null,null,null);
    create table xxc_items(item_id number,org_id number,item_no varchar2(10));
    insert into xxc_items values(123,12,'book');
    create table xxc_headers(header_id number,order_id number);
    insert into xxc_headers values(null,null);
    create table xxc_lines(header_id number,item_id number,line_id number);
    insert into xxc_lines values(null,null,null);
    create table xxc_types_tl(transaction_id number,NAME varchar2(10));
    insert into xxc_types_tl values(106,'abc');
    create table xxc_uinon_table(item_id number);
    insert into xxc_types_tl values(123);
    SELECT   union_id.item_id,
             b.org_id ,
             e.name ,
             fun1(union_id.item_id) item_no   --> to get item_no
             FORM xxc_transactions a,
             xxc_items             b,
             xxc_headers           c,
             xxc_lines             d,
             xxc_types_tl          e,
             ( SELECT item_id
                 FROM   xxc_uinon_table ) union_id
    WHERE    a.type_id= 6
    AND      a.item_id = b.item_id
    AND      union_id.item_id = b.item_id
    AND      a.org_id = b.org_id
    AND      c.header_id = d.header_id
    AND      d.line_id= a.trx_line_id
    AND      d.item_id= b.item_id
    AND      c.order_id= e.transaction_id ---106
    AND      b.org_id = 12
    GROUP BY union_id.item_id,
             b.org_id ,
             e.name
    ORDER BY union_id.item_id;
    Note: xxc_uinon_table is a combination of UNION's
    select 1 from dual
    union
    select 1 from dual
    union
    select no rows returned  from dual;
    I will get 1 from the above Query
    Thank you in advanced

  • Using Select all to create multiple lines in a sales order

    Hello SAP experts,
    In our business practice users create multiple line sales orders with reference to contracts and use the copy paste method and then assign each line to the contract manually.
    After a few years of this practice i found a new way to create multiple lines but it doesn't quite work correctly. When you have created the first line of an order if you click on the select all button the system will ask you how many lines do you want to copy. I don't know if this is standard SAP but 3 things don't happen when we use this 1) The schedule line information is blank 2) conditions do not copy from the contract even though the contract has been referenced. 3) Since there is no schedule line information the order fails when saving and we get a update terminated message.
    I am having problems finding any documentation around this function so any help with this would be greatly appreciated.
    error when updating is
    Transaction..   VA01
    Update key...   4D358878A8B601AAE10080000A2C4982
    Generated....   28.01.2011, 13:47:23
    Completed....   28.01.2011, 13:47:23
    Error Info...   00 671: ABAP/4 processor: GETWA_NOT_ASSIGNED

    GETWA_NOT_ASSIGNED
    Many threads are there on this error message and you would come to know if you google with this text.  Check couple of threads where  the same topic was discussed
    [Re: GETWA_NOT_ASSIGNED|Re: GETWA_NOT_ASSIGNED;
    [Re: GETWA_NOT_ASSIGNED ABAP Dump|GETWA_NOT_ASSIGNED ABAP Dump;
    Also there are some 20 OSS notes on this error message and you can have a look at the following notes:-
    1)   Note 913679 - VA01: Short Dump GETWA_NOT_ASSIGNED on click of quantity.
    2)   Note 591955 - ABAP runtime error GETWA_NOT_ASSIGNED
    3)   Note 870670 - SD_SALES_DOCU_MAINTAIN_DIALOG termination with GETWA_NOT_***
    4)   Note 141314 - VA02: Dump with 'GETWA_NOT_ASSIGNED'
    thanks
    G. Lakshmipathi

  • How to create a view to display Multiple lines of Text using ABAP WebDynpro

    Hi,
    I need to create a static view page in ABAP WebDynpro that displays Static text data in multiple paragraphs. I tried to use textview, formatted text, text edit controls by binding the textcontrol to a text object that is created in so10, but the output I am getting is only one line and the character count is limited to 60 to 65 characters.
    I would like to know which control needs to be used in ABAP Webdynpro to get multiple lines displayed with text formatting like Paragraph, Indenting and Size.....
    Thanks for your time!
    Madhavi.

    Find the sample codes:
      data sapscript_lines     type tlinetab.
      data sapscript_lines1     type tlinetab.
      data sapscript_tline     type tline.
      data sapscript_head      type thead.
      data text                type string.
      data formatted_text type ref to cl_wd_formatted_text.
      call function 'DOCU_GET'
        EXPORTING
          id                = 'TX'
          langu             = 'D' "Germany language
          object            = 'WDR_TEST_HELP_EXP1'
        IMPORTING
          head              = sapscript_head
        TABLES
          line              = sapscript_lines
        EXCEPTIONS
          no_docu_on_screen = 1
          no_docu_self_def  = 2
          no_docu_temp      = 3
          ret_code          = 4
          others            = 5.
      if sy-subrc <> 0.
        text = space.
      endif.
      formatted_text = cl_wd_formatted_text=>create_from_sapscript(
        sapscript_head  = sapscript_head
        sapscript_lines = sapscript_lines
      " set it into the context
      if Not ( formatted_text is initial ).
        wd_context->set_attribute(
        name  = 'FORMATTED'
        value = formatted_text->m_xml_text ).
      endif.
    clear sapscript_head.
    clear sapscript_lines.
    *Get the text created by SO10
    CALL FUNCTION 'READ_TEXT_INLINE'
      EXPORTING
        ID                    = 'ST'
        INLINE_COUNT          = 1
        LANGUAGE              = 'E' "English language
        NAME                  = '85XX_FOOTER'
        OBJECT                = 'TEXT'
      LOCAL_CAT             = ' '
    IMPORTING
       HEADER                = sapscript_head
      TABLES
        INLINES               = sapscript_lines1
        LINES                 = sapscript_lines
    EXCEPTIONS
      ID                    = 1
      LANGUAGE              = 2
      NAME                  = 3
      NOT_FOUND             = 4
      OBJECT                = 5
      REFERENCE_CHECK       = 6
      OTHERS                = 7
      formatted_text = cl_wd_formatted_text=>create_from_sapscript(
        sapscript_head  = sapscript_head
        sapscript_lines = sapscript_lines
      " set it into the context
      if Not ( formatted_text is initial ).
        wd_context->set_attribute(
        name  = 'FORMATTED1'
        value = formatted_text->m_xml_text ).
      endif.

  • Creating a PO Using BAPI For Multiple PLants Or Multiple Line Items

    Hi All
        Can you please suggest me how to create a Purchase Order Using BAPI_PO_Create1 for Multiple Plants Or for Multiple Line items. The Requirement is like the PO is for single material for single vendor but for mulple stores i.e plants
    NOte:  Suggest me the  Creation of PO for MUltiple Line items or for multiple plants Using BAPI . Hope you people will give me the needful.
    Regards
    Shivakumar Bandari

    Hi,
    Here is the sample code to do that...
    *---> po header data
      wa_poheader-vendor    =  your vendor..
      wa_poheader-doc_type  =  Your doc type..check with Functional contact....
      wa_poheader-purch_org =  Purchasing Org..
      wa_poheader-pur_group =  Purchasing Group
    *---> po header data (change toolbar)
      wa_poheaderx-vendor    =  'X'.
      wa_poheaderx-doc_type  =  'X'.
      wa_poheaderx-purch_org =  'X'.
      wa_poheaderx-pur_group =  'X'.
    *---> poitem data
    data: item like ekpo-ebelp.
    item = '0010'.
    loop at t_parts.
      it_poitem-po_item  =  '00010'.
      IT_POITEM-PLANT    =  Plant..
      IT_POITEM-STGE_LOC =  Sloc...
    *---> poitemx (item data change toolbar)
      it_poitemx-po_item  =  '0010'.
      it_poitemx-po_itemx  =  'X'.
      IT_POITEMX-PLANT    =  'X'.
      IT_POITEMX-STGE_LOC =  'X'.
    *---> add record's to internal table
      APPEND:  it_poitem,
             it_poitemx.
    endloop.
    *call bapi_po_create1
      CLEAR v_ebeln.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader         = wa_poheader
          poheaderx        = wa_poheaderx
        IMPORTING
          exppurchaseorder = v_ebeln
        TABLES
          return           = it_return
          poitem           = it_poitem
          poitemx          = it_poitemx.
    *---> check the return table for error message
      READ TABLE it_return WITH KEY type = 'E'.
      IF sy-subrc NE 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.
      endif.
    Thanks,
    Murali

  • Pls help me to create SO using BDC for multiple line items (VA01)

    Hi all,
    My requirement is to create SO for multiple line items in ECC6.0
    My recording for VA01 is like this.
    start-of-selection.
    perform open_group.
    perform bdc_dynpro      using 'SAPMV45A' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAK-AUART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBAK-AUART'
                                  'ZOR'.
    perform bdc_field       using 'VBAK-VKORG'
                                  '2000'.
    perform bdc_field       using 'VBAK-VTWEG'
                                  '10'.
    perform bdc_field       using 'VBAK-SPART'
                                  '05'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-WERKS(01)'.
    perform bdc_field       using 'RV45A-MABNR(01)'
                                  'hrpocf'.
    perform bdc_field       using 'VBAP-POSNR(01)'
                                  '    10'.
    perform bdc_field       using 'RV45A-KWMENG(01)'
                                  '                 55'.
    perform bdc_field       using 'VBAP-WERKS(01)'
                                  '2010'.
    perform bdc_dynpro      using 'SAPLCEI0' '0109'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RCTMS-MWERT(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RCTMS-MNAME(01)'
                                  'A_THICK_MM'.
    perform bdc_field       using 'RCTMS-MNAME(02)'
                                  'A_WIDTH_MM'.
    perform bdc_field       using 'RCTMS-MNAME(03)'
                                  'A_EQUIVALENT_SPEC'.
    perform bdc_field       using 'RCTMS-MNAME(04)'
                                  'A_BATCH_WEIGHT_MAX_SI'.
    perform bdc_field       using 'RCTMS-MNAME(05)'
                                  'A_BATCH_WEIGHT_MIN_SI'.
    perform bdc_field       using 'RCTMS-MNAME(06)'
                                  'A_COIL_INNER_DIA_MM'.
    perform bdc_field       using 'RCTMS-MWERT(01)'
                                  '3.2'.
    perform bdc_field       using 'RCTMS-MWERT(02)'
                                  '1200'.
    perform bdc_field       using 'RCTMS-MWERT(03)'
                                  'IS_11513_GR_D_1985'.
    perform bdc_field       using 'RCTMS-MWERT(04)'
                                  '26.4'.
    perform bdc_field       using 'RCTMS-MWERT(05)'
                                  '26.4'.
    perform bdc_field       using 'RCTMS-MWERT(06)'
                                  '610'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-WERKS(02)'.
    perform bdc_field       using 'RV45A-MABNR(02)'
                                  'hrpocf'.
    perform bdc_field       using 'VBAP-POSNR(02)'
                                  '    11'.
    perform bdc_field       using 'RV45A-KWMENG(02)'
                                  '                 66'.
    perform bdc_field       using 'VBAP-WERKS(02)'
                                  '2010'.
    perform bdc_dynpro      using 'SAPLCEI0' '0109'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RCTMS-MWERT(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'RCTMS-MNAME(01)'
                                  'A_THICK_MM'.
    perform bdc_field       using 'RCTMS-MNAME(02)'
                                  'A_WIDTH_MM'.
    perform bdc_field       using 'RCTMS-MNAME(03)'
                                  'A_EQUIVALENT_SPEC'.
    perform bdc_field       using 'RCTMS-MNAME(04)'
                                  'A_BATCH_WEIGHT_MAX_SI'.
    perform bdc_field       using 'RCTMS-MNAME(05)'
                                  'A_BATCH_WEIGHT_MIN_SI'.
    perform bdc_field       using 'RCTMS-MNAME(06)'
                                  'A_COIL_INNER_DIA_MM'.
    perform bdc_field       using 'RCTMS-MWERT(01)'
                                  '3.1'.
    perform bdc_field       using 'RCTMS-MWERT(02)'
                                  '1250'.
    perform bdc_field       using 'RCTMS-MWERT(03)'
                                  'IS_11513_GR_D_1985'.
    perform bdc_field       using 'RCTMS-MWERT(04)'
                                  '20.084'.
    perform bdc_field       using 'RCTMS-MWERT(05)'
                                  '20.084'.
    perform bdc_field       using 'RCTMS-MWERT(06)'
                                  '610'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PDE3'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(01)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(01)'
                                  'X'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-TAXM1'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM2'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM3'
                                  '0'.
    perform bdc_field       using 'VBAP-TAXM4'
                                  '0'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'FDGFDG'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\10'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-POSEX_E'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '000005'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PDE3'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSNR(02)'.
    perform bdc_field       using 'RV45A-VBAP_SELKZ(02)'
                                  'X'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-TAXM1'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM2'
                                  '1'.
    perform bdc_field       using 'VBAP-TAXM3'
                                  '0'.
    perform bdc_field       using 'VBAP-TAXM4'
                                  '0'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'GFGFDG'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\10'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-POSEX_E'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '000005'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAP-POSEX'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAP-POSEX'
                                  '108128'.
    perform bdc_field       using 'VBKD-BSTKD_E'
                                  '3011192'.
    perform bdc_field       using 'VBKD-POSEX_E'
                                  '5'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=KKAU'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai east'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\02'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-KONDA'.
    perform bdc_field       using 'VBAK-AUDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAK-VKBUR'
                                  'IN15'.
    perform bdc_field       using 'VBAK-WAERK'
                                  'INR'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-KDGRP'
                                  'CF'.
    perform bdc_field       using 'VBKD-PLTYP'
                                  '01'.
    perform bdc_field       using 'VBKD-KONDA'
                                  '01'.
    perform bdc_field       using 'VBKD-BZIRK'
                                  'NORTH'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\03'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-VSART'.
    perform bdc_field       using 'VBAK-VSBED'
                                  '01'.
    perform bdc_field       using 'VBKD-KZAZU'
                                  'X'.
    perform bdc_field       using 'VBKD-VSART'
                                  'ER'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\05'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-INCO2'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'VBKD-FKDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBAK-TAXK1'
                                  '1'.
    perform bdc_field       using 'VBAK-TAXK3'
                                  'l'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\09'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-ZLSCH'.
    perform bdc_field       using 'VBKD-KTGRD'
                                  '01'.
    perform bdc_field       using 'VBKD-ZLSCH'
                                  'c'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DELETE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_CREATE'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TP_DETAIL'.
    perform bdc_field       using 'LV70T-SPRAS'
                                  'EN'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'BDFBFDB'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\11'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=KSTC'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(02)'.
    perform bdc_field       using 'J_STMAINT-ANWS(01)'
    perform bdc_field       using 'J_STMAINT-ANWS(02)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(03)'.
    perform bdc_field       using 'J_STMAINT-ANWS(02)'
    perform bdc_field       using 'J_STMAINT-ANWS(03)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_STMAINT-ANWS(04)'.
    perform bdc_field       using 'J_STMAINT-ANWS(03)'
    perform bdc_field       using 'J_STMAINT-ANWS(04)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLBSVA' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'JOSTD-OBJNR'.
    perform bdc_dynpro      using 'SAPMV45A' '4002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-TXT_VBELN'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    perform bdc_field       using 'VBKD-BSTKD'
                                  'open SO'.
    perform bdc_field       using 'VBKD-BSTDK'
                                  '29.01.2008'.
    perform bdc_field       using 'KUAGV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'KUWEV-KUNNR'
                                  '100000'.
    perform bdc_field       using 'RV45A-KETDAT'
                                  '29.01.2008'.
    perform bdc_field       using 'RV45A-KPRGBZ'
                                  'D'.
    perform bdc_field       using 'VBKD-PRSDT'
                                  '29.01.2008'.
    perform bdc_field       using 'VBKD-INCO1'
                                  'EXW'.
    perform bdc_field       using 'VBKD-INCO2'
                                  'mumbai'.
    perform bdc_field       using 'VBKD-ZTERM'
                                  '0001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    perform bdc_transaction using 'VA01'.
    perform close_group.
    if in excel file one row of records means i am succesfully creating SO.
    But for multiple i am not getting idea to create SO.
    My excel file details like this.In this excel file based on VBKD-BSTKD_E value i have to keep the records in line items.
    VBAK-AUART    :Order Type
    VBAK-VKORG    : Sales Org
    VBAK-VTWEG    : Distri Channel
    VBAK-SPART    : Division
    VBAK-KUNNR    : Sold-to-Party
    VBPA-KUNNAR   : Ship-to-Party
    VBAK-BSTNK    : PO No
    VBAK-BSTDK    : PO Date
    VBAP-MATNR    : Material No
    A_THICK_MM
    A_WIDTH_MM
    A_EQUIVALENT_SPEC
    A_COIL_INNER_DIA_MM
    A_BATCH_WEIGHT_MIN_SI
    A_BATCH_WEIGHT_MAX_SI
    VBAP-KWMENG    : Qty
    VBAP-WERKS     : Delivery Plant
    VBKD-INCO2     : Incoterm2
    VBKD-KONDA     : Price Group
    VBKD-VSART     : Shipping Type
    VBAK-TAXK1     : Cust Tax-1
    VBAK-TAXK2     : Cust Tax-2
    VBAK-TAXK3     : Cust Tax-3
    VBAK-TAXK4     : Cust Tax-4
    VBKD-ZLSCH     : Payment Method
    VBAP-TAXM1     : Mat tax clss-1
    VBAP-TAXM2     : Mat tax clss-2
    VBAP-TAXM3     : Mat tax clss-3
    VBAP-TAXM4     : Mat tax clss-4
    VBAP-POSEX     : IMPS Order No
    VBKD-BSTKD_E   : old SO in 4.6c
    VBKD-POSEX_E   : old SO Item  in 4.6c
    Text Id        : TDC No
    Text Id-ES10   : Special Inst(Unld const & Veh)
    ZOR,2000,10,5,100000,100000,PO NO 125,19.01.2008,HRPOCF,3.1,1200,IS_11513_GR_D_1985,610,20.084,20.084
    51,2010,Mumbai,01Freight-pre paid,ER,2,0,L,0,c,1,1,0,0,108128,3011192,     1,PO 444 AMD 1,Spl Inst
    based on VBKD-BSTKD_E line items has to create.
    if VBKD-BSTKD_E = 3011192 is like 4 records in excel means for these 4 should be one SO
    if it is changed to 3011193 then only different SO.
    PLs If any one knows solution pls write some sample code for me.
    If u send that code to my mail id also  very thankful.
    Pls help me this is urgent requirement.
    [email protected]
    Thanks & Regards,
    J.Lokesh

    If u want to add Items data, u have to handle the Table control by writing the complete code.
    U have to write code for 2 items, when u press enter u will get new row to enter new record one by one.
    Narendra

  • Creation of Blanket PO having Multiple Line items using Bapi_po_create1

    Hi
    How to create a Blanket Purchase ordetrs using Bapi BAPI_PO_CREATE1. The PO has multiple line items.
    Regards
    Lakshman

    Maybe this will help:
    [blanket purchase order (MM)|http://help.sap.com/saphelp_srm30/helpdata/en/35/26c019afab52b9e10000009b38f974/content.htm]
    Rob

  • Error trying to use multiple lines from a PO in a Goods Receipt PO

    I get the following error when I try to add 2 lines from a PO to a single Goods Receipt PO (code below):
    -5002 One of the base documents has already been closed  [PDN1.BaseEntry][line: 1]
    I can create the Goods Receipt PO if I use 1 line or lines from multiple PO's???
                   SAPbobsCOM.Documents poReceipt2 = (SAPbobsCOM.Documents)_diApi.SboCompany.GetBusinessObject(BoObjectTypes.oPurchaseDeliveryNotes);
                   poReceipt2.CardCode = "ALL";
                   poReceipt2.DocDueDate = DateTime.Now;
                   poReceipt2.Lines.Quantity = 5;
                   poReceipt2.Lines.ItemCode = "HAMSHA";
                   poReceipt2.Lines.BaseEntry = 11;
                   poReceipt2.Lines.BaseLine = 0;
                   poReceipt2.Lines.BaseType = 22;
                   poReceipt2.Lines.Add();
                   poReceipt2.Lines.Quantity = 5;
                   poReceipt2.Lines.ItemCode = "LAMFIL";
                   poReceipt2.Lines.BaseEntry = 11;
                   poReceipt2.Lines.BaseLine = 1;
                   poReceipt2.Lines.BaseType = 22;
                   poReceipt2.Add();
    Any help is appreciated!
    Thanks,
    Daniel

    Hi Louis, thanks for the post...
    However the PO document that I am refercing definately has both lines open, if I use 1 of those lines it works fine, but the error occurs if I use 2 lines from the same PO.  I am also definately using the docentry not the docnum for the GetByKey() method.
    Can anyone run the same basic logic through the DI API?  That is create a PO with 2 lines on it, then run the code as above to make a Goods Receipt PO and reference the 2 lines from the 1 PO document?  (It works if I add multiple lines referncing lines from multiple PO docs??)
    Thanks,
    Dan
    Message was edited by: Daniel Archer

  • Using ME57 to create an RFQ from multiple lines on multiple PRs

    When using ME57 to create RFQs how can I select multiple line items from multiple purchase requisitions to turn into a single RFQ. If I select multiple lines and then use 'RFQ with Vendor', it only selects one line item.  After further research it appears that you can only create only line at a time (very time consuming). 
    If you use ME41 and create with reference to PR then you can not sort or filter columns to allow for easy consolidation.
    Another forum recommended the following when using ME57 which works but it again adds extra steps to the process.
         The whole process is as follows -
         1) When you are in the 'Assign and Process Purchase Requisition' screen, select related PR and then click on 'Without Vendor' icon to flag all PRs for RFQ processing.
         2) Select these PRs again and click further on 'Assignment Overview' icon (Shift and F5). The next screen will appear - Assign and Process requisitions - Overview of Assignments screen.
         3) Select the 'PReq' column and then click further on 'Process Assignment' icon (F2). The next screen will appear where you have to maintain the 'quotation deadline' information.
         4) Then click on 'Continue' icon (enter).
    [http://www.sapfans.com/forums/viewtopic.php?f=6&t=198768]
    So is there any way to either 1) enable sorting of data in ME41 or 2) use ME57 to create one RFQ from multiple line items of multiple purchase requisitions when selecting 'RFQ with Vendor'.

    What is the JPEG specs? What are the specs of the project you're working in?

  • How to insert multiple line items in fv60 using bdc.

    Hi all,
          How to insert multiple line items in fv60 using bdcs

    hi
    chk this
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : V_EBELP(30) , V_MENGE(30) , V_WERKS(30), V_EMATN(30) ,
    V_PEINH(30).
    DATA : FILE TYPE STRING, V_MSG(100) , V_IND(2) TYPE N , FLAG VALUE 'X'.
    PARAMETERS: P_FILE(50) TYPE C DEFAULT 'C:\ME21_TEST'.
    DATA : BEGIN OF ITAB OCCURS 0,
            IND(02),
            LIFNR_001(010),
    data element: BSART
            BSART_002(004),
    data element: BEDAT
    data element: EKORG
            EKORG_004(004),
            EKGRP_006(003),
    data element: LPEIN
            LPEIN_005(001),
    data element: EMATNR
            EMATN_01_007(018),
    data element: EWERK
            WERKS_01_008(004),
    data element: EPEIN
            PEINH_01_009(006),
    data element: EWERK
           MENGE_01_013(017),
    data element: AUFEP
            EBELP_014(005),
    data element: AUFEP
         END OF ITAB.
    START-OF-SELECTION.
    FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FILE
        FILETYPE                      = 'ASC'
        HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = ITAB
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    SORT ITAB BY IND.
    START-OF-SELECTION.
    LOOP AT ITAB.
    REFRESH IT_MESSAGES.
    <b>V_IND = V_IND + 1.</b>
    <b>AT NEW IND.</b>
    <b>READ TABLE ITAB INDEX SY-TABIX.</b>
    PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0100'.
    PERFORM BDC_FIELD       USING 'EKKO-LIFNR'
                                  ITAB-LIFNR_001.
    PERFORM BDC_FIELD       USING 'RM06E-BSART'
                                  ITAB-BSART_002.
    *perform bdc_field       using 'RM06E-BEDAT'
                                 ITAB-BEDAT_003.
    PERFORM BDC_FIELD       USING 'EKKO-EKORG'
                                  ITAB-EKORG_004.
    PERFORM BDC_FIELD       USING 'RM06E-LPEIN'
                                  ITAB-LPEIN_005.
    PERFORM BDC_FIELD       USING 'EKKO-EKGRP'
                                  ITAB-EKGRP_006.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    ENDAT.
    <b>PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
    CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN.
    PERFORM BDC_FIELD       USING  V_EMATN
                                   ITAB-EMATN_01_007.
    CONCATENATE 'EKPO-WERKS(' V_IND ')' INTO V_WERKS.
    PERFORM BDC_FIELD       USING  V_WERKS
                                   ITAB-WERKS_01_008.
    CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH.
    PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
    PERFORM BDC_FIELD       USING  V_PEINH
                                   ITAB-PEINH_01_009.
    *CONCATENATE 'EKPO-MENGE(' V_IND ')' INTO V_MENGE.
    *perform bdc_dynpro      using 'SAPMM06E' '0120'.
    *perform bdc_field       using  V_MENGE
                                  ITAB-MENGE_01_013.
    *CONCATENATE 'EKPO-EBELP(' V_IND ')' INTO V_EBELP.
    PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
    PERFORM BDC_FIELD       USING  'RM06E-EBELP'
                                   ITAB-EBELP_014.</b>PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    AT END OF IND.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=BU'.
    ENDAT.
    CALL TRANSACTION 'ME21' USING IT_BDCDATA MODE 'A'
                                             UPDATE 'S'
                                        MESSAGES INTO IT_MESSAGES.
       LOOP AT IT_MESSAGES WHERE MSGTYP = 'E' OR MSGTYP = 'A'.
         IF FLAG = 'X'.
         CALL FUNCTION 'BDC_OPEN_GROUP'
         EXPORTING
            CLIENT                    = SY-MANDT
           DEST                      = FILLER8
            GROUP                     = 'GAMY_FAILURE'
           HOLDDATE                  = FILLER8
            KEEP                      = 'X'
            USER                      = SY-UNAME
           RECORD                    = FILLER1
           PROG                      = SY-CPROG
         IMPORTING
           QID                       =
          EXCEPTIONS
            CLIENT_INVALID            = 1
            DESTINATION_INVALID       = 2
            GROUP_INVALID             = 3
            GROUP_IS_LOCKED           = 4
            HOLDDATE_INVALID          = 5
            INTERNAL_ERROR            = 6
            QUEUE_ERROR               = 7
            RUNNING                   = 8
            SYSTEM_LOCK_ERROR         = 9
            USER_INVALID              = 10
            OTHERS                    = 11
         IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         CLEAR FLAG.
         ENDIF.
         CALL FUNCTION 'BDC_INSERT'
          EXPORTING
            TCODE                  = 'ME21'
           POST_LOCAL             = NOVBLOCAL
           PRINTING               = NOPRINT
           SIMUBATCH              = ' '
           CTUPARAMS              = ' '
           TABLES
             DYNPROTAB              = IT_BDCDATA
          EXCEPTIONS
            INTERNAL_ERROR         = 1
            NOT_OPEN               = 2
            QUEUE_ERROR            = 3
            TCODE_INVALID          = 4
            PRINTING_INVALID       = 5
            POSTING_INVALID        = 6
            OTHERS                 = 7
         IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
        ENDIF.
    CALL FUNCTION 'FORMAT_MESSAGE'
      EXPORTING
        ID              = IT_MESSAGES-MSGID
        LANG            = 'EN'
        NO              = IT_MESSAGES-MSGNR
        V1              = IT_MESSAGES-MSGV1
        V2              = IT_MESSAGES-MSGV2
        V3              = IT_MESSAGES-MSGV3
        V4              = IT_MESSAGES-MSGV4
      IMPORTING
        MSG             = V_MSG
      EXCEPTIONS
        NOT_FOUND       = 1
        OTHERS          = 2
       WRITE : / V_MSG.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDLOOP.
       ENDLOOP.
    IF FLAG NE 'X'.
      CALL FUNCTION 'BDC_CLOSE_GROUP'
       EXCEPTIONS
         NOT_OPEN          = 1
         QUEUE_ERROR       = 2
         OTHERS            = 3
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ENDIF.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-PROGRAM  = PROGRAM.
      IT_BDCDATA-DYNPRO   = DYNPRO.
      IT_BDCDATA-DYNBEGIN = 'X'.
      APPEND IT_BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
        CLEAR IT_BDCDATA.
        IT_BDCDATA-FNAM = FNAM.
        IT_BDCDATA-FVAL = FVAL.
        APPEND IT_BDCDATA.

  • Reading Multiple lines in a file Using File Adapter

    Hi All,
    Iam new to this technology.How to read multiple lines in a file using file adapter.Brief me with the methodology.

    I didn't look at anything else but if you want to write more than one line ever to your file you should change this
    out = new FileOutputStream("Calculation.log");to this...
    out = new FileOutputStream("Calculation.log",true);A quick look at the API reveals the follow constructor FileOutputStream(File file, boolean append) append means should I add on the end of the file or over-write what is there.
    By default you over-write. So in our case we say true instead which says add on to what is there.
    At the end of that little snippet you shoudl be closing that stream as well.
    So where you have
    p.close();You should have
    p.close();
    out.close();

  • The issue with using the multiple columns sub-query in WHERE clause

    Hi All,
    my database version is 10.2.
    the problem i am trying to deal with is that when I use multiple column sub-query in the WHERE clause of the SELECT statement, the actual row number returned from the sub-query is different from the whole statement.
    And what I found is that, whenever there is NULL in any of those columns returned from the SUB-QUERY, the outer query will just return NULL for that whole row.
    Here is an example:
    select empno, ename, job, mgr, hiredate, sal, deptno from EMP
    intersect
    select empno, ename, job,  mgr, hiredate, sal, deptno from t;
    7782     CLARK     MANAGER     7839     09-JUN-81     2450     10
    7839     KING     PRESIDENT  NULL  17-NOV-81     5000     10
    7934     MILLER     CLERK     7782     23-JAN-82     1300     10
    select * from EMP where (EMPNO, ENAME, job, MGR, HIREDATE, SAL, DEPTNO) in (
    select empno, ename, job, mgr, hiredate, sal, deptno from EMP
    intersect
    select empno, ename, job,  mgr, hiredate, sal, deptno from t);
    7782     CLARK     MANAGER     7839     09-JUN-81     2450          10     
    7934     MILLER     CLERK     7782     23-JAN-82     1300          10     If I specifically deal with the NULL situations for the columns which might return NULL, I can get the result right.
    select * from EMP where (EMPNO, ENAME, job, NVL(MGR,-1), HIREDATE, SAL, DEPTNO) in (
    select empno, ename, job, nvl(mgr,-1), hiredate, sal, deptno from EMP
    intersect
    select empno, ename, job,  nvl(mgr,-1), hiredate, sal, deptno from t);
    7782     CLARK     MANAGER     7839     09-JUN-81     2450          10     
    7839     KING     PRESIDENT  null   17-NOV-81     5000          10     
    7934     MILLER     CLERK     7782     23-JAN-82     1300          10     the problem is that, I feel this is a very lame way of handling it.
    So, I wonder or am asking if there is any better or standard way to do it?
    any help would be highly appreciated.
    Thanks

    Hi,
    As you discovered, INTERSECT treats NULL as a value, but IN does not.
    What you did with NVL is one way to handle the situation. If there was a chance that any of the columns could be NULL, then you might prefer something like this:
    select      *
    from      EMP
    where      ( EMPNO      || '~' ||
           ENAME      || '~' ||
           job           || '~' ||
           MGR           || '~' ||
           TO_CHAR (HIREDATE, 'DD-MON-YYYY HH24:MI:SS')
                    || '~' ||
           SAL           || '~' ||
           DEPTNO
         ) in (
              select  EMPNO      || '~' ||
                     ENAME      || '~' ||
                   job     || '~' ||
                   MGR     || '~' ||
                   TO_CHAR (HIREDATE, 'DD-MON-YYYY HH24:MI:SS')               
                        || '~' ||
                   SAL      || '~' ||
                   DEPTNO
              from     emp
             intersect
              select  EMPNO      || '~' ||
                     ENAME      || '~' ||
                   job     || '~' ||
                   MGR     || '~' ||
                   TO_CHAR (HIREDATE, 'DD-MON-YYYY HH24:MI:SS')               
                        || '~' ||
                   SAL      || '~' ||
                   DEPTNO
              from      t
             );This assumes that you can identify some string (I used '~') that never occurs in the strings in these tables.
    This is implicitly converting the NUMBERs. That's usually not a good thing to do. but explicitly converting them would make this even more tedious.
    You should explicitly convert any DATEs to strings, however. Depending on your default format, and your data, you might get away with implicit conversions even for DATEs, but don't bet on it.
    If you had to do this often, you might consider writing a user-defined function:
    delimited_string (empno, ename, job, mgr, hiredate, sal, deptno) would return a string like
    '7839~KING~PRESIDENT~~17-NOV-1981~5000~10'
    This will make the coding easier, but beware: it will make the execution slower.

  • How to read multiple lines using 'REUSE_ALV_GRID_DISPLAY'

    Hi,
    In ALV report the FM 'REUSE_ALV_GRID_DISPLAY' used.
    EXPORTING
    I_CALLBACK_PROGRAM = W_REPID
    I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    How to read multiple lines in the following dynamic subroutine ?
    I am able to read single value through p_selfld.
    Nut the requirement is to change the values in more than 1 row for a fld (edit mode)
    FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
    P_SELFLD TYPE SLIS_SELFIELD.
    endform
    Thanks in advance

    You can get the reference by a dirty assign, but this is not offcially supported...
    But if you have some limitations.
    FORM user_command  USING fuw_ucomm LIKE sy-ucomm
                                       fuw_selfield TYPE slis_selfield.
      FIELD-SYMBOLS: <lfs_grid>  type ref to cl_gui_alv_grid,
                                   <lfs_row> type LVC_S_ROW.
      data: li_rows type lvc_t_row.
          assign ('(SAPLSLVC_FULLSCREEN)GT_GRID-GRID') to <lfs_grid>.
          check sy-subrc is initial.
          call method <lfs_grid>->get_selected_rows
            IMPORTING
              et_index_rows = li_rows.
    endform.                    "user_command

  • Create a Multiple-Line JButton Without Using HTML format

    I used html format for multiple-line JButton and it took a long time to load that button up (about 5 seconds more). Does anyone know how to create a multiple-line JButton without using html?
    Any suggestion or sample code will be appreciated.
    javamesser

    Hello,
    You could try using the following:
    -give your button some layout (e.g.: BoxLayout.Y_AXIS, or BorderLayout).
    -create the wrapped text in separate JLabels (one line in each label)
    -add your labels to the button
    Advantage:
    this solution does not affect the laf classes
    Disadvantage:
    focus rectangle is not calculated accurately
    Regards,
    G

  • Need multiple lines in single column of header using alv oops

    Hi
    I am using alv oops in a report.
    I need multiple lines in single column of header.   
    In header of my report i am using 9 columns.
    In the second column i need to split the line
    Notification description/activity/work/activity long text/
    as
    Notification description/
    activity/
    work/
    activity long text/
    Please guide me to achieve this functionality.

    It is not possible to break the column description in the ALV  disply.
    Actually, if you have a longer description in one of the seltext_* field of the fiels catalog, it will automatically display it as a tooltip, if you put the mouse over the heading. In ALV OO, you can explicitly set the tooltip text.
    Also you can get more help on the field pressing F1: If you use DDIC fields, it it automatic, otherwise you can do it as you like.

Maybe you are looking for

  • ABAP CLASSICAL REPORT

    Hi to all,              Can u please send me your analyzation about the report given below why because i cant understand it.  Please send me your analyzation and how to develop this report. Service Request Title:     Custom SAP Report for MS Get Well

  • Trouble updating my AirPort Extreme firmware.

    I purchased my AirPort Extreme in 2009. It has been functioning fine. Just yesterday, none of the remote devices in our house could access the WiFi. I called our Internet provider (Charter) and they said it was probably an issue with needing to updat

  • Is there a template where I can cut and paste several photos into one?

    I am looking for a template where I can cut and paste from several different photos and make one collage. Can you help me find thius within the Photoshop program ?

  • Why can't we block tracking cookies?

    Mac MINI late 2012 OSX 10.0.5 i7 2.3ghz, 4g ram 1t hdd I have been trying to keep tracking cookies off due to the fact that aggressive anti malware programs don't do well in Mac. Safari help pages here say that if you reset Safari, all is erased. WRO

  • Need some help with method for calendar

    Hi all, I've got to design a claendar for college but I'm not allowed use any one the Java calendar classes so I've but up a number of methods to get the start days of months etc. At the moment I'm trying to get a method working tha will loop around