Quantcast
Viewing all 10425 articles
Browse latest View live

BAPI_BATCH_SAVE_REPLICA with classification data

Hi,

I have 2 questions:

  1. how can i create batch using BAPI_BATCH_SAVE_REPLICA FM - from my point of view, problem is that batch number paramaeter is obligatory. so ho can i use it to create new batch?
  2. i trying to add classification data, but classification are not filled. It's my code:
    TYPES: BEGIN OF ty_batch,
               batch TYPE bapibatchkey-batch,
              END OF ty_batch.

       DATA: lv_batch      LIKE bapibatchkey-batch,
             lv_objectkey  TYPE objnum,

             lt_batch      TYPE STANDARD TABLE OF ty_batch,
             ls_batch      LIKE LINE OF lt_batch.

       DATA: ls_batchattributes        TYPE bapibatchatt,
             ls_batchattributesx       TYPE bapibatchattx,
             ls_batchstatus            TYPE bapibatchstatus,
             ls_batchstatusx           TYPE bapibatchstatusx,
             ls_batchcontrolfields     TYPE bapibatchctrl,
             ls_batchstoragelocation   TYPE lgort_d,
             ls_internalnumbercom      TYPE bapibncom,
             ls_extension1             TYPE bapibncomz,
             ls_material_evg           TYPE bapimgvmatnr,
             lt_return                 TYPE bapiret2_tab,
             lt_classallocations       TYPE bapi3060_allocations,
             lt_classvaluationschar    TYPE bapi3060_valuations_char,
             lt_classvaluationscurr    TYPE bapi3060_valuations_curr,
             lt_allocvaluescurrnew     TYPE STANDARD TABLE OF bapi1003_alloc_values_curr,
             lt_allocvaluesnumnew      TYPE STANDARD TABLE OF bapi1003_alloc_values_num,
             lt_classvaluationsnum     TYPE bapi3060_valuations_num,
             ls_classallocations       TYPE bapi3060_allocation,
             ls_classvaluationschar    TYPE bapi3060_valuation_char.


    * Fill BatchControlFields
         ls_batchcontrolfields-class_num  = 'MAT_GADZETY_BDN'.
         ls_batchcontrolfields-doclassify = 'X'.

    ** Fill BatchAttributes
    *  ls_batchattributes-vendor_no  = 'RoPo'.
    *  ls_batchattributes-vendrbatch = '1234'.
    *  ls_batchattributes-prod_date  = '19680624'.
    *  ls_batchattributes-expirydate = '20120101'.
    *
    *  ls_batchattributesx-vendor_no  = 'X'.
    *  ls_batchattributesx-vendrbatch = 'X'.
    *  ls_batchattributesx-prod_date  = 'X'.
    *  ls_batchattributesx-expirydate = 'X'.

    * Fill ClassAllocations
         ls_classallocations-class_type   = '023'.

         CONCATENATE zmm_newspaper_addon-matnr
    *    'BC01'
         ls_batch-batch INTO lv_objectkey.

    *    lv_objectkey = zmm_newspaper_addon-matnr.

         ls_classallocations-objectkey   = lv_objectkey.

         ls_classallocations-objecttable = 'MARA'.   " MCH1, MCHA, MARA or MCHB tables
         ls_classallocations-classnum    = 'MAT_GADZETY_BDN'.
         ls_classallocations-statuS      = '1'.
         APPEND ls_classallocations TO lt_classallocations.

    * Fill ClassValuationsChar
         ls_classvaluationschar-class_type    = '023'.
         ls_classvaluationschar-objectkey     = lv_objectkey.
         ls_classvaluationschar-objecttable   = 'MARA'.
         ls_classvaluationschar-charact       = 'PP_NAZWISKO'.
         ls_classvaluationschar-value_char    = 'XXXXX'.
    *    ls_classvaluationschar-inherited     = ' '.
    *    ls_classvaluationschar-instance      = '000'.
         ls_classvaluationschar-value_neutral = 'XXXX'.
    *    ls_classvaluationschar-charact_descr = 'Nazwisko'.
         APPEND ls_classvaluationschar TO lt_classvaluationschar.

         BREAK-POINT.

         CALL FUNCTION 'BAPI_BATCH_SAVE_REPLICA'
           EXPORTING
             material             = zmm_newspaper_addon-matnr
             batch                = ls_batch-batch
             plant                = 'BC01'
             batchattributes      = ls_batchattributes
             batchattributesx     = ls_batchattributesx
             batchstatus          = ls_batchstatus
             batchstatusx         = ls_batchstatusx
             batchcontrolfields   = ls_batchcontrolfields
             batchstoragelocation = ls_batchstoragelocation
             internalnumbercom    = ls_internalnumbercom
             extension1           = ls_extension1
             material_evg         = ls_material_evg
           TABLES
             return               = lt_return
             classallocations     = lt_classallocations
             classvaluationschar  = lt_classvaluationschar
             classvaluationscurr  = lt_classvaluationscurr
             classvaluationsnum   = lt_classvaluationsnum.

         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
           WAIT = 'X'.

where is a problem? why i can't create classification with values?


thanks


Re: Wrong Data:  BAPI_ACC_DOCUMENT_POST

Re: BAPI_BATCH_SAVE_REPLICA with classification data

problem 2 solved:

correct code:

* Fill BatchControlFields
     ls_batchcontrolfields-class_num  = 'MAT_GADZETY_BDN'.
     ls_batchcontrolfields-doclassify = 'X'.

** Fill BatchAttributes
*  ls_batchattributes-vendor_no  = 'RoPo'.
*  ls_batchattributes-vendrbatch = '1234'.
*  ls_batchattributes-prod_date  = '19680624'.
*  ls_batchattributes-expirydate = '20120101'.
*
*  ls_batchattributesx-vendor_no  = 'X'.
*  ls_batchattributesx-vendrbatch = 'X'.
*  ls_batchattributesx-prod_date  = 'X'.
*  ls_batchattributesx-expirydate = 'X'.

* Fill ClassAllocations
     ls_classallocations-class_type   = '023'.
     ls_classallocations-classtype    = '023'.
     CONCATENATE zmm_newspaper_addon-matnr
*    'BC01'
     ls_batch-batch INTO lv_objectkey.

*    lv_objectkey = zmm_newspaper_addon-matnr.

     ls_classallocations-objectkey   = lv_objectkey.

     ls_classallocations-objecttable = 'MARA'.   " MCH1, MCHA, MARA or MCHB tables
     ls_classallocations-classnum    = 'MAT_GADZETY_BDN'.
     ls_classallocations-status      = '1'.
     APPEND ls_classallocations TO lt_classallocations.

* Fill ClassValuationsChar
     ls_classvaluationschar-class_type    = '023'.
     ls_classvaluationschar-objectkey     = lv_objectkey.
     ls_classvaluationschar-objecttable   = 'MARA'.
     ls_classvaluationschar-charact       = 'PP_IMIE'.
     ls_classvaluationschar-value_char    = 'XXXXXXXX'.
*    ls_classvaluationschar-inherited     = ' '.
*    ls_classvaluationschar-instance      = '000'.
     ls_classvaluationschar-value_neutral = 'XXXXXXXXXXXXX'.
*    ls_classvaluationschar-charact_descr = 'Nazwisko'.
     APPEND ls_classvaluationschar TO lt_classvaluationschar.

     CALL FUNCTION 'BAPI_BATCH_SAVE_REPLICA'
       EXPORTING
         material             = zmm_newspaper_addon-matnr
         batch                = ls_batch-batch
         plant                = 'BC01'
         batchattributes      = ls_batchattributes
         batchattributesx     = ls_batchattributesx
         batchstatus          = ls_batchstatus
         batchstatusx         = ls_batchstatusx
         batchcontrolfields   = ls_batchcontrolfields
         batchstoragelocation = ls_batchstoragelocation
         internalnumbercom    = ls_internalnumbercom
         extension1           = ls_extension1
         material_evg         = ls_material_evg
       TABLES
         return               = lt_return
         classallocations     = lt_classallocations
         classvaluationschar  = lt_classvaluationschar
         classvaluationscurr  = lt_classvaluationscurr
         classvaluationsnum   = lt_classvaluationsnum.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
         wait = 'X'.

Re: Do I have to embed File_get_name in a process code?

1. Transaction WE02 / BD87, Table EDIDC, EDI*

2. The functional module convert the logical file, which you created in the transaction FILE, in the physical file. In the FILE you can create logical file and logical path with variables, parameters, separated by operation systems. The file_get_name you can give the filename and you get the whole path (incl. filename) back. Then you use the generate path for "OPEN DATASET...".

Re: How to merge cells in excel through sap

Hi Amar Tolani,

In my above code, ls_table-date is not the last column, instead it is the last but one column of your attached screen shot,OP.

No need of FM also, you can implement your own logic.

 

Example : Take one more table called lt_final of the same structure of main table.

  data : lt_final type lt_table,

           ls_final like line of lt_final.

 

loop at lt_table in to ls_table.

 

at new ls_table-date.

concatenate lv_text ls_table-text into lv_Text.

endat.

 

concatenate lv_text ls_table-text into lv_Text.

 

on change of ls_table-date (... Last but one column )

move-corresponding ls_table to ls_final.

ls_final-LastColumn = lv_text.

clear lv_text.

concatenate lv_text ls_table-lastcolumn into lv_Text.

append ls_final to lt_final.

endon.

 

endloop.

 

Hope this will help you Image may be NSFW.
Clik here to view.
. Now download the LT_FINAL  to Excel.

 

Regards,

Ravikiran.K

Re: Failure Mail Alert

Hi Nair,

 

I think the code is ok! just modified as per the second situation!

 

TYPES:BEGIN OF TY_JOB,

LOG_ID type  RSPC_LOGID,

TYPE   type  RSPC_TYPE,

EVENT_START type BTCEVENTID,

JOB_COUNT type BTCJOBCNT,

BATCHDATE  type BTCRELDT,

BATCHTIME type BTCRELTM,

VARIANTE type RSPC_VARIANT,

INSTANCE type RSPC_INSTANCE,

STATE type RSPC_STATE,

ACTUAL_STATE type RSPC_STATE,

STARTTIMESTAMP type RSTIMESTMPL,

ENDTIMESTAMP type RSTIMESTMPL,

end of ty_job,

BEGIN OF TY_JOBNAME,

       CHAIN_ID TYPE RSPC_CHAIN,

       LOG_ID  TYPE RSPC_LOGID,

       DATUM   TYPE SYDATUM,

       ZEIT    TYPE SYUZEIT,

       MANUAL_ABORT  TYPE RSPC_MANUAL_ABORT,

END OF TY_JOBNAME.

 

 

data: gt_job type table of ty_job,

       gt_jobb type table of ty_job,

       gt_jobname type table of  ty_jobname,

       gs_job type ty_job,

       gs_jobname type ty_jobname,

       gs_maildata type SODOCCHGI1,

       mailtxt type table of SOLISTI1 with header line,

       mailrec type table of SOMLRECI1 with header line,

       OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,

       OBJBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,

       ls_log_id type RSPC_LOGID,

       ls_date type sydatum,

       ls_time type sy-uzeit,

       ls_params like pri_params,

       ls_jobcount like tbtcjob-jobcount,

       ls_jobname like tbtcjob-jobname,

       gt_JOB_LOG type TABLE OF RSPC_S_MSG,

       gs_job_log type rspc_s_msg,

       TAB_LINES LIKE SY-TABIX.

*   DATA L_NUM(3).

 

*constants: cv_1 value 'G',

*            cv_2 value 'A',

*            cv_3 value 'F',

*            cv_4 value 'P'.

 

 

start-of-selection.

wait until gs_job-actual_state <> 'G'.

ls_date = sy-datum.

ls_date = ls_date - 1.

 

 

 

select LOG_ID

        TYPE

        EVENT_START

        JOB_COUNT

        BATCHDATE

        BATCHTIME

        VARIANTE

        INSTANCE

        STATE

        ACTUAL_STATE

        STARTTIMESTAMP

        ENDTIMESTAMP

        from RSPCPROCESSLOG

        into table gt_job

        where state not in ('F','G','A','P',' ')

        and batchdate between ls_date and sy-datum.

check sy-subrc = 0.

 

 

loop at gt_job into gs_job.

   SELECT SINGLE log_id

          from RSPCPROCESSLOG

          into ls_log_id

          WHERE log_id = gs_job-log_id

          AND type = gs_job-type

          and job_count = gs_job-job_count

          and state in  ('A','F','G').

 

     if sy-subrc ne 0.

       CONTINUE.

       else.

         DELETE gt_job from gs_job.

         endif.

         CLEAR gs_job.

   ENDLOOP.

 

* if two entries are exists - need to send one mail only

DELETE ADJACENT DUPLICATES from gt_job comparing type job_count.....

 

IF GT_JOB[] IS NOT INITIAL.

select  CHAIN_ID

         LOG_ID

         DATUM

         ZEIT

         MANUAL_ABORT

         from RSPCLOGCHAIN

         into table gt_jobname

         for all entries in gt_job

         where log_id = gt_job-log_id.

ENDIF.

loop at gt_jobname into gs_jobname.

  mailtxt-line = gs_jobname-chain_id.

  append mailtxt.

endloop.

loop at gt_job_log into gs_job_log.

   if gs_job_log-msgv4 = text-004.

   CONCATENATE gs_job_log-msgv1

               gs_job_log-msgv2

               gs_job_log-msgv4 into mailtxt SEPARATED BY space.

  append mailtxt.

  endif.

ENDLOOP.

clear: gs_maildata,mailrec,mailtxt.

gs_maildata-obj_name = text-002.

gs_maildata-obj_descr = text-001.

gs_maildata-obj_langu = sy-langu.

mailrec-receiver = 'ZAPO_JOBS'.

mailrec-rec_type = 'C'.

append mailrec.

 

 

 

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

   EXPORTING

     DOCUMENT_DATA                    = gs_maildata

    DOCUMENT_TYPE                    = 'RAW'

    PUT_IN_OUTBOX                    =  'X'

    COMMIT_WORK                      = 'X'

* IMPORTING

*   SENT_TO_ALL                      =

*   NEW_OBJECT_ID                    =

   TABLES

    OBJECT_HEADER                    = mailtxt

    OBJECT_CONTENT                   = mailtxt

*   CONTENTS_HEX                     =

*   OBJECT_PARA                      =

*   OBJECT_PARB                      =

     RECEIVERS                        = mailrec

  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

           .

IF SY-SUBRC <> 0.

  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Re: GN_DELIVERY_CREATE is creating multiple Inbound Delivery

I havent read through your code, but it seems that you delivery is getting split.

 

SAP provides a report in note 355404. Check if this report specifies why the delivery was split

Re: Function Group Error in quality systems


Re: Variant Configuration code parsing

Hi,

 

Any body has inputs on this issue?

 

Thanks!

Why Tax jurisdiction code is clearing once customer was created successfully?

Hello,

 

We are creating customers by running a custom report prog., wherein we used standard SAP's BAPI for creating this

customers.

 

We are running this custom report prog. in background, wherein the running user ID is WF-BATCH, i mean, workflow

batch ID

 

Customers are creating successfully without District and Tax jurisdiction code!!

 

When we checked the change log via XD03-->Menu-->Environment-->Account changes--->All fields--->All changes, we

noticed below

 

Fiels: District / ADRC-ORT02

Old value: New York district

New: '   ' ==> See, here its cleared!

User: WF-BATCH

This is happening only in case of US Sold-To creation

 

I mean, my prog. / BAPI / standard SAP is creating new customer successfully w/ district and tax code correctly, but after its creation IMMEDIATELY the WF-BATCH user is clearing these 2 flds data!!

 

Pls. let me know that Why WF-BATCH user is clearing immediately the district and tax jurisdiction code once its created in SAP?

 

Thank you

Re: Why Tax jurisdiction code is clearing once customer was created successfully?

How can i using this function with Gui Download ?

data yol type string.

concatenate 'D:\Proje Çalışanları\' gv_pjtx '.xls' into yol.

 

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

   EXPORTING

     file_name                       = yol

*   CREATE_PIVOT                    = 0

*   DATA_SHEET_NAME                 = ' '

*   PIVOT_SHEET_NAME                = ' '

*   PASSWORD                        = ' '

*   PASSWORD_OPTION                 = 0

  TABLES

*   PIVOT_FIELD_TAB                 =

    DATA_TAB                        = itab_detail_collected

*   FIELDNAMES                      =

  EXCEPTIONS

    FILE_NOT_EXIST                  = 1

    FILENAME_EXPECTED               = 2

    COMMUNICATION_ERROR             = 3

    OLE_OBJECT_METHOD_ERROR         = 4

    OLE_OBJECT_PROPERTY_ERROR       = 5

    INVALID_PIVOT_FIELDS            = 6

    DOWNLOAD_PROBLEM                = 7

    OTHERS                          = 8

           .

How to Create a SES with acc Assignment Category 'F' even though Purchase item Having acc assignment category 'U'

Hi Experts...

 

I am creating mass service entry sheets with BAPI_ENTRYSHEET_CREATE...as per the client requirement if purchase order item acc assignment category is 'U'..then we have to Create service entry sheet with account assignment category 'F' with Multiple line items...

we have passed all the parameters as like other cases But we are getting error as 'No Account assignment exist for line item 00010'....

Could you please help me  to create SES with acc assignment category 'F' even though purchase item having acc assignment category 'U'...

Thanks in advance.

Re: PPCO0007 User Exit for Changing Header Fields During Order (CO40)

Hi Noemi


You can use the enchancement PPCO0007 (exit when the production order is saved).

Use the function module EXIT_SAPLCOZV_001 (User Exit for Checking or Changing Header Fields During Order Save) to update the field priority starting the information in the material-customer info record.

Print and Email Payment advice using RFFOUS_T

Hi

 

I have to Print and email payment advice using RFFOUS_T (using T-code : F110).

 

I implemented BTE 2040. with this i can send email successfully. But it is not printing. 

 

I need to print payment advice to spool and send send payment advice to vendors at the same time.

 

please let me know how to achieve this.

 

i searched SDN for this but not able to find proper solution.

 

Thank you all.


Re: Joining three tables with inner join and for all entries

Also, you don't need the "IF s_ernam is INITIAL" distinction, as empty selection ranges will be automatically ignored by the select statement.

 

Thomas

Re: Change document for user is not updating

Hi,

 

Use FM BAPI_USER_CHANGE or BAPI_USER_UNLOCK to unlock the user, they will update the proper change documents.

 

Martin

how to populate structure inside a structure in FM output

Hi Experts,

 

I want to populate a structure inside a structure in output of a function module.

 

Currently I have defined a table type inside a line item i have defined an include structure. But when you append it with values it is not forming the sub-structure in the output. I doubt if this approach is correct for the output requirement or not.

 

Please suggest how to get this done or provide some sample standard function module which I can refer for this in SAP CRM/ISU.

Re: how to populate structure inside a structure in FM output

Hi Dharmaraj, by any change you have some coding with this problem? I think it's do-able but I can't give you a solid approach with a more concreet example. Best, Sander

Re: update scheduling lines in scheduling agreement

I could not locate any useful exit or enhance-point too. As per my understanding, what is required at the basic level is that I'll pass the details to my custom FM (same import parameters as SD_BACKORDER_UPDATE) for the scheduling agreement and then I need to check for the material availability date and confirmed quantity to update the same in JIT Delivery Schedule or Forecast Delivery Schedule as per my requirement.

 

Are there any other standard FM's which can help me achieve this requirement?

 

Regards,

Dawood

Viewing all 10425 articles
Browse latest View live


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