abap

How to encode JSON in ABAP before 7.02

 ̄綄美尐妖づ 提交于 2019-12-10 16:12:43
问题 As Horst Keller mentioned in his ABAP and JSON post, "with Releases 7.02 and 7.03/7.31 (Kernelpatch 116) JSON is supported natively in ABAP". Appartently 7.02 in my case of too generic because the line below: writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ). returns the error: "The field CO_XT_JSON is unknown, but there is a field with the similar name CO_XT_XOP". So is there any way to easily generate JSON? Edit: Screenshot from SAP - Status 回答1: About the class CL_TREX

replace parameter name show on screen?

女生的网名这么多〃 提交于 2019-12-10 15:59:05
问题 When I'm defining a parameter, like: PARAMETER pa_date TYPE d DEFAULT sy-datum. How do I change "pa_date" to something else when the app is launched? I want to change it to something like "choose date". Any Ideas? 回答1: The Correct Menu Path is: Goto (Alt-G) -> Text Elements (T) -> Selection Texts (S) Once there you can Type in the Text you want OR click the "Dictionary Ref." Checkbox. Doing this will keep your report selections a bit more standard, provided that you use the correct dictionary

Returning a range table in abap

谁都会走 提交于 2019-12-10 14:58:15
问题 I would like to write a function module that returns a range table. Is that possible and if so, how? 回答1: The structure of a typed range is like this : **Name** **Type** SIGNT VARV_SIGN OPTION TVARV_OPTI LOW your-type HIGH your-type You can create this structure in the dictionary, as well as a table of those, and then use it in the FM signature. Also, a generic structure already exists : RSDSSELOPT (along with a table type RSELOPTION ). 来源: https://stackoverflow.com/questions/3702429

ABAP: Syntax for creating internal table from existing database table

半腔热情 提交于 2019-12-10 13:35:42
问题 I'm new to ABAP. Started learning about internal tables. I was reading on the ways to create internal tables. I came across the following syntax to create an internal table from an existing database table: data: it_mara type table of mara. I'm confused since mara is a table and if both l.h.s and r.h.s are of the same type then shouldn't it be just: data: it_mara type mara. What is the need to convert mara into a table when it is already a table? 回答1: MARA is a transparent table which means

Different ways to call methods in ABAP

做~自己de王妃 提交于 2019-12-09 17:33:21
问题 Sorry for this basic ABAP question. What are the different ways to call methods in ABAP? And what are their "official" names? I've heard of perform, method call, and internal/inline method call. Perform uses the PERFORM keyword and method call the CALL METHOD syntax, I guess. But what is an "internal" or "inline method call"? 回答1: These are the possibilities of an inline method call. If you are calling so called functional method which has only IMPORTING parameters and optionally one RETURN

SAP S/4HANA使用ABAP获得生产订单的状态

北慕城南 提交于 2019-12-09 16:28:10
在S/4HANA里,我们如何根据一个销售订单的行项目,查看对应的生产订单状态? 双击行项目: 点击Schedule line: 这里就能看到生产订单的ID和状态了。 其中订单的状态存储在表vsaufk里,注意订单和状态可以是1对多的关系。 状态的ID和描述信息存储在表tj02t里,所以有了下面的代码: METHOD get_prod_order_status. DATA: lt_status TYPE TABLE OF j_status, lt_text TYPE TABLE OF tj02t, lv_id LIKE iv_prod_order_id, ls_result LIKE LINE OF rt_status_in_s4_format. lv_id = iv_prod_order_id. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = lv_id IMPORTING output = lv_id. SELECT stat INTO TABLE lt_status FROM vsaufk WHERE inact = space AND aufnr = lv_id. CHECK sy-subrc = 0. SELECT * INTO TABLE lt_text FROM tj02t FOR ALL

Get all data that match to the start letter

笑着哭i 提交于 2019-12-08 12:51:06
问题 How to create a CDS that select all KUNNR from table KNA1 that Customer Number starts for example with A% . I could use LIKE in the where clause but the RHS of the condition have to be static. It should depend on the input parameter from CDS. Is it possible to do it with CDS ? 回答1: I see two options. You get rid of your CDS input parameter handling and move the logic to ABAP. Write your OPEN SQL select on your CDS with like statement. Use CDS Table function and AMDP by pushing the like

How to loop at Table only having ref to data

爷,独闯天下 提交于 2019-12-08 12:46:19
问题 I am using the function Module RSAQ_QUERY_CALL , getting back a table DATA: gr_data TYPE REF TO data . CALL FUNCTION 'RSAQ_QUERY_CALL' EXPORTING query = 'ZXXXXXXXX' usergroup = 'XXX' VARIANT = 'TEST' SKIP_SELSCREEN = 'X' DATA_TO_MEMORY = 'X' IMPORTING ref_to_ldata = gr_data EXCEPTIONS OTHERS = 11 . Now how can I loop at that table? What I tried: assign to a filed-symbol passing a field-symbol instead of dref Both did not work. 回答1: I found the solution (after asking the senior dev..) FIELD

ABAP DDD how to correctly implement add/update/remove child from aggregate via RFC?

自作多情 提交于 2019-12-08 12:17:44
问题 I'm trying to follow DDD principles for my current project. Unfortunately I have to use RFCs due to technical constraints, so no OData and no REST. It's quite a long question I hope it's OK to ask this in Stackoverflow. In any case, I have an entity class WorkOrder with a list of Operation objects. I have a WorkOrderRepository class with a SAVE method that only receives a WorkOrder object and is able to save everything (header data, address, etc) in one go. No matter if it's creation, update

2-level column headings in ALV list

纵然是瞬间 提交于 2019-12-08 01:52:37
问题 I want to add a header row grouping the column headers. Departure Arrival <-- This row is what I want to add Airport Gate Date Airport Gate Date -------- ----- ----- -------- ----- ------- O'Hare A10 10Mar Atlanta G19 10Mar DFW K98 11Mar Denver Z76 11Mar Note that I'm using an ALV List , not an ALV Grid. I've looked at the sample program BALVBT01 which has a 2-level header but it turns out it's because they are displaying parent/child data. My data has only one level, I just want to group the