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

Help BAPI_MATERIAL_SAVEDATA !?!?

$
0
0

Hi Friends,

 

I've created a program that allow to change the <b>unit of measure</b> of a material master (add new  unit <b>USE</b>). But  wrong when I used BAPI  BAPI_MATERIAL_SAVEDATA to do it. The message error as below:

"specify the conversion factors for the unit of measure <b>USE</b>"

 

Anyone can tell me why?

 

Thanks,

Gy


How to find the enhancement spot

$
0
0

Hello,

 

I need your help, according to the following screen of ME23N I want to know how to find the enhancement of the button in red rectangle.

 

When I click this button appears a report with data purchase.

 

Thanks for your help friends.

 

print.png

The work area "IT_KUNNR" has more fields than selected. error

$
0
0

hi everyone

 

 

im gettin this error how can ı fıx this

 

any help would be amazing...

 

IF xline NE 0 .

     SELECT kna1~kunnr kna1~name1 kna1~name2 kna1~ort01 kna1~regio kna1~stras

       kna1~telf1 kna1~telfx kna1~adrnr kna1~erdat kna1~ort02 kna1~stcd1

       kna1~stcd2 FROM kna1

         INNER JOIN knb1 ON kna1~kunnr EQ knb1~kunnr

         INNER JOIN knvv ON knb1~kunnr EQ knvv~kunnr

         INNER JOIN knvk ON knvv~kunnr EQ knvk~kunnr

       INTO CORRESPONDING FIELDS OF TABLE it_kunnr

 

ı just added kna1~name2 thats all what ı have done and error occured...

 

ı can send all program codes ıf u need to answerr correcctly....

 

ım waiting....

CONVERT_OTFSPOOLJOB_2_PDF ECC6 spool conversion

$
0
0

Hi Folks, we facing an issue with the spool conversion in pdf.

We are using the FM CONVERT_OTFSPOOLJOB_2_PDF and upload the file on an application server.

The pdf is opening correctly but we have noticed that after the %%EOF  they are others characters and this avoid the destination system to process the file.

Is it normal having characters after the %%EOF?

Since it's a binary file how to remove these characters ( if it possible).?

 

After the conversion we upload it in an application server using

 

OPEN DATASET fullpath FOR OUTPUT IN BINARY MODE MESSAGE srvmsg ...

 

 

Regards.

Internal Table to xls Attachment cl bcs?

$
0
0

Hy folks i'm facing an issue while converting an internal table to excel using cl_bcs (to send as attachment.

After the first row, the first column wouldn't be fill again.

i can't figure out why.

this is my piece of code.

LOOP AT lt_kdmat INTO ls_kdmat.

DO.

ASSIGN COMPONENT sy-index OF STRUCTURE ls_kdmat TO <lv_field>.

IF sy-subrc EQ 0.

IF lv_string IS INITIAL.

WRITE <lv_field> TO lv_string_field.

lv_string = lv_string_field.

ELSE.

WRITE <lv_field> TO lv_string_field.

CONCATENATE lv_string gc_tab lv_string_field INTO lv_string.

ENDIF.

ELSE.

CONCATENATE lv_string gc_crlf INTO lv_string.

EXIT.

ENDIF.

ENDDO.

ENDLOOP.

 

TRY.

CALL METHOD cl_bcs_convert=>string_to_solix

EXPORTING

iv_string = lv_string

* iv_codepage = '4103'

* iv_add_bom =

IMPORTING

et_solix = gt_binary_data

ev_size = gw_doc_len. 

CATCH cx_bcs .

MESSAGE 'Error when transfering document contents' TYPE 'E'.

ENDTRY.

 

What do i miss?

Call transaction is not working for KKAO

$
0
0

Hi Experts,

 

I am calling KKAO transaction in my report using SET PARAMETER ID i am passing 4 values Plant, WIP to period, fiscal year and RA version respectively, all the 3 values are working fine but RA version is not passing to the transaction, its going blank. Please help me to solve it.

 

Thanks,

Ashutosh Katara

Taking SAP GUI screenshot automatically and send as attachment through mail programmatically

$
0
0

This document explains how screen shot of SAP GUI screen can be taken automatically (not using Prtsc manually )and sends it as mail attachment by ABAP program.


Requirement:Taking screenshot of GUI screen like shown below and send it as mail attachments through ABAP.

capture.png


Approach


1.      Use front end GUI service class to take screenshot – Method GET_SCREENSHOT of CL_GUI_FRONTEND_SERVICES.

         When you called this method, system will take screenshot of active screen and return screenshot data intern of hexadecimal values          (xstring).

capture.png

           As shown in above code, screenshot data is imported by image parameter


2.     Convert xstring data into binary data to send it as attachment – Use method XSTRING_TO_SOLIX  of class CL_BCS_CONVERT

capture.png

         LT_DOC_CONTENT contains binary data which will be used later to send as attachment in mail.


3.      Send screenshot as mail attachment – Use class CL_BCS to send mail with attachment.

        a)      Create persistent class reference for a mail send request

capture.png

    

       b)      Create Mail document to include body, attachment etc

capture.png

       Above code – Mail subject as ‘Project Status Info’. Mail body can be in I_TEXT parameter.

       For this example I not used any mail content.

      

     c)      Add screenshot as attachment to mail – Can be Attached as PNG,BMP, GIF, JPG etc format.

              Note screenshot content passed here.

capture.png

          Binary content of screenshot data LT_DOC_CONTENT which prepared in step1 and step2

          passed to I_ATT_CONTENT_HEX.


      d)      Attach mail document to send request.

capture.png

     e)      Attach sender and recipient address. Add sender, TO, CC, BC address to send request.


capture.png

   f)      Send Mail – Call send method to send mail with attachment

capture.png



Result :


capture.png

Email send with attachment


capture.png

Smartform hangs

$
0
0

Hi Experts,

 

Its been so long, I am not able to code. Please check the following screenshot:

 

 

Untitled.jpg

 

 

Is there any solution?

 

 

Regards

Mani


Arial font in smartform

$
0
0

Hi Experts,

 

The form is created and must be in ARIAL font. I have read many posts on it, it says upload from se73. I have already done it but in the printout it gives underline as follows:

 

Picture1.jpg

 

Please note that It is not giving in any other format and it shows perfect in the print preview. Any suggestions?

 

 

Regards

Mani

Does not update. Could you help please?

$
0
0

TABLES      :   pernr.

 

INFOTYPES   :   0021,0106.

 

DATA        : rec_p0021   TYPE   p0021      ,

               rec_q0106   TYPE   q0106      ,

               rec_p0106   TYPE   p0106      .

DATA          w_return    TYPE   bapireturn1.

 

START-OF-SELECTION.

 

GET pernr.

 

   READ TABLE p0106 INDEX 1.

   rec_p0106 = p0106.

   rec_p0106-stras = '2235 Burns Rd'"Sokak ve konut numarası

   READ TABLE p0021 INDEX 1.

   rec_p0021 = p0021.

   rec_p0021-favor = 'test-639111'.    "adı

 

* Enqueue personnel number

  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

    EXPORTING

      number = pernr-pernr

    IMPORTING

      return = w_return.

 

  CALL FUNCTION 'HR_INFOTYPE_OPERATION'

    EXPORTING

      infty            = '0021'

      number           = pernr-pernr

      subtype          = '2'

      record           = rec_p0021

      validityend      = p0021-endda

      validitybegin    = p0021-begda

      operation        = 'MOD'

      dialog_mode      = '2'

      view_identifier  = '07'

      secondary_record = rec_p0106

    IMPORTING

      return           = w_return.

 

  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

  EXPORTING

    number = pernr-pernr.

 

END-OF-SELECTION.

 

IF sy-subrc NE 0.

 

  WRITE:/ 'Infotype 0106 ve 0021 Bilgi Tipi Güncellendi'.

 

ENDIF.

MC87- create plan-Error: The evaluation profile SAP___A001 could not be read

$
0
0


Hi,

 

I am faceing error while saving SOP plan (MC87) in DEV server only. not in Quality Server.

 

Error:

The evaluation profile SAP___A001 could not be read

Message no. CY330

 

Thanks,

Jishu

Hi friends, I have a doubt in inserting a field to database table and inserting the same values in two different tables

$
0
0

I have a mpp screen for a cd library management system (we are practicing on it).
We have a main screen where a user should enter the enteries and while clicking a add button it should be inserted in a table, Here the problem rises the table name are ztransaction and zstatus.The fields in mpp are cdid,customerid,transaction id,date of issue and duedate.Now after entering all the values on clicking add button it should be inserted to database table ztransaction and the field cdid alone should be inserted both in ztransaction and zstatus.


Thank you

Mock specific classes with mockA

$
0
0

With mockA it is quite easy to mock interfaces for unit tests. But it is also capable of creating mock objects that are not based only on interfaces, but specific classes. This blog post shows how it works and what needs to be considered.

Basics

Creating such an instance is quite the same as the creation of mock objects based on interfaces. The only restriction that applies is the fact that the class which is to be mocked may not be final class. This is necessary because mockA couldn’t create a subclass to override method outputs.

The classes in the following examples can be found in the mockA package provided at Github.


DATA lo_mocker TYPE REF TO zif_mocka_mocker.
DATA lo_mocker_method TYPE REF TO zif_mocka_mocker_method.
DATA lo_flight_observer TYPE REF TO zcl_mocka_flight_observer.
lo_mocker = zcl_mocka_mocker=>zif_mocka_mocker~mock( zcl_mocka_flight_observer=>gc_name ).
lo_mocker_method = lo_mocker->method( 'observe_flight' ).
lo_mocker_method->with( i_p1 = 'NA' i_p2 = 007 i_p3 = sy-datlo ).
lo_mocker_method->returns( abap_true ). 
lo_flight_observer ?= lo_mocker->generate_mockup( ).


Constructor parameters

However, this little example will still fail, as ZCL_MOCKA_FLIGHT_OBSERVER’s constructor expects non-optional IMPORTING parameters. This is an issue which is not existent for interfaces. As you mock already existing implementations, you also need to take care of that.

But that is also no problem at all. Consider the following example that passes some earlier created instances to the constructor. It can be achieved by calling the method PASS_TO_SUPER_CONSTRUCTOR of the mocker instance.


DATA lo_is_in_time_info TYPE REF TO zif_mocka_is_in_time_info.
DATA lo_flight_alert_process TYPE REF TO zif_mocka_flight_alert_process.
*create lo_is_in_time_info and lo_flight_alert_process... (not shown here)
DATA lo_mocker TYPE REF TO zif_mocka_mocker.
DATA lo_mocker_method TYPE REF TO zif_mocka_mocker_method.
DATA lo_flight_observer TYPE REF TO zcl_mocka_flight_observer.
lo_mocker = zcl_mocka_mocker=>zif_mocka_mocker~mock( zcl_mocka_flight_observer=>gc_name ).
lo_mocker->pass_to_super_constructor(   i_p1 = lo_flight_alert_process i_p2 = lo_is_in_time_info ).
*mock some method output (not shown here)
lo_flight_observer ?= lo_mocker->generate_mockup( ).

The example s are also in the mockA package.

Take a look at the unit test report ZTEST_CL_MOCKA_MOCKER and the test methods mock_class_with_construc_param, mock_class_with_method_output and mock_intf_with_construc_param.

BAPI_BUPA_ADDRESS_ADD FM for add address

$
0
0

hi exports,

I'm using .net web service for create a vendor in sap,

i used VENDOR_INSERT FM , it's successfully created.

so then i go to xk03(t-code) to view the vendor by vendor code it show the error

 

Error analysis

    The system attempted to use

    This dynpro does not exist.

 

problem is addr is not found in lfa1

so i user BAPI_BUPA_ADDRESS_ADD FM for add address details.

then

 

CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE' "SAP BP, BAPI: Change Address

  EXPORTING

  businesspartner = " bapibus1006_head-bpartner Business Partner Number

* addressdata = " bapibus1006_address Address Data

 

what is businesspartner ID means. what value i have to pass to create the address ????

How to secure ALV report

$
0
0

Dear All,

           we have requirement to secure the extracted data from ALV report by means :

make the exported excel file  read only

or make it not able to be copied

or any kind of security

 

thanks and best regards


Level printing problem in smartform.

$
0
0

Dear All,

Good day.

Developing an smartform which will print levels based on counter number. For this reason i am doing the below code.

 

i = 6.

DO.

  READ TABLE it_final INTO wa_final INDEX i.

  IF sy-subrc = 0.

    APPEND wa_final TO it_main.

    i = i + 6.

  ELSE.

    EXIT.

  ENDIF.

ENDDO.

LOOP AT it_main INTO wa_final.

  DELETE it_final WHERE container_no = wa_final-container_no.

ENDLOOP.

 

So, it_main will contain only 6,12 or 18th row number from it_final. So, if i have to print 6 levels per page, then for counter number 20 there should be 4 pages. But using this condition, counter number 13 and 20 also going to it_main.i, e 5 pages are showing now. Can you solve the problem?

 

Note: First 2 pages shows right result but from page 3 it starts problem. According to my logic now it_main is containing data 6,12,18,13,20 !!!

CALCULATE_TAX_FROM_GROSSAMOUNT

$
0
0

Hi GROUP,

 

I am using FM CALCULATE_TAX_FROM_GROSSAMOUNT to calculate Tax based on Gross amount , but I am getting the below Error:

 

Tax code XX country GB does not exist in procedure XXXX.

 

can any body suggest what is missing? alternatively I tested CALCULATE_TAX_FROM_NET_AMOUNT its working perfectly fine,

Reg Internal table modification based on other itab

$
0
0

Hi Folks,

 

    I have two internal tables, my first internal table as follows(this is final internla table i want to modify this based on other itab)

 

material  field1 field2   newfield

 

  mat1    aa     bb     

 

  mat2   xx     yy

 

 

 

my second internal table has

 

mat                ref mat

mat1              A1

mat1              A2

mat1              A3

mat2             B2

mat2             B3

 

my final internal table is 1st one I want my new output as

 

material  field1 field2   newfield

 

  mat1    aa     bb         A1

  mat1    aa     bb         A2

  mat1    aa     bb         A3

 

  mat2   xx     yy         B2

  mat2   xx     yy         B3

 

 

Please give me some input how can i achieve the above.

 

Thanks,

Smriti

Create ZPA20

$
0
0

Hi Expert,

 

I want to create a new Tcode from PA20 which is allow only

Infotype

0001

0006

0007

0050

 

Now how can i start it....

 

Thanks,

Mahipal

moving last 2 records on change of material Number in a sorted table

$
0
0

Dear Gurus,

 

 

i have an internal table with material no,Qty and Posting dt.

i have sorted it based on material and date.

I want to move last two records from this itab to other itab on change of each material.

 

Example

 

scn.png

Viewing all 8332 articles
Browse latest View live


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