Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all 8332 articles
Browse latest View live

Data Types

$
0
0

Hi All ,

 

Please can you  resolev my query ..I am using DEC data type like... DEC(23.53) so  can you tel me how much  memory space occupied in bytes .

I try to searched it but I am not able to get it.

 

Plz help me

Thanks

Suraj


Output SE38 SA38

$
0
0

Hello experts,

 

I built an SE38 program which allows to display some results to end users.

 

I gived them access to transcation to SA38 to display the results without having access to the program code.

The issue is that the management isn't OK to give transaction SA38 access to all the end users.

 

Is there any other options like creating a specfic transaction or other option to allow the users execute this program and display the results?

 

FYI, before executing the program, the users have to fill some parameters in selection screen as following.

 

Sans titre.png

 

Thanks.

 

Amine

Length and Visibility Columns are grayed out in SAP

$
0
0

Hi All,

 

Length and Visibility Columns are grayed out in SAP.

 

Can someone please help making those columns editable?.

 

Best Regards

Arthur

How do you implement BAPI_PO_CREATE then BAPI_GOODSMVT_CREATE?

$
0
0

Hello experts,

 

Please give me a sample code to use the BAPI_PO_CREATE with BOM materials then use the PO number in BAPI_GOODSMVT_CREATE.

I always get the error of no selectable items in the PO. Must be my implementation of BAPI_PO_CREATE that is causing the error? Please help me.

I want to convert following BDC code Into BAPI,What i have to do for it?

$
0
0

*&---------------------------------------------------------------------*
*& Report  ZMAP_UPDATE_SALESSET
*&
*&---------------------------------------------------------------------*
*& Report Name : ZMAP_UPDATE_SALESSET                                 *
*& Program Type : Executable Program                                   *
*& Program Description : Update MAP for Sales Sets                     *
*& Functional Area : MM                                                *
*& Functional    : Kirit Mehta                                         *
*& Package :  ZSCM                                                     *
*& T-Code  :  ZMAPUPDATE                                                         *
*& Created by : Ritesh Parikh                                          *
*& Created on :  12.10.2011                                            *
*& Request No. : SRDK908813                                            *
*&*&-------------------------------------------------------------------*

REPORT  zmap_update_salesset.

*---------- Data Declaration---------------*

TYPE-POOLS : sscr.

TABLES: mbew,t001w,t100,mara,marc.


TYPES : BEGIN OF ty_mara,
         matnr TYPE mara-matnr,
         ersda TYPE mara-ersda,
         ernam TYPE mara-ernam,
         matkl TYPE mara-matkl,
         attyp TYPE mara-attyp,
         END OF ty_mara.

DATA : it_mara TYPE TABLE OF ty_mara.
DATA : wa_mara LIKE LINE OF it_mara.


TYPES : BEGIN OF ty_marc,
         matnr TYPE mara-matnr,
         werks TYPE marc-werks,
         END OF ty_marc.

DATA : it_marc TYPE TABLE OF ty_marc.
DATA : wa_marc LIKE LINE OF it_marc.

DATA : it_mara_final TYPE TABLE OF ty_marc.
DATA : wa_mara_final LIKE LINE OF it_mara_final.

TYPES : BEGIN OF ty_mast,
         matnr TYPE mast-matnr,
         stlnr TYPE mast-stlnr,
         END OF ty_mast.

DATA : it_mast TYPE TABLE OF ty_mast.
DATA : wa_mast LIKE LINE OF it_mast.

TYPES : BEGIN OF ty_stpo,
         stlnr TYPE stpo-stlnr,
         idnrk TYPE stpo-idnrk,
         menge TYPE stpo-menge,
         END OF ty_stpo.

DATA : it_stpo TYPE TABLE OF ty_stpo.
DATA : wa_stpo LIKE LINE OF it_stpo.


TYPES : BEGIN OF ty_mbew,
         matnr TYPE mbew-matnr,
         verpr TYPE mbew-verpr,
         END OF ty_mbew.

DATA : it_mbew TYPE TABLE OF ty_mbew.
DATA : wa_mbew LIKE LINE OF it_mbew.

TYPES : BEGIN OF ty_mbew_p,
         matnr TYPE mbew-matnr,
         lbkum TYPE mbew-lbkum,
         END OF ty_mbew_p.

DATA : it_mbew_p TYPE TABLE OF ty_mbew_p.
DATA : wa_mbew_p LIKE LINE OF it_mbew_p.



TYPES : BEGIN OF ty_final,
         smatnr  TYPE mast-matnr,
         verpr   TYPE mbew-verpr,
         menge   TYPE stpo-menge,
         valpr  TYPE valpr,
         END OF ty_final.

DATA : it_final TYPE HASHED TABLE OF ty_final
                WITH UNIQUE KEY smatnr.
DATA : wa_final LIKE LINE OF it_final.


DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA: tamount TYPE mbew-verpr.
DATA: v_cnt(2) TYPE n.
DATA: msg_str  TYPE string.


DATA : gs_restriction TYPE sscr_restrict.  "Select Option Restrict
DATA : gs_opt_list TYPE sscr_opt_list.
DATA : gs_*** TYPE sscr_***.

RANGES :  r_stlty          FOR stpo-stlty,
           r_stlkn          FOR stpo-stlkn,
           r_stpoz          FOR stpo-stpoz.

DATA : st_ctu_params LIKE ctu_params .

*-----------------------------------------------------------------------
*                       Selection Screen                               *
*-----------------------------------------------------------------------

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR mara-matnr.

PARAMETERS :    p_werks TYPE marc-werks OBLIGATORY.

SELECT-OPTIONS: s_matkl FOR mara-matkl OBLIGATORY,
                 s_ersda FOR mara-ersda,
                 s_ernam FOR mara-ernam.
SELECTION-SCREEN : END OF BLOCK b1.
*---------------------------------------------------------------------*

*---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_mode TYPE   ctu_params-dismode DEFAULT 'N'.
SELECTION-SCREEN : END OF BLOCK b2.

*---------------------------------------------------------------------*
*                End of Selection Screen                              *
*---------------------------------------------------------------------*



*---------------------------------------------------------------------*
*                Start-of-Selection                                   *
*---------------------------------------------------------------------*

START-OF-SELECTION.

   IF sy-batch = 'X'.
     v_cnt = '09'.
   ELSE.
     v_cnt = '09'.
   ENDIF.

   PERFORM get_data.

   IF NOT it_final[] IS INITIAL.

     PERFORM update_map.

   ENDIF.

END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_data .

*--------- Article details from MARA Table----------*


   IF NOT s_matnr[] IS INITIAL.
     SELECT matnr ersda ernam matkl attyp FROM mara
       INTO TABLE it_mara
            WHERE matnr IN s_matnr.
   ELSE.
     SELECT matnr ersda ernam matkl attyp FROM mara
        INTO TABLE it_mara
             WHERE matkl IN s_matkl AND
                   attyp EQ '10'.
   ENDIF.

   DELETE it_mara WHERE ersda NOT IN s_ersda.
   DELETE it_mara WHERE ernam NOT IN s_ernam.

   SORT : it_mara BY matnr.
   IF NOT it_mara[] IS INITIAL.

*---------Listed Article base on Site Code------------*

     SELECT matnr werks FROM marc
       INTO TABLE it_marc
         FOR ALL ENTRIES IN it_mara
          WHERE matnr = it_mara-matnr AND
                werks = p_werks.

     FREE : it_mara.
     SORT : it_marc BY matnr.
     it_mara_final[] = it_marc[].

*----------------------------------------------------------*

     SORT : it_mara_final BY matnr.
     IF NOT it_mara_final[] IS INITIAL.

*---- Fetching BOM Number Details from MAST Table------*

       SELECT matnr stlnr FROM mast
           INTO TABLE it_mast
             FOR ALL ENTRIES IN it_mara_final
               WHERE matnr = it_mara_final-matnr   AND
                     werks = ''                    AND
                     stlan = '5'.

       SORT : it_mast BY stlnr.
       IF NOT it_mast[] IS INITIAL .

*-------- Component code and quantity-------------------*

         SELECT stlnr idnrk menge FROM stpo
           INTO TABLE it_stpo
             FOR ALL ENTRIES IN it_mast
               WHERE stlty IN r_stlty AND
                     stlnr = it_mast-stlnr AND
                     stlkn IN r_stlkn AND
                     stpoz IN r_stpoz.

       ENDIF.

       SORT : it_stpo BY idnrk.
       IF NOT it_stpo[] IS  INITIAL.

*-------Moving Avg Price of Component Article-------------*

         SELECT matnr verpr FROM mbew
           INTO TABLE it_mbew
            FOR ALL ENTRIES IN it_stpo
             WHERE matnr = it_stpo-idnrk
                   AND bwkey = p_werks.

*-- Validation for  Stock check for sales set article & MAP check for component article--*

         SELECT matnr lbkum FROM mbew
           INTO TABLE it_mbew_p
            FOR ALL ENTRIES IN it_mara_final
             WHERE matnr = it_mara_final-matnr
                   AND bwkey = p_werks.

         DELETE it_mbew_p WHERE lbkum NE '0'.

         SORT : it_mara_final BY matnr.
         LOOP AT  it_mara_final INTO wa_mara_final.
           READ TABLE it_mbew_p INTO wa_mbew_p WITH KEY matnr = wa_mara_final-matnr BINARY SEARCH.
           IF sy-subrc <> 0.
             CONCATENATE  wa_mara_final-matnr
                         'Sales set article is not updated due to stock is available in sales set article for site' p_werks
                          INTO msg_str SEPARATED BY space.
             WRITE : / msg_str.
             CLEAR : msg_str.
             CONTINUE.
           ENDIF.
           CLEAR : wa_mara_final,wa_mbew_p.
         ENDLOOP.

       ENDIF.

     ENDIF.

*------------------CONSOLIDATED DATA -----------------------*

     SORT : it_mbew BY matnr.
     SORT : it_mast BY stlnr.
     SORT : it_mbew_p BY matnr.
     LOOP AT it_stpo INTO wa_stpo.

       CLEAR : wa_final,wa_mbew,wa_mast.

       READ TABLE it_mast INTO wa_mast WITH KEY stlnr = wa_stpo-stlnr BINARY SEARCH.
       IF sy-subrc = 0.
         wa_final-smatnr = wa_mast-matnr.
       ENDIF.
       READ TABLE it_mbew_p INTO wa_mbew_p WITH KEY matnr = wa_mast-matnr BINARY SEARCH.
       IF sy-subrc <> 0.
         CONTINUE.
       ENDIF.

       READ TABLE it_mbew INTO wa_mbew WITH KEY matnr = wa_stpo-idnrk BINARY SEARCH.
       IF sy-subrc = 0.
         IF wa_mbew-verpr = '0'.
           CONCATENATE  wa_mast-matnr 'Sales set article is not updated due to component' wa_mbew-matnr
                        'MAP is zero for site' p_werks
                        INTO msg_str SEPARATED BY space.
           WRITE : / msg_str.
           CLEAR : msg_str.
           CONTINUE.
         ENDIF.

         wa_final-verpr   = wa_mbew-verpr.
         wa_final-menge   = wa_stpo-menge.
         wa_final-valpr  = wa_mbew-verpr * wa_stpo-menge.
         COLLECT wa_final INTO it_final.
       ENDIF.

     ENDLOOP.

     SORT : it_final BY smatnr.

   ELSE.

     WRITE :/ 'No Data Found'(006) COLOR 6.

   ENDIF.

ENDFORM.                    " GET_DATA
*&---------------------------------------------------------------------*
*&      Form  UPDATE_MAP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM update_map .

   DATA: l_date(10) TYPE c.
   DATA: p_date TYPE sy-datum.
   DATA: cnt(2) TYPE n.
   DATA: l_str TYPE string.
   DATA: l_valpr(12) TYPE c.

   p_date = sy-datum.
   CONCATENATE p_date+6(2) '.' p_date+4(2) '.' p_date+0(4) INTO l_date.




   PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
   PERFORM bdc_field       USING 'MR21HEAD-BUDAT'
                                  l_date.
   PERFORM bdc_field       USING 'MR21HEAD-BUKRS'
                                     ' '.
   PERFORM bdc_field       USING 'MR21HEAD-WERKS'
                                  p_werks.
   PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.

   PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
   PERFORM bdc_field       USING 'MR21HEAD-SCREEN_VARIANT'
                                  'MR21_LAGERMATERIAL_0250'.





   LOOP AT it_final INTO wa_final.

     cnt = cnt + 1.

     CONCATENATE 'CKI_MR21_0250-MATNR(' cnt ')' INTO l_str.
     PERFORM bdc_field       USING l_str
                                   wa_final-smatnr.

     CLEAR : l_str.

     CONCATENATE 'CKI_MR21_0250-NEWVALPR(' cnt ')' INTO l_str.
     l_valpr = wa_final-valpr.
     PERFORM bdc_field       USING l_str
                                   l_valpr.

     CLEAR : l_str.


     IF cnt = v_cnt.
       PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ENTR'.

       PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
       PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=DOWN'.

       PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
       cnt = '01'.
     ENDIF.

     CLEAR : wa_final.
   ENDLOOP.

   PERFORM bdc_field       USING 'BDC_OKCODE'
                                   '=ENTR'.

   PERFORM bdc_dynpro      USING 'SAPRCKM_MR21' '0201'.
   PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=SAVE'.

   PERFORM bdc_transaction USING 'MR21'.


ENDFORM.                    " UPDATE_MAP
*&---------------------------------------------------------------------*
*&      Form  BDC_DYNPRO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0778   text
*      -->P_0779   text
*----------------------------------------------------------------------*
FORM bdc_dynpro  USING    program dynpro  .
   CLEAR bdcdata.
   bdcdata-program  = program.
   bdcdata-dynpro   = dynpro.
   bdcdata-dynbegin = 'X'.
   APPEND bdcdata.
   CLEAR bdcdata.
ENDFORM.                    " bdc_dynpro


*&---------------------------------------------------------------------*
*&      Form  bdc_field
*&---------------------------------------------------------------------*
FORM bdc_field  USING    fnam fval.
   CLEAR bdcdata.
   bdcdata-fnam = fnam.
   bdcdata-fval = fval.
   APPEND bdcdata.
   CLEAR bdcdata.
ENDFORM.                    " bdc_field
*&---------------------------------------------------------------------*
*&      Form  BDC_TRANSACTION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0860   text
*----------------------------------------------------------------------*
FORM bdc_transaction  USING tcode.

   DATA: l_mstring(480).
   DATA: l_subrc LIKE sy-subrc.
   st_ctu_params-nobinpt = 'X' .
   st_ctu_params-dismode = p_mode.
   st_ctu_params-defsize = 'X'.

   CALL TRANSACTION tcode USING bdcdata
                           OPTIONS FROM
                        st_ctu_params
                          MESSAGES INTO messtab.

   LOOP AT messtab WHERE ( msgtyp = 'S' OR msgtyp = 'E' ).
     SELECT SINGLE * FROM t100 WHERE sprsl = 'EN'
                               AND   arbgb = messtab-msgid
                               AND   msgnr = messtab-msgnr.
     IF sy-subrc = 0.
       l_mstring = t100-text.
       IF l_mstring CS '&1'.
         REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.
         REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.
         REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.
         REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.
       ELSE.
         REPLACE '&' WITH messtab-msgv1 INTO l_mstring.
         REPLACE '&' WITH messtab-msgv2 INTO l_mstring.
         REPLACE '&' WITH messtab-msgv3 INTO l_mstring.
         REPLACE '&' WITH messtab-msgv4 INTO l_mstring.
       ENDIF.
       CONDENSE l_mstring.
       WRITE: /  l_mstring(250).
     ELSE.
       WRITE: / messtab.
     ENDIF.
   ENDLOOP.

   REFRESH: bdcdata,messtab.
   CLEAR bdcdata.

ENDFORM.                    " BDC_TRANSACTION

BAPI_SALESORDER_SIMULATE doesn't return data when used in my own FM

$
0
0

I've written this code to get schedule line data from the BAPI_SALESORDER_SIMULATE. Normally this data is returned in the table ORDER_SCHEDULE_EX.

When I test the BAPI in SE37 it gives the expected result, but when I use it in my function module the table doesn't contain any data.

 

 

DATA:  doc_type TYPE AUART,

         req_qty TYPE WMENGC,

         partn_role TYPE PARVW,

         partn_numb TYPE KUNNR.

   DATA: itab_order_head_in type TABLE OF BAPISDHEAD,

         wa_order_head_in type BAPISDHEAD,

         itab_order_items_in TYPE TABLE OF BAPIITEMIN,

         wa_order_items_in TYPE BAPIITEMIN,

         itab_order_partners TYPE TABLE OF BAPIPARTNR,

         wa_order_partners TYPE BAPIPARTNR,

         itab_sched_ex TYPE STANDARD TABLE OF BAPISDHEDU,

         wa_sched_ex type BAPISDHEDU,

         wa_atp TYPE ZMOB_ATP,

         itab_incomp type TABLE OF BAPIINCOMP,

         wa_incomp TYPE BAPIINCOMP.

 

   doc_type = 'OR'.

   wa_order_head_in-doc_type = doc_type.

*  INSERT wa_order_head_in INTO TABLE itab_order_head_in.

 

   wa_order_items_in-material = P_MATNR.

   wa_order_items_in-plant = P_PLANT.

*  wa_order_items_in-store_loc = P_SLOC.

   req_qty = 999999.

   wa_order_items_in-req_qty = req_qty.

   wa_order_items_in-req_date = P_DATE.

   INSERT wa_order_items_in INTO TABLE itab_order_items_in.

 

   partn_role = 'SP'.

   wa_order_partners-partn_role = partn_role.

   partn_numb = 1.

   wa_order_partners-partn_numb = partn_numb.

   INSERT wa_order_partners INTO TABLE itab_order_partners.

 

 

   CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'

     EXPORTING

       ORDER_HEADER_IN     = wa_order_head_in

*     CONVERT_PARVW_AUART = ' '

*    IMPORTING

*     SALESDOCUMENT       =

*      SOLD_TO_PARTY       =

*     SHIP_TO_PARTY       =

*     BILLING_PARTY       =

*     RETURN              =

     TABLES

       ORDER_ITEMS_IN      = itab_order_items_in

       ORDER_PARTNERS      = itab_order_partners

*     ORDER_SCHEDULE_IN   =

*     ORDER_ITEMS_OUT     =

*     ORDER_CFGS_REF      =

*     ORDER_CFGS_INST     =

*     ORDER_CFGS_PART_OF  =

*     ORDER_CFGS_VALUE    =

*     ORDER_CFGS_BLOB     =

*     ORDER_CCARD         =

*     ORDER_CCARD_EX      =

       ORDER_SCHEDULE_EX   = itab_sched_ex

*     ORDER_CONDITION_EX  =

*      ORDER_INCOMPLETE    = itab_incomp

*     MESSAGETABLE        =

*     EXTENSIONIN         =

*     PARTNERADDRESSES    =

 

   LOOP AT itab_sched_ex INTO wa_sched_ex.

     wa_atp-matnr = P_MATNR.

     wa_atp-plant = P_PLANT.

*    wa_atp-store_loc = P_SLOC.

     wa_atp-req_qty = wa_sched_ex-req_qty.

     wa_atp-date1 = wa_sched_ex-req_date.

     wa_atp-confir_qty1 = wa_sched_ex-confir_qty.

   ENDLOOP.

 

 

ENDFUNCTION.

 

 

When I loop trough itab_sched_ex (which shoul contain the schedule line data), it's empty. As I said before, when testing BAPI_SALESORDER_SIMULATE it in se37 (with the same paramters), it works perfectly.

 

Does somebody have an idea? I would really appreciate your help.

 

Thanks!

Issue with the field COBRB-KONTY?

$
0
0

Hi All,

 

I have a requirement to create settlement rule for the cost center with values ,

COBRB-KONTY = CTR.

COBRB-PROZS = 100.

COBRB-EXTNR  = 1.

COBRB-PERBZ  = PER.

 

Here i am facing issue with the field KONTY. It is having length CHAR2 in database level.

But i have to pass the CTR value having 3 characters in length .

 

Anyway screen field is COBRB-KONTY only , taking only two characters 'CT'.

 

I have discussed with functional owner regarding this, and he suggested to check with table TO0B1.

In that table i can see the field OBART_LD having these object type values like CTR , WBS and so on.

 

 

 

Now, How can i use the field TO0B1-OBART_LD in my requirement to update the field COBRB-KONTY.?

 

Please help me.

 

 

 

Thanks

Siva

pass dynamic table to adobe.

$
0
0

Hi Experts,

 

I need to pass an internal table which have dynamic count of columns to pdf interface to print the table data in pdf.

the columns of internal table depends on the selection year which is input.

 

say for example : 

when A is my input  : my internal table may have "X" no. of columns . like c1, c2,... cx, as columns

and when  B is given : my internal table may have  "Y" no. of columns . like c1,c2,.. cy, as columns

 

after loading this internal table with data, i need to pass it to adobe application, to have a print output. As it should be passed to the function module of adobe interface. How the same internal table is declared there and handled there.?

 

please help me in declaring this internal table and printing the same in adobe.

your help will be greatly rewarded and appreciated .

 

Thanks ,

Srinivas.


the file is damaged and could not be repaired when smartforms convert to pdf

$
0
0

i m using your code but error is occur

please  help me


when i goto sost and open my pdf file at that time give error message untitled.JPG

 

my whole program is below

 

report  ypayment_advice2.

tables : bsak,skat.


types : begin of t_bsak,
       belnr type bsak-belnr,
       gjahr type bsak-gjahr,
       augbl type bsak-augbl,
       augdt type bsak-augdt,
       xblnr type bsak-xblnr,
       bldat type bsak-bldat,
*      DMBTR TYPE BSAK-DMBTR,
*      WAERS TYPE BSAK-WAERS,
       lifnr type bsak-lifnr,
       saknr type bsak-saknr,
       budat type bsak-budat,
*      EBELN TYPE BSAK-EBELN,
*      EBELP TYPE BSAK-EBELP,
       bukrs type bsak-bukrs,
       buzei type bsak-buzei,
*
       ebeln type bseg-ebeln,
       ebelp type bseg-ebelp,
       hkont type bseg-hkont,
       shkzg type bseg-shkzg,
       werks type bseg-werks,
       dmbtr type bseg-dmbtr,
       bldat1 type bsak-bldat,
       xblnr1 type bsak-xblnr,

end of t_bsak.
types : begin of t_bseg,
         belnr type bseg-belnr,
         gjahr type bseg-gjahr,
         ebeln type bseg-ebeln,
         ebelp type bseg-ebelp,
         hkont type bseg-hkont,
         shkzg type bseg-shkzg,
         werks type bseg-werks,
         dmbtr type bseg-dmbtr,

end of t_bseg.

types : begin of t_bseg2,
         belnr type bseg-belnr,
         gjahr type bseg-gjahr,
         ebeln type bseg-ebeln,
         ebelp type bseg-ebelp,
         werks type bseg-werks,
  end of  t_bseg2.

types : begin of t_bseg1,
         augbl type bseg-augbl,
         gjahr type bseg-gjahr,
         hkont type bseg-hkont,
end of t_bseg1.


types : begin of t_bkpf,
         bukrs type bkpf-bukrs,
         cpudt type bkpf-cpudt,
         blart type bkpf-blart,
         usnam type bkpf-usnam,
         budat type bkpf-budat,
end of t_bkpf.
types : begin of t_bsak1,
         lifnr type bsak-lifnr,
end of t_bsak1.
*DATA : IT_FINAL TYPE STANDARD TABLE OF T_FINAL WITH HEADER LINE.
*DATA : WA_FINAL TYPE T_FINAL.

data : wrk_answer type c.
data : it_bsak type standard table of t_bsak.
data : wa_bsak type t_bsak.

data : it_bsak_temp type standard table of t_bsak1 with header line,
        wa_bsak_temp type      t_bsak1.

data : it_bsak_temp1 type standard table of t_bsak1 with header line,
        wa_bsak_temp1 type      t_bsak1.

data : it_bsak1 type standard table of t_bsak.
data : wa_bsak1 type t_bsak.

data : it_bseg type standard table of t_bseg.
data : wa_bseg type t_bseg.

data : it_bseg1 type standard table of t_bseg1.
data : wa_bseg1 type t_bseg1.

data : it_bseg2 type standard table of t_bseg2.
data : wa_bseg2 type t_bseg2.


data : it_bkpf type standard table of t_bkpf.
data : wa_bkpf type t_bkpf.

data : l_cntr type i value 1.
data : op type ssfcompop.
data : control type ssfctrlop.

data: formname1  type  tdsfname," value 'YPAYMENT_ADVICE',
       fm_name    type  rs38l_fnam.

data : i_smtp_addr type adr6-smtp_addr,
          i_adrnr     type lfa1-adrnr.

data: gd_recsize type i.
*
data : it_tsp01 type standard table of tsp01 with header line .
data : it_pdf like tline occurs 0 with header line .

data : gd_buffer type string.
data: gd_spool_nr like tsp01-rqident,
       gd_destination like rlgrap-filename,
       gd_bytecount like tst01-dsize.

data: gd_subject   like sodocchgi1-obj_descr,
      it_mess_bod like solisti1 occurs 0 with header line,
      it_mess_att like solisti1 occurs 0 with header line,
      gd_sender_type     like soextreci1-adr_typ,
      gd_attachment_desc type so_obj_nam,
      gd_attachment_name type so_obj_des.

data : w_emailid type adr6-smtp_addr.

*  JOB RUNTIME PARAMETERS
data: gd_eventid like tbtcm-eventid,
     gd_eventparm like tbtcm-eventparm,
     gd_external_program_active like tbtcm-xpgactive,
     gd_jobcount like tbtcm-jobcount,
     gd_jobname like tbtcm-jobname,
     gd_stepcount like tbtcm-stepcount,
     gd_error    type sy-subrc,
     gd_reciever type sy-subrc.
*
data: t_otfdata type soli_tab,
       t_otfdata_item type soli_tab,
       t_objhex type solix_tab,
       t_objhead type soli_tab,
       w_transfer type sx_boolean,
       w_length type sood-objlen,
       w_length_item type sood-objlen,
       w_lines_txt type i,
       w_lines_bin type i,
       wa_soli type soli,
       wa_solix type solix,
       w_doc_chng type sodocchgi1,
       t_objcont type standard table of soli with header line,
       t_objcont_item type standard table of soli with header line,
       t_objpack like sopcklsti1 occurs 0 with header line,
       t_reclist like somlreci1 occurs 0 with header line,
       t_objtxt like solisti1 occurs 0 with header line.

data : ls_control type ssfctrlop,
        ls_output  type ssfcrescl,
        ls_output_opt type ssfcompop,
        lt_lines  type table of tline,
        lt_linesx  type table of tdline.


data : lv_pdf type xstring,
        lv_filelen type i,
        lv_file type string.

*
selection-screen begin of block b1 with frame title text-001.
select-options : p_lifnr for bsak-lifnr.
select-options : p_augbl for bsak-augbl obligatory,
                  p_year for bsak-gjahr obligatory.
*                 P_BUDAT FOR BSAK-BUDAT.

selection-screen end of block b1.


start-of-selection.

   perform get_data.
   perform process_data .
   perform call_smartforms.
*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form get_data .

   select augbl  gjahr budat xblnr
     from bsak
     into corresponding fields of table it_bsak1
     where augbl in p_augbl
       and gjahr in p_year
       and blart = 'KZ'
       and lifnr  in p_lifnr.

   if sy-subrc <> 0.
     message 'No Record Found ' type 'E'.
   endif.


   select augbl augdt belnr gjahr xblnr
            dmbtr lifnr saknr budat bukrs buzei
         from bsak
       into corresponding fields of table it_bsak
       for all entries in it_bsak1
       where augbl = it_bsak1-augbl
         and augdt = it_bsak1-budat
         and blart = 'RE'.
*    FOR ALL ENTRIES IN IT_BSAK
*    WHERE AUGBL = '1500000011' "IT_BSAK-AUGBL
*      AND GJAHR = '2013' "IT_BSAK-GJAHR
*      AND BLART = 'RE'.

   select belnr gjahr shkzg dmbtr koart
      from bseg
      into corresponding fields of table it_bseg
      for all entries in it_bsak
      where belnr = it_bsak-belnr
        and gjahr = it_bsak-gjahr
        and koart = 'K'.
*       AND BUKRS = IT_BSAK-BUKRS.
*       AND BUZEI = IT_BSAK-BUZEI.

   select belnr gjahr hkont
    from bseg
    into corresponding fields of table it_bseg1
       for all entries in it_bsak1
       where belnr = it_bsak1-augbl
         and gjahr = it_bsak1-gjahr
         and koart = 'S'.

   select  belnr gjahr ebeln ebelp werks
     from bseg
     into corresponding fields of table it_bseg2
        for all entries in it_bseg
        where belnr = it_bseg-belnr
          and gjahr = it_bseg-gjahr
          and buzid = 'W'.

*  BREAK ABAP.

   select bukrs cpudt blart usnam budat
     from bkpf
     into corresponding fields of table it_bkpf
     for all entries in it_bsak
     where belnr = it_bsak-belnr
       and gjahr = it_bsak-gjahr.
*      AND BUKRS = IT_BSAK-BUKRS
*      .
   loop at it_bsak into wa_bsak.
     read table it_bseg into wa_bseg with key belnr = wa_bsak-belnr
                                              gjahr = wa_bsak-gjahr.
     if sy-subrc = 0.
       move wa_bseg-shkzg to wa_bsak-shkzg.
       move wa_bseg-dmbtr to wa_bsak-dmbtr.
       modify it_bsak from  wa_bsak transporting shkzg dmbtr.
     endif.
     read table it_bseg2 into wa_bseg2 with key belnr = wa_bsak-belnr
                                                gjahr = wa_bsak-gjahr.
     if sy-subrc = 0.
       move wa_bseg2-ebeln to wa_bsak-ebeln.
       move wa_bseg2-ebelp to wa_bsak-ebelp.
       move wa_bseg2-werks to wa_bsak-werks.
       modify it_bsak from  wa_bsak transporting ebeln ebelp werks .
     endif.

     read table it_bseg1 into wa_bseg1 with key gjahr = wa_bsak-gjahr.
     if sy-subrc = 0.
       move wa_bseg1-hkont to wa_bsak-hkont.
       modify it_bsak from  wa_bsak transporting hkont where gjahr = wa_bsak-gjahr.
     endif.

     read table it_bsak1 into wa_bsak1 with key augbl = wa_bsak-augbl
                                                gjahr = wa_bsak-gjahr.
     if sy-subrc = 0.
       move wa_bsak1-bldat to wa_bsak-bldat1.
       move wa_bsak1-xblnr to wa_bsak-xblnr1.
       modify it_bsak from  wa_bsak transporting bldat1 xblnr1 where augbl = wa_bsak-augbl
                                                                and  gjahr = wa_bsak-gjahr.
     endif.
   endloop.

   loop at it_bsak into wa_bsak.
     move wa_bsak-lifnr to wa_bsak_temp-lifnr.
     append wa_bsak_temp to it_bsak_temp  .
   endloop.

   loop  at it_bsak_temp into wa_bsak_temp.
     collect wa_bsak_temp into it_bsak_temp1.
   endloop.


endform.                    " GET_DATA
*&---------------------------------------------------------------------*
*&      Form  PROCESS_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form process_data .

   export it_bsak to memory id 'IT_BSAK'.
   export it_bseg to memory id 'IT_BSEG'.
   export it_bkpf to memory id 'IT_BKPF'.
*  BREAK ABAP.
endform.                    " PROCESS_DATA
*&---------------------------------------------------------------------*
*&      Form  CALL_SMARTFORMS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form call_smartforms .
*  LOOP AT IT_BSAK_TEMP.
   call function 'SSF_FUNCTION_MODULE_NAME'
     exporting
       formname = 'YPAYMENT_ADVICE1'
     importing
       fm_name  = fm_name.



*    CALL FUNCTION FM_NAME"'/1BCDWB/SF00000442'
*      EXPORTING
*         P_LIFNR                   = IT_BSAK_TEMP-LIFNR.


   call function fm_name"'/1BCDWB/SF00000442'
     exporting
         it_bsak                    = it_bsak
         it_bseg                    = it_bseg
         it_bkpf                    = it_bkpf.

   clear wrk_answer.
*  BREAK ABAP.
   call function 'POPUP_TO_CONFIRM'
     exporting
     titlebar                    = 'LOGOFF'
*           DIAGNOSE_OBJECT         = ' '
       text_question             = 'Do You Want Send Mail?'
      text_button_1              = 'YES'
*           ICON_BUTTON_1           = ' '
      text_button_2              = 'NO'
      display_cancel_button      = space
      start_column               = 25
      start_row                  = 6
    importing
      answer                     = wrk_answer
*         TABLES
*           PARAMETER               =
    exceptions
      text_not_found             = 1
      others                     = 2
             .
   if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   endif.
*Mail send coding


   check wrk_answer = '1'.


   loop at it_bsak_temp1 into wa_bsak_temp1.
     break abap.

     select single adrnr from lfa1
         into i_adrnr where lifnr = wa_bsak_temp1-lifnr.

     select single smtp_addr from adr6
     into w_emailid
     where addrnumber = i_adrnr.
     if w_emailid is not initial.
       perform mail.
     else.
       message 'E-Mail Address is not maintained for Vendor' type 'S'.
     endif.

   endloop.



endform.                    " CALL_SMARTFORMS
*&---------------------------------------------------------------------*
*&      Form  SEND_EMAIL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_P_EMAIL1  text
*----------------------------------------------------------------------*
form send_email  using    p_email.
   check not ( p_email is initial ).

   refresh it_mess_bod.
*BREAK-POINT.
*   DEFAULT SUBJECT MATTER
   gd_subject         = 'SUBJECT'.
   gd_attachment_desc = 'Invoice  '.
*    CONCATENATE 'ATTACH_NAME' ' ' INTO GD_ATTACHMENT_NAME.
   it_mess_bod        = 'Hi,'.
   append it_mess_bod.
   it_mess_bod = 'Kindly Find an attached copy of Sale Invoice : '.
   concatenate it_mess_bod p_lifnr into it_mess_bod separated by space.
   append it_mess_bod.
   it_mess_bod        = 'This is system generated Mail,So do not reply.'
   .
   append it_mess_bod.
   it_mess_bod        = 'Thank you,'.
   append it_mess_bod.
   it_mess_bod        = 'Gokul Refoils & Solvent Ltd.'.
   append it_mess_bod.
   data : p_sender type somlreci1-receiver.

   p_sender = 'abc@abc.com'
*   IF NO SENDER SPECIFIED - DEFAULT BLANK
   if p_sender eq space.
     gd_sender_type  = space.
   else.
     gd_sender_type  = 'INT'.
   endif.

*   SEND FILE BY EMAIL AS .XLS SPEADSHEET
   perform send_file_as_email_attachment
                                tables it_mess_bod
                                       it_mess_att
                                 using p_email
'Narendra CHECK Invoice-Gokul Refoils & Solvent Ltd.'
*'Sale Invoice .pdf document attached'
                                       'PDF'
                                       gd_attachment_name
                                       gd_attachment_desc
                                       p_sender
                                       gd_sender_type
                              changing gd_error
                                       gd_reciever.
endform.                    " SEND_EMAIL
*&---------------------------------------------------------------------*
*  &      FORM  SEND_FILE_AS_EMAIL_ATTACHMENT
*&---------------------------------------------------------------------*
*         TEXT
*----------------------------------------------------------------------*
*        -->P_IT_MESS_BOD  TEXT
*        -->P_IT_MESS_ATT  TEXT
*        -->P_P_EMAIL  TEXT
*        -->P_1395   TEXT
*        -->P_1396   TEXT
*        -->P_GD_ATTACHMENT_NAME  TEXT
*        -->P_GD_ATTACHMENT_DESC  TEXT
*        -->P_P_SENDER  TEXT
*        -->P_GD_SENDER_TYPE  TEXT
*        <--P_GD_ERROR  TEXT
*        <--P_GD_RECIEVER  TEXT
*----------------------------------------------------------------------*
form send_file_as_email_attachment  tables   it_message
                                             it_attach
                                    using    p_email
                                             p_mtitle
                                             p_format
                                             p_filename
                                             p_attdescription
                                             p_sender_address
                                             p_sender_addres_type
                                    changing perror
                                             p_reciever.
   data:ld_error    type sy-subrc,
       ld_reciever type sy-subrc,
       ld_mtitle like sodocchgi1-obj_descr,
       ld_email like  somlreci1-receiver,
       ld_format type  so_obj_tp ,
       ld_attdescription type  so_obj_nam ,
       ld_attfilename type  so_obj_des ,
       ld_sender_address like  soextreci1-receiver,
       ld_sender_address_type like  soextreci1-adr_typ,
       ld_receiver like  sy-subrc.

   data:   t_packing_list like sopcklsti1 occurs 0 with header line,
           t_contents like solisti1 occurs 0 with header line,
           t_receivers like somlreci1 occurs 0 with header line,
           t_receivers1 like somlreci1 occurs 0 with header line,
           t_attachment like solisti1 occurs 0 with header line,
           t_object_header like solisti1 occurs 0 with header line,
           w_cnt type i,
           w_sent_all(1) type c,
           w_doc_data like sodocchgi1.


   ld_email  = p_email.
   ld_mtitle = p_mtitle.
   ld_format = p_format.
   ld_attdescription = p_attdescription.
   ld_attfilename    = p_filename.
   ld_sender_address = p_sender_address.
   ld_sender_address_type = p_sender_addres_type.


*   FILL THE DOCUMENT DATA.
   w_doc_data-doc_size = 1.

*   POPULATE THE SUBJECT/GENERIC MESSAGE ATTRIBUTES
   w_doc_data-obj_langu = sy-langu.
   w_doc_data-obj_name  = 'SAPRPT'.
   w_doc_data-obj_descr = ld_mtitle .
   w_doc_data-sensitivty = 'F'.

*   FILL THE DOCUMENT DATA AND GET SIZE OF ATTACHMENT
*BREAK-POINT.
   clear w_doc_data.
   read table it_attach index w_cnt.
   w_doc_data-doc_size =
      ( w_cnt - 1 ) * 255 + strlen( it_attach ).
   w_doc_data-obj_langu  = sy-langu.
   w_doc_data-obj_name   = 'SAPRPT'.
   w_doc_data-obj_descr  = ld_mtitle.
   w_doc_data-sensitivty = 'F'.
   clear t_attachment.
   refresh t_attachment.
   t_attachment[] = it_attach[].

*   DESCRIBE THE BODY OF THE MESSAGE
   clear t_packing_list.
   refresh t_packing_list.
   t_packing_list-transf_bin = space.
   t_packing_list-head_start = 1.
   t_packing_list-head_num = 0.
   t_packing_list-body_start = 1.
   describe table it_message lines t_packing_list-body_num.
   t_packing_list-doc_type = 'RAW'.
   append t_packing_list.

*   CREATE ATTACHMENT NOTIFICATION
   t_packing_list-transf_bin = 'X'.
   t_packing_list-head_start = 1.
   t_packing_list-head_num   = 1.
   t_packing_list-body_start = 1.

   describe table t_attachment lines t_packing_list-body_num.
   t_packing_list-doc_type   ld_format.
   t_packing_list-obj_descr  ld_attdescription.
   t_packing_list-obj_name   ld_attfilename.
   t_packing_list-doc_size   t_packing_list-body_num * 255.
   append t_packing_list.

*   ADD THE RECIPIENTS EMAIL ADDRESS
   clear t_receivers.
   refresh t_receivers.

   t_receivers-receiver = w_emailid.
   t_receivers-rec_type = 'U'.
   t_receivers-com_type = 'INT'.
   t_receivers-notif_del = 'X'.
   t_receivers-notif_ndel = 'X'.
   append t_receivers.
***
**  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
**    EXPORTING
**      DOCUMENT_DATA              =  W_DOC_DATA
**      PUT_IN_OUTBOX              = 'X'
**      COMMIT_WORK                = 'X'
**    TABLES
**      PACKING_LIST               = T_PACKING_LIST
**      CONTENTS_BIN               = T_ATTACHMENT
**      CONTENTS_TXT               = IT_MESSAGE
**      RECEIVERS                  = T_RECEIVERS
**    EXCEPTIONS
**      TOO_MANY_RECEIVERS         = 1
**      DOCUMENT_NOT_SENT          = 2
**      DOCUMENT_TYPE_NOT_EXIST    = 3
**      OPERATION_NO_AUTHORIZATION = 4
**      PARAMETER_ERROR            = 5
**      X_ERROR                    = 6
**      ENQUEUE_ERROR              = 7
**      OTHERS                     = 8.
**
**  COMMIT WORK.
**
**  LOOP AT T_RECEIVERS.
**    LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
**  ENDLOOP.
**ENDFORM.                    "SEND_FILE_AS_EMAIL_ATTACHMENT


   call function 'SO_DOCUMENT_SEND_API1'
     exporting
       document_data              = w_doc_data
       put_in_outbox              = 'X'
       sender_address             = ld_sender_address
       sender_address_type        = ld_sender_address_type
       commit_work                = 'X'
     importing
       sent_to_all                = w_sent_all
     tables
       packing_list               = t_packing_list
       contents_bin               = t_attachment
       contents_txt               = it_message
       receivers                  = t_receivers
     exceptions
       too_many_receivers         = 1
       document_not_sent          = 2
       document_type_not_exist    = 3
       operation_no_authorization = 4
       parameter_error            = 5
       x_error                    = 6
       enqueue_error              = 7
       others                     = 8.

*   POPULATE ZERROR RETURN CODE
   ld_error = sy-subrc.

*   POPULATE ZRECEIVER RETURN CODE
   loop at t_receivers.
     ld_receiver = t_receivers-retrn_code.
   endloop.
endform.                    "SEND_FILE_AS_EMAIL_ATTACHMENT
*&---------------------------------------------------------------------*
*&      Form  MAIL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form mail .
   ls_control-no_dialog = 'X'.
   ls_control-getotf    = 'X'.
   break abap.

   call function 'SSF_FUNCTION_MODULE_NAME'
     exporting
       formname = 'YPAYMENT_ADVICE'
     importing
       fm_name  = fm_name.

*  CONTROL-NO_DIALOG = 'X'.
*  CONTROL-PREVIEW = ''.
*  OP-XSFOUTDEV = 'LOGI'.
*  OP-TDDEST = 'LOGI'.
*  OP-TDIMMED = 'X'.

   call function fm_name
     exporting
            control_parameters = ls_control
           p_lifnr             = wa_bsak_temp1-lifnr
          importing
            job_output_info    = ls_output
*         JOB_OUTPUT_OPTIONS =
          exceptions
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            others             = 5.
   if sy-subrc <> 0.
     message 'error at call funcation module' type 'E'.
   endif.
   call function 'CONVERT_OTF'
     exporting
       format                = 'PDF'
       max_linewidth         = 132
*      PDF_PREVIEW           = 'X'
     importing
       bin_filesize          = lv_filelen
       bin_file              = lv_pdf
     tables
       otf                   = ls_output-otfdata
       lines                 = lt_lines
     exceptions
       err_max_linewidth     = 1
       err_format            = 2
       err_conv_not_possible = 3
       err_bad_otf           = 4
       others                = 5.
   if sy-subrc <> 0.
     message 'error at convert otf to pdf funcation module' type 'E'.
   endif.

   clear lt_linesx.


   call function 'SCMS_XSTRING_TO_BINARY'
     exporting
       buffer                = lv_pdf
      append_to_table       = 'X'
* IMPORTING
*   OUTPUT_LENGTH         =
     tables
       binary_tab            = lt_linesx
             .

*  SELECT * FROM TSP01 INTO TABLE IT_TSP01
*              WHERE RQ2NAME = SY-UNAME .
*
*  SORT IT_TSP01 BY RQCRETIME DESCENDING .
*  READ TABLE IT_TSP01 INDEX 1.
*
*  CLEAR: IT_PDF,IT_PDF[].
*
*
*  CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
*    EXPORTING
*      SRC_SPOOLID              = IT_TSP01-RQIDENT
*      NO_DIALOG                = ' '
*    TABLES
*      PDF                      = IT_PDF
*    EXCEPTIONS
*      ERR_NO_OTF_SPOOLJOB      = 1
*      ERR_NO_SPOOLJOB          = 2
*      ERR_NO_PERMISSION        = 3
*      ERR_CONV_NOT_POSSIBLE    = 4
*      ERR_BAD_DSTDEVICE        = 5
*      USER_CANCELLED           = 6
*      ERR_SPOOLERROR           = 7
*      ERR_TEMSEERROR           = 8
*      ERR_BTCJOB_OPEN_FAILED   = 9
*      ERR_BTCJOB_SUBMIT_FAILED = 10
*      ERR_BTCJOB_CLOSE_FAILED  = 11.
*
*  CHECK SY-SUBRC = 0.
*
*  LOOP AT IT_PDF.
*    TRANSLATE IT_PDF USING ' ~'.
*    CONCATENATE GD_BUFFER IT_PDF INTO GD_BUFFER.
*  ENDLOOP.
*
*  TRANSLATE GD_BUFFER USING '~ '.
*  DO.
*    IT_MESS_ATT = GD_BUFFER.
*    APPEND IT_MESS_ATT.
*    SHIFT GD_BUFFER LEFT BY 255 PLACES.
*    IF GD_BUFFER IS INITIAL.
*      EXIT.
*    ENDIF.
*  ENDDO.
break abap.
*      RECIPIENT
   data : p_email1 type somlreci1-receiver.
   p_email1 = w_emailid.
*  DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
*  CHECK GD_RECSIZE > 0.

   perform send_email using p_email1.



endform.                    " MAIL

BAPI_PO_CHANGE change price of service

$
0
0

Hi,

 

I am trying to update the price of a service irem using BAPI_PO_CHANGE and BAPI_PO_GETDETAIL1. The issue im having is for multiple PO's for the first PO the price updates as expected but on the next loop pass for the second PO the BAPI_PO_CHANGE is returning error message ''Instance 4330000362 of object type purchase order could not be changed" and "Please specify a valid account assignment". If I run the program with this same PO ONLY, the same one that is failing on the second loop pass it updates the price as expected.

 

I compared the contents of the internal tables poitem, poitemx and i_services just before te call of bapi_po_change when I run the program with 1 PO (Result as expected) and when I run the program with 2 PO's. The contents of the internal tables for the same PO is the same its just returning errors on the second loop pass.

 

In other words. The input for the bapi is the same but the bapi returns errors when I run the program with more than one PO.

 

All the internal tables get cleared after the first loop pass so I dont think is a clear refresh issue. Below is my code, te issue is happening in the call of bapi below comment "* Call bapi to change the gross price." Please advice me on this.

 

     

FIELD-SYMBOLS: <fs_po>   LIKE LINE OF i_poitem,                   <fs_k_serv> LIKE LINE OF i_services.     

*   Get PO details    CALL FUNCTION 'BAPI_PO_GETDETAIL1'      EXPORTING        purchaseorder = pk_po-ebeln        services      = c_x      TABLES        return        = i_return        poitem        = i_poitem        poservices    = i_services.    SORT i_return BY type.    READ TABLE i_return INTO k_return WITH KEY type = c_e BINARY SEARCH.    IF sy-subrc <> 0.      LOOP AT i_poitem ASSIGNING <fs_po>.
*       If PO is locked clear deletion indicator to unlock it.        IF <fs_po>-delete_ind = c_l.          CLEAR  <fs_po>-delete_ind.        ENDIF.        k_poitemx-po_item = <fs_po>-po_item.        k_poitemx-delete_ind = c_x.        APPEND k_poitemx TO i_poitemx.        CLEAR  k_poitemx.      ENDLOOP.      UNASSIGN <fs_po>.      CLEAR i_return.
*     Unlock PO      CALL FUNCTION 'BAPI_PO_CHANGE'        EXPORTING          purchaseorder = pk_po-ebeln        TABLES          return        = i_return          poitem        = i_poitem          poitemx       = i_poitemx.      SORT i_return BY type.      READ TABLE i_return INTO k_return WITH KEY type = c_e BINARY SEARCH.      IF sy-subrc <> 0.
*       Commit changes to DB.        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'          EXPORTING            wait = c_x.
*           No sy-subrc check required.
*       Modify the gross price of the services        LOOP AT i_services ASSIGNING <fs_k_serv>.                     <fs_k_serv>-gr_price = pk_po-ucost.               
*          In order to set the price the deletion indicator must be cleared.          CLEAR <fs_k_serv>-delete_ind.                             ENDLOOP.        UNASSIGN <fs_k_serv>.                                       CLEAR i_return.
*       Call bapi to change the gross price.        CALL FUNCTION 'BAPI_PO_CHANGE'          EXPORTING            purchaseorder = pk_po-ebeln          TABLES            return        = i_return1                           "<----------- Error            poitem        = i_poitem            poitemx       = i_poitemx            poservices    = i_services.        SORT i_return1 BY type.        READ TABLE i_return1 INTO k_return1 WITH KEY type = c_s         BINARY SEARCH TRANSPORTING type message.                    IF sy-subrc = 0.
*         Commit changes to the DB.          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'            EXPORTING              wait = c_x.
*         No sy-subrc check required

.

 

Edited by: bodyboarder1 on Apr 15, 2011 9:48 PM

How to convert internal table data into excel format

$
0
0

Hi,

 

Can anyone tell me,how to convert internal table data into excel format,and zip that excel format to send automail to vendors.

 

Please help me.

 

 

 

Thanks

LT07 - please specify an internal number range.

$
0
0

Hi,

 

I am creating transfer order through tcode LT07.  But I get error "Please specify an internal number range".

 

I noticed that in Include "LSNR3F01"on line 144 there is below statement

 

call 'ThNoGet', there I m getting sy-subrc = 19.

 

I am not getting what is permanent solution for this?  means where to enter Actual internal number range. ??

 

Pls help.

 

Regards,

Fields Matching

$
0
0

Hi All,

 

i am facing some unexpected situation, please help me get out of these.

 

I have two fields of char type with length 60. what i have to do is i am matching the data of these two fields throug IF statement. although it is working fine but in some cases in which '&'(ampersand) sign is occuring the data is not getting matching it bypass the code under IF statement.

 

E.g. If in the internal table i am getting any record like 'Health & Safety' and in the selection screen i have put the same department 'Health & Safety' on the behalf of which the data would get retreive from internal table but for the cases like this i am getting desirable result.

 

Please help.......

Thanks in advance !!!!!!

 

Regards,

Deepak kansal.

Less records are displaying when using template in smartform

$
0
0

Hi,

 

When I use table in smartform, its showing correct number of records that is 34 but I have to use template and when I use it, it displays 24 records.

How come? Please check the following screenshot:

 

Untitled.jpg

 

 

 

Regards

Mani

Assign value to other variable's value.

$
0
0

Hello friends,

 

Here I'm getting stuck.

 

I have a variable LV_POSNR& at runtime LV_POSNR filled by some value suppose say 'VBAP-POSNR(01)'.

 

it means LV_POSNR has value 'VBAP-POSNR(01)'.

 

But here my requirement is I wants to assign some new value to VBAP-POSNR(01).

means suppose say VBAP-POSNR(01) = 00010.

 

So how can I assign value to other variable's value at runtime.

 

 

Regards,

Keyur.


Joining tables with two different field types.

$
0
0

How to join tables with two different field having diffrent character length and same values?

Line after every record in template in smartform

$
0
0

Hi,

 

I have created a smartform but using templates this time. The problem I am getting in template is how to get line after every record. I have already chosen framed pattern which I normally choose in tables and get the lined output.

 

Untitled.jpg

 

 

Regards

Mani

Customization of standard web dynpro

$
0
0

Hi,

 

     I am trying to copy the standard web dynpro component 'ERC_C_REQ_MGMT' into Z component.

There are some standard enhancements in ERC_C_REQ_MGMT which is not getting copied, because of which some dropdowns are not working.

I tried to copy the enhancement from SE19 but its not allowing. So how can we do that ??

 

Regards,

Abhishek.

ACK in ABAP PROXIES

$
0
0

Hi experts.

We are sending ABAP proxies from SAP to PI requesting tecnichal ACK. The thing is that the ACK message is created but it remains in error in PI so the ack status in SAP backend is never updated.

Is there any setting that must be done in PI in order to send the ACK to SAP Backend?

Thanks a lot.

Best regards.

Christian.

Input field still appears to be mandatory after Uncheck the checkbox

$
0
0

Hi Experts,

 

I have an user input field tied to a Checkbox, if the checkbox is checked, the input field becomes mandatory, this part works fine. Now before I enter any data to the input field, I unchecked the checkbox, I am expecting the input field become optional at this point, but it still appears to be mandatory after I unchecked the checkbox. Also I googled and searched SDN and can't find a solution.

 

Am I missing anything here?

Viewing all 8332 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>