Coding logic
Hi,
In my program have written a code such that it fetches all the document numbers based on the company code and posting date.See based on this condition in a table it may contain N number of document numbers and each document number may have N number of line items.In my logic have to write the code such that if a document number consists of line items more than 10 then those document number has to be deleted.In my code have identified the document number based on the condition but dunno to write the logic to delete the document number if it has more line items.
the code is
LOOP AT gt_bsik.
AT NEW lifnr.
READ TABLE gt_lfb1 WITH KEY lifnr = gt_bsik-lifnr BINARY
SEARCH.
CLEAR lt_vendors.
lt_vendors-lifnr = gt_lfb1-lifnr.
ENDAT.
AT NEW belnr.
gv_new_invoice_ind = 'X'.
gt_bsik_copy-lifnr = gt_bsik-lifnr.
gt_bsik_copy-belnr = gt_bsik-belnr.
gt_bsik_copy-gjahr = gt_bsik-gjahr.
gt_bsik_copy-buzei = gt_bsik-buzei.
gv_count = gv_count + gt_bsik-buzei .
ENDAT.
IF gv_new_invoice_ind = 'X'.
ADD 1 TO lt_vendors-count.
ENDIF.
gv_new_invoice_ind = space.
AT END OF lifnr.
APPEND lt_vendors.
APPEND gt_bsik_copy.
ENDAT.
IF gv_count > 10.
* DELETE gt_bsik where lifnr =
*gt_bsik_copy-lifnr and belnr = gt_bsik_copy-belnr and
*gjahr = gt_bsik_copy-gjahr .
DELETE gt_bsik WHERE lifnr =
gt_bsik_copy-lifnr .
ENDIF.
ENDLOOP.
ENDIF.
gt_bsik is the internal table.
Please help me to write the logic.The above mentioned logic is not workin
Edited by: Julius Bussche on Feb 2, 2009 4:47 PM
Please use code tags and meaningfull subject titles
HI
Before the loop statement take a copy the internal table into another internal table of the same type.
gt_bsik_2[] = gt_bsik[]
sort gt_bsek_2 by BUKRS GJAHR BELNR BUZEI descending.
LOOP AT gt_bsik.
read table gt_bsek_2 with key bukrs = gt_bsik-belnr
gjahr = gt_bsik-gjahr
belnr = gt_bsik-belnr.
if sy-subrc eq 0.
if gt_bsik_2-buzei > 10.
delete gt_bsik_2 where bukrs = gt_bsik-belnr and
gjahr = gt_bsik-gjahr and
belnr = gt_bsik-belnr.
endif.
endif.
endloop.
after the endloop table gt_bsik_2 will will have only document numbers which have line items less than 10.
Hope the above code helps you
Similar Messages
-
Hi,
I need a logic for the below requirement,
Internal table 1 will have around 13 fields ex: a, b, c, d,.. m
Interanal table 2 has a field called FIELD which will have the field name ex a,b,c,d.. (field name is nothin but the fields in the internal table 1 i.e a,b,c,d.. m)
if the internal table 2 entries are d,e,g,h,k then i need to sort the internal table 1 by fields d,e,g,h and k
if the internal table 2 entries are b,d,f,k.a the i need to sort the internal table 1 by fields b,d,f,k,a
So could some one please suggest me some logic for this, It would be good if I could get a sample code for the same
Thnx,
Nalina
Moderator Message: Asking for coding without any effort fron you is NOT allowed.
Edited by: kishan P on Feb 16, 2011 4:34 PM<<code removed by moderator>>
Edited by: kishan P on Feb 16, 2011 4:35 PM -
Logical AND in MDX Reporting Services Parameter
Hi, I would like to implement logical AND on a cube parameter. I have seen examples of hard-coded logical AND in MDX.
(http://salvoz.com/blog/2013/12/24/mdx-implementing-logical-and-on-members-of-the-same-hierarchy/)
But I'm not sure how to apply this to a parameter's MDX dataset.
Here is an example of the automatically generated MDX which uses logical OR:
This is the drop down parameter:
WITH MEMBER [Measures].[ParameterCaption] AS [Department].[Department].CURRENTMEMBER.MEMBER_CAPTION MEMBER
[Measures].[ParameterValue] AS
[Department].[Department].CURRENTMEMBER.UNIQUENAME MEMBER [Measures].[ParameterLevel] AS
[Department].[Department].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue],
[Measures].[ParameterLevel]} ON COLUMNS
, [Department].[Department].ALLMEMBERS ON ROWS
FROM [MyCube]
And the demo report dataset is:
SELECT NON EMPTY { [Measures].[CompanyTbl Count] } ON COLUMNS,
NON EMPTY { ([Product Level No].[Product Level No].[Product Level No].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
( SELECT ( STRTOSET(@DepartmentDepartment, CONSTRAINED) )
ON COLUMNS FROM [MyCube]) WHERE
( IIF( STRTOSET(@DepartmentDepartment, CONSTRAINED).Count = 1,
STRTOSET(@DepartmentDepartment, CONSTRAINED), [Department].[Department].currentmember ) )
CELL PROPERTIES VALUE,
BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING,
FONT_NAME, FONT_SIZE, FONT_FLAGSHi,
I can see there just one parameter @Department@Department in your script. But if you had two parameters that should return resultset affected by two parameters. You can do it as either select from subselect from subselect.
Example 1
SELECT
{x} ON COLUMNS,
{ROWS_SET} ON ROWS
FROM
(SELECT StrToSet(@Param1) ON COLUMNS FROM
(SELECT StrToSet(@Param2) ON COLUMNS FROM
[CUBE_NAME]
Or crossjoin between 2 parameters
SELECT
{x} ON COLUMNS,
{ROWS_SET} ON ROWS
FROM
(SELECT StrToSet(@Param1)*StrToSet(@Param2) ON COLUMNS FROM
[CUBE_NAME]
Jiri
Jiri Neoral -
Need to create a transformation based on Update Rules Logic
Hi,
I have an existing complex Update Rule. I need to manually create a Transformation based on this Update Rule logic. The Start Routine of the Update Rule comprises of:
1) All data declarations in the Global Area
2) The local coding area consists of various select statements from various r/3 tables used later for mapping. It also calculates and stores values in the Data Package final internal table for few infoobjects that are not present in the Source object but and are used to populated data in the target.
3) then we have the various one to one individual Infoobject mappings/constants and many individual infoobject routines that pick result from the comm_structure
I am not very clear as to where each of the above coding logic should be put in the transformation coding area...... I can see four main coding areas in the transformation....global area, 2nd Global Area, Method Start_Routine and Method Inverse_Start_Routine........... I think the global data declarations(point 1 above) should be put in the Global declaration area of the start routine. The local area of the update rule logic (point 2 above) that contains select statements should be put in 2nd Global part or should it be put in Method Start_routine????? Point 3 above for individual filed mappings will be done through Rule groups. Also can anyone let me know what is the methos inverse_start_routine used for?????
Thanks.Hi,
Point 1 you mentioned should be put under2nd Global declaration part of start routine.
Point 2 should be put under Method Start_routine.
Point 3 as you only mentioned can be done by individual field rule mappings.
Method inverse_start_routine
This subroutine needs to be implemented only for direct access
(for better performance) and for the Report/Report Interface
(drill through)
Not very clear though about Inverse routine. But definetly not being used for the case you mentioned.
Hope it helps. -
Logic for LSMW screen development
Hi,
I need somution for the following:
"There wil be a screen which will allow users to create projects and objects in the same way as like LSMW and all customizing data will be linked to the corresponding project and object.
Projects are to be stored in table A
Sub-Projects to be stored in table B
Objects are to be in table C"
Can anyone give me the coding logic to develop this?
Thanks.Can be closed.
-
How to being the coding inside an inbound proxy class for a given structure
Hi.
i have been assigned a task to write a code to post a GL for which i am using a BAPI but as the mapping is done in XI the structure has been provided, where the structure in nested in first table type and then line type and above all the proxy structure, so i was wondering how would i start with the coding part as it would have been easy if i had to access the structure directly from the DB table but now i have to make use of the structure provided by XI.
can any one help to start with the coding logic, where in afterwards in can implement the rest of the logic myself,
Thanks in advance,
Robert.You should run an application in the "debug" mode. Just put "&analyze=X" at the end of the PCUI application' URL in the browser.
Sometimes it's necessary to turn off buffering:
Call up the 'User maintenance' transaciton (SU01)
Call up the change mode for the desired user
Go to the 'Parameters' tab
Create parameter CRM_URL_BUFFER_OFF if this does not exist
Enter parameter value 'X' for parameter CRM_URL_BUFFER_OFF
Save -
System/logic of material codification for sap
hi,
what is the good system/logic of material codification? i mean how can i give a usefull code to material like spares, raw material?
any link where can i find material coding system for sap?
thanks and regardsHi Buddy,
As said in earlier post before the coding logic can used either internal or external
1> Internal is normally used for raw materils or material which r been used internally in organization
2> external is used for finished products which are to be saleable
Eg: For Electronic manufacturing firm of
Can have internal number range for IC's , PCB's , Speakers etc procured for production of the finished products.
Were as the Material code for this Finished product shouldbe used as External so that nomenculture can be alloted for every specific Catergory of product ie lets consider this firm produces TV , Music System etc
So for TV the external code can be :
TVCRT211000W
which states as:
TV : Television
CRT : Type of Display section ie Cathode ray tube
21 : 21 inch sizing
1000W : Sound output
TVLCD42450W
which states as:
TV : Television
CRT : Type of Display section LCD
42 : 42 inch sizing
450W : Sound output
and so on
Hope so this was usefull to u .
Thanks -
Retrieve text file from ftp server every 15 mins
Hi guys,
We are able to connect to an FTP server with 5 text files. Every 15 minutes, we need to retrieve each of the 5 files. Please assist me with the coding logic to retrieve the file into the SAP Directory. Any suggestions would be greatly appreciated.
Regards,
SidSid
Try searching on SCN, there are plenty of materials you can find without even asking a question in the forum.
How to use SCN search
For example, if you search with keywords "FTP ABAP", immediately the first two Wiki entries would give you the details you are looking for.
Rgds
Eng Swee -
Concept of groups vs concept of roles
Hi!
I'm designing an LDAP structure mainly for authentication and authorization of users. I want to use the LDAP server for applications, intranet (different platforms like linux, NT, ...) and portals.
I read the Admin guide about groups and roles and found, that there aren't that many reasons for using roles instead of groups. The only real difference is (as I understood) that when using roles, I don't have to search for the the groups a user is member of, because every user contains the nsrole attribute with all the roles he is member of.
One big reason for not using roles is, that they are quite specific for iPlanet Directory Server. If one ever changes to another product (for example OpenLDAP) the roles concept may or may not be the same. When using groups I don't have that problem.
(If my information about that is incorrect please conradict!)
A mixture of groups and roles is a quite bad idea because if I put a group in a role, the "nsrole" attribute is added only to the group but not the the members of the group, so if I use roles, I should stick to them and should not use any groups.
As I told at the beginning, I am planning an LDAP structure. I don't have any "real life LDAP-experience" so if your experience is different, please tell me.
Thanks in advance for your opinion!
Florian1. Why there could be a problem without scopes in
groups. If I have two companies and each of them has
a group "employees". Two companies would probably be
separated in two different subtrees, so I just use a
dynamic group, where I can specify a subtree where
groupmembers can be located or I use static groups,
where I define each entry.You see, you had to make a choice on which group type you could use - not because one was more convenient for defining members for the problem at hand, but because only one would work at all.
One thing I did not mention about roles advantages: they all work the same way - if a new role type were invented, applications written to work with roles prior to the new role, would still work with that role type. Groups types are so different that forward compatibility is not possible - mostly because to even use groups, applications have to do all the work to do common things like, enumerate the group, enumerate the groups an entry belongs to, test for group membership etc.
>
2. The coding logic for group evaluation with dynamic
and static groups and even mixtures of it is quite
complicated, it is much easier to ask an entry for a
roledn and thats it, but do most clients support
roles? Probably not. But then roles have not been around as long. I don't have any hard data on how many apps use roles - you would be surprised how hard it is to get that data for a developer.
As far as I know roles are not used in any
other LDAP Server. Well, the Sun DS, and the Netscape DS (which admittedly were once the same thing) both support the same roles.
So you can optimize an
applications implementing a role based queries, but
if you have a OpenLDAP environment you also need a
possibility to use groups. Talk to the OpenLDAP people about that. I believe they (at one time at least) decided to support the Netscape slapi interface - roles have interface components in that api.
I do understand what you are saying - there isn't an RFC, so other servers don't support roles. Well, I'm sorry, I never got around to it. To be perfectly frank, a lot of LDAP RFCs/Drafts merely describe some proprietary mechanism which other servers never adopt. Some even describe mechanisms that nobody has ever implemented.
When it comes down to it, it is only you who can decide whether being able to move to OpenLDAP or some other server without any reimplimentation is an important consideration. Every server will have features not supported by others, and if your choice is to use only those that are commonly supported, then that is your choice.
Roles will allow much less complex coding in order to use them and they are much faster than equivalent client side operations, but the price is non-comformance with other servers. But when that non-conformance simply boils down to entries which merely "describe" the groups without adding application level functionality - how much have you really lost? Well, until you need to change server vendor you have only gained, and then you'll need to put in the effort you saved ealier.
On the other side, what
application do support roles right now? (I really
don't know)Apart from applications by vendors that also supply DS I don't know either - but support for features such as this need to come from customers of those products. It is surprisingly simple to add support for roles in a product (for most it will almost be free) - much simpler than for groups. -
Hi experts:
In our Delivery-Related sales,the pricing date in billing comes from the PGI date of delivery actually.
Now,i want the pricing date in billing comes from pricing date in sales order, i try it many times,but all failed.
In VOV8 i can Propose the pricing date in sales order.
How does the Pricing date come from in billing in SAP Std?
Pls give me some advice.
Thank you very much.Use t.code VTFL (Copy control from delivery to billing document).
Select the source and target document types.
Then go to item details. You need to select appropriate routine in the field Data VBRK/VBRP. This routine should have coding to propose the price data from the order.
If you don't find a routine to suit your requirement, then you can develop the routine in t.code VOFM - Menu Data Transfer ->Billing documents.
The coding logic can be;
IF NOT VBKD-PRSDT IS INITIAL.
VBRP-PRSDT = VBKD-PRSDT.
ENDIF.
There is an OSS Note 130339 - Pricing date in the billing document, but this refers to versions upto 4.5b.
Regards, -
Problems in print of PO from SRM
Hi experts,
I have a problem in assigning the right printer for output of PO in SRM.
Example:
The Print settings are:
User A is printing on printer X.
User B is printing on printer Y.
User A create a shopping cart, by using the functionality 'shop on behalf'. User A create a shopping cart on behalf of user B.
How can I get the the SRM-PO, which is automatic generated from the shopping cart, to be printet on printer X?
Thanks KimHi
Which SRM version are you using ? Are you using any custom report in this case ?
Take help of ABAP person here... You need to try Coding logic in this case...
Function module GET_PRINT_PARAMETERS (Retrives User Current Printer settings)
Function module SET_PRINT_PARAMETERS (Sets User Current Printer settings as per your new options)
Also look for BADIs using SE18 transaction ->
BBP_OUTPUT_CHANGE
BBP_OUTPUT_CHANGE_SF
Hope this will help. Do let me know.
Regards
- Atul -
Problem in AR Line Item IDOC method
Hello Guys ,
iam migrating open AR Line Items using lsmw Idoc method.when i uploaded the flat file and converted the file .at step 10 display converted data it is not displaying the values for the field net duedate(FAEDN) and amount(BETRW) but when iam processing the idoc ,the values are displayed in data records .can anybody explain what is the reason for this.your valuablae answer is greatly appreciated.
Regards
Janapathihi,
to load open ar item , the best method is to use FRBIBL00. you can put in the additional coding logic in begin of processing events.
this will give you good control over the loading as well.
pls reward points if found usefull.
regards
pragya -
Hi, I am trying to determine the line a condition type is on to be able to delete that line in a pricing screen. I am on 45b and DEFSIZE in the function CALL TRANSACTION is not available to me. Please help. I call a screen to get the number of screen rows but the static number of lines seems to change depending on font size.
I have it working in my development system but in the QA system it fails. I only have an issue with background processing.
Any help would be much appreciated. Regards Joannehi,
long ago i found this example in a forum:
"CTU_PARMS will force the BDC to use the standard default screen size (rather than being dynamic based on the user's settings. I think I explained that right, but all I know is that it keeps the BDC from behaving differently between users and makes things more consistent for coding logic".
Here's an example (note that DEFSIZE is the key to the solution here):
data: begin of tran_opts,
dismode type ctu_params-dismode value 'N',
updmode type ctu_params-updmode value 'S',
cattmode type ctu_params-cattmode,
<b>defsize type ctu_params-defsize value 'X'</b>,
racommit type ctu_params-racommit,
nobinpt type ctu_params-nobinpt,
nobiend type ctu_params-nobiend,
end of tran_opts.
call transaction 'F-02'
using bdcdata
options from tran_opts
messages into bdc_messages
Hope it helps,
Best regards -
Why do you expose the accessors of a foreign key association in an Entity?
Hello Everyone:
I am working on our re-usable Business Components .jar file. I am re-doing the one we had created in 10g from scratch in 11.1.2 in order to utilize all of the features of 11.1.2 and remove the problems we were having with re-factor in 10g.
In 10g there was also a bug that gave us an error if we exposed the source and destination accessors of foreign keys if there were multiple similarly named source accessors for a number of foreign keys on a table. So we removed all the foreign key source and destination accessors. We only exposed the accessors for parent/child relationships and uniquely named them eg. Person_parent_to_PersonAddress. We have used a number of these parent/child accessors in customized coding logic, but not the foreign key accessors.
Is anyone using the foreign key accessors and what function are you using them for? In moving forward with starting this re-usable Business Components .jar file, I am trying to determine if we should be exposing the foreign key source and destination accessors.
Thanks in advance for any replies.
Mary
UofWMany thanks for the response. Don't think I can make use of synchronous replication with lookup tables given our own requirements.
I was thinking however, by employing a hub-and-spoke replication model instead of an N-WAY, that this would avoid foreign key conflicts altogether. -
HEllo ABAPERS,
KINDLY HELP .
I have developed a report which displays a html page in a custom control .But while printing it not displaying table borders . I have used method display_document ffor printing .Can anyone tell me the reason why is it not printing borders ?
Following code is the code for subroutine and PBO : -
MODULE status_0322 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
IF first_display EQ 'X'.
SET PF-STATUS 'PMENU'.
create document
CREATE OBJECT do.
fill document
PERFORM display_data USING do t_no.
merge document
CALL METHOD do->merge_document.
display the document inside the container named 'mmscr
CALL METHOD do->display_document
EXPORTING
container = 'MMSCR'
EXCEPTIONS
html_display_error = 1.
" do some exception handling ...
CLEAR first_display.
ENDIF.
ENDMODULE. " STATUS_0322 OUTPUT
*& Form display_data
FORM display_data USING p_do TYPE REF TO cl_dd_document P_no type n.
DATA ta1 TYPE REF TO cl_dd_table_element.
DATA col11 TYPE REF TO cl_dd_area.
DATA col12 TYPE REF TO cl_dd_area.
DATA col13 TYPE REF TO cl_dd_area.
DATA col14 TYPE REF TO cl_dd_area.
DATA col15 TYPE REF TO cl_dd_area.
DATA head1 TYPE sdydo_text_element.
DATA head2 TYPE sdydo_text_element.
DATA head3 TYPE sdydo_text_element.
DATA head4 TYPE sdydo_text_element.
DATA text TYPE sdydo_text_element.
CALL METHOD p_do->new_line.
CALL METHOD p_do->add_table
EXPORTING
no_of_columns = 5
cell_background_transparent = space
with_heading = 'X'
border = '5'
width = '50%'
IMPORTING
table = ta1.
set columns
CALL METHOD ta1->add_column EXPORTING heading = head1
width = '10%'
IMPORTING column = col11.
CALL METHOD ta1->set_column_style EXPORTING col_no = 1
sap_color = cl_dd_area=>list_background_int.
CALL METHOD ta1->add_column EXPORTING heading = head2
width = '15%'
IMPORTING column = col12.
CALL METHOD ta1->add_column EXPORTING heading = head3
width = '15%'
IMPORTING column = col13.
CALL METHOD ta1->add_column EXPORTING heading = head4
width = '15%'
IMPORTING column = col14.
CALL METHOD ta1->add_column EXPORTING heading = head4
width = '15%'
IMPORTING column = col15.
fill columns
text = ' '.
CALL METHOD col11->add_text
EXPORTING
text = text.
text = 'Init'.
CALL METHOD col12->add_text
EXPORTING
text = text.
text = 'Supv No'.
CALL METHOD col13->add_text
EXPORTING
text = text.
text = 'Date'.
CALL METHOD col14->add_text
EXPORTING
text = text.
text = 'Discrepancy Report Notation'.
CALL METHOD col15->add_text
EXPORTING
text = text.
CALL METHOD ta1->new_row
EXPORTING
sap_color = cl_dd_area=>list_background.
text = 'Q/C by'.
CALL METHOD col11->add_text
EXPORTING
text = text.
text = ' '.
CALL METHOD col12->add_text
EXPORTING
text = text.
CALL METHOD col13->add_text
EXPORTING
text = text.
CALL METHOD col14->add_text
EXPORTING
text = text.
CALL METHOD col15->add_text
EXPORTING
text = text.
CALL METHOD ta1->new_row.
text = 'Received by'.
CALL METHOD col11->add_text
EXPORTING
text = text.
text = ' '.
CALL METHOD col12->add_text
EXPORTING
text = text.
CALL METHOD col13->add_text
EXPORTING
text = text.
CALL METHOD col14->add_text
EXPORTING
text = text.
CALL METHOD col15->add_text
EXPORTING
text = text.
CALL METHOD ta1->new_row.
text = 'Sign Off'.
CALL METHOD col11->add_text
EXPORTING
text = text.
text = ' '.
CALL METHOD col12->add_text
EXPORTING
text = text.
CALL METHOD col13->add_text
EXPORTING
text = text.
CALL METHOD col14->add_text
EXPORTING
text = text.
CALL METHOD col15->add_text
EXPORTING
text = text.
CALL METHOD do->new_line
EXPORTING
repeat = 1.
ENDFORM.
MSKYou can use HTTP Receiver to pass the data to the servlet that runs on the HTTP Server. The servlet has already screen design logic written in HTML or jsp to display in HTML Table or so. PI requires to just post data on the servlet of HTTP Server using HTTP Receiver. PI will not create screen look and feel logic while posting data.
If you want HTML table coding logic refer this link
http://www.w3schools.com/html/html_tables.asp
Maybe you are looking for
-
My Creative Cloud Wont Load Up (Windows 7)
I Downloaded Adobe Creative Cloud, But It Wont Load. I Have A Windows 7 64-Bit Computer. I've Tried Turning Off All My Firewalls And Anti-Virus Software, But It Still Wont Work. Every Time I Try And Launch Adobe Creative Cloud Windows Shows The Loadi
-
< MODERATOR: Message locked. Please read the [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting next time. > hi all We have 2 depreciation areas. 1. 01 Book of depreciation area 2. 02 Spl
-
We are in process on migrating over to an ACS appliance 4.1. I have downloaded updates and have launched the autorun.bat file. After running the update to 4.1.3.12 CSAdmin fails to start. Tried starting it manually via serial port, but no luck. The p
-
Pixma Pro-100 archival qualities
I am interested in the archival qualities of the photos printed from a Canon Pixma Pro-100 using Canon inks and photo papers. Are test results available?
-
I'm looking for a VNC viewer to connect to PCs to for screen sharing for tutorial purposes. Can't use Skype due to network restrictions. Any suggestions?